repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.__remove_handler_factory
def __remove_handler_factory(self, svc_ref): # type: (ServiceReference) -> None """ Removes an handler factory :param svc_ref: ServiceReference of the handler factory to remove """ with self.__handlers_lock: # Get the handler ID handler_id = svc_r...
python
def __remove_handler_factory(self, svc_ref): # type: (ServiceReference) -> None """ Removes an handler factory :param svc_ref: ServiceReference of the handler factory to remove """ with self.__handlers_lock: # Get the handler ID handler_id = svc_r...
[ "def", "__remove_handler_factory", "(", "self", ",", "svc_ref", ")", ":", "# type: (ServiceReference) -> None", "with", "self", ".", "__handlers_lock", ":", "# Get the handler ID", "handler_id", "=", "svc_ref", ".", "get_property", "(", "handlers_const", ".", "PROP_HAND...
Removes an handler factory :param svc_ref: ServiceReference of the handler factory to remove
[ "Removes", "an", "handler", "factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L250-L299
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.__get_factory_with_context
def __get_factory_with_context(self, factory_name): # type: (str) -> Tuple[type, FactoryContext] """ Retrieves the factory registered with the given and its factory context :param factory_name: The name of the factory :return: A (factory, context) tuple :raise TypeError:...
python
def __get_factory_with_context(self, factory_name): # type: (str) -> Tuple[type, FactoryContext] """ Retrieves the factory registered with the given and its factory context :param factory_name: The name of the factory :return: A (factory, context) tuple :raise TypeError:...
[ "def", "__get_factory_with_context", "(", "self", ",", "factory_name", ")", ":", "# type: (str) -> Tuple[type, FactoryContext]", "factory", "=", "self", ".", "__factories", ".", "get", "(", "factory_name", ")", "if", "factory", "is", "None", ":", "raise", "TypeError...
Retrieves the factory registered with the given and its factory context :param factory_name: The name of the factory :return: A (factory, context) tuple :raise TypeError: Unknown factory, or factory not manipulated
[ "Retrieves", "the", "factory", "registered", "with", "the", "given", "and", "its", "factory", "context" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L301-L323
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.__get_stored_instances
def __get_stored_instances(self, factory_name): # type: (str) -> List[StoredInstance] """ Retrieves the list of all stored instances objects corresponding to the given factory name :param factory_name: A factory name :return: All components instantiated from the given fa...
python
def __get_stored_instances(self, factory_name): # type: (str) -> List[StoredInstance] """ Retrieves the list of all stored instances objects corresponding to the given factory name :param factory_name: A factory name :return: All components instantiated from the given fa...
[ "def", "__get_stored_instances", "(", "self", ",", "factory_name", ")", ":", "# type: (str) -> List[StoredInstance]", "with", "self", ".", "__instances_lock", ":", "return", "[", "stored_instance", "for", "stored_instance", "in", "self", ".", "__instances", ".", "valu...
Retrieves the list of all stored instances objects corresponding to the given factory name :param factory_name: A factory name :return: All components instantiated from the given factory
[ "Retrieves", "the", "list", "of", "all", "stored", "instances", "objects", "corresponding", "to", "the", "given", "factory", "name" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L337-L351
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.__try_instantiate
def __try_instantiate(self, component_context, instance): # type: (ComponentContext, object) -> bool """ Instantiates a component, if all of its handlers are there. Returns False if a handler is missing. :param component_context: A ComponentContext bean :param instance: ...
python
def __try_instantiate(self, component_context, instance): # type: (ComponentContext, object) -> bool """ Instantiates a component, if all of its handlers are there. Returns False if a handler is missing. :param component_context: A ComponentContext bean :param instance: ...
[ "def", "__try_instantiate", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# type: (ComponentContext, object) -> bool", "with", "self", ".", "__instances_lock", ":", "# Extract information about the component", "factory_context", "=", "component_context", ...
Instantiates a component, if all of its handlers are there. Returns False if a handler is missing. :param component_context: A ComponentContext bean :param instance: The component instance :return: True if the component has started, False if a handler is missing
[ "Instantiates", "a", "component", "if", "all", "of", "its", "handlers", "are", "there", ".", "Returns", "False", "if", "a", "handler", "is", "missing", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L353-L410
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._autorestart_store_components
def _autorestart_store_components(self, bundle): # type: (Bundle) -> None """ Stores the components of the given bundle with the auto-restart property :param bundle: A Bundle object """ with self.__instances_lock: # Prepare the list of components ...
python
def _autorestart_store_components(self, bundle): # type: (Bundle) -> None """ Stores the components of the given bundle with the auto-restart property :param bundle: A Bundle object """ with self.__instances_lock: # Prepare the list of components ...
[ "def", "_autorestart_store_components", "(", "self", ",", "bundle", ")", ":", "# type: (Bundle) -> None", "with", "self", ".", "__instances_lock", ":", "# Prepare the list of components", "store", "=", "self", ".", "__auto_restart", ".", "setdefault", "(", "bundle", "...
Stores the components of the given bundle with the auto-restart property :param bundle: A Bundle object
[ "Stores", "the", "components", "of", "the", "given", "bundle", "with", "the", "auto", "-", "restart", "property" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L412-L434
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._autorestart_components
def _autorestart_components(self, bundle): # type: (Bundle) -> None """ Restart the components of the given bundle :param bundle: A Bundle object """ with self.__instances_lock: instances = self.__auto_restart.get(bundle) if not instances: ...
python
def _autorestart_components(self, bundle): # type: (Bundle) -> None """ Restart the components of the given bundle :param bundle: A Bundle object """ with self.__instances_lock: instances = self.__auto_restart.get(bundle) if not instances: ...
[ "def", "_autorestart_components", "(", "self", ",", "bundle", ")", ":", "# type: (Bundle) -> None", "with", "self", ".", "__instances_lock", ":", "instances", "=", "self", ".", "__auto_restart", ".", "get", "(", "bundle", ")", "if", "not", "instances", ":", "#...
Restart the components of the given bundle :param bundle: A Bundle object
[ "Restart", "the", "components", "of", "the", "given", "bundle" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L436-L463
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._fire_ipopo_event
def _fire_ipopo_event(self, kind, factory_name, instance_name=None): # type: (int, str, Optional[str]) -> None """ Triggers an iPOPO event :param kind: Kind of event :param factory_name: Name of the factory associated to the event :param instance_name: Name of the compon...
python
def _fire_ipopo_event(self, kind, factory_name, instance_name=None): # type: (int, str, Optional[str]) -> None """ Triggers an iPOPO event :param kind: Kind of event :param factory_name: Name of the factory associated to the event :param instance_name: Name of the compon...
[ "def", "_fire_ipopo_event", "(", "self", ",", "kind", ",", "factory_name", ",", "instance_name", "=", "None", ")", ":", "# type: (int, str, Optional[str]) -> None", "with", "self", ".", "__listeners_lock", ":", "# Use a copy of the list of listeners", "listeners", "=", ...
Triggers an iPOPO event :param kind: Kind of event :param factory_name: Name of the factory associated to the event :param instance_name: Name of the component instance associated to the event
[ "Triggers", "an", "iPOPO", "event" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L479-L499
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._prepare_instance_properties
def _prepare_instance_properties(self, properties, factory_properties): # type: (dict, dict) -> dict """ Prepares the properties of a component instance, based on its configuration, factory and framework properties :param properties: Component instance properties :param ...
python
def _prepare_instance_properties(self, properties, factory_properties): # type: (dict, dict) -> dict """ Prepares the properties of a component instance, based on its configuration, factory and framework properties :param properties: Component instance properties :param ...
[ "def", "_prepare_instance_properties", "(", "self", ",", "properties", ",", "factory_properties", ")", ":", "# type: (dict, dict) -> dict", "# Normalize given properties", "if", "properties", "is", "None", "or", "not", "isinstance", "(", "properties", ",", "dict", ")", ...
Prepares the properties of a component instance, based on its configuration, factory and framework properties :param properties: Component instance properties :param factory_properties: Component factory "default" properties :return: The merged properties
[ "Prepares", "the", "properties", "of", "a", "component", "instance", "based", "on", "its", "configuration", "factory", "and", "framework", "properties" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L501-L525
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._register_bundle_factories
def _register_bundle_factories(self, bundle): # type: (Bundle) -> None """ Registers all factories found in the given bundle :param bundle: A bundle """ # Load the bundle factories factories = _load_bundle_factories(bundle) for context, factory_class in ...
python
def _register_bundle_factories(self, bundle): # type: (Bundle) -> None """ Registers all factories found in the given bundle :param bundle: A bundle """ # Load the bundle factories factories = _load_bundle_factories(bundle) for context, factory_class in ...
[ "def", "_register_bundle_factories", "(", "self", ",", "bundle", ")", ":", "# type: (Bundle) -> None", "# Load the bundle factories", "factories", "=", "_load_bundle_factories", "(", "bundle", ")", "for", "context", ",", "factory_class", "in", "factories", ":", "try", ...
Registers all factories found in the given bundle :param bundle: A bundle
[ "Registers", "all", "factories", "found", "in", "the", "given", "bundle" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L527-L558
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._register_factory
def _register_factory(self, factory_name, factory, override): # type: (str, type, bool) -> None """ Registers a component factory :param factory_name: The name of the factory :param factory: The factory class object :param override: If true, previous factory is overridde...
python
def _register_factory(self, factory_name, factory, override): # type: (str, type, bool) -> None """ Registers a component factory :param factory_name: The name of the factory :param factory: The factory class object :param override: If true, previous factory is overridde...
[ "def", "_register_factory", "(", "self", ",", "factory_name", ",", "factory", ",", "override", ")", ":", "# type: (str, type, bool) -> None", "if", "not", "factory_name", "or", "not", "is_string", "(", "factory_name", ")", ":", "raise", "ValueError", "(", "\"A fac...
Registers a component factory :param factory_name: The name of the factory :param factory: The factory class object :param override: If true, previous factory is overridden, else an exception is risen if a previous factory with that name already...
[ "Registers", "a", "component", "factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L560-L595
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._unregister_all_factories
def _unregister_all_factories(self): """ Unregisters all factories. This method should be called only after the iPOPO service has been unregistered (that's why it's not locked) """ factories = list(self.__factories.keys()) for factory_name in factories: self.u...
python
def _unregister_all_factories(self): """ Unregisters all factories. This method should be called only after the iPOPO service has been unregistered (that's why it's not locked) """ factories = list(self.__factories.keys()) for factory_name in factories: self.u...
[ "def", "_unregister_all_factories", "(", "self", ")", ":", "factories", "=", "list", "(", "self", ".", "__factories", ".", "keys", "(", ")", ")", "for", "factory_name", "in", "factories", ":", "self", ".", "unregister_factory", "(", "factory_name", ")" ]
Unregisters all factories. This method should be called only after the iPOPO service has been unregistered (that's why it's not locked)
[ "Unregisters", "all", "factories", ".", "This", "method", "should", "be", "called", "only", "after", "the", "iPOPO", "service", "has", "been", "unregistered", "(", "that", "s", "why", "it", "s", "not", "locked", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L597-L604
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._unregister_bundle_factories
def _unregister_bundle_factories(self, bundle): # type: (Bundle) -> None """ Unregisters all factories of the given bundle :param bundle: A bundle """ with self.__factories_lock: # Find out which factories must be removed to_remove = [ ...
python
def _unregister_bundle_factories(self, bundle): # type: (Bundle) -> None """ Unregisters all factories of the given bundle :param bundle: A bundle """ with self.__factories_lock: # Find out which factories must be removed to_remove = [ ...
[ "def", "_unregister_bundle_factories", "(", "self", ",", "bundle", ")", ":", "# type: (Bundle) -> None", "with", "self", ".", "__factories_lock", ":", "# Find out which factories must be removed", "to_remove", "=", "[", "factory_name", "for", "factory_name", "in", "self",...
Unregisters all factories of the given bundle :param bundle: A bundle
[ "Unregisters", "all", "factories", "of", "the", "given", "bundle" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L606-L628
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService._stop
def _stop(self): """ iPOPO is stopping: clean everything up """ # Running flag down self.running = False # Unregister the service listener self.__context.remove_service_listener(self) # Clean up handler factories usages with self.__instances_lock...
python
def _stop(self): """ iPOPO is stopping: clean everything up """ # Running flag down self.running = False # Unregister the service listener self.__context.remove_service_listener(self) # Clean up handler factories usages with self.__instances_lock...
[ "def", "_stop", "(", "self", ")", ":", "# Running flag down", "self", ".", "running", "=", "False", "# Unregister the service listener", "self", ".", "__context", ".", "remove_service_listener", "(", "self", ")", "# Clean up handler factories usages", "with", "self", ...
iPOPO is stopping: clean everything up
[ "iPOPO", "is", "stopping", ":", "clean", "everything", "up" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L630-L646
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.bundle_changed
def bundle_changed(self, event): # type: (BundleEvent) -> None """ A bundle event has been triggered :param event: The bundle event """ kind = event.get_kind() bundle = event.get_bundle() if kind == BundleEvent.STOPPING_PRECLEAN: # A bundle i...
python
def bundle_changed(self, event): # type: (BundleEvent) -> None """ A bundle event has been triggered :param event: The bundle event """ kind = event.get_kind() bundle = event.get_bundle() if kind == BundleEvent.STOPPING_PRECLEAN: # A bundle i...
[ "def", "bundle_changed", "(", "self", ",", "event", ")", ":", "# type: (BundleEvent) -> None", "kind", "=", "event", ".", "get_kind", "(", ")", "bundle", "=", "event", ".", "get_bundle", "(", ")", "if", "kind", "==", "BundleEvent", ".", "STOPPING_PRECLEAN", ...
A bundle event has been triggered :param event: The bundle event
[ "A", "bundle", "event", "has", "been", "triggered" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L654-L687
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.service_changed
def service_changed(self, event): # type: (ServiceEvent) -> None """ Called when a handler factory service is un/registered """ # Call sub-methods kind = event.get_kind() svc_ref = event.get_service_reference() if kind == ServiceEvent.REGISTERED: ...
python
def service_changed(self, event): # type: (ServiceEvent) -> None """ Called when a handler factory service is un/registered """ # Call sub-methods kind = event.get_kind() svc_ref = event.get_service_reference() if kind == ServiceEvent.REGISTERED: ...
[ "def", "service_changed", "(", "self", ",", "event", ")", ":", "# type: (ServiceEvent) -> None", "# Call sub-methods", "kind", "=", "event", ".", "get_kind", "(", ")", "svc_ref", "=", "event", ".", "get_service_reference", "(", ")", "if", "kind", "==", "ServiceE...
Called when a handler factory service is un/registered
[ "Called", "when", "a", "handler", "factory", "service", "is", "un", "/", "registered" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L689-L706
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.instantiate
def instantiate(self, factory_name, name, properties=None): # type: (str, str, dict) -> Any """ Instantiates a component from the given factory, with the given name :param factory_name: Name of the component factory :param name: Name of the instance to be started :param ...
python
def instantiate(self, factory_name, name, properties=None): # type: (str, str, dict) -> Any """ Instantiates a component from the given factory, with the given name :param factory_name: Name of the component factory :param name: Name of the instance to be started :param ...
[ "def", "instantiate", "(", "self", ",", "factory_name", ",", "name", ",", "properties", "=", "None", ")", ":", "# type: (str, str, dict) -> Any", "# Test parameters", "if", "not", "factory_name", "or", "not", "is_string", "(", "factory_name", ")", ":", "raise", ...
Instantiates a component from the given factory, with the given name :param factory_name: Name of the component factory :param name: Name of the instance to be started :param properties: Initial properties of the component instance :return: The component instance :raise TypeErro...
[ "Instantiates", "a", "component", "from", "the", "given", "factory", "with", "the", "given", "name" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L708-L790
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.retry_erroneous
def retry_erroneous(self, name, properties_update=None): # type: (str, dict) -> int """ Removes the ERRONEOUS state of the given component, and retries a validation :param name: Name of the component to retry :param properties_update: A dictionary to update the initial p...
python
def retry_erroneous(self, name, properties_update=None): # type: (str, dict) -> int """ Removes the ERRONEOUS state of the given component, and retries a validation :param name: Name of the component to retry :param properties_update: A dictionary to update the initial p...
[ "def", "retry_erroneous", "(", "self", ",", "name", ",", "properties_update", "=", "None", ")", ":", "# type: (str, dict) -> int", "with", "self", ".", "__instances_lock", ":", "try", ":", "stored_instance", "=", "self", ".", "__instances", "[", "name", "]", "...
Removes the ERRONEOUS state of the given component, and retries a validation :param name: Name of the component to retry :param properties_update: A dictionary to update the initial properties of the component :return: The new state of the component ...
[ "Removes", "the", "ERRONEOUS", "state", "of", "the", "given", "component", "and", "retries", "a", "validation" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L792-L812
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.invalidate
def invalidate(self, name): # type: (str) -> None """ Invalidates the given component :param name: Name of the component to invalidate :raise ValueError: Invalid component name """ with self.__instances_lock: try: stored_instance = sel...
python
def invalidate(self, name): # type: (str) -> None """ Invalidates the given component :param name: Name of the component to invalidate :raise ValueError: Invalid component name """ with self.__instances_lock: try: stored_instance = sel...
[ "def", "invalidate", "(", "self", ",", "name", ")", ":", "# type: (str) -> None", "with", "self", ".", "__instances_lock", ":", "try", ":", "stored_instance", "=", "self", ".", "__instances", "[", "name", "]", "except", "KeyError", ":", "raise", "ValueError", ...
Invalidates the given component :param name: Name of the component to invalidate :raise ValueError: Invalid component name
[ "Invalidates", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L814-L831
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.kill
def kill(self, name): # type: (str) -> None """ Kills the given component :param name: Name of the component to kill :raise ValueError: Invalid component name """ if not name: raise ValueError("Name can't be None or empty") with self.__instan...
python
def kill(self, name): # type: (str) -> None """ Kills the given component :param name: Name of the component to kill :raise ValueError: Invalid component name """ if not name: raise ValueError("Name can't be None or empty") with self.__instan...
[ "def", "kill", "(", "self", ",", "name", ")", ":", "# type: (str) -> None", "if", "not", "name", ":", "raise", "ValueError", "(", "\"Name can't be None or empty\"", ")", "with", "self", ".", "__instances_lock", ":", "try", ":", "# Running instance", "stored_instan...
Kills the given component :param name: Name of the component to kill :raise ValueError: Invalid component name
[ "Kills", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L854-L889
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.register_factory
def register_factory(self, bundle_context, factory): # type: (BundleContext, type) -> bool """ Registers a manually created factory, using decorators programmatically :param bundle_context: The factory bundle context :param factory: A manipulated class :return: True if t...
python
def register_factory(self, bundle_context, factory): # type: (BundleContext, type) -> bool """ Registers a manually created factory, using decorators programmatically :param bundle_context: The factory bundle context :param factory: A manipulated class :return: True if t...
[ "def", "register_factory", "(", "self", ",", "bundle_context", ",", "factory", ")", ":", "# type: (BundleContext, type) -> bool", "if", "factory", "is", "None", "or", "bundle_context", "is", "None", ":", "# Invalid parameter, to nothing", "raise", "ValueError", "(", "...
Registers a manually created factory, using decorators programmatically :param bundle_context: The factory bundle context :param factory: A manipulated class :return: True if the factory has been registered :raise ValueError: Invalid parameter, or factory already registered :rai...
[ "Registers", "a", "manually", "created", "factory", "using", "decorators", "programmatically" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L891-L911
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.unregister_factory
def unregister_factory(self, factory_name): # type: (str) -> bool """ Unregisters the given component factory :param factory_name: Name of the factory to unregister :return: True the factory has been removed, False if the factory is unknown """ i...
python
def unregister_factory(self, factory_name): # type: (str) -> bool """ Unregisters the given component factory :param factory_name: Name of the factory to unregister :return: True the factory has been removed, False if the factory is unknown """ i...
[ "def", "unregister_factory", "(", "self", ",", "factory_name", ")", ":", "# type: (str) -> bool", "if", "not", "factory_name", "or", "not", "is_string", "(", "factory_name", ")", ":", "# Invalid name", "return", "False", "with", "self", ".", "__factories_lock", ":...
Unregisters the given component factory :param factory_name: Name of the factory to unregister :return: True the factory has been removed, False if the factory is unknown
[ "Unregisters", "the", "given", "component", "factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L913-L968
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.get_instances
def get_instances(self): # type: () -> List[Tuple[str, str, int]] """ Retrieves the list of the currently registered component instances :return: A list of (name, factory name, state) tuples. """ with self.__instances_lock: return sorted( (nam...
python
def get_instances(self): # type: () -> List[Tuple[str, str, int]] """ Retrieves the list of the currently registered component instances :return: A list of (name, factory name, state) tuples. """ with self.__instances_lock: return sorted( (nam...
[ "def", "get_instances", "(", "self", ")", ":", "# type: () -> List[Tuple[str, str, int]]", "with", "self", ".", "__instances_lock", ":", "return", "sorted", "(", "(", "name", ",", "stored_instance", ".", "factory_name", ",", "stored_instance", ".", "state", ")", "...
Retrieves the list of the currently registered component instances :return: A list of (name, factory name, state) tuples.
[ "Retrieves", "the", "list", "of", "the", "currently", "registered", "component", "instances" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L998-L1009
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.get_waiting_components
def get_waiting_components(self): # type: () -> List[Tuple[str, str, Set[str]]] """ Returns the list of the instances waiting for their handlers :return: A list of (name, factory name, missing handlers) tuples """ with self.__instances_lock: result = [] ...
python
def get_waiting_components(self): # type: () -> List[Tuple[str, str, Set[str]]] """ Returns the list of the instances waiting for their handlers :return: A list of (name, factory name, missing handlers) tuples """ with self.__instances_lock: result = [] ...
[ "def", "get_waiting_components", "(", "self", ")", ":", "# type: () -> List[Tuple[str, str, Set[str]]]", "with", "self", ".", "__instances_lock", ":", "result", "=", "[", "]", "for", "name", ",", "(", "context", ",", "_", ")", "in", "self", ".", "__waiting_handl...
Returns the list of the instances waiting for their handlers :return: A list of (name, factory name, missing handlers) tuples
[ "Returns", "the", "list", "of", "the", "instances", "waiting", "for", "their", "handlers" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L1022-L1039
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.get_instance_details
def get_instance_details(self, name): # type: (str) -> Dict[str, Any] """ Retrieves a snapshot of the given component instance. The result dictionary has the following keys: * ``name``: The component name * ``factory``: The name of the component factory * ``bundl...
python
def get_instance_details(self, name): # type: (str) -> Dict[str, Any] """ Retrieves a snapshot of the given component instance. The result dictionary has the following keys: * ``name``: The component name * ``factory``: The name of the component factory * ``bundl...
[ "def", "get_instance_details", "(", "self", ",", "name", ")", ":", "# type: (str) -> Dict[str, Any]", "if", "not", "is_string", "(", "name", ")", ":", "raise", "ValueError", "(", "\"Component name must be a string\"", ")", "with", "self", ".", "__instances_lock", ":...
Retrieves a snapshot of the given component instance. The result dictionary has the following keys: * ``name``: The component name * ``factory``: The name of the component factory * ``bundle_id``: The ID of the bundle providing the component factory * ``state``: The current comp...
[ "Retrieves", "a", "snapshot", "of", "the", "given", "component", "instance", ".", "The", "result", "dictionary", "has", "the", "following", "keys", ":" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L1041-L1136
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.get_factory_bundle
def get_factory_bundle(self, name): # type: (str) -> Bundle """ Retrieves the Pelix Bundle object that registered the given factory :param name: The name of a factory :return: The Bundle that registered the given factory :raise ValueError: Invalid factory """ ...
python
def get_factory_bundle(self, name): # type: (str) -> Bundle """ Retrieves the Pelix Bundle object that registered the given factory :param name: The name of a factory :return: The Bundle that registered the given factory :raise ValueError: Invalid factory """ ...
[ "def", "get_factory_bundle", "(", "self", ",", "name", ")", ":", "# type: (str) -> Bundle", "with", "self", ".", "__factories_lock", ":", "try", ":", "factory", "=", "self", ".", "__factories", "[", "name", "]", "except", "KeyError", ":", "raise", "ValueError"...
Retrieves the Pelix Bundle object that registered the given factory :param name: The name of a factory :return: The Bundle that registered the given factory :raise ValueError: Invalid factory
[ "Retrieves", "the", "Pelix", "Bundle", "object", "that", "registered", "the", "given", "factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L1148-L1167
tcalmant/ipopo
pelix/ipopo/core.py
_IPopoService.get_factory_details
def get_factory_details(self, name): # type: (str) -> Dict[str, Any] """ Retrieves a dictionary with details about the given factory * ``name``: The factory name * ``bundle``: The Bundle object of the bundle providing the factory * ``properties``: Copy of the components ...
python
def get_factory_details(self, name): # type: (str) -> Dict[str, Any] """ Retrieves a dictionary with details about the given factory * ``name``: The factory name * ``bundle``: The Bundle object of the bundle providing the factory * ``properties``: Copy of the components ...
[ "def", "get_factory_details", "(", "self", ",", "name", ")", ":", "# type: (str) -> Dict[str, Any]", "with", "self", ".", "__factories_lock", ":", "try", ":", "factory", "=", "self", ".", "__factories", "[", "name", "]", "except", "KeyError", ":", "raise", "Va...
Retrieves a dictionary with details about the given factory * ``name``: The factory name * ``bundle``: The Bundle object of the bundle providing the factory * ``properties``: Copy of the components properties defined by the factory * ``requirements``: List of the requirements ...
[ "Retrieves", "a", "dictionary", "with", "details", "about", "the", "given", "factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L1169-L1257
tcalmant/ipopo
pelix/ipv6utils.py
set_double_stack
def set_double_stack(socket_obj, double_stack=True): # type: (socket.socket, bool) -> None """ Sets up the IPv6 double stack according to the operating system :param socket_obj: A socket object :param double_stack: If True, use the double stack, else only support IPv6 :raise AttributeError: Pyt...
python
def set_double_stack(socket_obj, double_stack=True): # type: (socket.socket, bool) -> None """ Sets up the IPv6 double stack according to the operating system :param socket_obj: A socket object :param double_stack: If True, use the double stack, else only support IPv6 :raise AttributeError: Pyt...
[ "def", "set_double_stack", "(", "socket_obj", ",", "double_stack", "=", "True", ")", ":", "# type: (socket.socket, bool) -> None", "try", ":", "# Use existing value", "opt_ipv6_only", "=", "socket", ".", "IPV6_V6ONLY", "except", "AttributeError", ":", "# Use \"known\" val...
Sets up the IPv6 double stack according to the operating system :param socket_obj: A socket object :param double_stack: If True, use the double stack, else only support IPv6 :raise AttributeError: Python or system doesn't support V6 :raise socket.error: Error setting up the double stack value
[ "Sets", "up", "the", "IPv6", "double", "stack", "according", "to", "the", "operating", "system" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipv6utils.py#L64-L90
tcalmant/ipopo
pelix/ldapfilter.py
escape_LDAP
def escape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Escape a string to let it go in an LDAP filter :param ldap_string: The string to escape :return: The protected string """ if not ldap_string: # No content return ldap_string # Protect esc...
python
def escape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Escape a string to let it go in an LDAP filter :param ldap_string: The string to escape :return: The protected string """ if not ldap_string: # No content return ldap_string # Protect esc...
[ "def", "escape_LDAP", "(", "ldap_string", ")", ":", "# type: (str) -> str", "# pylint: disable=C0103", "if", "not", "ldap_string", ":", "# No content", "return", "ldap_string", "# Protect escape character previously in the string", "assert", "is_string", "(", "ldap_string", "...
Escape a string to let it go in an LDAP filter :param ldap_string: The string to escape :return: The protected string
[ "Escape", "a", "string", "to", "let", "it", "go", "in", "an", "LDAP", "filter" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L308-L339
tcalmant/ipopo
pelix/ldapfilter.py
unescape_LDAP
def unescape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Unespaces an LDAP string :param ldap_string: The string to unescape :return: The unprotected string """ if ldap_string is None: return None if ESCAPE_CHARACTER not in ldap_string: # No ...
python
def unescape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Unespaces an LDAP string :param ldap_string: The string to unescape :return: The unprotected string """ if ldap_string is None: return None if ESCAPE_CHARACTER not in ldap_string: # No ...
[ "def", "unescape_LDAP", "(", "ldap_string", ")", ":", "# type: (str) -> str", "# pylint: disable=C0103", "if", "ldap_string", "is", "None", ":", "return", "None", "if", "ESCAPE_CHARACTER", "not", "in", "ldap_string", ":", "# No need to loop", "return", "ldap_string", ...
Unespaces an LDAP string :param ldap_string: The string to unescape :return: The unprotected string
[ "Unespaces", "an", "LDAP", "string" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L342-L370
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_presence
def _comparator_presence(_, tested_value): """ Tests a filter which simply a joker, i.e. a value presence test """ # The filter value is a joker : simple presence test if tested_value is None: return False elif hasattr(tested_value, "__len__"): # Refuse empty values # pyl...
python
def _comparator_presence(_, tested_value): """ Tests a filter which simply a joker, i.e. a value presence test """ # The filter value is a joker : simple presence test if tested_value is None: return False elif hasattr(tested_value, "__len__"): # Refuse empty values # pyl...
[ "def", "_comparator_presence", "(", "_", ",", "tested_value", ")", ":", "# The filter value is a joker : simple presence test", "if", "tested_value", "is", "None", ":", "return", "False", "elif", "hasattr", "(", "tested_value", ",", "\"__len__\"", ")", ":", "# Refuse ...
Tests a filter which simply a joker, i.e. a value presence test
[ "Tests", "a", "filter", "which", "simply", "a", "joker", "i", ".", "e", ".", "a", "value", "presence", "test" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L380-L393
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_star
def _comparator_star(filter_value, tested_value): """ Tests a filter containing a joker """ if isinstance(tested_value, ITERABLES): for value in tested_value: if _star_comparison(filter_value, value): return True return False return _star_comparison(filte...
python
def _comparator_star(filter_value, tested_value): """ Tests a filter containing a joker """ if isinstance(tested_value, ITERABLES): for value in tested_value: if _star_comparison(filter_value, value): return True return False return _star_comparison(filte...
[ "def", "_comparator_star", "(", "filter_value", ",", "tested_value", ")", ":", "if", "isinstance", "(", "tested_value", ",", "ITERABLES", ")", ":", "for", "value", "in", "tested_value", ":", "if", "_star_comparison", "(", "filter_value", ",", "value", ")", ":"...
Tests a filter containing a joker
[ "Tests", "a", "filter", "containing", "a", "joker" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L396-L406
tcalmant/ipopo
pelix/ldapfilter.py
_star_comparison
def _star_comparison(filter_value, tested_value): """ Tests a filter containing a joker """ if not is_string(tested_value): # Unhandled value type... return False parts = filter_value.split("*") i = 0 last_part = len(parts) - 1 idx = 0 for part in parts: # ...
python
def _star_comparison(filter_value, tested_value): """ Tests a filter containing a joker """ if not is_string(tested_value): # Unhandled value type... return False parts = filter_value.split("*") i = 0 last_part = len(parts) - 1 idx = 0 for part in parts: # ...
[ "def", "_star_comparison", "(", "filter_value", ",", "tested_value", ")", ":", "if", "not", "is_string", "(", "tested_value", ")", ":", "# Unhandled value type...", "return", "False", "parts", "=", "filter_value", ".", "split", "(", "\"*\"", ")", "i", "=", "0"...
Tests a filter containing a joker
[ "Tests", "a", "filter", "containing", "a", "joker" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L409-L449
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_eq
def _comparator_eq(filter_value, tested_value): """ Tests if the filter value is equal to the tested value """ if isinstance(tested_value, ITERABLES): # Convert the list items to strings for value in tested_value: # Try with the string conversion if not is_string(...
python
def _comparator_eq(filter_value, tested_value): """ Tests if the filter value is equal to the tested value """ if isinstance(tested_value, ITERABLES): # Convert the list items to strings for value in tested_value: # Try with the string conversion if not is_string(...
[ "def", "_comparator_eq", "(", "filter_value", ",", "tested_value", ")", ":", "if", "isinstance", "(", "tested_value", ",", "ITERABLES", ")", ":", "# Convert the list items to strings", "for", "value", "in", "tested_value", ":", "# Try with the string conversion", "if", ...
Tests if the filter value is equal to the tested value
[ "Tests", "if", "the", "filter", "value", "is", "equal", "to", "the", "tested", "value" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L452-L474
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_approximate
def _comparator_approximate(filter_value, tested_value): """ Tests if the filter value is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() if is_string(tested_value): ...
python
def _comparator_approximate(filter_value, tested_value): """ Tests if the filter value is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() if is_string(tested_value): ...
[ "def", "_comparator_approximate", "(", "filter_value", ",", "tested_value", ")", ":", "lower_filter_value", "=", "filter_value", ".", "lower", "(", ")", "if", "is_string", "(", "tested_value", ")", ":", "# Lower case comparison", "return", "_comparator_eq", "(", "lo...
Tests if the filter value is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms
[ "Tests", "if", "the", "filter", "value", "is", "nearly", "equal", "to", "the", "tested", "value", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L477-L503
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_approximate_star
def _comparator_approximate_star(filter_value, tested_value): """ Tests if the filter value, which contains a joker, is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() ...
python
def _comparator_approximate_star(filter_value, tested_value): """ Tests if the filter value, which contains a joker, is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() ...
[ "def", "_comparator_approximate_star", "(", "filter_value", ",", "tested_value", ")", ":", "lower_filter_value", "=", "filter_value", ".", "lower", "(", ")", "if", "is_string", "(", "tested_value", ")", ":", "# Lower case comparison", "return", "_comparator_star", "("...
Tests if the filter value, which contains a joker, is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms
[ "Tests", "if", "the", "filter", "value", "which", "contains", "a", "joker", "is", "nearly", "equal", "to", "the", "tested", "value", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L506-L533
tcalmant/ipopo
pelix/ldapfilter.py
_comparator_lt
def _comparator_lt(filter_value, tested_value): """ Tests if the filter value is strictly greater than the tested value tested_value < filter_value """ if is_string(filter_value): value_type = type(tested_value) try: # Try a conversion filter_value = value_ty...
python
def _comparator_lt(filter_value, tested_value): """ Tests if the filter value is strictly greater than the tested value tested_value < filter_value """ if is_string(filter_value): value_type = type(tested_value) try: # Try a conversion filter_value = value_ty...
[ "def", "_comparator_lt", "(", "filter_value", ",", "tested_value", ")", ":", "if", "is_string", "(", "filter_value", ")", ":", "value_type", "=", "type", "(", "tested_value", ")", "try", ":", "# Try a conversion", "filter_value", "=", "value_type", "(", "filter_...
Tests if the filter value is strictly greater than the tested value tested_value < filter_value
[ "Tests", "if", "the", "filter", "value", "is", "strictly", "greater", "than", "the", "tested", "value" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L547-L574
tcalmant/ipopo
pelix/ldapfilter.py
_compute_comparator
def _compute_comparator(string, idx): # type: (str, int) -> Optional[Callable[[Any, Any], bool]] """ Tries to compute the LDAP comparator at the given index Valid operators are : * = : equality * <= : less than * >= : greater than * ~= : approximate :param string: A LDAP filter st...
python
def _compute_comparator(string, idx): # type: (str, int) -> Optional[Callable[[Any, Any], bool]] """ Tries to compute the LDAP comparator at the given index Valid operators are : * = : equality * <= : less than * >= : greater than * ~= : approximate :param string: A LDAP filter st...
[ "def", "_compute_comparator", "(", "string", ",", "idx", ")", ":", "# type: (str, int) -> Optional[Callable[[Any, Any], bool]]", "part1", "=", "string", "[", "idx", "]", "try", ":", "part2", "=", "string", "[", "idx", "+", "1", "]", "except", "IndexError", ":", ...
Tries to compute the LDAP comparator at the given index Valid operators are : * = : equality * <= : less than * >= : greater than * ~= : approximate :param string: A LDAP filter string :param idx: An index in the given string :return: The corresponding operator, None if unknown
[ "Tries", "to", "compute", "the", "LDAP", "comparator", "at", "the", "given", "index" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L660-L704
tcalmant/ipopo
pelix/ldapfilter.py
_compute_operation
def _compute_operation(string, idx): # type: (str, int) -> Optional[int] """ Tries to compute the LDAP operation at the given index Valid operations are : * & : AND * | : OR * ! : NOT :param string: A LDAP filter string :param idx: An index in the given string :return: The cor...
python
def _compute_operation(string, idx): # type: (str, int) -> Optional[int] """ Tries to compute the LDAP operation at the given index Valid operations are : * & : AND * | : OR * ! : NOT :param string: A LDAP filter string :param idx: An index in the given string :return: The cor...
[ "def", "_compute_operation", "(", "string", ",", "idx", ")", ":", "# type: (str, int) -> Optional[int]", "operator", "=", "string", "[", "idx", "]", "if", "operator", "==", "\"&\"", ":", "return", "AND", "elif", "operator", "==", "\"|\"", ":", "return", "OR", ...
Tries to compute the LDAP operation at the given index Valid operations are : * & : AND * | : OR * ! : NOT :param string: A LDAP filter string :param idx: An index in the given string :return: The corresponding operator (AND, OR or NOT)
[ "Tries", "to", "compute", "the", "LDAP", "operation", "at", "the", "given", "index" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L707-L730
tcalmant/ipopo
pelix/ldapfilter.py
_skip_spaces
def _skip_spaces(string, idx): # type: (str, int) -> int """ Retrieves the next non-space character after idx index in the given string :param string: The string to look into :param idx: The base search index :return: The next non-space character index, -1 if not found """ i = idx f...
python
def _skip_spaces(string, idx): # type: (str, int) -> int """ Retrieves the next non-space character after idx index in the given string :param string: The string to look into :param idx: The base search index :return: The next non-space character index, -1 if not found """ i = idx f...
[ "def", "_skip_spaces", "(", "string", ",", "idx", ")", ":", "# type: (str, int) -> int", "i", "=", "idx", "for", "char", "in", "string", "[", "idx", ":", "]", ":", "if", "not", "char", ".", "isspace", "(", ")", ":", "return", "i", "i", "+=", "1", "...
Retrieves the next non-space character after idx index in the given string :param string: The string to look into :param idx: The base search index :return: The next non-space character index, -1 if not found
[ "Retrieves", "the", "next", "non", "-", "space", "character", "after", "idx", "index", "in", "the", "given", "string" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L733-L748
tcalmant/ipopo
pelix/ldapfilter.py
_parse_ldap_criteria
def _parse_ldap_criteria(ldap_filter, startidx=0, endidx=-1): # type: (str, int, int) -> LDAPCriteria """ Parses an LDAP sub filter (criterion) :param ldap_filter: An LDAP filter string :param startidx: Sub-filter start index :param endidx: Sub-filter end index :return: The LDAP sub-filter ...
python
def _parse_ldap_criteria(ldap_filter, startidx=0, endidx=-1): # type: (str, int, int) -> LDAPCriteria """ Parses an LDAP sub filter (criterion) :param ldap_filter: An LDAP filter string :param startidx: Sub-filter start index :param endidx: Sub-filter end index :return: The LDAP sub-filter ...
[ "def", "_parse_ldap_criteria", "(", "ldap_filter", ",", "startidx", "=", "0", ",", "endidx", "=", "-", "1", ")", ":", "# type: (str, int, int) -> LDAPCriteria", "comparators", "=", "\"=<>~\"", "if", "startidx", "<", "0", ":", "raise", "ValueError", "(", "\"Inval...
Parses an LDAP sub filter (criterion) :param ldap_filter: An LDAP filter string :param startidx: Sub-filter start index :param endidx: Sub-filter end index :return: The LDAP sub-filter :raise ValueError: Invalid sub-filter
[ "Parses", "an", "LDAP", "sub", "filter", "(", "criterion", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L751-L831
tcalmant/ipopo
pelix/ldapfilter.py
_parse_ldap
def _parse_ldap(ldap_filter): # type: (str) -> Optional[LDAPFilter] """ Parses the given LDAP filter string :param ldap_filter: An LDAP filter string :return: An LDAPFilter object, None if the filter was empty :raise ValueError: The LDAP filter string is invalid """ if ldap_filter is No...
python
def _parse_ldap(ldap_filter): # type: (str) -> Optional[LDAPFilter] """ Parses the given LDAP filter string :param ldap_filter: An LDAP filter string :return: An LDAPFilter object, None if the filter was empty :raise ValueError: The LDAP filter string is invalid """ if ldap_filter is No...
[ "def", "_parse_ldap", "(", "ldap_filter", ")", ":", "# type: (str) -> Optional[LDAPFilter]", "if", "ldap_filter", "is", "None", ":", "# Nothing to do", "return", "None", "assert", "is_string", "(", "ldap_filter", ")", "# Remove surrounding spaces", "ldap_filter", "=", "...
Parses the given LDAP filter string :param ldap_filter: An LDAP filter string :return: An LDAPFilter object, None if the filter was empty :raise ValueError: The LDAP filter string is invalid
[ "Parses", "the", "given", "LDAP", "filter", "string" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L834-L929
tcalmant/ipopo
pelix/ldapfilter.py
get_ldap_filter
def get_ldap_filter(ldap_filter): # type: (Any) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Retrieves the LDAP filter object corresponding to the given filter. Parses it the argument if it is an LDAPFilter instance :param ldap_filter: An LDAP filter (LDAPFilter or string) :return: The corr...
python
def get_ldap_filter(ldap_filter): # type: (Any) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Retrieves the LDAP filter object corresponding to the given filter. Parses it the argument if it is an LDAPFilter instance :param ldap_filter: An LDAP filter (LDAPFilter or string) :return: The corr...
[ "def", "get_ldap_filter", "(", "ldap_filter", ")", ":", "# type: (Any) -> Optional[Union[LDAPFilter, LDAPCriteria]]", "if", "ldap_filter", "is", "None", ":", "return", "None", "if", "isinstance", "(", "ldap_filter", ",", "(", "LDAPFilter", ",", "LDAPCriteria", ")", ")...
Retrieves the LDAP filter object corresponding to the given filter. Parses it the argument if it is an LDAPFilter instance :param ldap_filter: An LDAP filter (LDAPFilter or string) :return: The corresponding filter, can be None :raise ValueError: Invalid filter string found :raise TypeError: Unknow...
[ "Retrieves", "the", "LDAP", "filter", "object", "corresponding", "to", "the", "given", "filter", ".", "Parses", "it", "the", "argument", "if", "it", "is", "an", "LDAPFilter", "instance" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L932-L956
tcalmant/ipopo
pelix/ldapfilter.py
combine_filters
def combine_filters(filters, operator=AND): # type: (Iterable[Any], int) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Combines two LDAP filters, which can be strings or LDAPFilter objects :param filters: Filters to combine :param operator: The operator for combination :return: The combined ...
python
def combine_filters(filters, operator=AND): # type: (Iterable[Any], int) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Combines two LDAP filters, which can be strings or LDAPFilter objects :param filters: Filters to combine :param operator: The operator for combination :return: The combined ...
[ "def", "combine_filters", "(", "filters", ",", "operator", "=", "AND", ")", ":", "# type: (Iterable[Any], int) -> Optional[Union[LDAPFilter, LDAPCriteria]]", "if", "not", "filters", ":", "return", "None", "if", "not", "hasattr", "(", "filters", ",", "\"__iter__\"", ")...
Combines two LDAP filters, which can be strings or LDAPFilter objects :param filters: Filters to combine :param operator: The operator for combination :return: The combined filter, can be None if all filters are None :raise ValueError: Invalid filter string found :raise TypeError: Unknown filter ty...
[ "Combines", "two", "LDAP", "filters", "which", "can", "be", "strings", "or", "LDAPFilter", "objects" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L959-L1000
tcalmant/ipopo
pelix/ldapfilter.py
LDAPFilter.append
def append(self, ldap_filter): """ Appends a filter or a criterion to this filter :param ldap_filter: An LDAP filter or criterion :raise TypeError: If the parameter is not of a known type :raise ValueError: If the more than one filter is associated to a ...
python
def append(self, ldap_filter): """ Appends a filter or a criterion to this filter :param ldap_filter: An LDAP filter or criterion :raise TypeError: If the parameter is not of a known type :raise ValueError: If the more than one filter is associated to a ...
[ "def", "append", "(", "self", ",", "ldap_filter", ")", ":", "if", "not", "isinstance", "(", "ldap_filter", ",", "(", "LDAPFilter", ",", "LDAPCriteria", ")", ")", ":", "raise", "TypeError", "(", "\"Invalid filter type: {0}\"", ".", "format", "(", "type", "(",...
Appends a filter or a criterion to this filter :param ldap_filter: An LDAP filter or criterion :raise TypeError: If the parameter is not of a known type :raise ValueError: If the more than one filter is associated to a NOT operator
[ "Appends", "a", "filter", "or", "a", "criterion", "to", "this", "filter" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L139-L156
tcalmant/ipopo
pelix/ldapfilter.py
LDAPFilter.matches
def matches(self, properties): """ Tests if the given properties matches this LDAP filter and its children :param properties: A dictionary of properties :return: True if the properties matches this filter, else False """ # Use a generator, and declare it outside of the m...
python
def matches(self, properties): """ Tests if the given properties matches this LDAP filter and its children :param properties: A dictionary of properties :return: True if the properties matches this filter, else False """ # Use a generator, and declare it outside of the m...
[ "def", "matches", "(", "self", ",", "properties", ")", ":", "# Use a generator, and declare it outside of the method call", "# => seems to be quite a speed up trick", "generator", "=", "(", "criterion", ".", "matches", "(", "properties", ")", "for", "criterion", "in", "se...
Tests if the given properties matches this LDAP filter and its children :param properties: A dictionary of properties :return: True if the properties matches this filter, else False
[ "Tests", "if", "the", "given", "properties", "matches", "this", "LDAP", "filter", "and", "its", "children" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L158-L180
tcalmant/ipopo
pelix/ldapfilter.py
LDAPFilter.normalize
def normalize(self): """ Returns the first meaningful object in this filter. """ if not self.subfilters: # No sub-filters return None # New sub-filters list new_filters = [] for subfilter in self.subfilters: # Normalize the sub...
python
def normalize(self): """ Returns the first meaningful object in this filter. """ if not self.subfilters: # No sub-filters return None # New sub-filters list new_filters = [] for subfilter in self.subfilters: # Normalize the sub...
[ "def", "normalize", "(", "self", ")", ":", "if", "not", "self", ".", "subfilters", ":", "# No sub-filters", "return", "None", "# New sub-filters list", "new_filters", "=", "[", "]", "for", "subfilter", "in", "self", ".", "subfilters", ":", "# Normalize the sub-f...
Returns the first meaningful object in this filter.
[ "Returns", "the", "first", "meaningful", "object", "in", "this", "filter", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L182-L208
tcalmant/ipopo
pelix/ldapfilter.py
LDAPCriteria.matches
def matches(self, properties): """ Tests if the given criterion matches this LDAP criterion :param properties: A dictionary of properties :return: True if the properties matches this criterion, else False """ try: # Use the comparator return self....
python
def matches(self, properties): """ Tests if the given criterion matches this LDAP criterion :param properties: A dictionary of properties :return: True if the properties matches this criterion, else False """ try: # Use the comparator return self....
[ "def", "matches", "(", "self", ",", "properties", ")", ":", "try", ":", "# Use the comparator", "return", "self", ".", "comparator", "(", "self", ".", "value", ",", "properties", "[", "self", ".", "name", "]", ")", "except", "KeyError", ":", "# Criterion k...
Tests if the given criterion matches this LDAP criterion :param properties: A dictionary of properties :return: True if the properties matches this criterion, else False
[ "Tests", "if", "the", "given", "criterion", "matches", "this", "LDAP", "criterion" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ldapfilter.py#L284-L296
tcalmant/ipopo
samples/run_remote.py
main
def main(is_server, discoveries, transports, http_port, other_arguments): """ Runs the framework :param is_server: If True, starts the provider bundle, else the consumer one :param discoveries: List of discovery protocols :param transports: List of RPC protocols :param htt...
python
def main(is_server, discoveries, transports, http_port, other_arguments): """ Runs the framework :param is_server: If True, starts the provider bundle, else the consumer one :param discoveries: List of discovery protocols :param transports: List of RPC protocols :param htt...
[ "def", "main", "(", "is_server", ",", "discoveries", ",", "transports", ",", "http_port", ",", "other_arguments", ")", ":", "# Create the framework", "framework", "=", "pelix", ".", "framework", ".", "create_framework", "(", "(", "\"pelix.ipopo.core\"", ",", "\"pe...
Runs the framework :param is_server: If True, starts the provider bundle, else the consumer one :param discoveries: List of discovery protocols :param transports: List of RPC protocols :param http_port: Port of the HTTP server :param other_arguments: Other arguments
[ "Runs", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L254-L325
tcalmant/ipopo
samples/run_remote.py
InstallUtils.discovery_multicast
def discovery_multicast(self): """ Installs the multicast discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.multicast").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
python
def discovery_multicast(self): """ Installs the multicast discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.multicast").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
[ "def", "discovery_multicast", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.discovery.multicast\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as"...
Installs the multicast discovery bundles and instantiates components
[ "Installs", "the", "multicast", "discovery", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L88-L99
tcalmant/ipopo
samples/run_remote.py
InstallUtils.discovery_mdns
def discovery_mdns(self): """ Installs the mDNS discovery bundles and instantiates components """ # Remove Zeroconf debug output logging.getLogger("zeroconf").setLevel(logging.WARNING) # Install the bundle self.context.install_bundle("pelix.remote.discovery.mdns"...
python
def discovery_mdns(self): """ Installs the mDNS discovery bundles and instantiates components """ # Remove Zeroconf debug output logging.getLogger("zeroconf").setLevel(logging.WARNING) # Install the bundle self.context.install_bundle("pelix.remote.discovery.mdns"...
[ "def", "discovery_mdns", "(", "self", ")", ":", "# Remove Zeroconf debug output", "logging", ".", "getLogger", "(", "\"zeroconf\"", ")", ".", "setLevel", "(", "logging", ".", "WARNING", ")", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(...
Installs the mDNS discovery bundles and instantiates components
[ "Installs", "the", "mDNS", "discovery", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L101-L113
tcalmant/ipopo
samples/run_remote.py
InstallUtils.discovery_mqtt
def discovery_mqtt(self): """ Installs the MQTT discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.mqtt").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery...
python
def discovery_mqtt(self): """ Installs the MQTT discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.mqtt").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery...
[ "def", "discovery_mqtt", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.discovery.mqtt\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as", "ipopo...
Installs the MQTT discovery bundles and instantiates components
[ "Installs", "the", "MQTT", "discovery", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L115-L132
tcalmant/ipopo
samples/run_remote.py
InstallUtils.discovery_redis
def discovery_redis(self): """ Installs the Redis discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.redis").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discov...
python
def discovery_redis(self): """ Installs the Redis discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.redis").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discov...
[ "def", "discovery_redis", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.discovery.redis\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as", "ipo...
Installs the Redis discovery bundles and instantiates components
[ "Installs", "the", "Redis", "discovery", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L134-L151
tcalmant/ipopo
samples/run_remote.py
InstallUtils.discovery_zookeeper
def discovery_zookeeper(self): """ Installs the ZooKeeper discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.zookeeper").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
python
def discovery_zookeeper(self): """ Installs the ZooKeeper discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.zookeeper").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
[ "def", "discovery_zookeeper", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.discovery.zookeeper\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as"...
Installs the ZooKeeper discovery bundles and instantiates components
[ "Installs", "the", "ZooKeeper", "discovery", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L153-L170
tcalmant/ipopo
samples/run_remote.py
InstallUtils.transport_jsonrpc
def transport_jsonrpc(self): """ Installs the JSON-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.json_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discover...
python
def transport_jsonrpc(self): """ Installs the JSON-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.json_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discover...
[ "def", "transport_jsonrpc", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.json_rpc\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as", "ipopo", ...
Installs the JSON-RPC transport bundles and instantiates components
[ "Installs", "the", "JSON", "-", "RPC", "transport", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L172-L186
tcalmant/ipopo
samples/run_remote.py
InstallUtils.transport_jabsorbrpc
def transport_jabsorbrpc(self): """ Installs the JABSORB-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle( "pelix.remote.transport.jabsorb_rpc" ).start() with use_waiting_list(self.context) as ipop...
python
def transport_jabsorbrpc(self): """ Installs the JABSORB-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle( "pelix.remote.transport.jabsorb_rpc" ).start() with use_waiting_list(self.context) as ipop...
[ "def", "transport_jabsorbrpc", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.transport.jabsorb_rpc\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "...
Installs the JABSORB-RPC transport bundles and instantiates components
[ "Installs", "the", "JABSORB", "-", "RPC", "transport", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L188-L206
tcalmant/ipopo
samples/run_remote.py
InstallUtils.transport_mqttrpc
def transport_mqttrpc(self): """ Installs the MQTT-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.transport.mqtt_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate th...
python
def transport_mqttrpc(self): """ Installs the MQTT-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.transport.mqtt_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate th...
[ "def", "transport_mqttrpc", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.transport.mqtt_rpc\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as", ...
Installs the MQTT-RPC transport bundles and instantiates components
[ "Installs", "the", "MQTT", "-", "RPC", "transport", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L208-L232
tcalmant/ipopo
samples/run_remote.py
InstallUtils.transport_xmlrpc
def transport_xmlrpc(self): """ Installs the XML-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.xml_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery ...
python
def transport_xmlrpc(self): """ Installs the XML-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.xml_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery ...
[ "def", "transport_xmlrpc", "(", "self", ")", ":", "# Install the bundle", "self", ".", "context", ".", "install_bundle", "(", "\"pelix.remote.xml_rpc\"", ")", ".", "start", "(", ")", "with", "use_waiting_list", "(", "self", ".", "context", ")", "as", "ipopo", ...
Installs the XML-RPC transport bundles and instantiates components
[ "Installs", "the", "XML", "-", "RPC", "transport", "bundles", "and", "instantiates", "components" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/run_remote.py#L234-L248
tcalmant/ipopo
pelix/ipopo/handlers/requiresbest.py
_HandlerFactory.get_handlers
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
python
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
[ "def", "get_handlers", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# Extract information from the context", "requirements", "=", "component_context", ".", "get_handler", "(", "ipopo_constants", ".", "HANDLER_REQUIRES_BEST", ")", "requires_filters", ...
Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component
[ "Sets", "up", "service", "providers", "for", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresbest.py#L54-L79
tcalmant/ipopo
pelix/ipopo/handlers/requiresbest.py
BestDependency.on_service_arrival
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: new_ranking = svc_ref.get_property(SERVICE_RANKING) if self._current_ranking is not None: ...
python
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: new_ranking = svc_ref.get_property(SERVICE_RANKING) if self._current_ranking is not None: ...
[ "def", "on_service_arrival", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "new_ranking", "=", "svc_ref", ".", "get_property", "(", "SERVICE_RANKING", ")", "if", "self", ".", "_current_ranking", "is", "not", "None", ":", "if", "...
Called when a service has been registered in the framework :param svc_ref: A service reference
[ "Called", "when", "a", "service", "has", "been", "registered", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresbest.py#L146-L175
tcalmant/ipopo
pelix/ipopo/handlers/requiresbest.py
BestDependency.on_service_departure
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference """ with self._lock: if svc_ref is self.reference: # Injected service going away... service...
python
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference """ with self._lock: if svc_ref is self.reference: # Injected service going away... service...
[ "def", "on_service_departure", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "if", "svc_ref", "is", "self", ".", "reference", ":", "# Injected service going away...", "service", "=", "self", ".", "_value", "# Clear the instance values",...
Called when a service has been unregistered from the framework :param svc_ref: A service reference
[ "Called", "when", "a", "service", "has", "been", "unregistered", "from", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresbest.py#L177-L201
tcalmant/ipopo
pelix/ipopo/handlers/requiresbest.py
BestDependency.on_service_modify
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values """ with self._lock: if self.reference is None: ...
python
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values """ with self._lock: if self.reference is None: ...
[ "def", "on_service_modify", "(", "self", ",", "svc_ref", ",", "old_properties", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "reference", "is", "None", ":", "# A previously registered service now matches our filter", "return", "self", ".", "on_s...
Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values
[ "Called", "when", "a", "service", "has", "been", "modified", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresbest.py#L203-L230
tcalmant/ipopo
pelix/services/configadmin.py
Configuration.get_properties
def get_properties(self): """ Return the properties of this Configuration object. The Dictionary object returned is a private copy for the caller and may be changed without influencing the stored configuration. If called just after the configuration is created and before update ...
python
def get_properties(self): """ Return the properties of this Configuration object. The Dictionary object returned is a private copy for the caller and may be changed without influencing the stored configuration. If called just after the configuration is created and before update ...
[ "def", "get_properties", "(", "self", ")", ":", "with", "self", ".", "__lock", ":", "if", "self", ".", "__deleted", ":", "raise", "ValueError", "(", "\"{0} has been deleted\"", ".", "format", "(", "self", ".", "__pid", ")", ")", "elif", "not", "self", "....
Return the properties of this Configuration object. The Dictionary object returned is a private copy for the caller and may be changed without influencing the stored configuration. If called just after the configuration is created and before update has been called, this method returns N...
[ "Return", "the", "properties", "of", "this", "Configuration", "object", ".", "The", "Dictionary", "object", "returned", "is", "a", "private", "copy", "for", "the", "caller", "and", "may", "be", "changed", "without", "influencing", "the", "stored", "configuration...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/configadmin.py#L170-L201
tcalmant/ipopo
pelix/services/configadmin.py
Configuration.__properties_update
def __properties_update(self, properties): """ Internal update of configuration properties. Does not notifies the ConfigurationAdmin of this modification. :param properties: the new set of properties for this configuration :return: True if the properties have been updated, else ...
python
def __properties_update(self, properties): """ Internal update of configuration properties. Does not notifies the ConfigurationAdmin of this modification. :param properties: the new set of properties for this configuration :return: True if the properties have been updated, else ...
[ "def", "__properties_update", "(", "self", ",", "properties", ")", ":", "if", "not", "properties", ":", "# Nothing to do", "return", "False", "with", "self", ".", "__lock", ":", "# Make a copy of the properties", "properties", "=", "properties", ".", "copy", "(", ...
Internal update of configuration properties. Does not notifies the ConfigurationAdmin of this modification. :param properties: the new set of properties for this configuration :return: True if the properties have been updated, else False
[ "Internal", "update", "of", "configuration", "properties", ".", "Does", "not", "notifies", "the", "ConfigurationAdmin", "of", "this", "modification", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/configadmin.py#L213-L255
tcalmant/ipopo
pelix/services/configadmin.py
Configuration.update
def update(self, properties=None): # pylint: disable=W0212 """ If called without properties, only notifies listeners Update the properties of this Configuration object. Stores the properties in persistent storage after adding or overwriting the following properties: ...
python
def update(self, properties=None): # pylint: disable=W0212 """ If called without properties, only notifies listeners Update the properties of this Configuration object. Stores the properties in persistent storage after adding or overwriting the following properties: ...
[ "def", "update", "(", "self", ",", "properties", "=", "None", ")", ":", "# pylint: disable=W0212", "with", "self", ".", "__lock", ":", "# Update properties", "if", "self", ".", "__properties_update", "(", "properties", ")", ":", "# Update configurations, if somethin...
If called without properties, only notifies listeners Update the properties of this Configuration object. Stores the properties in persistent storage after adding or overwriting the following properties: * "service.pid" : is set to be the PID of this configuration. * "service.f...
[ "If", "called", "without", "properties", "only", "notifies", "listeners" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/configadmin.py#L266-L296
tcalmant/ipopo
pelix/services/configadmin.py
Configuration.delete
def delete(self, directory_updated=False): # pylint: disable=W0212 """ Delete this configuration :param directory_updated: If True, tell ConfigurationAdmin to not recall the directory of this deletion (internal use only...
python
def delete(self, directory_updated=False): # pylint: disable=W0212 """ Delete this configuration :param directory_updated: If True, tell ConfigurationAdmin to not recall the directory of this deletion (internal use only...
[ "def", "delete", "(", "self", ",", "directory_updated", "=", "False", ")", ":", "# pylint: disable=W0212", "with", "self", ".", "__lock", ":", "if", "self", ".", "__deleted", ":", "# Nothing to do", "return", "# Update status", "self", ".", "__deleted", "=", "...
Delete this configuration :param directory_updated: If True, tell ConfigurationAdmin to not recall the directory of this deletion (internal use only)
[ "Delete", "this", "configuration" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/configadmin.py#L298-L327
tcalmant/ipopo
pelix/services/configadmin.py
Configuration.matches
def matches(self, ldap_filter): """ Tests if this configuration matches the given filter. :param ldap_filter: A parsed LDAP filter object :return: True if the properties of this configuration matches the filter """ if not self.is_valid(): # D...
python
def matches(self, ldap_filter): """ Tests if this configuration matches the given filter. :param ldap_filter: A parsed LDAP filter object :return: True if the properties of this configuration matches the filter """ if not self.is_valid(): # D...
[ "def", "matches", "(", "self", ",", "ldap_filter", ")", ":", "if", "not", "self", ".", "is_valid", "(", ")", ":", "# Do not test invalid configurations", "return", "False", "return", "ldap_filter", ".", "matches", "(", "self", ".", "__properties", ")" ]
Tests if this configuration matches the given filter. :param ldap_filter: A parsed LDAP filter object :return: True if the properties of this configuration matches the filter
[ "Tests", "if", "this", "configuration", "matches", "the", "given", "filter", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/configadmin.py#L329-L341
tcalmant/ipopo
pelix/framework.py
walk_modules
def walk_modules(path): """ Code from ``pkgutil.ImpImporter.iter_modules()``: walks through a folder and yields all loadable packages and modules. :param path: Path where to look for modules :return: Generator to walk through found packages and modules """ if path is None or not os.path.isd...
python
def walk_modules(path): """ Code from ``pkgutil.ImpImporter.iter_modules()``: walks through a folder and yields all loadable packages and modules. :param path: Path where to look for modules :return: Generator to walk through found packages and modules """ if path is None or not os.path.isd...
[ "def", "walk_modules", "(", "path", ")", ":", "if", "path", "is", "None", "or", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "yielded", "=", "set", "(", ")", "try", ":", "file_names", "=", "os", ".", "listdir", "(", "p...
Code from ``pkgutil.ImpImporter.iter_modules()``: walks through a folder and yields all loadable packages and modules. :param path: Path where to look for modules :return: Generator to walk through found packages and modules
[ "Code", "from", "pkgutil", ".", "ImpImporter", ".", "iter_modules", "()", ":", "walks", "through", "a", "folder", "and", "yields", "all", "loadable", "packages", "and", "modules", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L101-L149
tcalmant/ipopo
pelix/framework.py
create_framework
def create_framework( bundles, properties=None, auto_start=False, wait_for_stop=False, auto_delete=False, ): # type: (Union[list, tuple], dict, bool, bool, bool) -> Framework """ Creates a Pelix framework, installs the given bundles and returns its instance reference. If *auto_st...
python
def create_framework( bundles, properties=None, auto_start=False, wait_for_stop=False, auto_delete=False, ): # type: (Union[list, tuple], dict, bool, bool, bool) -> Framework """ Creates a Pelix framework, installs the given bundles and returns its instance reference. If *auto_st...
[ "def", "create_framework", "(", "bundles", ",", "properties", "=", "None", ",", "auto_start", "=", "False", ",", "wait_for_stop", "=", "False", ",", "auto_delete", "=", "False", ",", ")", ":", "# type: (Union[list, tuple], dict, bool, bool, bool) -> Framework", "# Tes...
Creates a Pelix framework, installs the given bundles and returns its instance reference. If *auto_start* is True, the framework will be started once all bundles will have been installed If *wait_for_stop* is True, the method will return only when the framework will have stopped. This requires *auto...
[ "Creates", "a", "Pelix", "framework", "installs", "the", "given", "bundles", "and", "returns", "its", "instance", "reference", ".", "If", "*", "auto_start", "*", "is", "True", "the", "framework", "will", "be", "started", "once", "all", "bundles", "will", "ha...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1883-L1942
tcalmant/ipopo
pelix/framework.py
_package_exists
def _package_exists(path): # type: (str) -> bool """ Checks if the given Python path matches a valid file or a valid container file :param path: A Python path :return: True if the module or its container exists """ while path: if os.path.exists(path): return True ...
python
def _package_exists(path): # type: (str) -> bool """ Checks if the given Python path matches a valid file or a valid container file :param path: A Python path :return: True if the module or its container exists """ while path: if os.path.exists(path): return True ...
[ "def", "_package_exists", "(", "path", ")", ":", "# type: (str) -> bool", "while", "path", ":", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "True", "else", ":", "path", "=", "os", ".", "path", ".", "dirname", "(", "path", ...
Checks if the given Python path matches a valid file or a valid container file :param path: A Python path :return: True if the module or its container exists
[ "Checks", "if", "the", "given", "Python", "path", "matches", "a", "valid", "file", "or", "a", "valid", "container", "file" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1945-L1960
tcalmant/ipopo
pelix/framework.py
normalize_path
def normalize_path(): """ Normalizes sys.path to avoid the use of relative folders """ # Normalize Python paths whole_path = [ os.path.abspath(path) for path in sys.path if os.path.exists(path) ] # Keep the "dynamic" current folder indicator and add the "static" # current path ...
python
def normalize_path(): """ Normalizes sys.path to avoid the use of relative folders """ # Normalize Python paths whole_path = [ os.path.abspath(path) for path in sys.path if os.path.exists(path) ] # Keep the "dynamic" current folder indicator and add the "static" # current path ...
[ "def", "normalize_path", "(", ")", ":", "# Normalize Python paths", "whole_path", "=", "[", "os", ".", "path", ".", "abspath", "(", "path", ")", "for", "path", "in", "sys", ".", "path", "if", "os", ".", "path", ".", "exists", "(", "path", ")", "]", "...
Normalizes sys.path to avoid the use of relative folders
[ "Normalizes", "sys", ".", "path", "to", "avoid", "the", "use", "of", "relative", "folders" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1963-L1997
tcalmant/ipopo
pelix/framework.py
Bundle.__get_activator_method
def __get_activator_method(self, method_name): """ Retrieves the requested method of the activator, or returns None :param method_name: A method name :return: A method, or None """ # Get the activator activator = getattr(self.__module, ACTIVATOR, None) if...
python
def __get_activator_method(self, method_name): """ Retrieves the requested method of the activator, or returns None :param method_name: A method name :return: A method, or None """ # Get the activator activator = getattr(self.__module, ACTIVATOR, None) if...
[ "def", "__get_activator_method", "(", "self", ",", "method_name", ")", ":", "# Get the activator", "activator", "=", "getattr", "(", "self", ".", "__module", ",", "ACTIVATOR", ",", "None", ")", "if", "activator", "is", "None", ":", "# Get the old activator", "ac...
Retrieves the requested method of the activator, or returns None :param method_name: A method name :return: A method, or None
[ "Retrieves", "the", "requested", "method", "of", "the", "activator", "or", "returns", "None" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L236-L256
tcalmant/ipopo
pelix/framework.py
Bundle._fire_bundle_event
def _fire_bundle_event(self, kind): # type: (int) -> None """ Fires a bundle event of the given kind :param kind: Kind of event """ self.__framework._dispatcher.fire_bundle_event(BundleEvent(kind, self))
python
def _fire_bundle_event(self, kind): # type: (int) -> None """ Fires a bundle event of the given kind :param kind: Kind of event """ self.__framework._dispatcher.fire_bundle_event(BundleEvent(kind, self))
[ "def", "_fire_bundle_event", "(", "self", ",", "kind", ")", ":", "# type: (int) -> None", "self", ".", "__framework", ".", "_dispatcher", ".", "fire_bundle_event", "(", "BundleEvent", "(", "kind", ",", "self", ")", ")" ]
Fires a bundle event of the given kind :param kind: Kind of event
[ "Fires", "a", "bundle", "event", "of", "the", "given", "kind" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L258-L265
tcalmant/ipopo
pelix/framework.py
Bundle.get_registered_services
def get_registered_services(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it has registered or an empty list The list is valid at the time of the call to this method, however, as the Framework is a very dynam...
python
def get_registered_services(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it has registered or an empty list The list is valid at the time of the call to this method, however, as the Framework is a very dynam...
[ "def", "get_registered_services", "(", "self", ")", ":", "# type: () -> List[ServiceReference]", "if", "self", ".", "_state", "==", "Bundle", ".", "UNINSTALLED", ":", "raise", "BundleException", "(", "\"Can't call 'get_registered_services' on an \"", "\"uninstalled bundle\"",...
Returns this bundle's ServiceReference list for all services it has registered or an empty list The list is valid at the time of the call to this method, however, as the Framework is a very dynamic environment, services can be modified or unregistered at any time. :return: An a...
[ "Returns", "this", "bundle", "s", "ServiceReference", "list", "for", "all", "services", "it", "has", "registered", "or", "an", "empty", "list" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L326-L344
tcalmant/ipopo
pelix/framework.py
Bundle.get_services_in_use
def get_services_in_use(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it is using or an empty list. A bundle is considered to be using a service if its use count for that service is greater than zero. ...
python
def get_services_in_use(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it is using or an empty list. A bundle is considered to be using a service if its use count for that service is greater than zero. ...
[ "def", "get_services_in_use", "(", "self", ")", ":", "# type: () -> List[ServiceReference]", "if", "self", ".", "_state", "==", "Bundle", ".", "UNINSTALLED", ":", "raise", "BundleException", "(", "\"Can't call 'get_services_in_use' on an uninstalled bundle\"", ")", "return"...
Returns this bundle's ServiceReference list for all services it is using or an empty list. A bundle is considered to be using a service if its use count for that service is greater than zero. The list is valid at the time of the call to this method, however, as the Framework is ...
[ "Returns", "this", "bundle", "s", "ServiceReference", "list", "for", "all", "services", "it", "is", "using", "or", "an", "empty", "list", ".", "A", "bundle", "is", "considered", "to", "be", "using", "a", "service", "if", "its", "use", "count", "for", "th...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L346-L365
tcalmant/ipopo
pelix/framework.py
Bundle.get_version
def get_version(self): # type: () -> str """ Retrieves the bundle version, using the ``__version__`` or ``__version_info__`` attributes of its module. :return: The bundle version, "0.0.0" by default """ # Get the version value version = getattr(self.__mod...
python
def get_version(self): # type: () -> str """ Retrieves the bundle version, using the ``__version__`` or ``__version_info__`` attributes of its module. :return: The bundle version, "0.0.0" by default """ # Get the version value version = getattr(self.__mod...
[ "def", "get_version", "(", "self", ")", ":", "# type: () -> str", "# Get the version value", "version", "=", "getattr", "(", "self", ".", "__module", ",", "\"__version__\"", ",", "None", ")", "if", "version", ":", "return", "version", "# Convert the __version_info__...
Retrieves the bundle version, using the ``__version__`` or ``__version_info__`` attributes of its module. :return: The bundle version, "0.0.0" by default
[ "Retrieves", "the", "bundle", "version", "using", "the", "__version__", "or", "__version_info__", "attributes", "of", "its", "module", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L385-L404
tcalmant/ipopo
pelix/framework.py
Bundle.start
def start(self): """ Starts the bundle. Does nothing if the bundle is already starting or active. :raise BundleException: The framework is not yet started or the bundle activator failed. """ if self.__framework._state not in (Bundle.STARTI...
python
def start(self): """ Starts the bundle. Does nothing if the bundle is already starting or active. :raise BundleException: The framework is not yet started or the bundle activator failed. """ if self.__framework._state not in (Bundle.STARTI...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "__framework", ".", "_state", "not", "in", "(", "Bundle", ".", "STARTING", ",", "Bundle", ".", "ACTIVE", ")", ":", "# Framework is not running", "raise", "BundleException", "(", "\"Framework must be sta...
Starts the bundle. Does nothing if the bundle is already starting or active. :raise BundleException: The framework is not yet started or the bundle activator failed.
[ "Starts", "the", "bundle", ".", "Does", "nothing", "if", "the", "bundle", "is", "already", "starting", "or", "active", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L406-L459
tcalmant/ipopo
pelix/framework.py
Bundle.stop
def stop(self): """ Stops the bundle. Does nothing if the bundle is already stopped. :raise BundleException: The bundle activator failed. """ if self._state != Bundle.ACTIVE: # Invalid state return exception = None with self._lock: ...
python
def stop(self): """ Stops the bundle. Does nothing if the bundle is already stopped. :raise BundleException: The bundle activator failed. """ if self._state != Bundle.ACTIVE: # Invalid state return exception = None with self._lock: ...
[ "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_state", "!=", "Bundle", ".", "ACTIVE", ":", "# Invalid state", "return", "exception", "=", "None", "with", "self", ".", "_lock", ":", "# Store the bundle current state", "previous_state", "=", "self", ...
Stops the bundle. Does nothing if the bundle is already stopped. :raise BundleException: The bundle activator failed.
[ "Stops", "the", "bundle", ".", "Does", "nothing", "if", "the", "bundle", "is", "already", "stopped", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L461-L523
tcalmant/ipopo
pelix/framework.py
Bundle.__unregister_services
def __unregister_services(self): """ Unregisters all bundle services """ # Copy the services list, as it will be modified during the process with self.__registration_lock: registered_services = self.__registered_services.copy() for registration in registered_...
python
def __unregister_services(self): """ Unregisters all bundle services """ # Copy the services list, as it will be modified during the process with self.__registration_lock: registered_services = self.__registered_services.copy() for registration in registered_...
[ "def", "__unregister_services", "(", "self", ")", ":", "# Copy the services list, as it will be modified during the process", "with", "self", ".", "__registration_lock", ":", "registered_services", "=", "self", ".", "__registered_services", ".", "copy", "(", ")", "for", "...
Unregisters all bundle services
[ "Unregisters", "all", "bundle", "services" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L525-L545
tcalmant/ipopo
pelix/framework.py
Bundle.uninstall
def uninstall(self): """ Uninstalls the bundle """ with self._lock: if self._state == Bundle.ACTIVE: self.stop() # Change the bundle state self._state = Bundle.UNINSTALLED # Call the framework self.__framework....
python
def uninstall(self): """ Uninstalls the bundle """ with self._lock: if self._state == Bundle.ACTIVE: self.stop() # Change the bundle state self._state = Bundle.UNINSTALLED # Call the framework self.__framework....
[ "def", "uninstall", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_state", "==", "Bundle", ".", "ACTIVE", ":", "self", ".", "stop", "(", ")", "# Change the bundle state", "self", ".", "_state", "=", "Bundle", ".", "UNINS...
Uninstalls the bundle
[ "Uninstalls", "the", "bundle" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L547-L559
tcalmant/ipopo
pelix/framework.py
Bundle.update
def update(self): """ Updates the bundle """ with self._lock: # Was it active ? restart = self._state == Bundle.ACTIVE # Send the update event self._fire_bundle_event(BundleEvent.UPDATE_BEGIN) try: # Stop the b...
python
def update(self): """ Updates the bundle """ with self._lock: # Was it active ? restart = self._state == Bundle.ACTIVE # Send the update event self._fire_bundle_event(BundleEvent.UPDATE_BEGIN) try: # Stop the b...
[ "def", "update", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "# Was it active ?", "restart", "=", "self", ".", "_state", "==", "Bundle", ".", "ACTIVE", "# Send the update event", "self", ".", "_fire_bundle_event", "(", "BundleEvent", ".", "UPDATE...
Updates the bundle
[ "Updates", "the", "bundle" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L561-L644
tcalmant/ipopo
pelix/framework.py
Framework.add_property
def add_property(self, name, value): # type: (str, object) -> bool """ Adds a property to the framework **if it is not yet set**. If the property already exists (same name), then nothing is done. Properties can't be updated. :param name: The property name :param...
python
def add_property(self, name, value): # type: (str, object) -> bool """ Adds a property to the framework **if it is not yet set**. If the property already exists (same name), then nothing is done. Properties can't be updated. :param name: The property name :param...
[ "def", "add_property", "(", "self", ",", "name", ",", "value", ")", ":", "# type: (str, object) -> bool", "with", "self", ".", "__properties_lock", ":", "if", "name", "in", "self", ".", "__properties", ":", "# Already stored property", "return", "False", "self", ...
Adds a property to the framework **if it is not yet set**. If the property already exists (same name), then nothing is done. Properties can't be updated. :param name: The property name :param value: The value to set :return: True if the property was stored, else False
[ "Adds", "a", "property", "to", "the", "framework", "**", "if", "it", "is", "not", "yet", "set", "**", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L707-L725
tcalmant/ipopo
pelix/framework.py
Framework.find_service_references
def find_service_references( self, clazz=None, ldap_filter=None, only_one=False ): # type: (Optional[str], Optional[str], bool) -> Optional[List[ServiceReference]] """ Finds all services references matching the given filter. :param clazz: Class implemented by the service ...
python
def find_service_references( self, clazz=None, ldap_filter=None, only_one=False ): # type: (Optional[str], Optional[str], bool) -> Optional[List[ServiceReference]] """ Finds all services references matching the given filter. :param clazz: Class implemented by the service ...
[ "def", "find_service_references", "(", "self", ",", "clazz", "=", "None", ",", "ldap_filter", "=", "None", ",", "only_one", "=", "False", ")", ":", "# type: (Optional[str], Optional[str], bool) -> Optional[List[ServiceReference]]", "return", "self", ".", "_registry", "....
Finds all services references matching the given filter. :param clazz: Class implemented by the service :param ldap_filter: Service filter :param only_one: Return the first matching service reference only :return: A list of found reference, or None :raise BundleException: An err...
[ "Finds", "all", "services", "references", "matching", "the", "given", "filter", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L727-L743
tcalmant/ipopo
pelix/framework.py
Framework.get_bundle_by_id
def get_bundle_by_id(self, bundle_id): # type: (int) -> Union[Bundle, Framework] """ Retrieves the bundle with the given ID :param bundle_id: ID of an installed bundle :return: The requested bundle :raise BundleException: The ID is invalid """ if bundle_i...
python
def get_bundle_by_id(self, bundle_id): # type: (int) -> Union[Bundle, Framework] """ Retrieves the bundle with the given ID :param bundle_id: ID of an installed bundle :return: The requested bundle :raise BundleException: The ID is invalid """ if bundle_i...
[ "def", "get_bundle_by_id", "(", "self", ",", "bundle_id", ")", ":", "# type: (int) -> Union[Bundle, Framework]", "if", "bundle_id", "==", "0", ":", "# \"System bundle\"", "return", "self", "with", "self", ".", "__bundles_lock", ":", "if", "bundle_id", "not", "in", ...
Retrieves the bundle with the given ID :param bundle_id: ID of an installed bundle :return: The requested bundle :raise BundleException: The ID is invalid
[ "Retrieves", "the", "bundle", "with", "the", "given", "ID" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L745-L762
tcalmant/ipopo
pelix/framework.py
Framework.get_bundle_by_name
def get_bundle_by_name(self, bundle_name): # type: (str) -> Optional[Bundle] """ Retrieves the bundle with the given name :param bundle_name: Name of the bundle to look for :return: The requested bundle, None if not found """ if bundle_name is None: #...
python
def get_bundle_by_name(self, bundle_name): # type: (str) -> Optional[Bundle] """ Retrieves the bundle with the given name :param bundle_name: Name of the bundle to look for :return: The requested bundle, None if not found """ if bundle_name is None: #...
[ "def", "get_bundle_by_name", "(", "self", ",", "bundle_name", ")", ":", "# type: (str) -> Optional[Bundle]", "if", "bundle_name", "is", "None", ":", "# Nothing to do", "return", "None", "if", "bundle_name", "is", "self", ".", "get_symbolic_name", "(", ")", ":", "#...
Retrieves the bundle with the given name :param bundle_name: Name of the bundle to look for :return: The requested bundle, None if not found
[ "Retrieves", "the", "bundle", "with", "the", "given", "name" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L764-L787
tcalmant/ipopo
pelix/framework.py
Framework.get_bundles
def get_bundles(self): # type: () -> List[Bundle] """ Returns the list of all installed bundles :return: the list of all installed bundles """ with self.__bundles_lock: return [ self.__bundles[bundle_id] for bundle_id in sorted...
python
def get_bundles(self): # type: () -> List[Bundle] """ Returns the list of all installed bundles :return: the list of all installed bundles """ with self.__bundles_lock: return [ self.__bundles[bundle_id] for bundle_id in sorted...
[ "def", "get_bundles", "(", "self", ")", ":", "# type: () -> List[Bundle]", "with", "self", ".", "__bundles_lock", ":", "return", "[", "self", ".", "__bundles", "[", "bundle_id", "]", "for", "bundle_id", "in", "sorted", "(", "self", ".", "__bundles", ".", "ke...
Returns the list of all installed bundles :return: the list of all installed bundles
[ "Returns", "the", "list", "of", "all", "installed", "bundles" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L789-L800
tcalmant/ipopo
pelix/framework.py
Framework.get_property
def get_property(self, name): # type: (str) -> object """ Retrieves a framework or system property. As framework properties don't change while it's running, this method don't need to be protected. :param name: The property name """ with self.__properties_lock: ...
python
def get_property(self, name): # type: (str) -> object """ Retrieves a framework or system property. As framework properties don't change while it's running, this method don't need to be protected. :param name: The property name """ with self.__properties_lock: ...
[ "def", "get_property", "(", "self", ",", "name", ")", ":", "# type: (str) -> object", "with", "self", ".", "__properties_lock", ":", "return", "self", ".", "__properties", ".", "get", "(", "name", ",", "os", ".", "getenv", "(", "name", ")", ")" ]
Retrieves a framework or system property. As framework properties don't change while it's running, this method don't need to be protected. :param name: The property name
[ "Retrieves", "a", "framework", "or", "system", "property", ".", "As", "framework", "properties", "don", "t", "change", "while", "it", "s", "running", "this", "method", "don", "t", "need", "to", "be", "protected", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L810-L819
tcalmant/ipopo
pelix/framework.py
Framework.get_service
def get_service(self, bundle, reference): # type: (Bundle, ServiceReference) -> Any """ Retrieves the service corresponding to the given reference :param bundle: The bundle requiring the service :param reference: A service reference :return: The requested service ...
python
def get_service(self, bundle, reference): # type: (Bundle, ServiceReference) -> Any """ Retrieves the service corresponding to the given reference :param bundle: The bundle requiring the service :param reference: A service reference :return: The requested service ...
[ "def", "get_service", "(", "self", ",", "bundle", ",", "reference", ")", ":", "# type: (Bundle, ServiceReference) -> Any", "if", "not", "isinstance", "(", "bundle", ",", "Bundle", ")", ":", "raise", "TypeError", "(", "\"First argument must be a Bundle object\"", ")", ...
Retrieves the service corresponding to the given reference :param bundle: The bundle requiring the service :param reference: A service reference :return: The requested service :raise BundleException: The service could not be found :raise TypeError: The argument is not a ServiceR...
[ "Retrieves", "the", "service", "corresponding", "to", "the", "given", "reference" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L831-L851
tcalmant/ipopo
pelix/framework.py
Framework.install_bundle
def install_bundle(self, name, path=None): # type: (str, str) -> Bundle """ Installs the bundle with the given name *Note:* Before Pelix 0.5.0, this method returned the ID of the installed bundle, instead of the Bundle object. **WARNING:** The behavior of the loading pr...
python
def install_bundle(self, name, path=None): # type: (str, str) -> Bundle """ Installs the bundle with the given name *Note:* Before Pelix 0.5.0, this method returned the ID of the installed bundle, instead of the Bundle object. **WARNING:** The behavior of the loading pr...
[ "def", "install_bundle", "(", "self", ",", "name", ",", "path", "=", "None", ")", ":", "# type: (str, str) -> Bundle", "with", "self", ".", "__bundles_lock", ":", "# A bundle can't be installed twice", "for", "bundle", "in", "self", ".", "__bundles", ".", "values"...
Installs the bundle with the given name *Note:* Before Pelix 0.5.0, this method returned the ID of the installed bundle, instead of the Bundle object. **WARNING:** The behavior of the loading process is subject to changes, as it does not allow to safely run multiple frameworks in the s...
[ "Installs", "the", "bundle", "with", "the", "given", "name" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L874-L942
tcalmant/ipopo
pelix/framework.py
Framework.install_package
def install_package(self, path, recursive=False, prefix=None): # type: (str, bool, str) -> tuple """ Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**in...
python
def install_package(self, path, recursive=False, prefix=None): # type: (str, bool, str) -> tuple """ Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**in...
[ "def", "install_package", "(", "self", ",", "path", ",", "recursive", "=", "False", ",", "prefix", "=", "None", ")", ":", "# type: (str, bool, str) -> tuple", "if", "not", "path", ":", "raise", "ValueError", "(", "\"Empty path\"", ")", "elif", "not", "is_strin...
Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**internal**) Prefix for all found modules :return: A 2-tuple, with the list of installed bundles and the list ...
[ "Installs", "all", "the", "modules", "found", "in", "the", "given", "package" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L944-L1000
tcalmant/ipopo
pelix/framework.py
Framework.install_visiting
def install_visiting(self, path, visitor, prefix=None): """ Installs all the modules found in the given path if they are accepted by the visitor. The visitor must be a callable accepting 3 parameters: * fullname: The full name of the module * is_package: If True, ...
python
def install_visiting(self, path, visitor, prefix=None): """ Installs all the modules found in the given path if they are accepted by the visitor. The visitor must be a callable accepting 3 parameters: * fullname: The full name of the module * is_package: If True, ...
[ "def", "install_visiting", "(", "self", ",", "path", ",", "visitor", ",", "prefix", "=", "None", ")", ":", "# Validate the path", "if", "not", "path", ":", "raise", "ValueError", "(", "\"Empty path\"", ")", "elif", "not", "is_string", "(", "path", ")", ":"...
Installs all the modules found in the given path if they are accepted by the visitor. The visitor must be a callable accepting 3 parameters: * fullname: The full name of the module * is_package: If True, the module is a package * module_path: The path to the module fil...
[ "Installs", "all", "the", "modules", "found", "in", "the", "given", "path", "if", "they", "are", "accepted", "by", "the", "visitor", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1002-L1075
tcalmant/ipopo
pelix/framework.py
Framework.register_service
def register_service( self, bundle, clazz, service, properties, send_event, factory=False, prototype=False, ): # type: (Bundle, Union[List[Any], type, str], object, dict, bool, bool, bool) -> ServiceRegistration """ Registers a ...
python
def register_service( self, bundle, clazz, service, properties, send_event, factory=False, prototype=False, ): # type: (Bundle, Union[List[Any], type, str], object, dict, bool, bool, bool) -> ServiceRegistration """ Registers a ...
[ "def", "register_service", "(", "self", ",", "bundle", ",", "clazz", ",", "service", ",", "properties", ",", "send_event", ",", "factory", "=", "False", ",", "prototype", "=", "False", ",", ")", ":", "# type: (Bundle, Union[List[Any], type, str], object, dict, bool,...
Registers a service and calls the listeners :param bundle: The bundle registering the service :param clazz: Name(s) of the interface(s) implemented by service :param service: The service to register :param properties: Service properties :param send_event: If not, doesn't trigger...
[ "Registers", "a", "service", "and", "calls", "the", "listeners" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1077-L1148
tcalmant/ipopo
pelix/framework.py
Framework.start
def start(self): # type: () -> bool """ Starts the framework :return: True if the bundle has been started, False if it was already running :raise BundleException: A bundle failed to start """ with self._lock: if self._state in (Bundle...
python
def start(self): # type: () -> bool """ Starts the framework :return: True if the bundle has been started, False if it was already running :raise BundleException: A bundle failed to start """ with self._lock: if self._state in (Bundle...
[ "def", "start", "(", "self", ")", ":", "# type: () -> bool", "with", "self", ".", "_lock", ":", "if", "self", ".", "_state", "in", "(", "Bundle", ".", "STARTING", ",", "Bundle", ".", "ACTIVE", ")", ":", "# Already started framework", "return", "False", "# ...
Starts the framework :return: True if the bundle has been started, False if it was already running :raise BundleException: A bundle failed to start
[ "Starts", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1150-L1193
tcalmant/ipopo
pelix/framework.py
Framework.stop
def stop(self): # type: () -> bool """ Stops the framework :return: True if the framework stopped, False it wasn't running """ with self._lock: if self._state != Bundle.ACTIVE: # Invalid state return False # Hide a...
python
def stop(self): # type: () -> bool """ Stops the framework :return: True if the framework stopped, False it wasn't running """ with self._lock: if self._state != Bundle.ACTIVE: # Invalid state return False # Hide a...
[ "def", "stop", "(", "self", ")", ":", "# type: () -> bool", "with", "self", ".", "_lock", ":", "if", "self", ".", "_state", "!=", "Bundle", ".", "ACTIVE", ":", "# Invalid state", "return", "False", "# Hide all services (they will be deleted by bundle.stop())", "for"...
Stops the framework :return: True if the framework stopped, False it wasn't running
[ "Stops", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1195-L1250
tcalmant/ipopo
pelix/framework.py
Framework.delete
def delete(self, force=False): """ Deletes the current framework :param force: If True, stops the framework before deleting it :return: True if the framework has been delete, False if is couldn't """ if not force and self._state not in ( Bundle.INSTALLED, ...
python
def delete(self, force=False): """ Deletes the current framework :param force: If True, stops the framework before deleting it :return: True if the framework has been delete, False if is couldn't """ if not force and self._state not in ( Bundle.INSTALLED, ...
[ "def", "delete", "(", "self", ",", "force", "=", "False", ")", ":", "if", "not", "force", "and", "self", ".", "_state", "not", "in", "(", "Bundle", ".", "INSTALLED", ",", "Bundle", ".", "RESOLVED", ",", "Bundle", ".", "STOPPING", ",", ")", ":", "_l...
Deletes the current framework :param force: If True, stops the framework before deleting it :return: True if the framework has been delete, False if is couldn't
[ "Deletes", "the", "current", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1252-L1267
tcalmant/ipopo
pelix/framework.py
Framework.uninstall_bundle
def uninstall_bundle(self, bundle): # type: (Bundle) -> None """ Ends the uninstallation of the given bundle (must be called by Bundle) :param bundle: The bundle to uninstall :raise BundleException: Invalid bundle """ if bundle is None: # Do nothing ...
python
def uninstall_bundle(self, bundle): # type: (Bundle) -> None """ Ends the uninstallation of the given bundle (must be called by Bundle) :param bundle: The bundle to uninstall :raise BundleException: Invalid bundle """ if bundle is None: # Do nothing ...
[ "def", "uninstall_bundle", "(", "self", ",", "bundle", ")", ":", "# type: (Bundle) -> None", "if", "bundle", "is", "None", ":", "# Do nothing", "return", "with", "self", ".", "__bundles_lock", ":", "# Stop the bundle first", "bundle", ".", "stop", "(", ")", "bun...
Ends the uninstallation of the given bundle (must be called by Bundle) :param bundle: The bundle to uninstall :raise BundleException: Invalid bundle
[ "Ends", "the", "uninstallation", "of", "the", "given", "bundle", "(", "must", "be", "called", "by", "Bundle", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1277-L1321
tcalmant/ipopo
pelix/framework.py
Framework.unregister_service
def unregister_service(self, registration): # type: (ServiceRegistration) -> bool """ Unregisters the given service :param registration: A ServiceRegistration to the service to unregister :raise BundleException: Invalid reference """ # Get the Service Reference ...
python
def unregister_service(self, registration): # type: (ServiceRegistration) -> bool """ Unregisters the given service :param registration: A ServiceRegistration to the service to unregister :raise BundleException: Invalid reference """ # Get the Service Reference ...
[ "def", "unregister_service", "(", "self", ",", "registration", ")", ":", "# type: (ServiceRegistration) -> bool", "# Get the Service Reference", "reference", "=", "registration", ".", "get_reference", "(", ")", "# Remove the service from the registry", "svc_instance", "=", "s...
Unregisters the given service :param registration: A ServiceRegistration to the service to unregister :raise BundleException: Invalid reference
[ "Unregisters", "the", "given", "service" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1323-L1350
tcalmant/ipopo
pelix/framework.py
Framework.update
def update(self): """ Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework. """ with self._lock: if self._state == Bundle.ACTIVE: ...
python
def update(self): """ Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework. """ with self._lock: if self._state == Bundle.ACTIVE: ...
[ "def", "update", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_state", "==", "Bundle", ".", "ACTIVE", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework.
[ "Stops", "and", "starts", "the", "framework", "if", "the", "framework", "is", "active", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1371-L1381
tcalmant/ipopo
pelix/framework.py
Framework.wait_for_stop
def wait_for_stop(self, timeout=None): # type: (Optional[int]) -> bool """ Waits for the framework to stop. Does nothing if the framework bundle is not in ACTIVE state. Uses a threading.Condition object :param timeout: The maximum time to wait (in seconds) :retu...
python
def wait_for_stop(self, timeout=None): # type: (Optional[int]) -> bool """ Waits for the framework to stop. Does nothing if the framework bundle is not in ACTIVE state. Uses a threading.Condition object :param timeout: The maximum time to wait (in seconds) :retu...
[ "def", "wait_for_stop", "(", "self", ",", "timeout", "=", "None", ")", ":", "# type: (Optional[int]) -> bool", "if", "self", ".", "_state", "!=", "Bundle", ".", "ACTIVE", ":", "# Inactive framework, ignore the call", "return", "True", "self", ".", "_fw_stop_event", ...
Waits for the framework to stop. Does nothing if the framework bundle is not in ACTIVE state. Uses a threading.Condition object :param timeout: The maximum time to wait (in seconds) :return: True if the framework has stopped, False if the timeout raised
[ "Waits", "for", "the", "framework", "to", "stop", ".", "Does", "nothing", "if", "the", "framework", "bundle", "is", "not", "in", "ACTIVE", "state", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1383-L1402
tcalmant/ipopo
pelix/framework.py
ServiceObjects.unget_service
def unget_service(self, service): # type: (Any) -> bool """ Releases a service object for the associated service. :param service: An instance of a service returned by ``get_service()`` :return: True if the bundle usage has been removed """ return self.__registry....
python
def unget_service(self, service): # type: (Any) -> bool """ Releases a service object for the associated service. :param service: An instance of a service returned by ``get_service()`` :return: True if the bundle usage has been removed """ return self.__registry....
[ "def", "unget_service", "(", "self", ",", "service", ")", ":", "# type: (Any) -> bool", "return", "self", ".", "__registry", ".", "unget_service", "(", "self", ".", "__bundle", ",", "self", ".", "__reference", ",", "service", ")" ]
Releases a service object for the associated service. :param service: An instance of a service returned by ``get_service()`` :return: True if the bundle usage has been removed
[ "Releases", "a", "service", "object", "for", "the", "associated", "service", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1440-L1450
tcalmant/ipopo
pelix/framework.py
BundleContext.add_service_listener
def add_service_listener( self, listener, ldap_filter=None, specification=None ): """ Registers a service listener The service listener must have a method with the following prototype:: def service_changed(self, event): ''' Called by Pelix w...
python
def add_service_listener( self, listener, ldap_filter=None, specification=None ): """ Registers a service listener The service listener must have a method with the following prototype:: def service_changed(self, event): ''' Called by Pelix w...
[ "def", "add_service_listener", "(", "self", ",", "listener", ",", "ldap_filter", "=", "None", ",", "specification", "=", "None", ")", ":", "return", "self", ".", "__framework", ".", "_dispatcher", ".", "add_service_listener", "(", "self", ",", "listener", ",",...
Registers a service listener The service listener must have a method with the following prototype:: def service_changed(self, event): ''' Called by Pelix when some service properties changes event: A ServiceEvent object ''' ...
[ "Registers", "a", "service", "listener" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1510-L1536