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/internals/registry.py | EventDispatcher.remove_bundle_listener | def remove_bundle_listener(self, listener):
"""
Unregisters a bundle listener
:param listener: The bundle listener to unregister
:return: True if the listener has been unregistered, else False
"""
with self.__bnd_lock:
if listener not in self.__bnd_listeners:... | python | def remove_bundle_listener(self, listener):
"""
Unregisters a bundle listener
:param listener: The bundle listener to unregister
:return: True if the listener has been unregistered, else False
"""
with self.__bnd_lock:
if listener not in self.__bnd_listeners:... | [
"def",
"remove_bundle_listener",
"(",
"self",
",",
"listener",
")",
":",
"with",
"self",
".",
"__bnd_lock",
":",
"if",
"listener",
"not",
"in",
"self",
".",
"__bnd_listeners",
":",
"return",
"False",
"self",
".",
"__bnd_listeners",
".",
"remove",
"(",
"liste... | Unregisters a bundle listener
:param listener: The bundle listener to unregister
:return: True if the listener has been unregistered, else False | [
"Unregisters",
"a",
"bundle",
"listener"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L757-L769 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher.remove_framework_listener | def remove_framework_listener(self, listener):
"""
Unregisters a framework stop listener
:param listener: The framework listener to unregister
:return: True if the listener has been unregistered, else False
"""
with self.__fw_lock:
try:
self._... | python | def remove_framework_listener(self, listener):
"""
Unregisters a framework stop listener
:param listener: The framework listener to unregister
:return: True if the listener has been unregistered, else False
"""
with self.__fw_lock:
try:
self._... | [
"def",
"remove_framework_listener",
"(",
"self",
",",
"listener",
")",
":",
"with",
"self",
".",
"__fw_lock",
":",
"try",
":",
"self",
".",
"__fw_listeners",
".",
"remove",
"(",
"listener",
")",
"return",
"True",
"except",
"ValueError",
":",
"return",
"False... | Unregisters a framework stop listener
:param listener: The framework listener to unregister
:return: True if the listener has been unregistered, else False | [
"Unregisters",
"a",
"framework",
"stop",
"listener"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L771-L783 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher.remove_service_listener | def remove_service_listener(self, listener):
"""
Unregisters a service listener
:param listener: The service listener
:return: True if the listener has been unregistered
"""
with self.__svc_lock:
try:
data = self.__listeners_data.pop(listener)... | python | def remove_service_listener(self, listener):
"""
Unregisters a service listener
:param listener: The service listener
:return: True if the listener has been unregistered
"""
with self.__svc_lock:
try:
data = self.__listeners_data.pop(listener)... | [
"def",
"remove_service_listener",
"(",
"self",
",",
"listener",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"try",
":",
"data",
"=",
"self",
".",
"__listeners_data",
".",
"pop",
"(",
"listener",
")",
"spec_listeners",
"=",
"self",
".",
"__svc_listeners... | Unregisters a service listener
:param listener: The service listener
:return: True if the listener has been unregistered | [
"Unregisters",
"a",
"service",
"listener"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L785-L801 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher.fire_bundle_event | def fire_bundle_event(self, event):
"""
Notifies bundle events listeners of a new event in the calling thread.
:param event: The bundle event
"""
with self.__bnd_lock:
# Copy the list of listeners
listeners = self.__bnd_listeners[:]
# Call'em all... | python | def fire_bundle_event(self, event):
"""
Notifies bundle events listeners of a new event in the calling thread.
:param event: The bundle event
"""
with self.__bnd_lock:
# Copy the list of listeners
listeners = self.__bnd_listeners[:]
# Call'em all... | [
"def",
"fire_bundle_event",
"(",
"self",
",",
"event",
")",
":",
"with",
"self",
".",
"__bnd_lock",
":",
"# Copy the list of listeners",
"listeners",
"=",
"self",
".",
"__bnd_listeners",
"[",
":",
"]",
"# Call'em all",
"for",
"listener",
"in",
"listeners",
":",
... | Notifies bundle events listeners of a new event in the calling thread.
:param event: The bundle event | [
"Notifies",
"bundle",
"events",
"listeners",
"of",
"a",
"new",
"event",
"in",
"the",
"calling",
"thread",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L803-L818 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher.fire_framework_stopping | def fire_framework_stopping(self):
"""
Calls all framework listeners, telling them that the framework is
stopping
"""
with self.__fw_lock:
# Copy the list of listeners
listeners = self.__fw_listeners[:]
for listener in listeners:
try:
... | python | def fire_framework_stopping(self):
"""
Calls all framework listeners, telling them that the framework is
stopping
"""
with self.__fw_lock:
# Copy the list of listeners
listeners = self.__fw_listeners[:]
for listener in listeners:
try:
... | [
"def",
"fire_framework_stopping",
"(",
"self",
")",
":",
"with",
"self",
".",
"__fw_lock",
":",
"# Copy the list of listeners",
"listeners",
"=",
"self",
".",
"__fw_listeners",
"[",
":",
"]",
"for",
"listener",
"in",
"listeners",
":",
"try",
":",
"listener",
"... | Calls all framework listeners, telling them that the framework is
stopping | [
"Calls",
"all",
"framework",
"listeners",
"telling",
"them",
"that",
"the",
"framework",
"is",
"stopping"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L820-L836 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher.fire_service_event | def fire_service_event(self, event):
"""
Notifies service events listeners of a new event in the calling thread.
:param event: The service event
"""
# Get the service properties
properties = event.get_service_reference().get_properties()
svc_specs = properties[OB... | python | def fire_service_event(self, event):
"""
Notifies service events listeners of a new event in the calling thread.
:param event: The service event
"""
# Get the service properties
properties = event.get_service_reference().get_properties()
svc_specs = properties[OB... | [
"def",
"fire_service_event",
"(",
"self",
",",
"event",
")",
":",
"# Get the service properties",
"properties",
"=",
"event",
".",
"get_service_reference",
"(",
")",
".",
"get_properties",
"(",
")",
"svc_specs",
"=",
"properties",
"[",
"OBJECTCLASS",
"]",
"previou... | Notifies service events listeners of a new event in the calling thread.
:param event: The service event | [
"Notifies",
"service",
"events",
"listeners",
"of",
"a",
"new",
"event",
"in",
"the",
"calling",
"thread",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L838-L902 |
tcalmant/ipopo | pelix/internals/registry.py | EventDispatcher._filter_with_hooks | def _filter_with_hooks(self, svc_event, listeners):
"""
Filters listeners with EventListenerHooks
:param svc_event: ServiceEvent being triggered
:param listeners: Listeners to filter
:return: A list of listeners with hook references
"""
svc_ref = svc_event.get_se... | python | def _filter_with_hooks(self, svc_event, listeners):
"""
Filters listeners with EventListenerHooks
:param svc_event: ServiceEvent being triggered
:param listeners: Listeners to filter
:return: A list of listeners with hook references
"""
svc_ref = svc_event.get_se... | [
"def",
"_filter_with_hooks",
"(",
"self",
",",
"svc_event",
",",
"listeners",
")",
":",
"svc_ref",
"=",
"svc_event",
".",
"get_service_reference",
"(",
")",
"# Get EventListenerHooks service refs from registry",
"hook_refs",
"=",
"self",
".",
"_registry",
".",
"find_s... | Filters listeners with EventListenerHooks
:param svc_event: ServiceEvent being triggered
:param listeners: Listeners to filter
:return: A list of listeners with hook references | [
"Filters",
"listeners",
"with",
"EventListenerHooks"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L904-L963 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.clear | def clear(self):
"""
Clears the registry
"""
with self.__svc_lock:
self.__svc_registry.clear()
self.__svc_factories.clear()
self.__svc_specs.clear()
self.__bundle_svc.clear()
self.__bundle_imports.clear()
self.__fact... | python | def clear(self):
"""
Clears the registry
"""
with self.__svc_lock:
self.__svc_registry.clear()
self.__svc_factories.clear()
self.__svc_specs.clear()
self.__bundle_svc.clear()
self.__bundle_imports.clear()
self.__fact... | [
"def",
"clear",
"(",
"self",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"self",
".",
"__svc_registry",
".",
"clear",
"(",
")",
"self",
".",
"__svc_factories",
".",
"clear",
"(",
")",
"self",
".",
"__svc_specs",
".",
"clear",
"(",
")",
"self",
... | Clears the registry | [
"Clears",
"the",
"registry"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1016-L1027 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.register | def register(
self, bundle, classes, properties, svc_instance, factory, prototype
):
"""
Registers a service.
:param bundle: The bundle that registers the service
:param classes: The classes implemented by the service
:param properties: The properties associated to t... | python | def register(
self, bundle, classes, properties, svc_instance, factory, prototype
):
"""
Registers a service.
:param bundle: The bundle that registers the service
:param classes: The classes implemented by the service
:param properties: The properties associated to t... | [
"def",
"register",
"(",
"self",
",",
"bundle",
",",
"classes",
",",
"properties",
",",
"svc_instance",
",",
"factory",
",",
"prototype",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"# Prepare properties",
"service_id",
"=",
"self",
".",
"__next_service_i... | Registers a service.
:param bundle: The bundle that registers the service
:param classes: The classes implemented by the service
:param properties: The properties associated to the service
:param svc_instance: The instance of the service
:param factory: If True, the given servic... | [
"Registers",
"a",
"service",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1029-L1088 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.__sort_registry | def __sort_registry(self, svc_ref):
# type: (ServiceReference) -> None
"""
Sorts the registry, after the update of the sort key of given service
reference
:param svc_ref: A service reference with a modified sort key
"""
with self.__svc_lock:
if svc_re... | python | def __sort_registry(self, svc_ref):
# type: (ServiceReference) -> None
"""
Sorts the registry, after the update of the sort key of given service
reference
:param svc_ref: A service reference with a modified sort key
"""
with self.__svc_lock:
if svc_re... | [
"def",
"__sort_registry",
"(",
"self",
",",
"svc_ref",
")",
":",
"# type: (ServiceReference) -> None",
"with",
"self",
".",
"__svc_lock",
":",
"if",
"svc_ref",
"not",
"in",
"self",
".",
"__svc_registry",
":",
"raise",
"BundleException",
"(",
"\"Unknown service: {0}\... | Sorts the registry, after the update of the sort key of given service
reference
:param svc_ref: A service reference with a modified sort key | [
"Sorts",
"the",
"registry",
"after",
"the",
"update",
"of",
"the",
"sort",
"key",
"of",
"given",
"service",
"reference"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1090-L1115 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.unregister | def unregister(self, svc_ref):
# type: (ServiceReference) -> Any
"""
Unregisters a service
:param svc_ref: A service reference
:return: The unregistered service instance
:raise BundleException: Unknown service reference
"""
with self.__svc_lock:
... | python | def unregister(self, svc_ref):
# type: (ServiceReference) -> Any
"""
Unregisters a service
:param svc_ref: A service reference
:return: The unregistered service instance
:raise BundleException: Unknown service reference
"""
with self.__svc_lock:
... | [
"def",
"unregister",
"(",
"self",
",",
"svc_ref",
")",
":",
"# type: (ServiceReference) -> Any",
"with",
"self",
".",
"__svc_lock",
":",
"try",
":",
"# Try in pending services",
"return",
"self",
".",
"__pending_services",
".",
"pop",
"(",
"svc_ref",
")",
"except"... | Unregisters a service
:param svc_ref: A service reference
:return: The unregistered service instance
:raise BundleException: Unknown service reference | [
"Unregisters",
"a",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1117-L1165 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.hide_bundle_services | def hide_bundle_services(self, bundle):
"""
Hides the services of the given bundle (removes them from lists, but
lets them be unregistered)
:param bundle: The bundle providing services
:return: The references of the hidden services
"""
with self.__svc_lock:
... | python | def hide_bundle_services(self, bundle):
"""
Hides the services of the given bundle (removes them from lists, but
lets them be unregistered)
:param bundle: The bundle providing services
:return: The references of the hidden services
"""
with self.__svc_lock:
... | [
"def",
"hide_bundle_services",
"(",
"self",
",",
"bundle",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"try",
":",
"svc_refs",
"=",
"self",
".",
"__bundle_svc",
".",
"pop",
"(",
"bundle",
")",
"except",
"KeyError",
":",
"# Nothing to do",
"return",
"... | Hides the services of the given bundle (removes them from lists, but
lets them be unregistered)
:param bundle: The bundle providing services
:return: The references of the hidden services | [
"Hides",
"the",
"services",
"of",
"the",
"given",
"bundle",
"(",
"removes",
"them",
"from",
"lists",
"but",
"lets",
"them",
"be",
"unregistered",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1167-L1203 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.find_service_references | def find_service_references(
self, clazz=None, ldap_filter=None, only_one=False
):
"""
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 matchin... | python | def find_service_references(
self, clazz=None, ldap_filter=None, only_one=False
):
"""
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 matchin... | [
"def",
"find_service_references",
"(",
"self",
",",
"clazz",
"=",
"None",
",",
"ldap_filter",
"=",
"None",
",",
"only_one",
"=",
"False",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"if",
"clazz",
"is",
"None",
"and",
"ldap_filter",
"is",
"None",
"... | 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 references, or None
:raise BundleException: An er... | [
"Finds",
"all",
"services",
"references",
"matching",
"the",
"given",
"filter",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1205-L1266 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.get_bundle_imported_services | def get_bundle_imported_services(self, bundle):
"""
Returns this bundle's ServiceReference list for all services it is
using or returns None if this bundle is not using any services.
A bundle is considered to be using a service if its use count for that
service is greater than ze... | python | def get_bundle_imported_services(self, bundle):
"""
Returns this bundle's ServiceReference list for all services it is
using or returns None if this bundle is not using any services.
A bundle is considered to be using a service if its use count for that
service is greater than ze... | [
"def",
"get_bundle_imported_services",
"(",
"self",
",",
"bundle",
")",
":",
"with",
"self",
".",
"__svc_lock",
":",
"return",
"sorted",
"(",
"self",
".",
"__bundle_imports",
".",
"get",
"(",
"bundle",
",",
"[",
"]",
")",
")"
] | Returns this bundle's ServiceReference list for all services it is
using or returns None if this bundle is not using any services.
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 metho... | [
"Returns",
"this",
"bundle",
"s",
"ServiceReference",
"list",
"for",
"all",
"services",
"it",
"is",
"using",
"or",
"returns",
"None",
"if",
"this",
"bundle",
"is",
"not",
"using",
"any",
"services",
".",
"A",
"bundle",
"is",
"considered",
"to",
"be",
"usin... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1268-L1283 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.get_bundle_registered_services | def get_bundle_registered_services(self, bundle):
# type: (Any) -> List[ServiceReference]
"""
Retrieves the services registered by the given bundle. Returns None
if the bundle didn't register any service.
:param bundle: The bundle to look into
:return: The references to ... | python | def get_bundle_registered_services(self, bundle):
# type: (Any) -> List[ServiceReference]
"""
Retrieves the services registered by the given bundle. Returns None
if the bundle didn't register any service.
:param bundle: The bundle to look into
:return: The references to ... | [
"def",
"get_bundle_registered_services",
"(",
"self",
",",
"bundle",
")",
":",
"# type: (Any) -> List[ServiceReference]",
"with",
"self",
".",
"__svc_lock",
":",
"return",
"sorted",
"(",
"self",
".",
"__bundle_svc",
".",
"get",
"(",
"bundle",
",",
"[",
"]",
")",... | Retrieves the services registered by the given bundle. Returns None
if the bundle didn't register any service.
:param bundle: The bundle to look into
:return: The references to the services registered by the bundle | [
"Retrieves",
"the",
"services",
"registered",
"by",
"the",
"given",
"bundle",
".",
"Returns",
"None",
"if",
"the",
"bundle",
"didn",
"t",
"register",
"any",
"service",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1285-L1295 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.get_service | def get_service(self, bundle, reference):
# type: (Any, 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
:r... | python | def get_service(self, bundle, reference):
# type: (Any, 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
:r... | [
"def",
"get_service",
"(",
"self",
",",
"bundle",
",",
"reference",
")",
":",
"# type: (Any, ServiceReference) -> Any",
"with",
"self",
".",
"__svc_lock",
":",
"if",
"reference",
".",
"is_factory",
"(",
")",
":",
"return",
"self",
".",
"__get_service_from_factory"... | 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 | [
"Retrieves",
"the",
"service",
"corresponding",
"to",
"the",
"given",
"reference"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1297-L1324 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.__get_service_from_factory | def __get_service_from_factory(self, bundle, reference):
# type: (Any, ServiceReference) -> Any
"""
Returns a service instance from a service factory or a prototype
service factory
:param bundle: The bundle requiring the service
:param reference: A reference pointing to ... | python | def __get_service_from_factory(self, bundle, reference):
# type: (Any, ServiceReference) -> Any
"""
Returns a service instance from a service factory or a prototype
service factory
:param bundle: The bundle requiring the service
:param reference: A reference pointing to ... | [
"def",
"__get_service_from_factory",
"(",
"self",
",",
"bundle",
",",
"reference",
")",
":",
"# type: (Any, ServiceReference) -> Any",
"try",
":",
"factory",
",",
"svc_reg",
"=",
"self",
".",
"__svc_factories",
"[",
"reference",
"]",
"# Indicate the dependency",
"impo... | Returns a service instance from a service factory or a prototype
service factory
:param bundle: The bundle requiring the service
:param reference: A reference pointing to a factory
:return: The requested service
:raise BundleException: The service could not be found | [
"Returns",
"a",
"service",
"instance",
"from",
"a",
"service",
"factory",
"or",
"a",
"prototype",
"service",
"factory"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1326-L1359 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.unget_used_services | def unget_used_services(self, bundle):
"""
Cleans up all service usages of the given bundle.
:param bundle: Bundle to be cleaned up
"""
# Pop used references
try:
imported_refs = list(self.__bundle_imports.pop(bundle))
except KeyError:
# N... | python | def unget_used_services(self, bundle):
"""
Cleans up all service usages of the given bundle.
:param bundle: Bundle to be cleaned up
"""
# Pop used references
try:
imported_refs = list(self.__bundle_imports.pop(bundle))
except KeyError:
# N... | [
"def",
"unget_used_services",
"(",
"self",
",",
"bundle",
")",
":",
"# Pop used references",
"try",
":",
"imported_refs",
"=",
"list",
"(",
"self",
".",
"__bundle_imports",
".",
"pop",
"(",
"bundle",
")",
")",
"except",
"KeyError",
":",
"# Nothing to do",
"ret... | Cleans up all service usages of the given bundle.
:param bundle: Bundle to be cleaned up | [
"Cleans",
"up",
"all",
"service",
"usages",
"of",
"the",
"given",
"bundle",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1361-L1397 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.unget_service | def unget_service(self, bundle, reference, service=None):
# type: (Any, ServiceReference, Any) -> bool
"""
Removes the usage of a service by a bundle
:param bundle: The bundle that used the service
:param reference: A service reference
:param service: Service instance (f... | python | def unget_service(self, bundle, reference, service=None):
# type: (Any, ServiceReference, Any) -> bool
"""
Removes the usage of a service by a bundle
:param bundle: The bundle that used the service
:param reference: A service reference
:param service: Service instance (f... | [
"def",
"unget_service",
"(",
"self",
",",
"bundle",
",",
"reference",
",",
"service",
"=",
"None",
")",
":",
"# type: (Any, ServiceReference, Any) -> bool",
"with",
"self",
".",
"__svc_lock",
":",
"if",
"reference",
".",
"is_prototype",
"(",
")",
":",
"return",
... | Removes the usage of a service by a bundle
:param bundle: The bundle that used the service
:param reference: A service reference
:param service: Service instance (for Prototype Service Factories)
:return: True if the bundle usage has been removed | [
"Removes",
"the",
"usage",
"of",
"a",
"service",
"by",
"a",
"bundle"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1399-L1433 |
tcalmant/ipopo | pelix/internals/registry.py | ServiceRegistry.__unget_service_from_factory | def __unget_service_from_factory(self, bundle, reference, service=None):
# type: (Any, ServiceReference, Any) -> bool
"""
Removes the usage of a a service factory or a prototype
service factory by a bundle
:param bundle: The bundle that used the service
:param reference:... | python | def __unget_service_from_factory(self, bundle, reference, service=None):
# type: (Any, ServiceReference, Any) -> bool
"""
Removes the usage of a a service factory or a prototype
service factory by a bundle
:param bundle: The bundle that used the service
:param reference:... | [
"def",
"__unget_service_from_factory",
"(",
"self",
",",
"bundle",
",",
"reference",
",",
"service",
"=",
"None",
")",
":",
"# type: (Any, ServiceReference, Any) -> bool",
"try",
":",
"factory",
",",
"svc_reg",
"=",
"self",
".",
"__svc_factories",
"[",
"reference",
... | Removes the usage of a a service factory or a prototype
service factory by a bundle
:param bundle: The bundle that used the service
:param reference: A service reference
:param service: Service instance (for prototype factories)
:return: True if the bundle usage has been removed | [
"Removes",
"the",
"usage",
"of",
"a",
"a",
"service",
"factory",
"or",
"a",
"prototype",
"service",
"factory",
"by",
"a",
"bundle"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L1435-L1479 |
tcalmant/ipopo | pelix/remote/edef_io.py | EDEFReader._convert_value | def _convert_value(vtype, value):
"""
Converts the given value string according to the given type
:param vtype: Type of the value
:param value: String form of the value
:return: The converted value
:raise ValueError: Conversion failed
"""
# Normalize valu... | python | def _convert_value(vtype, value):
"""
Converts the given value string according to the given type
:param vtype: Type of the value
:param value: String form of the value
:return: The converted value
:raise ValueError: Conversion failed
"""
# Normalize valu... | [
"def",
"_convert_value",
"(",
"vtype",
",",
"value",
")",
":",
"# Normalize value",
"value",
"=",
"value",
".",
"strip",
"(",
")",
"if",
"vtype",
"==",
"TYPE_STRING",
":",
"# Nothing to do",
"return",
"value",
"elif",
"vtype",
"in",
"TYPES_INT",
":",
"return... | Converts the given value string according to the given type
:param vtype: Type of the value
:param value: String form of the value
:return: The converted value
:raise ValueError: Conversion failed | [
"Converts",
"the",
"given",
"value",
"string",
"according",
"to",
"the",
"given",
"type"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/edef_io.py#L122-L148 |
tcalmant/ipopo | pelix/remote/edef_io.py | EDEFWriter._indent | def _indent(self, element, level=0, prefix="\t"):
"""
In-place Element text auto-indent, for pretty printing.
Code from: http://effbot.org/zone/element-lib.htm#prettyprint
:param element: An Element object
:param level: Level of indentation
:param prefix: String to use ... | python | def _indent(self, element, level=0, prefix="\t"):
"""
In-place Element text auto-indent, for pretty printing.
Code from: http://effbot.org/zone/element-lib.htm#prettyprint
:param element: An Element object
:param level: Level of indentation
:param prefix: String to use ... | [
"def",
"_indent",
"(",
"self",
",",
"element",
",",
"level",
"=",
"0",
",",
"prefix",
"=",
"\"\\t\"",
")",
":",
"element_prefix",
"=",
"\"\\r\\n{0}\"",
".",
"format",
"(",
"level",
"*",
"prefix",
")",
"if",
"len",
"(",
"element",
")",
":",
"if",
"not... | In-place Element text auto-indent, for pretty printing.
Code from: http://effbot.org/zone/element-lib.htm#prettyprint
:param element: An Element object
:param level: Level of indentation
:param prefix: String to use for each indentation | [
"In",
"-",
"place",
"Element",
"text",
"auto",
"-",
"indent",
"for",
"pretty",
"printing",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/edef_io.py#L253-L283 |
tcalmant/ipopo | pelix/remote/edef_io.py | EDEFWriter._add_container | def _add_container(props_node, tag, container):
"""
Walks through the given container and fills the node
:param props_node: A property node
:param tag: Name of the container tag
:param container: The container
"""
values_node = ElementTree.SubElement(props_node, ... | python | def _add_container(props_node, tag, container):
"""
Walks through the given container and fills the node
:param props_node: A property node
:param tag: Name of the container tag
:param container: The container
"""
values_node = ElementTree.SubElement(props_node, ... | [
"def",
"_add_container",
"(",
"props_node",
",",
"tag",
",",
"container",
")",
":",
"values_node",
"=",
"ElementTree",
".",
"SubElement",
"(",
"props_node",
",",
"tag",
")",
"for",
"value",
"in",
"container",
":",
"value_node",
"=",
"ElementTree",
".",
"SubE... | Walks through the given container and fills the node
:param props_node: A property node
:param tag: Name of the container tag
:param container: The container | [
"Walks",
"through",
"the",
"given",
"container",
"and",
"fills",
"the",
"node"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/edef_io.py#L286-L297 |
tcalmant/ipopo | pelix/remote/edef_io.py | EDEFWriter._get_type | def _get_type(name, value):
"""
Returns the type associated to the given name or value
:param name: Property name
:param value: Property value
:return: A value type name
"""
# Types forced for known keys
if name in TYPED_BOOL:
return TYPE_BOOL... | python | def _get_type(name, value):
"""
Returns the type associated to the given name or value
:param name: Property name
:param value: Property value
:return: A value type name
"""
# Types forced for known keys
if name in TYPED_BOOL:
return TYPE_BOOL... | [
"def",
"_get_type",
"(",
"name",
",",
"value",
")",
":",
"# Types forced for known keys",
"if",
"name",
"in",
"TYPED_BOOL",
":",
"return",
"TYPE_BOOLEAN",
"elif",
"name",
"in",
"TYPED_LONG",
":",
"return",
"TYPE_LONG",
"elif",
"name",
"in",
"TYPED_STRING",
":",
... | Returns the type associated to the given name or value
:param name: Property name
:param value: Property value
:return: A value type name | [
"Returns",
"the",
"type",
"associated",
"to",
"the",
"given",
"name",
"or",
"value"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/edef_io.py#L300-L343 |
tcalmant/ipopo | pelix/remote/edef_io.py | EDEFWriter.to_string | def to_string(self, endpoints):
"""
Converts the given endpoint description beans into a string
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document
"""
# Make the ElementTree
root = self._make_xml(endpoints)
... | python | def to_string(self, endpoints):
"""
Converts the given endpoint description beans into a string
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document
"""
# Make the ElementTree
root = self._make_xml(endpoints)
... | [
"def",
"to_string",
"(",
"self",
",",
"endpoints",
")",
":",
"# Make the ElementTree",
"root",
"=",
"self",
".",
"_make_xml",
"(",
"endpoints",
")",
"tree",
"=",
"ElementTree",
".",
"ElementTree",
"(",
"root",
")",
"# Force the default name space",
"ElementTree",
... | Converts the given endpoint description beans into a string
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document | [
"Converts",
"the",
"given",
"endpoint",
"description",
"beans",
"into",
"a",
"string"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/edef_io.py#L413-L449 |
tcalmant/ipopo | pelix/misc/xmpp.py | BasicBot.connect | def connect(
self, host, port=5222, reattempt=False, use_tls=True, use_ssl=False
):
# pylint: disable=W0221
"""
Connects to the server.
By default, uses an un-encrypted connection, as it won't connect to an
OpenFire server otherwise
:param host: Server host ... | python | def connect(
self, host, port=5222, reattempt=False, use_tls=True, use_ssl=False
):
# pylint: disable=W0221
"""
Connects to the server.
By default, uses an un-encrypted connection, as it won't connect to an
OpenFire server otherwise
:param host: Server host ... | [
"def",
"connect",
"(",
"self",
",",
"host",
",",
"port",
"=",
"5222",
",",
"reattempt",
"=",
"False",
",",
"use_tls",
"=",
"True",
",",
"use_ssl",
"=",
"False",
")",
":",
"# pylint: disable=W0221",
"if",
"not",
"self",
".",
"_expected_server_name",
":",
... | Connects to the server.
By default, uses an un-encrypted connection, as it won't connect to an
OpenFire server otherwise
:param host: Server host name
:param port: Server port (default: 5222)
:param reattempt: If True, tries to connect to the server until it
... | [
"Connects",
"to",
"the",
"server",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/xmpp.py#L72-L104 |
tcalmant/ipopo | pelix/misc/xmpp.py | BasicBot.on_session_start | def on_session_start(self, data):
# pylint: disable=W0613
"""
XMPP session started
"""
# Send initial presence
self.send_presence(ppriority=self._initial_priority)
# Request roster
self.get_roster() | python | def on_session_start(self, data):
# pylint: disable=W0613
"""
XMPP session started
"""
# Send initial presence
self.send_presence(ppriority=self._initial_priority)
# Request roster
self.get_roster() | [
"def",
"on_session_start",
"(",
"self",
",",
"data",
")",
":",
"# pylint: disable=W0613",
"# Send initial presence",
"self",
".",
"send_presence",
"(",
"ppriority",
"=",
"self",
".",
"_initial_priority",
")",
"# Request roster",
"self",
".",
"get_roster",
"(",
")"
] | XMPP session started | [
"XMPP",
"session",
"started"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/xmpp.py#L106-L115 |
tcalmant/ipopo | pelix/misc/xmpp.py | InviteMixIn.on_invite | def on_invite(self, data):
"""
Multi-User Chat invite
"""
if not self._nick:
self._nick = self.boundjid.user
# Join the room
self.plugin["xep_0045"].joinMUC(data["from"], self._nick) | python | def on_invite(self, data):
"""
Multi-User Chat invite
"""
if not self._nick:
self._nick = self.boundjid.user
# Join the room
self.plugin["xep_0045"].joinMUC(data["from"], self._nick) | [
"def",
"on_invite",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"_nick",
":",
"self",
".",
"_nick",
"=",
"self",
".",
"boundjid",
".",
"user",
"# Join the room",
"self",
".",
"plugin",
"[",
"\"xep_0045\"",
"]",
".",
"joinMUC",
"(",
... | Multi-User Chat invite | [
"Multi",
"-",
"User",
"Chat",
"invite"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/xmpp.py#L154-L162 |
tcalmant/ipopo | pelix/misc/xmpp.py | ServiceDiscoveryMixin.iter_services | def iter_services(self, feature=None):
"""
Iterates over the root-level services on the server which provides the
requested feature
:param feature: Feature that the service must provide (optional)
:return: A generator of services JID
"""
# Get the list of root se... | python | def iter_services(self, feature=None):
"""
Iterates over the root-level services on the server which provides the
requested feature
:param feature: Feature that the service must provide (optional)
:return: A generator of services JID
"""
# Get the list of root se... | [
"def",
"iter_services",
"(",
"self",
",",
"feature",
"=",
"None",
")",
":",
"# Get the list of root services",
"items",
"=",
"self",
"[",
"\"xep_0030\"",
"]",
".",
"get_items",
"(",
"jid",
"=",
"self",
".",
"boundjid",
".",
"domain",
",",
"ifrom",
"=",
"se... | Iterates over the root-level services on the server which provides the
requested feature
:param feature: Feature that the service must provide (optional)
:return: A generator of services JID | [
"Iterates",
"over",
"the",
"root",
"-",
"level",
"services",
"on",
"the",
"server",
"which",
"provides",
"the",
"requested",
"feature"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/xmpp.py#L181-L212 |
tcalmant/ipopo | pelix/shell/parser.py | _find_assignment | def _find_assignment(arg_token):
"""
Find the first non-escaped assignment in the given argument token.
Returns -1 if no assignment was found.
:param arg_token: The argument token
:return: The index of the first assignment, or -1
"""
idx = arg_token.find("=")
while idx != -1:
if... | python | def _find_assignment(arg_token):
"""
Find the first non-escaped assignment in the given argument token.
Returns -1 if no assignment was found.
:param arg_token: The argument token
:return: The index of the first assignment, or -1
"""
idx = arg_token.find("=")
while idx != -1:
if... | [
"def",
"_find_assignment",
"(",
"arg_token",
")",
":",
"idx",
"=",
"arg_token",
".",
"find",
"(",
"\"=\"",
")",
"while",
"idx",
"!=",
"-",
"1",
":",
"if",
"idx",
"!=",
"0",
"and",
"arg_token",
"[",
"idx",
"-",
"1",
"]",
"!=",
"\"\\\\\"",
":",
"# No... | Find the first non-escaped assignment in the given argument token.
Returns -1 if no assignment was found.
:param arg_token: The argument token
:return: The index of the first assignment, or -1 | [
"Find",
"the",
"first",
"non",
"-",
"escaped",
"assignment",
"in",
"the",
"given",
"argument",
"token",
".",
"Returns",
"-",
"1",
"if",
"no",
"assignment",
"was",
"found",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L62-L79 |
tcalmant/ipopo | pelix/shell/parser.py | _make_args | def _make_args(args_list, session, fw_props):
"""
Converts the given list of arguments into a list (args) and a
dictionary (kwargs).
All arguments with an assignment are put into kwargs, others in args.
:param args_list: The list of arguments to be treated
:param session: The current shell sess... | python | def _make_args(args_list, session, fw_props):
"""
Converts the given list of arguments into a list (args) and a
dictionary (kwargs).
All arguments with an assignment are put into kwargs, others in args.
:param args_list: The list of arguments to be treated
:param session: The current shell sess... | [
"def",
"_make_args",
"(",
"args_list",
",",
"session",
",",
"fw_props",
")",
":",
"args",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"for",
"arg_token",
"in",
"args_list",
":",
"idx",
"=",
"_find_assignment",
"(",
"arg_token",
")",
"if",
"idx",
"!=",
"-",... | Converts the given list of arguments into a list (args) and a
dictionary (kwargs).
All arguments with an assignment are put into kwargs, others in args.
:param args_list: The list of arguments to be treated
:param session: The current shell session
:return: The (arg_token, kwargs) tuple. | [
"Converts",
"the",
"given",
"list",
"of",
"arguments",
"into",
"a",
"list",
"(",
"args",
")",
"and",
"a",
"dictionary",
"(",
"kwargs",
")",
".",
"All",
"arguments",
"with",
"an",
"assignment",
"are",
"put",
"into",
"kwargs",
"others",
"in",
"args",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L90-L125 |
tcalmant/ipopo | pelix/shell/parser.py | _split_ns_command | def _split_ns_command(cmd_token):
"""
Extracts the name space and the command name of the given command token.
:param cmd_token: The command token
:return: The extracted (name space, command) tuple
"""
namespace = None
cmd_split = cmd_token.split(".", 1)
if len(cmd_split) == 1:
... | python | def _split_ns_command(cmd_token):
"""
Extracts the name space and the command name of the given command token.
:param cmd_token: The command token
:return: The extracted (name space, command) tuple
"""
namespace = None
cmd_split = cmd_token.split(".", 1)
if len(cmd_split) == 1:
... | [
"def",
"_split_ns_command",
"(",
"cmd_token",
")",
":",
"namespace",
"=",
"None",
"cmd_split",
"=",
"cmd_token",
".",
"split",
"(",
"\".\"",
",",
"1",
")",
"if",
"len",
"(",
"cmd_split",
")",
"==",
"1",
":",
"# No name space given",
"command",
"=",
"cmd_sp... | Extracts the name space and the command name of the given command token.
:param cmd_token: The command token
:return: The extracted (name space, command) tuple | [
"Extracts",
"the",
"name",
"space",
"and",
"the",
"command",
"name",
"of",
"the",
"given",
"command",
"token",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L128-L150 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.register_command | def register_command(self, namespace, command, method):
"""
Registers the given command to the shell.
The namespace can be None, empty or "default"
:param namespace: The command name space.
:param command: The shell name of the command
:param method: The method to call
... | python | def register_command(self, namespace, command, method):
"""
Registers the given command to the shell.
The namespace can be None, empty or "default"
:param namespace: The command name space.
:param command: The shell name of the command
:param method: The method to call
... | [
"def",
"register_command",
"(",
"self",
",",
"namespace",
",",
"command",
",",
"method",
")",
":",
"if",
"method",
"is",
"None",
":",
"self",
".",
"_logger",
".",
"error",
"(",
"\"No method given for %s.%s\"",
",",
"namespace",
",",
"command",
")",
"return",... | Registers the given command to the shell.
The namespace can be None, empty or "default"
:param namespace: The command name space.
:param command: The shell name of the command
:param method: The method to call
:return: True if the method has been registered, False if it was
... | [
"Registers",
"the",
"given",
"command",
"to",
"the",
"shell",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L204-L243 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.get_command_completers | def get_command_completers(self, namespace, command):
# type: (str, str) -> CompletionInfo
"""
Returns the completer method associated to the given command, or None
:param namespace: The command name space.
:param command: The shell name of the command
:return: A Complet... | python | def get_command_completers(self, namespace, command):
# type: (str, str) -> CompletionInfo
"""
Returns the completer method associated to the given command, or None
:param namespace: The command name space.
:param command: The shell name of the command
:return: A Complet... | [
"def",
"get_command_completers",
"(",
"self",
",",
"namespace",
",",
"command",
")",
":",
"# type: (str, str) -> CompletionInfo",
"# Find the method (can raise a KeyError)",
"method",
"=",
"self",
".",
"_commands",
"[",
"namespace",
"]",
"[",
"command",
"]",
"# Return t... | Returns the completer method associated to the given command, or None
:param namespace: The command name space.
:param command: The shell name of the command
:return: A CompletionConfiguration object
:raise KeyError: Unknown command or name space | [
"Returns",
"the",
"completer",
"method",
"associated",
"to",
"the",
"given",
"command",
"or",
"None"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L245-L259 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.unregister | def unregister(self, namespace, command=None):
"""
Unregisters the given command. If command is None, the whole name space
is unregistered.
:param namespace: The command name space.
:param command: The shell name of the command, or None
:return: True if the command was k... | python | def unregister(self, namespace, command=None):
"""
Unregisters the given command. If command is None, the whole name space
is unregistered.
:param namespace: The command name space.
:param command: The shell name of the command, or None
:return: True if the command was k... | [
"def",
"unregister",
"(",
"self",
",",
"namespace",
",",
"command",
"=",
"None",
")",
":",
"if",
"not",
"namespace",
":",
"namespace",
"=",
"DEFAULT_NAMESPACE",
"namespace",
"=",
"namespace",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"namespa... | Unregisters the given command. If command is None, the whole name space
is unregistered.
:param namespace: The command name space.
:param command: The shell name of the command, or None
:return: True if the command was known, else False | [
"Unregisters",
"the",
"given",
"command",
".",
"If",
"command",
"is",
"None",
"the",
"whole",
"name",
"space",
"is",
"unregistered",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L261-L296 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.__find_command_ns | def __find_command_ns(self, command):
"""
Returns the name spaces where the given command named is registered.
If the command exists in the default name space, the returned list will
only contain the default name space.
Returns an empty list of the command is unknown
:pa... | python | def __find_command_ns(self, command):
"""
Returns the name spaces where the given command named is registered.
If the command exists in the default name space, the returned list will
only contain the default name space.
Returns an empty list of the command is unknown
:pa... | [
"def",
"__find_command_ns",
"(",
"self",
",",
"command",
")",
":",
"# Look for the spaces where the command name appears",
"namespaces",
"=",
"[",
"]",
"for",
"namespace",
",",
"commands",
"in",
"self",
".",
"_commands",
".",
"items",
"(",
")",
":",
"if",
"comma... | Returns the name spaces where the given command named is registered.
If the command exists in the default name space, the returned list will
only contain the default name space.
Returns an empty list of the command is unknown
:param command: A command name
:return: A list of nam... | [
"Returns",
"the",
"name",
"spaces",
"where",
"the",
"given",
"command",
"named",
"is",
"registered",
".",
"If",
"the",
"command",
"exists",
"in",
"the",
"default",
"name",
"space",
"the",
"returned",
"list",
"will",
"only",
"contain",
"the",
"default",
"name... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L298-L325 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.get_namespaces | def get_namespaces(self):
"""
Retrieves the list of known name spaces (without the default one)
:return: The list of known name spaces
"""
namespaces = list(self._commands.keys())
namespaces.remove(DEFAULT_NAMESPACE)
namespaces.sort()
return namespaces | python | def get_namespaces(self):
"""
Retrieves the list of known name spaces (without the default one)
:return: The list of known name spaces
"""
namespaces = list(self._commands.keys())
namespaces.remove(DEFAULT_NAMESPACE)
namespaces.sort()
return namespaces | [
"def",
"get_namespaces",
"(",
"self",
")",
":",
"namespaces",
"=",
"list",
"(",
"self",
".",
"_commands",
".",
"keys",
"(",
")",
")",
"namespaces",
".",
"remove",
"(",
"DEFAULT_NAMESPACE",
")",
"namespaces",
".",
"sort",
"(",
")",
"return",
"namespaces"
] | Retrieves the list of known name spaces (without the default one)
:return: The list of known name spaces | [
"Retrieves",
"the",
"list",
"of",
"known",
"name",
"spaces",
"(",
"without",
"the",
"default",
"one",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L327-L336 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.get_commands | def get_commands(self, namespace):
"""
Retrieves the commands of the given name space. If *namespace* is None
or empty, it retrieves the commands of the default name space
:param namespace: The commands name space
:return: A list of commands names
"""
if not name... | python | def get_commands(self, namespace):
"""
Retrieves the commands of the given name space. If *namespace* is None
or empty, it retrieves the commands of the default name space
:param namespace: The commands name space
:return: A list of commands names
"""
if not name... | [
"def",
"get_commands",
"(",
"self",
",",
"namespace",
")",
":",
"if",
"not",
"namespace",
":",
"# Default name space:",
"namespace",
"=",
"DEFAULT_NAMESPACE",
"try",
":",
"namespace",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"commands",
"=",
"list",
... | Retrieves the commands of the given name space. If *namespace* is None
or empty, it retrieves the commands of the default name space
:param namespace: The commands name space
:return: A list of commands names | [
"Retrieves",
"the",
"commands",
"of",
"the",
"given",
"name",
"space",
".",
"If",
"*",
"namespace",
"*",
"is",
"None",
"or",
"empty",
"it",
"retrieves",
"the",
"commands",
"of",
"the",
"default",
"name",
"space"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L338-L357 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.get_ns_commands | def get_ns_commands(self, cmd_name):
"""
Retrieves the possible name spaces and commands associated to the given
command name.
:param cmd_name: The given command name
:return: A list of 2-tuples (name space, command)
:raise ValueError: Unknown command name
"""
... | python | def get_ns_commands(self, cmd_name):
"""
Retrieves the possible name spaces and commands associated to the given
command name.
:param cmd_name: The given command name
:return: A list of 2-tuples (name space, command)
:raise ValueError: Unknown command name
"""
... | [
"def",
"get_ns_commands",
"(",
"self",
",",
"cmd_name",
")",
":",
"namespace",
",",
"command",
"=",
"_split_ns_command",
"(",
"cmd_name",
")",
"if",
"not",
"namespace",
":",
"# Name space not given, look for the commands",
"spaces",
"=",
"self",
".",
"__find_command... | Retrieves the possible name spaces and commands associated to the given
command name.
:param cmd_name: The given command name
:return: A list of 2-tuples (name space, command)
:raise ValueError: Unknown command name | [
"Retrieves",
"the",
"possible",
"name",
"spaces",
"and",
"commands",
"associated",
"to",
"the",
"given",
"command",
"name",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L359-L380 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.get_ns_command | def get_ns_command(self, cmd_name):
"""
Retrieves the name space and the command associated to the given
command name.
:param cmd_name: The given command name
:return: A 2-tuple (name space, command)
:raise ValueError: Unknown command name
"""
namespace, ... | python | def get_ns_command(self, cmd_name):
"""
Retrieves the name space and the command associated to the given
command name.
:param cmd_name: The given command name
:return: A 2-tuple (name space, command)
:raise ValueError: Unknown command name
"""
namespace, ... | [
"def",
"get_ns_command",
"(",
"self",
",",
"cmd_name",
")",
":",
"namespace",
",",
"command",
"=",
"_split_ns_command",
"(",
"cmd_name",
")",
"if",
"not",
"namespace",
":",
"# Name space not given, look for the command",
"spaces",
"=",
"self",
".",
"__find_command_n... | Retrieves the name space and the command associated to the given
command name.
:param cmd_name: The given command name
:return: A 2-tuple (name space, command)
:raise ValueError: Unknown command name | [
"Retrieves",
"the",
"name",
"space",
"and",
"the",
"command",
"associated",
"to",
"the",
"given",
"command",
"name",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L382-L416 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.execute | def execute(self, cmdline, session=None):
"""
Executes the command corresponding to the given line
:param cmdline: Command line to parse
:param session: Current shell session
:return: True if command succeeded, else False
"""
if session is None:
# Def... | python | def execute(self, cmdline, session=None):
"""
Executes the command corresponding to the given line
:param cmdline: Command line to parse
:param session: Current shell session
:return: True if command succeeded, else False
"""
if session is None:
# Def... | [
"def",
"execute",
"(",
"self",
",",
"cmdline",
",",
"session",
"=",
"None",
")",
":",
"if",
"session",
"is",
"None",
":",
"# Default session",
"session",
"=",
"beans",
".",
"ShellSession",
"(",
"beans",
".",
"IOHandler",
"(",
"sys",
".",
"stdin",
",",
... | Executes the command corresponding to the given line
:param cmdline: Command line to parse
:param session: Current shell session
:return: True if command succeeded, else False | [
"Executes",
"the",
"command",
"corresponding",
"to",
"the",
"given",
"line"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L418-L504 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.__extract_help | def __extract_help(method):
"""
Formats the help string for the given method
:param method: The method to document
:return: A tuple: (arguments list, documentation line)
"""
if method is None:
return "(No associated method)"
# Get the arguments
... | python | def __extract_help(method):
"""
Formats the help string for the given method
:param method: The method to document
:return: A tuple: (arguments list, documentation line)
"""
if method is None:
return "(No associated method)"
# Get the arguments
... | [
"def",
"__extract_help",
"(",
"method",
")",
":",
"if",
"method",
"is",
"None",
":",
"return",
"\"(No associated method)\"",
"# Get the arguments",
"arg_spec",
"=",
"get_method_arguments",
"(",
"method",
")",
"# Ignore the session argument",
"start_arg",
"=",
"1",
"# ... | Formats the help string for the given method
:param method: The method to document
:return: A tuple: (arguments list, documentation line) | [
"Formats",
"the",
"help",
"string",
"for",
"the",
"given",
"method"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L507-L554 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.__print_command_help | def __print_command_help(self, session, namespace, cmd_name):
"""
Prints the documentation of the given command
:param session: Session handler
:param namespace: Name space of the command
:param cmd_name: Name of the command
"""
# Extract documentation
ar... | python | def __print_command_help(self, session, namespace, cmd_name):
"""
Prints the documentation of the given command
:param session: Session handler
:param namespace: Name space of the command
:param cmd_name: Name of the command
"""
# Extract documentation
ar... | [
"def",
"__print_command_help",
"(",
"self",
",",
"session",
",",
"namespace",
",",
"cmd_name",
")",
":",
"# Extract documentation",
"args",
",",
"doc",
"=",
"self",
".",
"__extract_help",
"(",
"self",
".",
"_commands",
"[",
"namespace",
"]",
"[",
"cmd_name",
... | Prints the documentation of the given command
:param session: Session handler
:param namespace: Name space of the command
:param cmd_name: Name of the command | [
"Prints",
"the",
"documentation",
"of",
"the",
"given",
"command"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L556-L574 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.__print_namespace_help | def __print_namespace_help(self, session, namespace, cmd_name=None):
"""
Prints the documentation of all the commands in the given name space,
or only of the given command
:param session: Session Handler
:param namespace: Name space of the command
:param cmd_name: Name o... | python | def __print_namespace_help(self, session, namespace, cmd_name=None):
"""
Prints the documentation of all the commands in the given name space,
or only of the given command
:param session: Session Handler
:param namespace: Name space of the command
:param cmd_name: Name o... | [
"def",
"__print_namespace_help",
"(",
"self",
",",
"session",
",",
"namespace",
",",
"cmd_name",
"=",
"None",
")",
":",
"session",
".",
"write_line",
"(",
"\"=== Name space '{0}' ===\"",
",",
"namespace",
")",
"# Get all commands in this name space",
"if",
"cmd_name",... | Prints the documentation of all the commands in the given name space,
or only of the given command
:param session: Session Handler
:param namespace: Name space of the command
:param cmd_name: Name of the command to show, None to show them all | [
"Prints",
"the",
"documentation",
"of",
"all",
"the",
"commands",
"in",
"the",
"given",
"name",
"space",
"or",
"only",
"of",
"the",
"given",
"command"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L576-L601 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.print_help | def print_help(self, session, command=None):
"""
Prints the available methods and their documentation, or the
documentation of the given command.
"""
if command:
# Single command mode
if command in self._commands:
# Argument is a name space... | python | def print_help(self, session, command=None):
"""
Prints the available methods and their documentation, or the
documentation of the given command.
"""
if command:
# Single command mode
if command in self._commands:
# Argument is a name space... | [
"def",
"print_help",
"(",
"self",
",",
"session",
",",
"command",
"=",
"None",
")",
":",
"if",
"command",
":",
"# Single command mode",
"if",
"command",
"in",
"self",
".",
"_commands",
":",
"# Argument is a name space",
"self",
".",
"__print_namespace_help",
"("... | Prints the available methods and their documentation, or the
documentation of the given command. | [
"Prints",
"the",
"available",
"methods",
"and",
"their",
"documentation",
"or",
"the",
"documentation",
"of",
"the",
"given",
"command",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L603-L652 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.var_set | def var_set(session, **kwargs):
"""
Sets the given variables or prints the current ones. "set answer=42"
"""
if not kwargs:
for name, value in session.variables.items():
session.write_line("{0}={1}".format(name, value))
else:
for name, valu... | python | def var_set(session, **kwargs):
"""
Sets the given variables or prints the current ones. "set answer=42"
"""
if not kwargs:
for name, value in session.variables.items():
session.write_line("{0}={1}".format(name, value))
else:
for name, valu... | [
"def",
"var_set",
"(",
"session",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
":",
"for",
"name",
",",
"value",
"in",
"session",
".",
"variables",
".",
"items",
"(",
")",
":",
"session",
".",
"write_line",
"(",
"\"{0}={1}\"",
".",
"form... | Sets the given variables or prints the current ones. "set answer=42" | [
"Sets",
"the",
"given",
"variables",
"or",
"prints",
"the",
"current",
"ones",
".",
"set",
"answer",
"=",
"42"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L670-L681 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.var_unset | def var_unset(session, name):
"""
Unsets the given variable
"""
name = name.strip()
try:
session.unset(name)
except KeyError:
session.write_line("Unknown variable: {0}", name)
return False
else:
session.write_line("V... | python | def var_unset(session, name):
"""
Unsets the given variable
"""
name = name.strip()
try:
session.unset(name)
except KeyError:
session.write_line("Unknown variable: {0}", name)
return False
else:
session.write_line("V... | [
"def",
"var_unset",
"(",
"session",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"strip",
"(",
")",
"try",
":",
"session",
".",
"unset",
"(",
"name",
")",
"except",
"KeyError",
":",
"session",
".",
"write_line",
"(",
"\"Unknown variable: {0}\"",
",",... | Unsets the given variable | [
"Unsets",
"the",
"given",
"variable"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L684-L697 |
tcalmant/ipopo | pelix/shell/parser.py | Shell.run_file | def run_file(self, session, filename):
"""
Runs the given "script" file
"""
try:
with open(filename, "r") as filep:
for lineno, line in enumerate(filep):
line = line.strip()
if not line or line.startswith("#"):
... | python | def run_file(self, session, filename):
"""
Runs the given "script" file
"""
try:
with open(filename, "r") as filep:
for lineno, line in enumerate(filep):
line = line.strip()
if not line or line.startswith("#"):
... | [
"def",
"run_file",
"(",
"self",
",",
"session",
",",
"filename",
")",
":",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"filep",
":",
"for",
"lineno",
",",
"line",
"in",
"enumerate",
"(",
"filep",
")",
":",
"line",
"=",
"li... | Runs the given "script" file | [
"Runs",
"the",
"given",
"script",
"file"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/parser.py#L699-L726 |
tcalmant/ipopo | pelix/remote/xml_rpc.py | _XmlRpcServlet._simple_dispatch | def _simple_dispatch(self, name, params):
"""
Dispatch method
"""
try:
# Internal method
return self.funcs[name](*params)
except KeyError:
# Other method
pass
# Call the other method outside the except block, to avoid messy... | python | def _simple_dispatch(self, name, params):
"""
Dispatch method
"""
try:
# Internal method
return self.funcs[name](*params)
except KeyError:
# Other method
pass
# Call the other method outside the except block, to avoid messy... | [
"def",
"_simple_dispatch",
"(",
"self",
",",
"name",
",",
"params",
")",
":",
"try",
":",
"# Internal method",
"return",
"self",
".",
"funcs",
"[",
"name",
"]",
"(",
"*",
"params",
")",
"except",
"KeyError",
":",
"# Other method",
"pass",
"# Call the other m... | Dispatch method | [
"Dispatch",
"method"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/xml_rpc.py#L104-L117 |
tcalmant/ipopo | pelix/misc/init_handler.py | _Configuration.add_properties | def add_properties(self, properties):
"""
Updates the framework properties dictionary
:param properties: New framework properties to add
"""
if isinstance(properties, dict):
self._properties.update(properties) | python | def add_properties(self, properties):
"""
Updates the framework properties dictionary
:param properties: New framework properties to add
"""
if isinstance(properties, dict):
self._properties.update(properties) | [
"def",
"add_properties",
"(",
"self",
",",
"properties",
")",
":",
"if",
"isinstance",
"(",
"properties",
",",
"dict",
")",
":",
"self",
".",
"_properties",
".",
"update",
"(",
"properties",
")"
] | Updates the framework properties dictionary
:param properties: New framework properties to add | [
"Updates",
"the",
"framework",
"properties",
"dictionary"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L108-L115 |
tcalmant/ipopo | pelix/misc/init_handler.py | _Configuration.add_environment | def add_environment(self, environ):
"""
Updates the environment dictionary with the given one.
Existing entries are overridden by the given ones
:param environ: New environment variables
"""
if isinstance(environ, dict):
self._environment.update(environ) | python | def add_environment(self, environ):
"""
Updates the environment dictionary with the given one.
Existing entries are overridden by the given ones
:param environ: New environment variables
"""
if isinstance(environ, dict):
self._environment.update(environ) | [
"def",
"add_environment",
"(",
"self",
",",
"environ",
")",
":",
"if",
"isinstance",
"(",
"environ",
",",
"dict",
")",
":",
"self",
".",
"_environment",
".",
"update",
"(",
"environ",
")"
] | Updates the environment dictionary with the given one.
Existing entries are overridden by the given ones
:param environ: New environment variables | [
"Updates",
"the",
"environment",
"dictionary",
"with",
"the",
"given",
"one",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L126-L135 |
tcalmant/ipopo | pelix/misc/init_handler.py | _Configuration.add_paths | def add_paths(self, paths):
"""
Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add
"""
if paths:
# Use new paths in priority
self._paths = list(paths) ... | python | def add_paths(self, paths):
"""
Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add
"""
if paths:
# Use new paths in priority
self._paths = list(paths) ... | [
"def",
"add_paths",
"(",
"self",
",",
"paths",
")",
":",
"if",
"paths",
":",
"# Use new paths in priority",
"self",
".",
"_paths",
"=",
"list",
"(",
"paths",
")",
"+",
"self",
".",
"_paths"
] | Adds entries to the Python path.
The given paths are normalized before being added to the left of the
list
:param paths: New paths to add | [
"Adds",
"entries",
"to",
"the",
"Python",
"path",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L147-L158 |
tcalmant/ipopo | pelix/misc/init_handler.py | _Configuration.add_components | def add_components(self, components):
"""
Adds a list of components to instantiate
:param components: The description of components
:raise KeyError: Missing component configuration
"""
if components:
for component in components:
self._componen... | python | def add_components(self, components):
"""
Adds a list of components to instantiate
:param components: The description of components
:raise KeyError: Missing component configuration
"""
if components:
for component in components:
self._componen... | [
"def",
"add_components",
"(",
"self",
",",
"components",
")",
":",
"if",
"components",
":",
"for",
"component",
"in",
"components",
":",
"self",
".",
"_components",
"[",
"component",
"[",
"\"name\"",
"]",
"]",
"=",
"(",
"component",
"[",
"\"factory\"",
"]"... | Adds a list of components to instantiate
:param components: The description of components
:raise KeyError: Missing component configuration | [
"Adds",
"a",
"list",
"of",
"components",
"to",
"instantiate"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L198-L210 |
tcalmant/ipopo | pelix/misc/init_handler.py | _Configuration.normalize | def normalize(self):
"""
Normalizes environment variables, paths and filters the lists of
bundles to install and start.
After this call, the environment variables of this process will have
been updated.
"""
# Add environment variables
os.environ.update(se... | python | def normalize(self):
"""
Normalizes environment variables, paths and filters the lists of
bundles to install and start.
After this call, the environment variables of this process will have
been updated.
"""
# Add environment variables
os.environ.update(se... | [
"def",
"normalize",
"(",
"self",
")",
":",
"# Add environment variables",
"os",
".",
"environ",
".",
"update",
"(",
"self",
".",
"_environment",
")",
"# Normalize paths and avoid duplicates",
"self",
".",
"_paths",
"=",
"remove_duplicates",
"(",
"os",
".",
"path",... | Normalizes environment variables, paths and filters the lists of
bundles to install and start.
After this call, the environment variables of this process will have
been updated. | [
"Normalizes",
"environment",
"variables",
"paths",
"and",
"filters",
"the",
"lists",
"of",
"bundles",
"to",
"install",
"and",
"start",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L223-L242 |
tcalmant/ipopo | pelix/misc/init_handler.py | InitFileHandler.find_default | def find_default(self, filename):
"""
A generate which looks in common folders for the default configuration
file. The paths goes from system defaults to user specific files.
:param filename: The name of the file to find
:return: The complete path to the found files
"""
... | python | def find_default(self, filename):
"""
A generate which looks in common folders for the default configuration
file. The paths goes from system defaults to user specific files.
:param filename: The name of the file to find
:return: The complete path to the found files
"""
... | [
"def",
"find_default",
"(",
"self",
",",
"filename",
")",
":",
"for",
"path",
"in",
"self",
".",
"DEFAULT_PATH",
":",
"# Normalize path",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"os",
".",
"path",
".",
"expandvars",
"(",
"path",
")",
")... | A generate which looks in common folders for the default configuration
file. The paths goes from system defaults to user specific files.
:param filename: The name of the file to find
:return: The complete path to the found files | [
"A",
"generate",
"which",
"looks",
"in",
"common",
"folders",
"for",
"the",
"default",
"configuration",
"file",
".",
"The",
"paths",
"goes",
"from",
"system",
"defaults",
"to",
"user",
"specific",
"files",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L289-L303 |
tcalmant/ipopo | pelix/misc/init_handler.py | InitFileHandler.load | def load(self, filename=None):
"""
Loads the given file and adds its content to the current state.
This method can be called multiple times to merge different files.
If no filename is given, this method loads all default files found.
It returns False if no default configuration ... | python | def load(self, filename=None):
"""
Loads the given file and adds its content to the current state.
This method can be called multiple times to merge different files.
If no filename is given, this method loads all default files found.
It returns False if no default configuration ... | [
"def",
"load",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"not",
"filename",
":",
"for",
"name",
"in",
"self",
".",
"find_default",
"(",
"\".pelix.conf\"",
")",
":",
"self",
".",
"load",
"(",
"name",
")",
"else",
":",
"with",
"open",
... | Loads the given file and adds its content to the current state.
This method can be called multiple times to merge different files.
If no filename is given, this method loads all default files found.
It returns False if no default configuration file has been found
:param filename: The f... | [
"Loads",
"the",
"given",
"file",
"and",
"adds",
"its",
"content",
"to",
"the",
"current",
"state",
".",
"This",
"method",
"can",
"be",
"called",
"multiple",
"times",
"to",
"merge",
"different",
"files",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L305-L323 |
tcalmant/ipopo | pelix/misc/init_handler.py | InitFileHandler.__parse | def __parse(self, configuration):
"""
Parses the given configuration dictionary
:param configuration: A configuration as a dictionary (JSON object)
"""
for entry in (
"properties",
"environment",
"paths",
"bundles",
"co... | python | def __parse(self, configuration):
"""
Parses the given configuration dictionary
:param configuration: A configuration as a dictionary (JSON object)
"""
for entry in (
"properties",
"environment",
"paths",
"bundles",
"co... | [
"def",
"__parse",
"(",
"self",
",",
"configuration",
")",
":",
"for",
"entry",
"in",
"(",
"\"properties\"",
",",
"\"environment\"",
",",
"\"paths\"",
",",
"\"bundles\"",
",",
"\"components\"",
",",
")",
":",
"# Check if current values must be reset",
"reset_key",
... | Parses the given configuration dictionary
:param configuration: A configuration as a dictionary (JSON object) | [
"Parses",
"the",
"given",
"configuration",
"dictionary"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L325-L346 |
tcalmant/ipopo | pelix/misc/init_handler.py | InitFileHandler.normalize | def normalize(self):
"""
Normalizes environment variables and the Python path.
This method first updates the environment variables (``os.environ``).
Then, it normalizes the Python path (``sys.path``) by resolving all
references to the user directory and environment variables.
... | python | def normalize(self):
"""
Normalizes environment variables and the Python path.
This method first updates the environment variables (``os.environ``).
Then, it normalizes the Python path (``sys.path``) by resolving all
references to the user directory and environment variables.
... | [
"def",
"normalize",
"(",
"self",
")",
":",
"# Normalize configuration",
"self",
".",
"__state",
".",
"normalize",
"(",
")",
"# Update sys.path, avoiding duplicates",
"whole_path",
"=",
"list",
"(",
"self",
".",
"__state",
".",
"paths",
")",
"whole_path",
".",
"e... | Normalizes environment variables and the Python path.
This method first updates the environment variables (``os.environ``).
Then, it normalizes the Python path (``sys.path``) by resolving all
references to the user directory and environment variables. | [
"Normalizes",
"environment",
"variables",
"and",
"the",
"Python",
"path",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L348-L367 |
tcalmant/ipopo | pelix/misc/init_handler.py | InitFileHandler.instantiate_components | def instantiate_components(self, context):
"""
Instantiate the defined components
.. note::
This method requires the iPOPO core service to be registered.
This means that the ``pelix.ipopo.core`` must have been declared in
the list of bundles (or installed and st... | python | def instantiate_components(self, context):
"""
Instantiate the defined components
.. note::
This method requires the iPOPO core service to be registered.
This means that the ``pelix.ipopo.core`` must have been declared in
the list of bundles (or installed and st... | [
"def",
"instantiate_components",
"(",
"self",
",",
"context",
")",
":",
"with",
"use_ipopo",
"(",
"context",
")",
"as",
"ipopo",
":",
"for",
"name",
",",
"(",
"factory",
",",
"properties",
")",
"in",
"self",
".",
"__state",
".",
"components",
".",
"items... | Instantiate the defined components
.. note::
This method requires the iPOPO core service to be registered.
This means that the ``pelix.ipopo.core`` must have been declared in
the list of bundles (or installed and started programmatically).
:param context: A :class:`~pe... | [
"Instantiate",
"the",
"defined",
"components"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/init_handler.py#L369-L384 |
moskytw/uniout | _uniout.py | literalize_string | def literalize_string(content, is_unicode=False):
r'''Literalize a string content.
Examples:
>>> print literalize_string('str')
'str'
>>> print literalize_string('\'str\'')
"'str'"
>>> print literalize_string('\"\'str\'\"')
'"\'str\'"'
'''
quote_mark = "'"
if "'" in conten... | python | def literalize_string(content, is_unicode=False):
r'''Literalize a string content.
Examples:
>>> print literalize_string('str')
'str'
>>> print literalize_string('\'str\'')
"'str'"
>>> print literalize_string('\"\'str\'\"')
'"\'str\'"'
'''
quote_mark = "'"
if "'" in conten... | [
"def",
"literalize_string",
"(",
"content",
",",
"is_unicode",
"=",
"False",
")",
":",
"quote_mark",
"=",
"\"'\"",
"if",
"\"'\"",
"in",
"content",
":",
"quote_mark",
"=",
"'\"'",
"if",
"'\"'",
"in",
"content",
":",
"quote_mark",
"=",
"\"'\"",
"content",
"=... | r'''Literalize a string content.
Examples:
>>> print literalize_string('str')
'str'
>>> print literalize_string('\'str\'')
"'str'"
>>> print literalize_string('\"\'str\'\"')
'"\'str\'"' | [
"r",
"Literalize",
"a",
"string",
"content",
"."
] | train | https://github.com/moskytw/uniout/blob/8ea8fc84f3da297352e6b7335e354b41b40e7788/_uniout.py#L9-L32 |
moskytw/uniout | _uniout.py | unescape_string_literal | def unescape_string_literal(literal, encoding):
r'''Unescape a string or unicode literal.
Examples:
>>> u = u'\u4e16\u754c\u4f60\u597d' # 世界你好
>>> print unescape_string_literal(repr(u), 'utf-8')
u'世界你好'
>>> print unescape_string_literal(repr(u.encode('utf-8')), 'utf-8')
'世界你好'
>>> pr... | python | def unescape_string_literal(literal, encoding):
r'''Unescape a string or unicode literal.
Examples:
>>> u = u'\u4e16\u754c\u4f60\u597d' # 世界你好
>>> print unescape_string_literal(repr(u), 'utf-8')
u'世界你好'
>>> print unescape_string_literal(repr(u.encode('utf-8')), 'utf-8')
'世界你好'
>>> pr... | [
"def",
"unescape_string_literal",
"(",
"literal",
",",
"encoding",
")",
":",
"if",
"encoding",
"is",
"None",
":",
"encoding",
"=",
"getfilesystemencoding",
"(",
")",
"if",
"literal",
"[",
"0",
"]",
"in",
"'uU'",
":",
"return",
"literalize_string",
"(",
"lite... | r'''Unescape a string or unicode literal.
Examples:
>>> u = u'\u4e16\u754c\u4f60\u597d' # 世界你好
>>> print unescape_string_literal(repr(u), 'utf-8')
u'世界你好'
>>> print unescape_string_literal(repr(u.encode('utf-8')), 'utf-8')
'世界你好'
>>> print unescape_string_literal(repr(u.encode('big5')), ... | [
"r",
"Unescape",
"a",
"string",
"or",
"unicode",
"literal",
"."
] | train | https://github.com/moskytw/uniout/blob/8ea8fc84f3da297352e6b7335e354b41b40e7788/_uniout.py#L38-L74 |
moskytw/uniout | _uniout.py | unescape | def unescape(b, encoding):
'''Unescape all string and unicode literals in bytes.'''
return string_literal_re.sub(
lambda m: unescape_string_literal(m.group(), encoding),
b
) | python | def unescape(b, encoding):
'''Unescape all string and unicode literals in bytes.'''
return string_literal_re.sub(
lambda m: unescape_string_literal(m.group(), encoding),
b
) | [
"def",
"unescape",
"(",
"b",
",",
"encoding",
")",
":",
"return",
"string_literal_re",
".",
"sub",
"(",
"lambda",
"m",
":",
"unescape_string_literal",
"(",
"m",
".",
"group",
"(",
")",
",",
"encoding",
")",
",",
"b",
")"
] | Unescape all string and unicode literals in bytes. | [
"Unescape",
"all",
"string",
"and",
"unicode",
"literals",
"in",
"bytes",
"."
] | train | https://github.com/moskytw/uniout/blob/8ea8fc84f3da297352e6b7335e354b41b40e7788/_uniout.py#L77-L82 |
moskytw/uniout | _uniout.py | make_unistream | def make_unistream(stream):
'''Make a stream which unescapes string literals before writes out.'''
unistream = lambda: 'I am an unistream!'
# make unistream look like the stream
for attr_name in dir(stream):
if not attr_name.startswith('_'):
setattr(unistream, attr_name, getattr(st... | python | def make_unistream(stream):
'''Make a stream which unescapes string literals before writes out.'''
unistream = lambda: 'I am an unistream!'
# make unistream look like the stream
for attr_name in dir(stream):
if not attr_name.startswith('_'):
setattr(unistream, attr_name, getattr(st... | [
"def",
"make_unistream",
"(",
"stream",
")",
":",
"unistream",
"=",
"lambda",
":",
"'I am an unistream!'",
"# make unistream look like the stream",
"for",
"attr_name",
"in",
"dir",
"(",
"stream",
")",
":",
"if",
"not",
"attr_name",
".",
"startswith",
"(",
"'_'",
... | Make a stream which unescapes string literals before writes out. | [
"Make",
"a",
"stream",
"which",
"unescapes",
"string",
"literals",
"before",
"writes",
"out",
"."
] | train | https://github.com/moskytw/uniout/blob/8ea8fc84f3da297352e6b7335e354b41b40e7788/_uniout.py#L96-L112 |
tcalmant/ipopo | pelix/shell/report.py | format_frame_info | def format_frame_info(frame):
"""
Formats the given stack frame to show its position in the code and
part of its context
:param frame: A stack frame
"""
# Same as in traceback.extract_stack
line_no = frame.f_lineno
code = frame.f_code
filename = code.co_filename
method_name = co... | python | def format_frame_info(frame):
"""
Formats the given stack frame to show its position in the code and
part of its context
:param frame: A stack frame
"""
# Same as in traceback.extract_stack
line_no = frame.f_lineno
code = frame.f_code
filename = code.co_filename
method_name = co... | [
"def",
"format_frame_info",
"(",
"frame",
")",
":",
"# Same as in traceback.extract_stack",
"line_no",
"=",
"frame",
".",
"f_lineno",
"code",
"=",
"frame",
".",
"f_code",
"filename",
"=",
"code",
".",
"co_filename",
"method_name",
"=",
"code",
".",
"co_name",
"l... | Formats the given stack frame to show its position in the code and
part of its context
:param frame: A stack frame | [
"Formats",
"the",
"given",
"stack",
"frame",
"to",
"show",
"its",
"position",
"in",
"the",
"code",
"and",
"part",
"of",
"its",
"context"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L65-L130 |
tcalmant/ipopo | pelix/shell/report.py | _extract_lines | def _extract_lines(filename, f_globals, line_no, around):
"""
Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Number of line to print before and ... | python | def _extract_lines(filename, f_globals, line_no, around):
"""
Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Number of line to print before and ... | [
"def",
"_extract_lines",
"(",
"filename",
",",
"f_globals",
",",
"line_no",
",",
"around",
")",
":",
"current_line",
"=",
"linecache",
".",
"getline",
"(",
"filename",
",",
"line_no",
",",
"f_globals",
")",
"if",
"not",
"current_line",
":",
"# No data on this ... | Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Number of line to print before and after the current one | [
"Extracts",
"a",
"block",
"of",
"lines",
"from",
"the",
"given",
"file"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L133-L177 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.get_methods | def get_methods(self):
"""
Retrieves the list of tuples (command, method) for this command handler
"""
return [
("levels", self.print_levels),
("make", self.make_report),
("clear", self.clear_report),
("show", self.show_report),
... | python | def get_methods(self):
"""
Retrieves the list of tuples (command, method) for this command handler
"""
return [
("levels", self.print_levels),
("make", self.make_report),
("clear", self.clear_report),
("show", self.show_report),
... | [
"def",
"get_methods",
"(",
"self",
")",
":",
"return",
"[",
"(",
"\"levels\"",
",",
"self",
".",
"print_levels",
")",
",",
"(",
"\"make\"",
",",
"self",
".",
"make_report",
")",
",",
"(",
"\"clear\"",
",",
"self",
".",
"clear_report",
")",
",",
"(",
... | Retrieves the list of tuples (command, method) for this command handler | [
"Retrieves",
"the",
"list",
"of",
"tuples",
"(",
"command",
"method",
")",
"for",
"this",
"command",
"handler"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L251-L261 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.get_level_methods | def get_level_methods(self, level):
"""
Returns the methods to call for the given level of report
:param level: The level of report
:return: The set of methods to call to fill the report
:raise KeyError: Unknown level or alias
"""
try:
# Real name of ... | python | def get_level_methods(self, level):
"""
Returns the methods to call for the given level of report
:param level: The level of report
:return: The set of methods to call to fill the report
:raise KeyError: Unknown level or alias
"""
try:
# Real name of ... | [
"def",
"get_level_methods",
"(",
"self",
",",
"level",
")",
":",
"try",
":",
"# Real name of the level",
"return",
"set",
"(",
"self",
".",
"__levels",
"[",
"level",
"]",
")",
"except",
"KeyError",
":",
"# Alias",
"result",
"=",
"set",
"(",
")",
"for",
"... | Returns the methods to call for the given level of report
:param level: The level of report
:return: The set of methods to call to fill the report
:raise KeyError: Unknown level or alias | [
"Returns",
"the",
"methods",
"to",
"call",
"for",
"the",
"given",
"level",
"of",
"report"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L263-L279 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.print_levels | def print_levels(self, session):
"""
Lists available levels
"""
lines = []
for level in sorted(self.get_levels()):
methods = sorted(
method.__name__ for method in self.get_level_methods(level)
)
lines.append("- {0}:".format(leve... | python | def print_levels(self, session):
"""
Lists available levels
"""
lines = []
for level in sorted(self.get_levels()):
methods = sorted(
method.__name__ for method in self.get_level_methods(level)
)
lines.append("- {0}:".format(leve... | [
"def",
"print_levels",
"(",
"self",
",",
"session",
")",
":",
"lines",
"=",
"[",
"]",
"for",
"level",
"in",
"sorted",
"(",
"self",
".",
"get_levels",
"(",
")",
")",
":",
"methods",
"=",
"sorted",
"(",
"method",
".",
"__name__",
"for",
"method",
"in",... | Lists available levels | [
"Lists",
"available",
"levels"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L293-L304 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.os_details | def os_details():
"""
Returns a dictionary containing details about the operating system
"""
# Compute architecture and linkage
bits, linkage = platform.architecture()
results = {
# Machine details
"platform.arch.bits": bits,
"platform.... | python | def os_details():
"""
Returns a dictionary containing details about the operating system
"""
# Compute architecture and linkage
bits, linkage = platform.architecture()
results = {
# Machine details
"platform.arch.bits": bits,
"platform.... | [
"def",
"os_details",
"(",
")",
":",
"# Compute architecture and linkage",
"bits",
",",
"linkage",
"=",
"platform",
".",
"architecture",
"(",
")",
"results",
"=",
"{",
"# Machine details",
"\"platform.arch.bits\"",
":",
"bits",
",",
"\"platform.arch.linkage\"",
":",
... | Returns a dictionary containing details about the operating system | [
"Returns",
"a",
"dictionary",
"containing",
"details",
"about",
"the",
"operating",
"system"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L307-L347 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.process_details | def process_details():
"""
Returns details about the current process
"""
results = {"argv": sys.argv, "working.directory": os.getcwd()}
# Process ID and execution IDs (UID, GID, Login, ...)
for key, method in {
"pid": "getpid",
"ppid": "getppid",
... | python | def process_details():
"""
Returns details about the current process
"""
results = {"argv": sys.argv, "working.directory": os.getcwd()}
# Process ID and execution IDs (UID, GID, Login, ...)
for key, method in {
"pid": "getpid",
"ppid": "getppid",
... | [
"def",
"process_details",
"(",
")",
":",
"results",
"=",
"{",
"\"argv\"",
":",
"sys",
".",
"argv",
",",
"\"working.directory\"",
":",
"os",
".",
"getcwd",
"(",
")",
"}",
"# Process ID and execution IDs (UID, GID, Login, ...)",
"for",
"key",
",",
"method",
"in",
... | Returns details about the current process | [
"Returns",
"details",
"about",
"the",
"current",
"process"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L357-L378 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.network_details | def network_details():
"""
Returns details about the network links
"""
# Get IPv4 details
ipv4_addresses = [
info[4][0]
for info in socket.getaddrinfo(
socket.gethostname(), None, socket.AF_INET
)
]
# Add localh... | python | def network_details():
"""
Returns details about the network links
"""
# Get IPv4 details
ipv4_addresses = [
info[4][0]
for info in socket.getaddrinfo(
socket.gethostname(), None, socket.AF_INET
)
]
# Add localh... | [
"def",
"network_details",
"(",
")",
":",
"# Get IPv4 details",
"ipv4_addresses",
"=",
"[",
"info",
"[",
"4",
"]",
"[",
"0",
"]",
"for",
"info",
"in",
"socket",
".",
"getaddrinfo",
"(",
"socket",
".",
"gethostname",
"(",
")",
",",
"None",
",",
"socket",
... | Returns details about the network links | [
"Returns",
"details",
"about",
"the",
"network",
"links"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L381-L430 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.python_details | def python_details():
"""
Returns a dictionary containing details about the Python interpreter
"""
build_no, build_date = platform.python_build()
results = {
# Version of interpreter
"build.number": build_no,
"build.date": build_date,
... | python | def python_details():
"""
Returns a dictionary containing details about the Python interpreter
"""
build_no, build_date = platform.python_build()
results = {
# Version of interpreter
"build.number": build_no,
"build.date": build_date,
... | [
"def",
"python_details",
"(",
")",
":",
"build_no",
",",
"build_date",
"=",
"platform",
".",
"python_build",
"(",
")",
"results",
"=",
"{",
"# Version of interpreter",
"\"build.number\"",
":",
"build_no",
",",
"\"build.date\"",
":",
"build_date",
",",
"\"compiler\... | Returns a dictionary containing details about the Python interpreter | [
"Returns",
"a",
"dictionary",
"containing",
"details",
"about",
"the",
"Python",
"interpreter"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L433-L472 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.python_modules | def python_modules():
"""
Returns the list of Python modules and their file
"""
imported = {}
results = {"builtins": sys.builtin_module_names, "imported": imported}
for module_name, module_ in sys.modules.items():
if module_name not in sys.builtin_module_names... | python | def python_modules():
"""
Returns the list of Python modules and their file
"""
imported = {}
results = {"builtins": sys.builtin_module_names, "imported": imported}
for module_name, module_ in sys.modules.items():
if module_name not in sys.builtin_module_names... | [
"def",
"python_modules",
"(",
")",
":",
"imported",
"=",
"{",
"}",
"results",
"=",
"{",
"\"builtins\"",
":",
"sys",
".",
"builtin_module_names",
",",
"\"imported\"",
":",
"imported",
"}",
"for",
"module_name",
",",
"module_",
"in",
"sys",
".",
"modules",
"... | Returns the list of Python modules and their file | [
"Returns",
"the",
"list",
"of",
"Python",
"modules",
"and",
"their",
"file"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L486-L501 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.pelix_infos | def pelix_infos(self):
"""
Basic information about the Pelix framework instance
"""
framework = self.__context.get_framework()
return {
"version": framework.get_version(),
"properties": framework.get_properties(),
} | python | def pelix_infos(self):
"""
Basic information about the Pelix framework instance
"""
framework = self.__context.get_framework()
return {
"version": framework.get_version(),
"properties": framework.get_properties(),
} | [
"def",
"pelix_infos",
"(",
"self",
")",
":",
"framework",
"=",
"self",
".",
"__context",
".",
"get_framework",
"(",
")",
"return",
"{",
"\"version\"",
":",
"framework",
".",
"get_version",
"(",
")",
",",
"\"properties\"",
":",
"framework",
".",
"get_properti... | Basic information about the Pelix framework instance | [
"Basic",
"information",
"about",
"the",
"Pelix",
"framework",
"instance"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L503-L511 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.pelix_bundles | def pelix_bundles(self):
"""
List of installed bundles
"""
framework = self.__context.get_framework()
return {
bundle.get_bundle_id(): {
"name": bundle.get_symbolic_name(),
"version": bundle.get_version(),
"state": bundl... | python | def pelix_bundles(self):
"""
List of installed bundles
"""
framework = self.__context.get_framework()
return {
bundle.get_bundle_id(): {
"name": bundle.get_symbolic_name(),
"version": bundle.get_version(),
"state": bundl... | [
"def",
"pelix_bundles",
"(",
"self",
")",
":",
"framework",
"=",
"self",
".",
"__context",
".",
"get_framework",
"(",
")",
"return",
"{",
"bundle",
".",
"get_bundle_id",
"(",
")",
":",
"{",
"\"name\"",
":",
"bundle",
".",
"get_symbolic_name",
"(",
")",
"... | List of installed bundles | [
"List",
"of",
"installed",
"bundles"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L513-L526 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.pelix_services | def pelix_services(self):
"""
List of registered services
"""
return {
svc_ref.get_property(pelix.constants.SERVICE_ID): {
"specifications": svc_ref.get_property(
pelix.constants.OBJECTCLASS
),
"ranking": svc... | python | def pelix_services(self):
"""
List of registered services
"""
return {
svc_ref.get_property(pelix.constants.SERVICE_ID): {
"specifications": svc_ref.get_property(
pelix.constants.OBJECTCLASS
),
"ranking": svc... | [
"def",
"pelix_services",
"(",
"self",
")",
":",
"return",
"{",
"svc_ref",
".",
"get_property",
"(",
"pelix",
".",
"constants",
".",
"SERVICE_ID",
")",
":",
"{",
"\"specifications\"",
":",
"svc_ref",
".",
"get_property",
"(",
"pelix",
".",
"constants",
".",
... | List of registered services | [
"List",
"of",
"registered",
"services"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L528-L545 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.ipopo_factories | def ipopo_factories(self):
"""
List of iPOPO factories
"""
try:
with use_ipopo(self.__context) as ipopo:
return {
name: ipopo.get_factory_details(name)
for name in ipopo.get_factories()
}
except B... | python | def ipopo_factories(self):
"""
List of iPOPO factories
"""
try:
with use_ipopo(self.__context) as ipopo:
return {
name: ipopo.get_factory_details(name)
for name in ipopo.get_factories()
}
except B... | [
"def",
"ipopo_factories",
"(",
"self",
")",
":",
"try",
":",
"with",
"use_ipopo",
"(",
"self",
".",
"__context",
")",
"as",
"ipopo",
":",
"return",
"{",
"name",
":",
"ipopo",
".",
"get_factory_details",
"(",
"name",
")",
"for",
"name",
"in",
"ipopo",
"... | List of iPOPO factories | [
"List",
"of",
"iPOPO",
"factories"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L547-L559 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.ipopo_instances | def ipopo_instances(self):
"""
List of iPOPO instances
"""
try:
with use_ipopo(self.__context) as ipopo:
return {
instance[0]: ipopo.get_instance_details(instance[0])
for instance in ipopo.get_instances()
... | python | def ipopo_instances(self):
"""
List of iPOPO instances
"""
try:
with use_ipopo(self.__context) as ipopo:
return {
instance[0]: ipopo.get_instance_details(instance[0])
for instance in ipopo.get_instances()
... | [
"def",
"ipopo_instances",
"(",
"self",
")",
":",
"try",
":",
"with",
"use_ipopo",
"(",
"self",
".",
"__context",
")",
"as",
"ipopo",
":",
"return",
"{",
"instance",
"[",
"0",
"]",
":",
"ipopo",
".",
"get_instance_details",
"(",
"instance",
"[",
"0",
"]... | List of iPOPO instances | [
"List",
"of",
"iPOPO",
"instances"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L561-L573 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.threads_list | def threads_list():
"""
Lists the active threads and their current code line
"""
results = {}
# pylint: disable=W0212
try:
# Extract frames
frames = sys._current_frames()
# Get the thread ID -> Thread mapping
names = threa... | python | def threads_list():
"""
Lists the active threads and their current code line
"""
results = {}
# pylint: disable=W0212
try:
# Extract frames
frames = sys._current_frames()
# Get the thread ID -> Thread mapping
names = threa... | [
"def",
"threads_list",
"(",
")",
":",
"results",
"=",
"{",
"}",
"# pylint: disable=W0212",
"try",
":",
"# Extract frames",
"frames",
"=",
"sys",
".",
"_current_frames",
"(",
")",
"# Get the thread ID -> Thread mapping",
"names",
"=",
"threading",
".",
"_active",
"... | Lists the active threads and their current code line | [
"Lists",
"the",
"active",
"threads",
"and",
"their",
"current",
"code",
"line"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L576-L620 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.make_report | def make_report(self, session, *levels):
"""
Prepares the report at the requested level(s)
"""
if not levels:
levels = ["full"]
try:
# List the methods to call, avoiding double-calls
methods = set()
for level in levels:
... | python | def make_report(self, session, *levels):
"""
Prepares the report at the requested level(s)
"""
if not levels:
levels = ["full"]
try:
# List the methods to call, avoiding double-calls
methods = set()
for level in levels:
... | [
"def",
"make_report",
"(",
"self",
",",
"session",
",",
"*",
"levels",
")",
":",
"if",
"not",
"levels",
":",
"levels",
"=",
"[",
"\"full\"",
"]",
"try",
":",
"# List the methods to call, avoiding double-calls",
"methods",
"=",
"set",
"(",
")",
"for",
"level"... | Prepares the report at the requested level(s) | [
"Prepares",
"the",
"report",
"at",
"the",
"requested",
"level",
"(",
"s",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L622-L649 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.to_json | def to_json(self, data):
"""
Converts the given object to a pretty-formatted JSON string
:param data: the object to convert to JSON
:return: A pretty-formatted JSON string
"""
# Don't forget the empty line at the end of the file
return (
json.dumps(
... | python | def to_json(self, data):
"""
Converts the given object to a pretty-formatted JSON string
:param data: the object to convert to JSON
:return: A pretty-formatted JSON string
"""
# Don't forget the empty line at the end of the file
return (
json.dumps(
... | [
"def",
"to_json",
"(",
"self",
",",
"data",
")",
":",
"# Don't forget the empty line at the end of the file",
"return",
"(",
"json",
".",
"dumps",
"(",
"data",
",",
"sort_keys",
"=",
"True",
",",
"indent",
"=",
"4",
",",
"separators",
"=",
"(",
"\",\"",
",",... | Converts the given object to a pretty-formatted JSON string
:param data: the object to convert to JSON
:return: A pretty-formatted JSON string | [
"Converts",
"the",
"given",
"object",
"to",
"a",
"pretty",
"-",
"formatted",
"JSON",
"string"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L665-L682 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.show_report | def show_report(self, session, *levels):
"""
Shows the report that has been generated
"""
if levels:
self.make_report(session, *levels)
if self.__report:
session.write_line(self.to_json(self.__report))
else:
session.write_line("No repo... | python | def show_report(self, session, *levels):
"""
Shows the report that has been generated
"""
if levels:
self.make_report(session, *levels)
if self.__report:
session.write_line(self.to_json(self.__report))
else:
session.write_line("No repo... | [
"def",
"show_report",
"(",
"self",
",",
"session",
",",
"*",
"levels",
")",
":",
"if",
"levels",
":",
"self",
".",
"make_report",
"(",
"session",
",",
"*",
"levels",
")",
"if",
"self",
".",
"__report",
":",
"session",
".",
"write_line",
"(",
"self",
... | Shows the report that has been generated | [
"Shows",
"the",
"report",
"that",
"has",
"been",
"generated"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L684-L694 |
tcalmant/ipopo | pelix/shell/report.py | _ReportCommands.write_report | def write_report(self, session, filename):
"""
Writes the report in JSON format to the given file
"""
if not self.__report:
session.write_line("No report to write down")
return
try:
with open(filename, "w+") as out_file:
out_fi... | python | def write_report(self, session, filename):
"""
Writes the report in JSON format to the given file
"""
if not self.__report:
session.write_line("No report to write down")
return
try:
with open(filename, "w+") as out_file:
out_fi... | [
"def",
"write_report",
"(",
"self",
",",
"session",
",",
"filename",
")",
":",
"if",
"not",
"self",
".",
"__report",
":",
"session",
".",
"write_line",
"(",
"\"No report to write down\"",
")",
"return",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"\"... | Writes the report in JSON format to the given file | [
"Writes",
"the",
"report",
"in",
"JSON",
"format",
"to",
"the",
"given",
"file"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/report.py#L696-L708 |
tcalmant/ipopo | pelix/remote/transport/mqtt_rpc.py | _MqttCallableProxy.handle_result | def handle_result(self, result, error):
"""
The result has been received
:param result: Call result
:param error: Error message
"""
if not self._error and not self._result:
# Store results, if not already set
self._error = error
self._... | python | def handle_result(self, result, error):
"""
The result has been received
:param result: Call result
:param error: Error message
"""
if not self._error and not self._result:
# Store results, if not already set
self._error = error
self._... | [
"def",
"handle_result",
"(",
"self",
",",
"result",
",",
"error",
")",
":",
"if",
"not",
"self",
".",
"_error",
"and",
"not",
"self",
".",
"_result",
":",
"# Store results, if not already set",
"self",
".",
"_error",
"=",
"error",
"self",
".",
"_result",
"... | The result has been received
:param result: Call result
:param error: Error message | [
"The",
"result",
"has",
"been",
"received"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/transport/mqtt_rpc.py#L301-L314 |
tcalmant/ipopo | samples/hooks/hook_provider.py | EventListenerHookImpl.event | def event(self, service_event, listener_dict):
"""
A service has been received: this method can alter the list of
listeners to be notified of this event (remove only).
It can also be used as a handler for the event that will be called
before any standard one.
:param serv... | python | def event(self, service_event, listener_dict):
"""
A service has been received: this method can alter the list of
listeners to be notified of this event (remove only).
It can also be used as a handler for the event that will be called
before any standard one.
:param serv... | [
"def",
"event",
"(",
"self",
",",
"service_event",
",",
"listener_dict",
")",
":",
"print",
"(",
"\"EventListenerHookImpl: service_event=\"",
",",
"service_event",
",",
"\", listener_dict=\"",
",",
"listener_dict",
",",
"sep",
"=",
"\"\"",
",",
")",
"# Remove it if ... | A service has been received: this method can alter the list of
listeners to be notified of this event (remove only).
It can also be used as a handler for the event that will be called
before any standard one.
:param service_event: The ServiceEvent being triggered
:param listener... | [
"A",
"service",
"has",
"been",
"received",
":",
"this",
"method",
"can",
"alter",
"the",
"list",
"of",
"listeners",
"to",
"be",
"notified",
"of",
"this",
"event",
"(",
"remove",
"only",
")",
".",
"It",
"can",
"also",
"be",
"used",
"as",
"a",
"handler",... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/hooks/hook_provider.py#L63-L94 |
tcalmant/ipopo | docs/_static/tutorials/spell_checker/main_pelix_launcher.py | main | def main():
"""
Starts a Pelix framework and waits for it to stop
"""
# Prepare the framework, with iPOPO and the shell console
# Warning: we only use the first argument of this method, a list of bundles
framework = pelix.framework.create_framework((
# iPOPO
"pelix.ipopo.core",
... | python | def main():
"""
Starts a Pelix framework and waits for it to stop
"""
# Prepare the framework, with iPOPO and the shell console
# Warning: we only use the first argument of this method, a list of bundles
framework = pelix.framework.create_framework((
# iPOPO
"pelix.ipopo.core",
... | [
"def",
"main",
"(",
")",
":",
"# Prepare the framework, with iPOPO and the shell console",
"# Warning: we only use the first argument of this method, a list of bundles",
"framework",
"=",
"pelix",
".",
"framework",
".",
"create_framework",
"(",
"(",
"# iPOPO",
"\"pelix.ipopo.core\"... | Starts a Pelix framework and waits for it to stop | [
"Starts",
"a",
"Pelix",
"framework",
"and",
"waits",
"for",
"it",
"to",
"stop"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/docs/_static/tutorials/spell_checker/main_pelix_launcher.py#L15-L61 |
tcalmant/ipopo | pelix/misc/ssl_wrap.py | wrap_socket | def wrap_socket(socket, certfile, keyfile, password=None):
"""
Wraps an existing TCP socket and returns an SSLSocket object
:param socket: The socket to wrap
:param certfile: The server certificate file
:param keyfile: The server private key file
:param password: Password for the private key fi... | python | def wrap_socket(socket, certfile, keyfile, password=None):
"""
Wraps an existing TCP socket and returns an SSLSocket object
:param socket: The socket to wrap
:param certfile: The server certificate file
:param keyfile: The server private key file
:param password: Password for the private key fi... | [
"def",
"wrap_socket",
"(",
"socket",
",",
"certfile",
",",
"keyfile",
",",
"password",
"=",
"None",
")",
":",
"# Log warnings when some",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"\"ssl_wrap\"",
")",
"def",
"_password_support_error",
"(",
")",
":",
"\"... | Wraps an existing TCP socket and returns an SSLSocket object
:param socket: The socket to wrap
:param certfile: The server certificate file
:param keyfile: The server private key file
:param password: Password for the private key file (Python >= 3.3)
:return: The wrapped socket
:raise SSLError:... | [
"Wraps",
"an",
"existing",
"TCP",
"socket",
"and",
"returns",
"an",
"SSLSocket",
"object"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/ssl_wrap.py#L54-L139 |
tcalmant/ipopo | pelix/http/__init__.py | make_html_list | def make_html_list(items, tag="ul"):
# type: (Iterable[Any], str) -> str
"""
Makes a HTML list from the given iterable
:param items: The items to list
:param tag: The tag to use (ul or ol)
:return: The HTML list code
"""
html_list = "\n".join(
'<li><a href="{0}">{0}</a></li>'.fo... | python | def make_html_list(items, tag="ul"):
# type: (Iterable[Any], str) -> str
"""
Makes a HTML list from the given iterable
:param items: The items to list
:param tag: The tag to use (ul or ol)
:return: The HTML list code
"""
html_list = "\n".join(
'<li><a href="{0}">{0}</a></li>'.fo... | [
"def",
"make_html_list",
"(",
"items",
",",
"tag",
"=",
"\"ul\"",
")",
":",
"# type: (Iterable[Any], str) -> str",
"html_list",
"=",
"\"\\n\"",
".",
"join",
"(",
"'<li><a href=\"{0}\">{0}</a></li>'",
".",
"format",
"(",
"item",
")",
"for",
"item",
"in",
"items",
... | Makes a HTML list from the given iterable
:param items: The items to list
:param tag: The tag to use (ul or ol)
:return: The HTML list code | [
"Makes",
"a",
"HTML",
"list",
"from",
"the",
"given",
"iterable"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/__init__.py#L132-L144 |
tcalmant/ipopo | pelix/http/__init__.py | AbstractHTTPServletRequest.read_data | def read_data(self):
# type: () -> ByteString
"""
Reads all the data in the input stream
:return: The read data
"""
try:
size = int(self.get_header("content-length"))
except (ValueError, TypeError):
size = -1
return self.get_rfile... | python | def read_data(self):
# type: () -> ByteString
"""
Reads all the data in the input stream
:return: The read data
"""
try:
size = int(self.get_header("content-length"))
except (ValueError, TypeError):
size = -1
return self.get_rfile... | [
"def",
"read_data",
"(",
"self",
")",
":",
"# type: () -> ByteString",
"try",
":",
"size",
"=",
"int",
"(",
"self",
".",
"get_header",
"(",
"\"content-length\"",
")",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"size",
"=",
"-",
"1",
"r... | Reads all the data in the input stream
:return: The read data | [
"Reads",
"all",
"the",
"data",
"in",
"the",
"input",
"stream"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/__init__.py#L243-L255 |
tcalmant/ipopo | pelix/http/__init__.py | AbstractHTTPServletResponse.send_content | def send_content(
self,
http_code,
content,
mime_type="text/html",
http_message=None,
content_length=-1,
):
# type: (int, str, str, str, int) -> None
"""
Utility method to send the given content as an answer.
You can still use get_wfile... | python | def send_content(
self,
http_code,
content,
mime_type="text/html",
http_message=None,
content_length=-1,
):
# type: (int, str, str, str, int) -> None
"""
Utility method to send the given content as an answer.
You can still use get_wfile... | [
"def",
"send_content",
"(",
"self",
",",
"http_code",
",",
"content",
",",
"mime_type",
"=",
"\"text/html\"",
",",
"http_message",
"=",
"None",
",",
"content_length",
"=",
"-",
"1",
",",
")",
":",
"# type: (int, str, str, str, int) -> None",
"self",
".",
"set_re... | Utility method to send the given content as an answer.
You can still use get_wfile or write afterwards, if you forced the
content length.
If content_length is negative (default), it will be computed as the
length of the content;
if it is positive, the given value will be used;
... | [
"Utility",
"method",
"to",
"send",
"the",
"given",
"content",
"as",
"an",
"answer",
".",
"You",
"can",
"still",
"use",
"get_wfile",
"or",
"write",
"afterwards",
"if",
"you",
"forced",
"the",
"content",
"length",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/__init__.py#L335-L380 |
tcalmant/ipopo | pelix/remote/discovery/multicast.py | make_mreq | def make_mreq(family, address):
"""
Makes a mreq structure object for the given address and socket family.
:param family: A socket family (AF_INET or AF_INET6)
:param address: A multicast address (group)
:raise ValueError: Invalid family or address
"""
if not address:
raise ValueErr... | python | def make_mreq(family, address):
"""
Makes a mreq structure object for the given address and socket family.
:param family: A socket family (AF_INET or AF_INET6)
:param address: A multicast address (group)
:raise ValueError: Invalid family or address
"""
if not address:
raise ValueErr... | [
"def",
"make_mreq",
"(",
"family",
",",
"address",
")",
":",
"if",
"not",
"address",
":",
"raise",
"ValueError",
"(",
"\"Empty address\"",
")",
"# Convert the address to a binary form",
"group_bin",
"=",
"pton",
"(",
"family",
",",
"address",
")",
"if",
"family"... | Makes a mreq structure object for the given address and socket family.
:param family: A socket family (AF_INET or AF_INET6)
:param address: A multicast address (group)
:raise ValueError: Invalid family or address | [
"Makes",
"a",
"mreq",
"structure",
"object",
"for",
"the",
"given",
"address",
"and",
"socket",
"family",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/discovery/multicast.py#L151-L184 |
tcalmant/ipopo | pelix/remote/discovery/multicast.py | create_multicast_socket | def create_multicast_socket(address, port):
"""
Creates a multicast socket according to the given address and port.
Handles both IPv4 and IPv6 addresses.
:param address: Multicast address/group
:param port: Socket port
:return: A tuple (socket, listening address)
:raise ValueError: Invalid ... | python | def create_multicast_socket(address, port):
"""
Creates a multicast socket according to the given address and port.
Handles both IPv4 and IPv6 addresses.
:param address: Multicast address/group
:param port: Socket port
:return: A tuple (socket, listening address)
:raise ValueError: Invalid ... | [
"def",
"create_multicast_socket",
"(",
"address",
",",
"port",
")",
":",
"# Get the information about a datagram (UDP) socket, of any family",
"try",
":",
"addrs_info",
"=",
"socket",
".",
"getaddrinfo",
"(",
"address",
",",
"port",
",",
"socket",
".",
"AF_UNSPEC",
",... | Creates a multicast socket according to the given address and port.
Handles both IPv4 and IPv6 addresses.
:param address: Multicast address/group
:param port: Socket port
:return: A tuple (socket, listening address)
:raise ValueError: Invalid address or port | [
"Creates",
"a",
"multicast",
"socket",
"according",
"to",
"the",
"given",
"address",
"and",
"port",
".",
"Handles",
"both",
"IPv4",
"and",
"IPv6",
"addresses",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/discovery/multicast.py#L190-L263 |
tcalmant/ipopo | pelix/remote/discovery/multicast.py | close_multicast_socket | def close_multicast_socket(sock, address):
"""
Cleans up the given multicast socket.
Unregisters it of the multicast group.
Parameters should be the result of create_multicast_socket
:param sock: A multicast socket
:param address: The multicast address used by the socket
"""
if sock is... | python | def close_multicast_socket(sock, address):
"""
Cleans up the given multicast socket.
Unregisters it of the multicast group.
Parameters should be the result of create_multicast_socket
:param sock: A multicast socket
:param address: The multicast address used by the socket
"""
if sock is... | [
"def",
"close_multicast_socket",
"(",
"sock",
",",
"address",
")",
":",
"if",
"sock",
"is",
"None",
":",
"return",
"if",
"address",
":",
"# Prepare the mreq structure to join the group",
"mreq",
"=",
"make_mreq",
"(",
"sock",
".",
"family",
",",
"address",
")",
... | Cleans up the given multicast socket.
Unregisters it of the multicast group.
Parameters should be the result of create_multicast_socket
:param sock: A multicast socket
:param address: The multicast address used by the socket | [
"Cleans",
"up",
"the",
"given",
"multicast",
"socket",
".",
"Unregisters",
"it",
"of",
"the",
"multicast",
"group",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/discovery/multicast.py#L266-L293 |
tcalmant/ipopo | samples/rsa/helloimpl.py | HelloImpl.sayHello | def sayHello(self, name="Not given", message="nothing"):
"""
Synchronous implementation of IHello.sayHello synchronous method.
The remote calling thread will be blocked until this is executed and
responds.
"""
print(
"Python.sayHello called by: {0} "
... | python | def sayHello(self, name="Not given", message="nothing"):
"""
Synchronous implementation of IHello.sayHello synchronous method.
The remote calling thread will be blocked until this is executed and
responds.
"""
print(
"Python.sayHello called by: {0} "
... | [
"def",
"sayHello",
"(",
"self",
",",
"name",
"=",
"\"Not given\"",
",",
"message",
"=",
"\"nothing\"",
")",
":",
"print",
"(",
"\"Python.sayHello called by: {0} \"",
"\"with message: '{1}'\"",
".",
"format",
"(",
"name",
",",
"message",
")",
")",
"return",
"(",
... | Synchronous implementation of IHello.sayHello synchronous method.
The remote calling thread will be blocked until this is executed and
responds. | [
"Synchronous",
"implementation",
"of",
"IHello",
".",
"sayHello",
"synchronous",
"method",
".",
"The",
"remote",
"calling",
"thread",
"will",
"be",
"blocked",
"until",
"this",
"is",
"executed",
"and",
"responds",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/rsa/helloimpl.py#L25-L38 |
tcalmant/ipopo | samples/rsa/helloimpl.py | HelloImpl.sayHelloAsync | def sayHelloAsync(self, name="Not given", message="nothing"):
"""
Implementation of IHello.sayHelloAsync.
This method will be executed via some thread, and the remote caller
will not block.
This method should return either a String result (since the return type
of IHello.... | python | def sayHelloAsync(self, name="Not given", message="nothing"):
"""
Implementation of IHello.sayHelloAsync.
This method will be executed via some thread, and the remote caller
will not block.
This method should return either a String result (since the return type
of IHello.... | [
"def",
"sayHelloAsync",
"(",
"self",
",",
"name",
"=",
"\"Not given\"",
",",
"message",
"=",
"\"nothing\"",
")",
":",
"print",
"(",
"\"Python.sayHelloAsync called by: {0} \"",
"\"with message: '{1}'\"",
".",
"format",
"(",
"name",
",",
"message",
")",
")",
"return... | Implementation of IHello.sayHelloAsync.
This method will be executed via some thread, and the remote caller
will not block.
This method should return either a String result (since the return type
of IHello.sayHelloAsync is CompletableFuture<String>, OR a Future that
returns a pyt... | [
"Implementation",
"of",
"IHello",
".",
"sayHelloAsync",
".",
"This",
"method",
"will",
"be",
"executed",
"via",
"some",
"thread",
"and",
"the",
"remote",
"caller",
"will",
"not",
"block",
".",
"This",
"method",
"should",
"return",
"either",
"a",
"String",
"r... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/rsa/helloimpl.py#L40-L56 |
tcalmant/ipopo | samples/rsa/helloimpl.py | HelloImpl.sayHelloPromise | def sayHelloPromise(self, name="Not given", message="nothing"):
"""
Implementation of IHello.sayHelloPromise.
This method will be executed via some thread, and the remote caller
will not block.
"""
print(
"Python.sayHelloPromise called by: {0} "
"w... | python | def sayHelloPromise(self, name="Not given", message="nothing"):
"""
Implementation of IHello.sayHelloPromise.
This method will be executed via some thread, and the remote caller
will not block.
"""
print(
"Python.sayHelloPromise called by: {0} "
"w... | [
"def",
"sayHelloPromise",
"(",
"self",
",",
"name",
"=",
"\"Not given\"",
",",
"message",
"=",
"\"nothing\"",
")",
":",
"print",
"(",
"\"Python.sayHelloPromise called by: {0} \"",
"\"with message: '{1}'\"",
".",
"format",
"(",
"name",
",",
"message",
")",
")",
"re... | Implementation of IHello.sayHelloPromise.
This method will be executed via some thread, and the remote caller
will not block. | [
"Implementation",
"of",
"IHello",
".",
"sayHelloPromise",
".",
"This",
"method",
"will",
"be",
"executed",
"via",
"some",
"thread",
"and",
"the",
"remote",
"caller",
"will",
"not",
"block",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/rsa/helloimpl.py#L58-L71 |
tcalmant/ipopo | pelix/ipopo/core.py | _set_factory_context | def _set_factory_context(factory_class, bundle_context):
# type: (type, Optional[BundleContext]) -> Optional[FactoryContext]
"""
Transforms the context data dictionary into its FactoryContext object form.
:param factory_class: A manipulated class
:param bundle_context: The class bundle context
... | python | def _set_factory_context(factory_class, bundle_context):
# type: (type, Optional[BundleContext]) -> Optional[FactoryContext]
"""
Transforms the context data dictionary into its FactoryContext object form.
:param factory_class: A manipulated class
:param bundle_context: The class bundle context
... | [
"def",
"_set_factory_context",
"(",
"factory_class",
",",
"bundle_context",
")",
":",
"# type: (type, Optional[BundleContext]) -> Optional[FactoryContext]",
"try",
":",
"# Try to get the factory context (built using decorators)",
"context",
"=",
"getattr",
"(",
"factory_class",
","... | Transforms the context data dictionary into its FactoryContext object form.
:param factory_class: A manipulated class
:param bundle_context: The class bundle context
:return: The factory context, None on error | [
"Transforms",
"the",
"context",
"data",
"dictionary",
"into",
"its",
"FactoryContext",
"object",
"form",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L85-L107 |
tcalmant/ipopo | pelix/ipopo/core.py | _load_bundle_factories | def _load_bundle_factories(bundle):
# type: (Bundle) -> List[Tuple[FactoryContext, type]]
"""
Retrieves a list of pairs (FactoryContext, factory class) with all
readable manipulated classes found in the bundle.
:param bundle: A Bundle object
:return: The list of factories loaded from the bundle... | python | def _load_bundle_factories(bundle):
# type: (Bundle) -> List[Tuple[FactoryContext, type]]
"""
Retrieves a list of pairs (FactoryContext, factory class) with all
readable manipulated classes found in the bundle.
:param bundle: A Bundle object
:return: The list of factories loaded from the bundle... | [
"def",
"_load_bundle_factories",
"(",
"bundle",
")",
":",
"# type: (Bundle) -> List[Tuple[FactoryContext, type]]",
"result",
"=",
"[",
"]",
"# Get the Python module",
"module_",
"=",
"bundle",
".",
"get_module",
"(",
")",
"# Get the bundle context",
"bundle_context",
"=",
... | Retrieves a list of pairs (FactoryContext, factory class) with all
readable manipulated classes found in the bundle.
:param bundle: A Bundle object
:return: The list of factories loaded from the bundle | [
"Retrieves",
"a",
"list",
"of",
"pairs",
"(",
"FactoryContext",
"factory",
"class",
")",
"with",
"all",
"readable",
"manipulated",
"classes",
"found",
"in",
"the",
"bundle",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L110-L150 |
tcalmant/ipopo | pelix/ipopo/core.py | _IPopoService.__find_handler_factories | def __find_handler_factories(self):
"""
Finds all registered handler factories and stores them
"""
# Get the references
svc_refs = self.__context.get_all_service_references(
handlers_const.SERVICE_IPOPO_HANDLER_FACTORY
)
if svc_refs:
for sv... | python | def __find_handler_factories(self):
"""
Finds all registered handler factories and stores them
"""
# Get the references
svc_refs = self.__context.get_all_service_references(
handlers_const.SERVICE_IPOPO_HANDLER_FACTORY
)
if svc_refs:
for sv... | [
"def",
"__find_handler_factories",
"(",
"self",
")",
":",
"# Get the references",
"svc_refs",
"=",
"self",
".",
"__context",
".",
"get_all_service_references",
"(",
"handlers_const",
".",
"SERVICE_IPOPO_HANDLER_FACTORY",
")",
"if",
"svc_refs",
":",
"for",
"svc_ref",
"... | Finds all registered handler factories and stores them | [
"Finds",
"all",
"registered",
"handler",
"factories",
"and",
"stores",
"them"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L206-L217 |
tcalmant/ipopo | pelix/ipopo/core.py | _IPopoService.__add_handler_factory | def __add_handler_factory(self, svc_ref):
# type: (ServiceReference) -> None
"""
Stores a new handler factory
:param svc_ref: ServiceReference of the new handler factory
"""
with self.__handlers_lock:
# Get the handler ID
handler_id = svc_ref.get_... | python | def __add_handler_factory(self, svc_ref):
# type: (ServiceReference) -> None
"""
Stores a new handler factory
:param svc_ref: ServiceReference of the new handler factory
"""
with self.__handlers_lock:
# Get the handler ID
handler_id = svc_ref.get_... | [
"def",
"__add_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_HANDLER... | Stores a new handler factory
:param svc_ref: ServiceReference of the new handler factory | [
"Stores",
"a",
"new",
"handler",
"factory"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/core.py#L219-L248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.