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/framework.py | BundleContext.get_bundle | def get_bundle(self, bundle_id=None):
# type: (Union[Bundle, int]) -> Bundle
"""
Retrieves the :class:`~pelix.framework.Bundle` object for the bundle
matching the given ID (int). If no ID is given (None), the bundle
associated to this context is returned.
:param bundle_i... | python | def get_bundle(self, bundle_id=None):
# type: (Union[Bundle, int]) -> Bundle
"""
Retrieves the :class:`~pelix.framework.Bundle` object for the bundle
matching the given ID (int). If no ID is given (None), the bundle
associated to this context is returned.
:param bundle_i... | [
"def",
"get_bundle",
"(",
"self",
",",
"bundle_id",
"=",
"None",
")",
":",
"# type: (Union[Bundle, int]) -> Bundle",
"if",
"bundle_id",
"is",
"None",
":",
"# Current bundle",
"return",
"self",
".",
"__bundle",
"elif",
"isinstance",
"(",
"bundle_id",
",",
"Bundle",... | Retrieves the :class:`~pelix.framework.Bundle` object for the bundle
matching the given ID (int). If no ID is given (None), the bundle
associated to this context is returned.
:param bundle_id: A bundle ID (optional)
:return: The requested :class:`~pelix.framework.Bundle` object
... | [
"Retrieves",
"the",
":",
"class",
":",
"~pelix",
".",
"framework",
".",
"Bundle",
"object",
"for",
"the",
"bundle",
"matching",
"the",
"given",
"ID",
"(",
"int",
")",
".",
"If",
"no",
"ID",
"is",
"given",
"(",
"None",
")",
"the",
"bundle",
"associated"... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1551-L1569 |
tcalmant/ipopo | pelix/framework.py | BundleContext.get_service_reference | def get_service_reference(self, clazz, ldap_filter=None):
# type: (Optional[str], Optional[str]) -> Optional[ServiceReference]
"""
Returns a ServiceReference object for a service that implements and
was registered under the specified class
:param clazz: The class name with which... | python | def get_service_reference(self, clazz, ldap_filter=None):
# type: (Optional[str], Optional[str]) -> Optional[ServiceReference]
"""
Returns a ServiceReference object for a service that implements and
was registered under the specified class
:param clazz: The class name with which... | [
"def",
"get_service_reference",
"(",
"self",
",",
"clazz",
",",
"ldap_filter",
"=",
"None",
")",
":",
"# type: (Optional[str], Optional[str]) -> Optional[ServiceReference]",
"result",
"=",
"self",
".",
"__framework",
".",
"find_service_references",
"(",
"clazz",
",",
"l... | Returns a ServiceReference object for a service that implements and
was registered under the specified class
:param clazz: The class name with which the service was registered.
:param ldap_filter: A filter on service properties
:return: A service reference, None if not found | [
"Returns",
"a",
"ServiceReference",
"object",
"for",
"a",
"service",
"that",
"implements",
"and",
"was",
"registered",
"under",
"the",
"specified",
"class"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1621-L1637 |
tcalmant/ipopo | pelix/framework.py | BundleContext.get_service_references | def get_service_references(self, clazz, ldap_filter=None):
# type: (Optional[str], Optional[str]) -> Optional[List[ServiceReference]]
"""
Returns the service references for services that were registered under
the specified class by this bundle and matching the given filter
:para... | python | def get_service_references(self, clazz, ldap_filter=None):
# type: (Optional[str], Optional[str]) -> Optional[List[ServiceReference]]
"""
Returns the service references for services that were registered under
the specified class by this bundle and matching the given filter
:para... | [
"def",
"get_service_references",
"(",
"self",
",",
"clazz",
",",
"ldap_filter",
"=",
"None",
")",
":",
"# type: (Optional[str], Optional[str]) -> Optional[List[ServiceReference]]",
"refs",
"=",
"self",
".",
"__framework",
".",
"find_service_references",
"(",
"clazz",
",",... | Returns the service references for services that were registered under
the specified class by this bundle and matching the given filter
:param clazz: The class name with which the service was registered.
:param ldap_filter: A filter on service properties
:return: The list of references ... | [
"Returns",
"the",
"service",
"references",
"for",
"services",
"that",
"were",
"registered",
"under",
"the",
"specified",
"class",
"by",
"this",
"bundle",
"and",
"matching",
"the",
"given",
"filter"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1639-L1656 |
tcalmant/ipopo | pelix/framework.py | BundleContext.install_package | def install_package(self, path, recursive=False):
# type: (str, bool) -> tuple
"""
Installs all the modules found in the given package (directory).
It is a utility method working like
:meth:`~pelix.framework.BundleContext.install_visiting`, with a visitor
accepting every ... | python | def install_package(self, path, recursive=False):
# type: (str, bool) -> tuple
"""
Installs all the modules found in the given package (directory).
It is a utility method working like
:meth:`~pelix.framework.BundleContext.install_visiting`, with a visitor
accepting every ... | [
"def",
"install_package",
"(",
"self",
",",
"path",
",",
"recursive",
"=",
"False",
")",
":",
"# type: (str, bool) -> tuple",
"return",
"self",
".",
"__framework",
".",
"install_package",
"(",
"path",
",",
"recursive",
")"
] | Installs all the modules found in the given package (directory).
It is a utility method working like
:meth:`~pelix.framework.BundleContext.install_visiting`, with a visitor
accepting every module found.
:param path: Path of the package (folder)
:param recursive: If True, install... | [
"Installs",
"all",
"the",
"modules",
"found",
"in",
"the",
"given",
"package",
"(",
"directory",
")",
".",
"It",
"is",
"a",
"utility",
"method",
"working",
"like",
":",
"meth",
":",
"~pelix",
".",
"framework",
".",
"BundleContext",
".",
"install_visiting",
... | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1686-L1701 |
tcalmant/ipopo | pelix/framework.py | BundleContext.register_service | def register_service(
self,
clazz,
service,
properties,
send_event=True,
factory=False,
prototype=False,
):
# type: (Union[List[Any], type, str], object, dict, bool, bool, bool) -> ServiceRegistration
"""
Registers a service
:p... | python | def register_service(
self,
clazz,
service,
properties,
send_event=True,
factory=False,
prototype=False,
):
# type: (Union[List[Any], type, str], object, dict, bool, bool, bool) -> ServiceRegistration
"""
Registers a service
:p... | [
"def",
"register_service",
"(",
"self",
",",
"clazz",
",",
"service",
",",
"properties",
",",
"send_event",
"=",
"True",
",",
"factory",
"=",
"False",
",",
"prototype",
"=",
"False",
",",
")",
":",
"# type: (Union[List[Any], type, str], object, dict, bool, bool, boo... | Registers a service
:param clazz: Class or Classes (list) implemented by this service
:param service: The service instance
:param properties: The services properties (dictionary)
:param send_event: If not, doesn't trigger a service registered event
:param factory: If True, the g... | [
"Registers",
"a",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1723-L1754 |
tcalmant/ipopo | pelix/framework.py | BundleContext.unget_service | def unget_service(self, reference):
# type: (ServiceReference) -> bool
"""
Disables a reference to the service
:return: True if the bundle was using this reference, else False
"""
# Lose the dependency
return self.__framework._registry.unget_service(
... | python | def unget_service(self, reference):
# type: (ServiceReference) -> bool
"""
Disables a reference to the service
:return: True if the bundle was using this reference, else False
"""
# Lose the dependency
return self.__framework._registry.unget_service(
... | [
"def",
"unget_service",
"(",
"self",
",",
"reference",
")",
":",
"# type: (ServiceReference) -> bool",
"# Lose the dependency",
"return",
"self",
".",
"__framework",
".",
"_registry",
".",
"unget_service",
"(",
"self",
".",
"__bundle",
",",
"reference",
")"
] | Disables a reference to the service
:return: True if the bundle was using this reference, else False | [
"Disables",
"a",
"reference",
"to",
"the",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1784-L1794 |
tcalmant/ipopo | pelix/framework.py | FrameworkFactory.get_framework | def get_framework(cls, properties=None):
# type: (Optional[dict]) -> Framework
"""
If it doesn't exist yet, creates a framework with the given properties,
else returns the current framework instance.
:return: A Pelix instance
"""
if cls.__singleton is None:
... | python | def get_framework(cls, properties=None):
# type: (Optional[dict]) -> Framework
"""
If it doesn't exist yet, creates a framework with the given properties,
else returns the current framework instance.
:return: A Pelix instance
"""
if cls.__singleton is None:
... | [
"def",
"get_framework",
"(",
"cls",
",",
"properties",
"=",
"None",
")",
":",
"# type: (Optional[dict]) -> Framework",
"if",
"cls",
".",
"__singleton",
"is",
"None",
":",
"# Normalize sys.path",
"normalize_path",
"(",
")",
"cls",
".",
"__singleton",
"=",
"Framewor... | If it doesn't exist yet, creates a framework with the given properties,
else returns the current framework instance.
:return: A Pelix instance | [
"If",
"it",
"doesn",
"t",
"exist",
"yet",
"creates",
"a",
"framework",
"with",
"the",
"given",
"properties",
"else",
"returns",
"the",
"current",
"framework",
"instance",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1809-L1822 |
tcalmant/ipopo | pelix/framework.py | FrameworkFactory.delete_framework | def delete_framework(cls, framework=None):
# type: (Optional[Framework]) -> bool
# pylint: disable=W0212
"""
Removes the framework singleton
:return: True on success, else False
"""
if framework is None:
framework = cls.__singleton
if framewo... | python | def delete_framework(cls, framework=None):
# type: (Optional[Framework]) -> bool
# pylint: disable=W0212
"""
Removes the framework singleton
:return: True on success, else False
"""
if framework is None:
framework = cls.__singleton
if framewo... | [
"def",
"delete_framework",
"(",
"cls",
",",
"framework",
"=",
"None",
")",
":",
"# type: (Optional[Framework]) -> bool",
"# pylint: disable=W0212",
"if",
"framework",
"is",
"None",
":",
"framework",
"=",
"cls",
".",
"__singleton",
"if",
"framework",
"is",
"cls",
"... | Removes the framework singleton
:return: True on success, else False | [
"Removes",
"the",
"framework",
"singleton"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/framework.py#L1841-L1877 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_matching_interfaces | def get_matching_interfaces(object_class, exported_intfs):
# type: (List[str], Optional[List[str]]) -> Optional[List[str]]
"""
Returns the list of interfaces matching the export property
:param object_class: The specifications of the service
:param exported_intfs: The declared exported interfaces
... | python | def get_matching_interfaces(object_class, exported_intfs):
# type: (List[str], Optional[List[str]]) -> Optional[List[str]]
"""
Returns the list of interfaces matching the export property
:param object_class: The specifications of the service
:param exported_intfs: The declared exported interfaces
... | [
"def",
"get_matching_interfaces",
"(",
"object_class",
",",
"exported_intfs",
")",
":",
"# type: (List[str], Optional[List[str]]) -> Optional[List[str]]",
"if",
"object_class",
"is",
"None",
"or",
"exported_intfs",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
... | Returns the list of interfaces matching the export property
:param object_class: The specifications of the service
:param exported_intfs: The declared exported interfaces
:return: The list of declared exported interfaces | [
"Returns",
"the",
"list",
"of",
"interfaces",
"matching",
"the",
"export",
"property"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1109-L1129 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_prop_value | def get_prop_value(name, props, default=None):
# type: (str, Dict[str, Any], Any) -> Any
"""
Returns the value of a property or the default one
:param name: Name of a property
:param props: Dictionary of properties
:param default: Default value
:return: The value of the property or the defa... | python | def get_prop_value(name, props, default=None):
# type: (str, Dict[str, Any], Any) -> Any
"""
Returns the value of a property or the default one
:param name: Name of a property
:param props: Dictionary of properties
:param default: Default value
:return: The value of the property or the defa... | [
"def",
"get_prop_value",
"(",
"name",
",",
"props",
",",
"default",
"=",
"None",
")",
":",
"# type: (str, Dict[str, Any], Any) -> Any",
"if",
"not",
"props",
":",
"return",
"default",
"try",
":",
"return",
"props",
"[",
"name",
"]",
"except",
"KeyError",
":",
... | Returns the value of a property or the default one
:param name: Name of a property
:param props: Dictionary of properties
:param default: Default value
:return: The value of the property or the default one | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"or",
"the",
"default",
"one"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1132-L1148 |
tcalmant/ipopo | pelix/rsa/__init__.py | set_prop_if_null | def set_prop_if_null(name, props, if_null):
# type: (str, Dict[str, Any], Any) -> None
"""
Updates the value of a property if the previous one was None
:param name: Name of the property
:param props: Dictionary of properties
:param if_null: Value to insert if the previous was None
"""
v... | python | def set_prop_if_null(name, props, if_null):
# type: (str, Dict[str, Any], Any) -> None
"""
Updates the value of a property if the previous one was None
:param name: Name of the property
:param props: Dictionary of properties
:param if_null: Value to insert if the previous was None
"""
v... | [
"def",
"set_prop_if_null",
"(",
"name",
",",
"props",
",",
"if_null",
")",
":",
"# type: (str, Dict[str, Any], Any) -> None",
"value",
"=",
"get_prop_value",
"(",
"name",
",",
"props",
")",
"if",
"value",
"is",
"None",
":",
"props",
"[",
"name",
"]",
"=",
"i... | Updates the value of a property if the previous one was None
:param name: Name of the property
:param props: Dictionary of properties
:param if_null: Value to insert if the previous was None | [
"Updates",
"the",
"value",
"of",
"a",
"property",
"if",
"the",
"previous",
"one",
"was",
"None"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1151-L1162 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_string_plus_property_value | def get_string_plus_property_value(value):
# type: (Any) -> Optional[List[str]]
"""
Converts a string or list of string into a list of strings
:param value: A string or a list of strings
:return: A list of strings or None
"""
if value:
if isinstance(value, str):
return [... | python | def get_string_plus_property_value(value):
# type: (Any) -> Optional[List[str]]
"""
Converts a string or list of string into a list of strings
:param value: A string or a list of strings
:return: A list of strings or None
"""
if value:
if isinstance(value, str):
return [... | [
"def",
"get_string_plus_property_value",
"(",
"value",
")",
":",
"# type: (Any) -> Optional[List[str]]",
"if",
"value",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"return",
"[",
"value",
"]",
"if",
"isinstance",
"(",
"value",
",",
"list",
")"... | Converts a string or list of string into a list of strings
:param value: A string or a list of strings
:return: A list of strings or None | [
"Converts",
"a",
"string",
"or",
"list",
"of",
"string",
"into",
"a",
"list",
"of",
"strings"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1165-L1181 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_string_plus_property | def get_string_plus_property(name, props, default=None):
# type: (str, Dict[str, Any], Optional[Any]) -> Any
"""
Returns the value of the given property or the default value
:param name: A property name
:param props: A dictionary of properties
:param default: Value to return if the property doe... | python | def get_string_plus_property(name, props, default=None):
# type: (str, Dict[str, Any], Optional[Any]) -> Any
"""
Returns the value of the given property or the default value
:param name: A property name
:param props: A dictionary of properties
:param default: Value to return if the property doe... | [
"def",
"get_string_plus_property",
"(",
"name",
",",
"props",
",",
"default",
"=",
"None",
")",
":",
"# type: (str, Dict[str, Any], Optional[Any]) -> Any",
"val",
"=",
"get_string_plus_property_value",
"(",
"get_prop_value",
"(",
"name",
",",
"props",
",",
"default",
... | Returns the value of the given property or the default value
:param name: A property name
:param props: A dictionary of properties
:param default: Value to return if the property doesn't exist
:return: The property value or the default one | [
"Returns",
"the",
"value",
"of",
"the",
"given",
"property",
"or",
"the",
"default",
"value"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1211-L1222 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_exported_interfaces | def get_exported_interfaces(svc_ref, overriding_props=None):
# type: (ServiceReference, Optional[Dict[str, Any]]) -> Optional[List[str]]
"""
Looks for the interfaces exported by a service
:param svc_ref: Service reference
:param overriding_props: Properties overriding service ones
:return: The ... | python | def get_exported_interfaces(svc_ref, overriding_props=None):
# type: (ServiceReference, Optional[Dict[str, Any]]) -> Optional[List[str]]
"""
Looks for the interfaces exported by a service
:param svc_ref: Service reference
:param overriding_props: Properties overriding service ones
:return: The ... | [
"def",
"get_exported_interfaces",
"(",
"svc_ref",
",",
"overriding_props",
"=",
"None",
")",
":",
"# type: (ServiceReference, Optional[Dict[str, Any]]) -> Optional[List[str]]",
"# first check overriding_props for service.exported.interfaces",
"exported_intfs",
"=",
"get_prop_value",
"(... | Looks for the interfaces exported by a service
:param svc_ref: Service reference
:param overriding_props: Properties overriding service ones
:return: The list of exported interfaces | [
"Looks",
"for",
"the",
"interfaces",
"exported",
"by",
"a",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1235-L1257 |
tcalmant/ipopo | pelix/rsa/__init__.py | validate_exported_interfaces | def validate_exported_interfaces(object_class, exported_intfs):
# type: (List[str], List[str]) -> bool
"""
Validates that the exported interfaces are all provided by the service
:param object_class: The specifications of a service
:param exported_intfs: The exported specifications
:return: True... | python | def validate_exported_interfaces(object_class, exported_intfs):
# type: (List[str], List[str]) -> bool
"""
Validates that the exported interfaces are all provided by the service
:param object_class: The specifications of a service
:param exported_intfs: The exported specifications
:return: True... | [
"def",
"validate_exported_interfaces",
"(",
"object_class",
",",
"exported_intfs",
")",
":",
"# type: (List[str], List[str]) -> bool",
"if",
"(",
"not",
"exported_intfs",
"or",
"not",
"isinstance",
"(",
"exported_intfs",
",",
"list",
")",
"or",
"not",
"exported_intfs",
... | Validates that the exported interfaces are all provided by the service
:param object_class: The specifications of a service
:param exported_intfs: The exported specifications
:return: True if the exported specifications are all provided by the service | [
"Validates",
"that",
"the",
"exported",
"interfaces",
"are",
"all",
"provided",
"by",
"the",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1260-L1279 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_package_versions | def get_package_versions(intfs, props):
# type: (List[str], Dict[str, Any]) -> List[Tuple[str, str]]
"""
Gets the package version of interfaces
:param intfs: A list of interfaces
:param props: A dictionary containing endpoint package versions
:return: A list of tuples (package name, version)
... | python | def get_package_versions(intfs, props):
# type: (List[str], Dict[str, Any]) -> List[Tuple[str, str]]
"""
Gets the package version of interfaces
:param intfs: A list of interfaces
:param props: A dictionary containing endpoint package versions
:return: A list of tuples (package name, version)
... | [
"def",
"get_package_versions",
"(",
"intfs",
",",
"props",
")",
":",
"# type: (List[str], Dict[str, Any]) -> List[Tuple[str, str]]",
"result",
"=",
"[",
"]",
"for",
"intf",
"in",
"intfs",
":",
"pkg_name",
"=",
"get_package_from_classname",
"(",
"intf",
")",
"if",
"p... | Gets the package version of interfaces
:param intfs: A list of interfaces
:param props: A dictionary containing endpoint package versions
:return: A list of tuples (package name, version) | [
"Gets",
"the",
"package",
"version",
"of",
"interfaces"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1296-L1313 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_rsa_props | def get_rsa_props(
object_class,
exported_cfgs,
remote_intents=None,
ep_svc_id=None,
fw_id=None,
pkg_vers=None,
service_intents=None,
):
"""
Constructs a dictionary of RSA properties from the given arguments
:param object_class: Service specifications
:param exported_cfgs: E... | python | def get_rsa_props(
object_class,
exported_cfgs,
remote_intents=None,
ep_svc_id=None,
fw_id=None,
pkg_vers=None,
service_intents=None,
):
"""
Constructs a dictionary of RSA properties from the given arguments
:param object_class: Service specifications
:param exported_cfgs: E... | [
"def",
"get_rsa_props",
"(",
"object_class",
",",
"exported_cfgs",
",",
"remote_intents",
"=",
"None",
",",
"ep_svc_id",
"=",
"None",
",",
"fw_id",
"=",
"None",
",",
"pkg_vers",
"=",
"None",
",",
"service_intents",
"=",
"None",
",",
")",
":",
"results",
"=... | Constructs a dictionary of RSA properties from the given arguments
:param object_class: Service specifications
:param exported_cfgs: Export configurations
:param remote_intents: Supported remote intents
:param ep_svc_id: Endpoint service ID
:param fw_id: Remote Framework ID
:param pkg_vers: Ver... | [
"Constructs",
"a",
"dictionary",
"of",
"RSA",
"properties",
"from",
"the",
"given",
"arguments"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1369-L1421 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_ecf_props | def get_ecf_props(ep_id, ep_id_ns, rsvc_id=None, ep_ts=None):
"""
Prepares the ECF properties
:param ep_id: Endpoint ID
:param ep_id_ns: Namespace of the Endpoint ID
:param rsvc_id: Remote service ID
:param ep_ts: Timestamp of the endpoint
:return: A dictionary of ECF properties
"""
... | python | def get_ecf_props(ep_id, ep_id_ns, rsvc_id=None, ep_ts=None):
"""
Prepares the ECF properties
:param ep_id: Endpoint ID
:param ep_id_ns: Namespace of the Endpoint ID
:param rsvc_id: Remote service ID
:param ep_ts: Timestamp of the endpoint
:return: A dictionary of ECF properties
"""
... | [
"def",
"get_ecf_props",
"(",
"ep_id",
",",
"ep_id_ns",
",",
"rsvc_id",
"=",
"None",
",",
"ep_ts",
"=",
"None",
")",
":",
"results",
"=",
"{",
"}",
"if",
"not",
"ep_id",
":",
"raise",
"ArgumentError",
"(",
"\"ep_id\"",
",",
"\"ep_id must be a valid endpoint i... | Prepares the ECF properties
:param ep_id: Endpoint ID
:param ep_id_ns: Namespace of the Endpoint ID
:param rsvc_id: Remote service ID
:param ep_ts: Timestamp of the endpoint
:return: A dictionary of ECF properties | [
"Prepares",
"the",
"ECF",
"properties"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1424-L1447 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_extra_props | def get_extra_props(props):
# type: (Dict[str, Any]) -> Dict[str, Any]
"""
Returns the extra properties, *i.e.* non-ECF, non-RSA properties
:param props: A dictionary of properties
:return: A filtered dictionary
"""
return {
key: value
for key, value in props.items()
... | python | def get_extra_props(props):
# type: (Dict[str, Any]) -> Dict[str, Any]
"""
Returns the extra properties, *i.e.* non-ECF, non-RSA properties
:param props: A dictionary of properties
:return: A filtered dictionary
"""
return {
key: value
for key, value in props.items()
... | [
"def",
"get_extra_props",
"(",
"props",
")",
":",
"# type: (Dict[str, Any]) -> Dict[str, Any]",
"return",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"props",
".",
"items",
"(",
")",
"if",
"key",
"not",
"in",
"ECFPROPNAMES",
"and",
"key",
"no... | Returns the extra properties, *i.e.* non-ECF, non-RSA properties
:param props: A dictionary of properties
:return: A filtered dictionary | [
"Returns",
"the",
"extra",
"properties",
"*",
"i",
".",
"e",
".",
"*",
"non",
"-",
"ECF",
"non",
"-",
"RSA",
"properties"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1450-L1464 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_edef_props | def get_edef_props(
object_class,
exported_cfgs,
ep_namespace,
ep_id,
ecf_ep_id,
ep_rsvc_id,
ep_ts,
remote_intents=None,
fw_id=None,
pkg_ver=None,
service_intents=None,
):
"""
Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties
"""
... | python | def get_edef_props(
object_class,
exported_cfgs,
ep_namespace,
ep_id,
ecf_ep_id,
ep_rsvc_id,
ep_ts,
remote_intents=None,
fw_id=None,
pkg_ver=None,
service_intents=None,
):
"""
Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties
"""
... | [
"def",
"get_edef_props",
"(",
"object_class",
",",
"exported_cfgs",
",",
"ep_namespace",
",",
"ep_id",
",",
"ecf_ep_id",
",",
"ep_rsvc_id",
",",
"ep_ts",
",",
"remote_intents",
"=",
"None",
",",
"fw_id",
"=",
"None",
",",
"pkg_ver",
"=",
"None",
",",
"servic... | Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties | [
"Prepares",
"the",
"EDEF",
"properties",
"of",
"an",
"endpoint",
"merge",
"of",
"RSA",
"and",
"ECF",
"properties"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1467-L1494 |
tcalmant/ipopo | pelix/rsa/__init__.py | get_dot_properties | def get_dot_properties(prefix, props, remove_prefix):
# type: (str, Dict[str, Any], bool) -> Dict[str, Any]
"""
Gets the properties starting with the given prefix
"""
result_props = {}
if props:
dot_keys = [x for x in props.keys() if x.startswith(prefix + ".")]
for dot_key in dot... | python | def get_dot_properties(prefix, props, remove_prefix):
# type: (str, Dict[str, Any], bool) -> Dict[str, Any]
"""
Gets the properties starting with the given prefix
"""
result_props = {}
if props:
dot_keys = [x for x in props.keys() if x.startswith(prefix + ".")]
for dot_key in dot... | [
"def",
"get_dot_properties",
"(",
"prefix",
",",
"props",
",",
"remove_prefix",
")",
":",
"# type: (str, Dict[str, Any], bool) -> Dict[str, Any]",
"result_props",
"=",
"{",
"}",
"if",
"props",
":",
"dot_keys",
"=",
"[",
"x",
"for",
"x",
"in",
"props",
".",
"keys... | Gets the properties starting with the given prefix | [
"Gets",
"the",
"properties",
"starting",
"with",
"the",
"given",
"prefix"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1513-L1527 |
tcalmant/ipopo | pelix/rsa/__init__.py | copy_non_reserved | def copy_non_reserved(props, target):
# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]
"""
Copies all properties with non-reserved names from ``props`` to ``target``
:param props: A dictionary of properties
:param target: Another dictionary
:return: The target dictionary
"""
t... | python | def copy_non_reserved(props, target):
# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]
"""
Copies all properties with non-reserved names from ``props`` to ``target``
:param props: A dictionary of properties
:param target: Another dictionary
:return: The target dictionary
"""
t... | [
"def",
"copy_non_reserved",
"(",
"props",
",",
"target",
")",
":",
"# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]",
"target",
".",
"update",
"(",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"props",
".",
"items",
"(",
")",
"if",
"n... | Copies all properties with non-reserved names from ``props`` to ``target``
:param props: A dictionary of properties
:param target: Another dictionary
:return: The target dictionary | [
"Copies",
"all",
"properties",
"with",
"non",
"-",
"reserved",
"names",
"from",
"props",
"to",
"target"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1563-L1579 |
tcalmant/ipopo | pelix/rsa/__init__.py | copy_non_ecf | def copy_non_ecf(props, target):
# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]
"""
Copies non-ECF properties from ``props`` to ``target``
:param props: An input dictionary
:param target: The dictionary to copy non-ECF properties to
:return: The ``target`` dictionary
"""
tar... | python | def copy_non_ecf(props, target):
# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]
"""
Copies non-ECF properties from ``props`` to ``target``
:param props: An input dictionary
:param target: The dictionary to copy non-ECF properties to
:return: The ``target`` dictionary
"""
tar... | [
"def",
"copy_non_ecf",
"(",
"props",
",",
"target",
")",
":",
"# type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]",
"target",
".",
"update",
"(",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"props",
".",
"items",
"(",
")",
"if",
"key",
... | Copies non-ECF properties from ``props`` to ``target``
:param props: An input dictionary
:param target: The dictionary to copy non-ECF properties to
:return: The ``target`` dictionary | [
"Copies",
"non",
"-",
"ECF",
"properties",
"from",
"props",
"to",
"target"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1582-L1594 |
tcalmant/ipopo | pelix/rsa/__init__.py | set_append | def set_append(input_set, item):
# type: (set, Any) -> set
"""
Appends in-place the given item to the set.
If the item is a list, all elements are added to the set.
:param input_set: An existing set
:param item: The item or list of items to add
:return: The given set
"""
if item:
... | python | def set_append(input_set, item):
# type: (set, Any) -> set
"""
Appends in-place the given item to the set.
If the item is a list, all elements are added to the set.
:param input_set: An existing set
:param item: The item or list of items to add
:return: The given set
"""
if item:
... | [
"def",
"set_append",
"(",
"input_set",
",",
"item",
")",
":",
"# type: (set, Any) -> set",
"if",
"item",
":",
"if",
"isinstance",
"(",
"item",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"input_set",
".",
"update",
"(",
"item",
")",
"else",
":",
"in... | Appends in-place the given item to the set.
If the item is a list, all elements are added to the set.
:param input_set: An existing set
:param item: The item or list of items to add
:return: The given set | [
"Appends",
"in",
"-",
"place",
"the",
"given",
"item",
"to",
"the",
"set",
".",
"If",
"the",
"item",
"is",
"a",
"list",
"all",
"elements",
"are",
"added",
"to",
"the",
"set",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L1597-L1612 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromimportreg | def fromimportreg(cls, bundle, import_reg):
# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an ImportRegistration
"""
exc = import_reg.get_exception()
if exc:
return RemoteServiceAdminEvent(
... | python | def fromimportreg(cls, bundle, import_reg):
# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an ImportRegistration
"""
exc = import_reg.get_exception()
if exc:
return RemoteServiceAdminEvent(
... | [
"def",
"fromimportreg",
"(",
"cls",
",",
"bundle",
",",
"import_reg",
")",
":",
"# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent",
"exc",
"=",
"import_reg",
".",
"get_exception",
"(",
")",
"if",
"exc",
":",
"return",
"RemoteServiceAdminEvent",
"(",
"Re... | Creates a RemoteServiceAdminEvent object from an ImportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"an",
"ImportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L769-L796 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromexportreg | def fromexportreg(cls, bundle, export_reg):
# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an ExportRegistration
"""
exc = export_reg.get_exception()
if exc:
return RemoteServiceAdminEvent(
... | python | def fromexportreg(cls, bundle, export_reg):
# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an ExportRegistration
"""
exc = export_reg.get_exception()
if exc:
return RemoteServiceAdminEvent(
... | [
"def",
"fromexportreg",
"(",
"cls",
",",
"bundle",
",",
"export_reg",
")",
":",
"# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent",
"exc",
"=",
"export_reg",
".",
"get_exception",
"(",
")",
"if",
"exc",
":",
"return",
"RemoteServiceAdminEvent",
"(",
"Re... | Creates a RemoteServiceAdminEvent object from an ExportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"an",
"ExportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L799-L826 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromexportupdate | def fromexportupdate(cls, bundle, export_reg):
# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from the update of an
ExportRegistration
"""
exc = export_reg.get_exception()
if exc:
return Rem... | python | def fromexportupdate(cls, bundle, export_reg):
# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from the update of an
ExportRegistration
"""
exc = export_reg.get_exception()
if exc:
return Rem... | [
"def",
"fromexportupdate",
"(",
"cls",
",",
"bundle",
",",
"export_reg",
")",
":",
"# type: (Bundle, ExportRegistration) -> RemoteServiceAdminEvent",
"exc",
"=",
"export_reg",
".",
"get_exception",
"(",
")",
"if",
"exc",
":",
"return",
"RemoteServiceAdminEvent",
"(",
... | Creates a RemoteServiceAdminEvent object from the update of an
ExportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"the",
"update",
"of",
"an",
"ExportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L829-L857 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromimportupdate | def fromimportupdate(cls, bundle, import_reg):
# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from the update of an
ImportRegistration
"""
exc = import_reg.get_exception()
if exc:
return Rem... | python | def fromimportupdate(cls, bundle, import_reg):
# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from the update of an
ImportRegistration
"""
exc = import_reg.get_exception()
if exc:
return Rem... | [
"def",
"fromimportupdate",
"(",
"cls",
",",
"bundle",
",",
"import_reg",
")",
":",
"# type: (Bundle, ImportRegistration) -> RemoteServiceAdminEvent",
"exc",
"=",
"import_reg",
".",
"get_exception",
"(",
")",
"if",
"exc",
":",
"return",
"RemoteServiceAdminEvent",
"(",
... | Creates a RemoteServiceAdminEvent object from the update of an
ImportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"the",
"update",
"of",
"an",
"ImportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L860-L888 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromimportunreg | def fromimportunreg(
cls, bundle, cid, rsid, import_ref, exception, endpoint
):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ImportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object... | python | def fromimportunreg(
cls, bundle, cid, rsid, import_ref, exception, endpoint
):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ImportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object... | [
"def",
"fromimportunreg",
"(",
"cls",
",",
"bundle",
",",
"cid",
",",
"rsid",
",",
"import_ref",
",",
"exception",
",",
"endpoint",
")",
":",
"# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ImportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> R... | Creates a RemoteServiceAdminEvent object from the departure of an
ImportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"the",
"departure",
"of",
"an",
"ImportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L891-L907 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromexportunreg | def fromexportunreg(
cls, bundle, exporterid, rsid, export_ref, exception, endpoint
):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ExportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent... | python | def fromexportunreg(
cls, bundle, exporterid, rsid, export_ref, exception, endpoint
):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ExportReference, Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent... | [
"def",
"fromexportunreg",
"(",
"cls",
",",
"bundle",
",",
"exporterid",
",",
"rsid",
",",
"export_ref",
",",
"exception",
",",
"endpoint",
")",
":",
"# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], ExportReference, Optional[Tuple[Any, Any, Any]], EndpointDescriptio... | Creates a RemoteServiceAdminEvent object from the departure of an
ExportRegistration | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"the",
"departure",
"of",
"an",
"ExportRegistration"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L910-L926 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromimporterror | def fromimporterror(cls, bundle, importerid, rsid, exception, endpoint):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an import error
"""
... | python | def fromimporterror(cls, bundle, importerid, rsid, exception, endpoint):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an import error
"""
... | [
"def",
"fromimporterror",
"(",
"cls",
",",
"bundle",
",",
"importerid",
",",
"rsid",
",",
"exception",
",",
"endpoint",
")",
":",
"# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent",
"retur... | Creates a RemoteServiceAdminEvent object from an import error | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"an",
"import",
"error"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L929-L943 |
tcalmant/ipopo | pelix/rsa/__init__.py | RemoteServiceAdminEvent.fromexporterror | def fromexporterror(cls, bundle, exporterid, rsid, exception, endpoint):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an export error
"""
... | python | def fromexporterror(cls, bundle, exporterid, rsid, exception, endpoint):
# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent
"""
Creates a RemoteServiceAdminEvent object from an export error
"""
... | [
"def",
"fromexporterror",
"(",
"cls",
",",
"bundle",
",",
"exporterid",
",",
"rsid",
",",
"exception",
",",
"endpoint",
")",
":",
"# type: (Bundle, Tuple[str, str], Tuple[Tuple[str, str], int], Optional[Tuple[Any, Any, Any]], EndpointDescription) -> RemoteServiceAdminEvent",
"retur... | Creates a RemoteServiceAdminEvent object from an export error | [
"Creates",
"a",
"RemoteServiceAdminEvent",
"object",
"from",
"an",
"export",
"error"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/__init__.py#L946-L960 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList._try_instantiate | def _try_instantiate(self, ipopo, factory, component):
# type: (Any, str, str) -> None
"""
Tries to instantiate a component from the queue. Hides all exceptions.
:param ipopo: The iPOPO service
:param factory: Component factory
:param component: Component name
""... | python | def _try_instantiate(self, ipopo, factory, component):
# type: (Any, str, str) -> None
"""
Tries to instantiate a component from the queue. Hides all exceptions.
:param ipopo: The iPOPO service
:param factory: Component factory
:param component: Component name
""... | [
"def",
"_try_instantiate",
"(",
"self",
",",
"ipopo",
",",
"factory",
",",
"component",
")",
":",
"# type: (Any, str, str) -> None",
"try",
":",
"# Get component properties",
"with",
"self",
".",
"__lock",
":",
"properties",
"=",
"self",
".",
"__queue",
"[",
"fa... | Tries to instantiate a component from the queue. Hides all exceptions.
:param ipopo: The iPOPO service
:param factory: Component factory
:param component: Component name | [
"Tries",
"to",
"instantiate",
"a",
"component",
"from",
"the",
"queue",
".",
"Hides",
"all",
"exceptions",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L93-L121 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList._start | def _start(self):
"""
Starts the instantiation queue (called by its bundle activator)
"""
try:
# Try to register to factory events
with use_ipopo(self.__context) as ipopo:
ipopo.add_listener(self)
except BundleException:
# Servi... | python | def _start(self):
"""
Starts the instantiation queue (called by its bundle activator)
"""
try:
# Try to register to factory events
with use_ipopo(self.__context) as ipopo:
ipopo.add_listener(self)
except BundleException:
# Servi... | [
"def",
"_start",
"(",
"self",
")",
":",
"try",
":",
"# Try to register to factory events",
"with",
"use_ipopo",
"(",
"self",
".",
"__context",
")",
"as",
"ipopo",
":",
"ipopo",
".",
"add_listener",
"(",
"self",
")",
"except",
"BundleException",
":",
"# Service... | Starts the instantiation queue (called by its bundle activator) | [
"Starts",
"the",
"instantiation",
"queue",
"(",
"called",
"by",
"its",
"bundle",
"activator",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L123-L136 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList._stop | def _stop(self):
"""
Stops the instantiation queue (called by its bundle activator)
"""
# Unregisters the iPOPO service listener
self.__context.remove_service_listener(self)
try:
# Try to register to factory events
with use_ipopo(self.__context) a... | python | def _stop(self):
"""
Stops the instantiation queue (called by its bundle activator)
"""
# Unregisters the iPOPO service listener
self.__context.remove_service_listener(self)
try:
# Try to register to factory events
with use_ipopo(self.__context) a... | [
"def",
"_stop",
"(",
"self",
")",
":",
"# Unregisters the iPOPO service listener",
"self",
".",
"__context",
".",
"remove_service_listener",
"(",
"self",
")",
"try",
":",
"# Try to register to factory events",
"with",
"use_ipopo",
"(",
"self",
".",
"__context",
")",
... | Stops the instantiation queue (called by its bundle activator) | [
"Stops",
"the",
"instantiation",
"queue",
"(",
"called",
"by",
"its",
"bundle",
"activator",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L138-L151 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList._clear | def _clear(self):
"""
Clear all references (called by its bundle activator)
"""
self.__names.clear()
self.__queue.clear()
self.__context = None | python | def _clear(self):
"""
Clear all references (called by its bundle activator)
"""
self.__names.clear()
self.__queue.clear()
self.__context = None | [
"def",
"_clear",
"(",
"self",
")",
":",
"self",
".",
"__names",
".",
"clear",
"(",
")",
"self",
".",
"__queue",
".",
"clear",
"(",
")",
"self",
".",
"__context",
"=",
"None"
] | Clear all references (called by its bundle activator) | [
"Clear",
"all",
"references",
"(",
"called",
"by",
"its",
"bundle",
"activator",
")"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L153-L159 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList.service_changed | def service_changed(self, event):
# type: (ServiceEvent) -> None
"""
Handles an event about the iPOPO service
"""
kind = event.get_kind()
if kind == ServiceEvent.REGISTERED:
# iPOPO service registered: register to factory events
with use_ipopo(self... | python | def service_changed(self, event):
# type: (ServiceEvent) -> None
"""
Handles an event about the iPOPO service
"""
kind = event.get_kind()
if kind == ServiceEvent.REGISTERED:
# iPOPO service registered: register to factory events
with use_ipopo(self... | [
"def",
"service_changed",
"(",
"self",
",",
"event",
")",
":",
"# type: (ServiceEvent) -> None",
"kind",
"=",
"event",
".",
"get_kind",
"(",
")",
"if",
"kind",
"==",
"ServiceEvent",
".",
"REGISTERED",
":",
"# iPOPO service registered: register to factory events",
"wit... | Handles an event about the iPOPO service | [
"Handles",
"an",
"event",
"about",
"the",
"iPOPO",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L161-L170 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList.handle_ipopo_event | def handle_ipopo_event(self, event):
# type: (IPopoEvent) -> None
"""
Handles an iPOPO event
:param event: iPOPO event bean
"""
kind = event.get_kind()
if kind == IPopoEvent.REGISTERED:
# A factory has been registered
try:
... | python | def handle_ipopo_event(self, event):
# type: (IPopoEvent) -> None
"""
Handles an iPOPO event
:param event: iPOPO event bean
"""
kind = event.get_kind()
if kind == IPopoEvent.REGISTERED:
# A factory has been registered
try:
... | [
"def",
"handle_ipopo_event",
"(",
"self",
",",
"event",
")",
":",
"# type: (IPopoEvent) -> None",
"kind",
"=",
"event",
".",
"get_kind",
"(",
")",
"if",
"kind",
"==",
"IPopoEvent",
".",
"REGISTERED",
":",
"# A factory has been registered",
"try",
":",
"with",
"u... | Handles an iPOPO event
:param event: iPOPO event bean | [
"Handles",
"an",
"iPOPO",
"event"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L172-L197 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList.add | def add(self, factory, component, properties=None):
# type: (str, str, dict) -> None
"""
Enqueues the instantiation of the given component
:param factory: Factory name
:param component: Component name
:param properties: Component properties
:raise ValueError: Com... | python | def add(self, factory, component, properties=None):
# type: (str, str, dict) -> None
"""
Enqueues the instantiation of the given component
:param factory: Factory name
:param component: Component name
:param properties: Component properties
:raise ValueError: Com... | [
"def",
"add",
"(",
"self",
",",
"factory",
",",
"component",
",",
"properties",
"=",
"None",
")",
":",
"# type: (str, str, dict) -> None",
"with",
"self",
".",
"__lock",
":",
"if",
"component",
"in",
"self",
".",
"__names",
":",
"raise",
"ValueError",
"(",
... | Enqueues the instantiation of the given component
:param factory: Factory name
:param component: Component name
:param properties: Component properties
:raise ValueError: Component name already reserved in the queue
:raise Exception: Error instantiating the component | [
"Enqueues",
"the",
"instantiation",
"of",
"the",
"given",
"component"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L199-L230 |
tcalmant/ipopo | pelix/ipopo/waiting.py | IPopoWaitingList.remove | def remove(self, component):
# type: (str) -> None
"""
Kills/Removes the component with the given name
:param component: A component name
:raise KeyError: Unknown component
"""
with self.__lock:
# Find its factory
factory = self.__names.po... | python | def remove(self, component):
# type: (str) -> None
"""
Kills/Removes the component with the given name
:param component: A component name
:raise KeyError: Unknown component
"""
with self.__lock:
# Find its factory
factory = self.__names.po... | [
"def",
"remove",
"(",
"self",
",",
"component",
")",
":",
"# type: (str) -> None",
"with",
"self",
".",
"__lock",
":",
"# Find its factory",
"factory",
"=",
"self",
".",
"__names",
".",
"pop",
"(",
"component",
")",
"components",
"=",
"self",
".",
"__queue",... | Kills/Removes the component with the given name
:param component: A component name
:raise KeyError: Unknown component | [
"Kills",
"/",
"Removes",
"the",
"component",
"with",
"the",
"given",
"name"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/waiting.py#L232-L258 |
tcalmant/ipopo | pelix/shell/remote.py | _create_server | def _create_server(
shell,
server_address,
port,
cert_file=None,
key_file=None,
key_password=None,
ca_file=None,
):
"""
Creates the TCP console on the given address and port
:param shell: The remote shell handler
:param server_address: Server bound address
:param port: S... | python | def _create_server(
shell,
server_address,
port,
cert_file=None,
key_file=None,
key_password=None,
ca_file=None,
):
"""
Creates the TCP console on the given address and port
:param shell: The remote shell handler
:param server_address: Server bound address
:param port: S... | [
"def",
"_create_server",
"(",
"shell",
",",
"server_address",
",",
"port",
",",
"cert_file",
"=",
"None",
",",
"key_file",
"=",
"None",
",",
"key_password",
"=",
"None",
",",
"ca_file",
"=",
"None",
",",
")",
":",
"# Set up the request handler creator",
"activ... | Creates the TCP console on the given address and port
:param shell: The remote shell handler
:param server_address: Server bound address
:param port: Server port
:param cert_file: Path to the server certificate
:param key_file: Path to the server private key
:param key_password: Password for th... | [
"Creates",
"the",
"TCP",
"console",
"on",
"the",
"given",
"address",
"and",
"port"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L370-L425 |
tcalmant/ipopo | pelix/shell/remote.py | _run_interpreter | def _run_interpreter(variables, banner):
"""
Runs a Python interpreter console and blocks until the user exits it.
:param variables: Interpreters variables (locals)
:param banner: Start-up banners
"""
# Script-only imports
import code
try:
import readline
import rlcompl... | python | def _run_interpreter(variables, banner):
"""
Runs a Python interpreter console and blocks until the user exits it.
:param variables: Interpreters variables (locals)
:param banner: Start-up banners
"""
# Script-only imports
import code
try:
import readline
import rlcompl... | [
"def",
"_run_interpreter",
"(",
"variables",
",",
"banner",
")",
":",
"# Script-only imports",
"import",
"code",
"try",
":",
"import",
"readline",
"import",
"rlcompleter",
"readline",
".",
"set_completer",
"(",
"rlcompleter",
".",
"Completer",
"(",
"variables",
")... | Runs a Python interpreter console and blocks until the user exits it.
:param variables: Interpreters variables (locals)
:param banner: Start-up banners | [
"Runs",
"a",
"Python",
"interpreter",
"console",
"and",
"blocks",
"until",
"the",
"user",
"exits",
"it",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L565-L587 |
tcalmant/ipopo | pelix/shell/remote.py | main | def main(argv=None):
"""
Script entry point
:param argv: Script arguments (None for sys.argv)
:return: An exit code or None
"""
# Prepare arguments
parser = argparse.ArgumentParser(
prog="pelix.shell.remote",
parents=[make_common_parser()],
description="Pelix Remote ... | python | def main(argv=None):
"""
Script entry point
:param argv: Script arguments (None for sys.argv)
:return: An exit code or None
"""
# Prepare arguments
parser = argparse.ArgumentParser(
prog="pelix.shell.remote",
parents=[make_common_parser()],
description="Pelix Remote ... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"# Prepare arguments",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"pelix.shell.remote\"",
",",
"parents",
"=",
"[",
"make_common_parser",
"(",
")",
"]",
",",
"description",
"=",
"\... | Script entry point
:param argv: Script arguments (None for sys.argv)
:return: An exit code or None | [
"Script",
"entry",
"point"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L590-L767 |
tcalmant/ipopo | pelix/shell/remote.py | RemoteConsole.send | def send(self, data):
"""
Tries to send data to the client.
:param data: Data to be sent
:return: True if the data was sent, False on error
"""
if data is not None:
data = data.encode("UTF-8")
try:
self.wfile.write(data)
self.... | python | def send(self, data):
"""
Tries to send data to the client.
:param data: Data to be sent
:return: True if the data was sent, False on error
"""
if data is not None:
data = data.encode("UTF-8")
try:
self.wfile.write(data)
self.... | [
"def",
"send",
"(",
"self",
",",
"data",
")",
":",
"if",
"data",
"is",
"not",
"None",
":",
"data",
"=",
"data",
".",
"encode",
"(",
"\"UTF-8\"",
")",
"try",
":",
"self",
".",
"wfile",
".",
"write",
"(",
"data",
")",
"self",
".",
"wfile",
".",
"... | Tries to send data to the client.
:param data: Data to be sent
:return: True if the data was sent, False on error | [
"Tries",
"to",
"send",
"data",
"to",
"the",
"client",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L138-L157 |
tcalmant/ipopo | pelix/shell/remote.py | RemoteConsole.handle | def handle(self):
"""
Handles a TCP client
"""
_logger.info(
"RemoteConsole client connected: [%s]:%d",
self.client_address[0],
self.client_address[1],
)
# Prepare the session
session = beans.ShellSession(
beans.IOH... | python | def handle(self):
"""
Handles a TCP client
"""
_logger.info(
"RemoteConsole client connected: [%s]:%d",
self.client_address[0],
self.client_address[1],
)
# Prepare the session
session = beans.ShellSession(
beans.IOH... | [
"def",
"handle",
"(",
"self",
")",
":",
"_logger",
".",
"info",
"(",
"\"RemoteConsole client connected: [%s]:%d\"",
",",
"self",
".",
"client_address",
"[",
"0",
"]",
",",
"self",
".",
"client_address",
"[",
"1",
"]",
",",
")",
"# Prepare the session",
"sessio... | Handles a TCP client | [
"Handles",
"a",
"TCP",
"client"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L159-L243 |
tcalmant/ipopo | pelix/shell/remote.py | ThreadingTCPServerFamily.get_request | def get_request(self):
"""
Accepts a new client. Sets up SSL wrapping if necessary.
:return: A tuple: (client socket, client address tuple)
"""
# Accept the client
client_socket, client_address = self.socket.accept()
if ssl is not None and self.cert_file:
... | python | def get_request(self):
"""
Accepts a new client. Sets up SSL wrapping if necessary.
:return: A tuple: (client socket, client address tuple)
"""
# Accept the client
client_socket, client_address = self.socket.accept()
if ssl is not None and self.cert_file:
... | [
"def",
"get_request",
"(",
"self",
")",
":",
"# Accept the client",
"client_socket",
",",
"client_address",
"=",
"self",
".",
"socket",
".",
"accept",
"(",
")",
"if",
"ssl",
"is",
"not",
"None",
"and",
"self",
".",
"cert_file",
":",
"# Setup an SSL context to ... | Accepts a new client. Sets up SSL wrapping if necessary.
:return: A tuple: (client socket, client address tuple) | [
"Accepts",
"a",
"new",
"client",
".",
"Sets",
"up",
"SSL",
"wrapping",
"if",
"necessary",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L301-L352 |
tcalmant/ipopo | pelix/shell/remote.py | ThreadingTCPServerFamily.process_request | def process_request(self, request, client_address):
"""
Starts a new thread to process the request, adding the client address
in its name.
"""
thread = threading.Thread(
name="RemoteShell-{0}-Client-{1}".format(
self.server_address[1], client_address[:... | python | def process_request(self, request, client_address):
"""
Starts a new thread to process the request, adding the client address
in its name.
"""
thread = threading.Thread(
name="RemoteShell-{0}-Client-{1}".format(
self.server_address[1], client_address[:... | [
"def",
"process_request",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"thread",
"=",
"threading",
".",
"Thread",
"(",
"name",
"=",
"\"RemoteShell-{0}-Client-{1}\"",
".",
"format",
"(",
"self",
".",
"server_address",
"[",
"1",
"]",
",",
"cli... | Starts a new thread to process the request, adding the client address
in its name. | [
"Starts",
"a",
"new",
"thread",
"to",
"process",
"the",
"request",
"adding",
"the",
"client",
"address",
"in",
"its",
"name",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/remote.py#L354-L367 |
tcalmant/ipopo | pelix/shell/completion/ipopo.py | ComponentFactoryCompleter.display_hook | def display_hook(prompt, session, context, matches, longest_match_len):
# type: (str, ShellSession, BundleContext, List[str], int) -> None
"""
Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session... | python | def display_hook(prompt, session, context, matches, longest_match_len):
# type: (str, ShellSession, BundleContext, List[str], int) -> None
"""
Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session... | [
"def",
"display_hook",
"(",
"prompt",
",",
"session",
",",
"context",
",",
"matches",
",",
"longest_match_len",
")",
":",
"# type: (str, ShellSession, BundleContext, List[str], int) -> None",
"# Prepare a line pattern for each match (-1 for the trailing space)",
"match_pattern",
"=... | Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session (for display)
:param context: BundleContext of the shell
:param matches: List of words matching the substitution
:param longest_match_len: Len... | [
"Displays",
"the",
"available",
"services",
"matches",
"and",
"the",
"service",
"details"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/ipopo.py#L79-L110 |
tcalmant/ipopo | pelix/shell/completion/ipopo.py | ComponentFactoryCompleter.complete | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | python | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | [
"def",
"complete",
"(",
"self",
",",
"config",
",",
"prompt",
",",
"session",
",",
"context",
",",
"current_arguments",
",",
"current",
")",
":",
"# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]",
"# Register a method to display helpful c... | Returns the list of services IDs matching the current state
:param config: Configuration of the current completion
:param prompt: Shell prompt (for re-display)
:param session: Shell session (to display in shell)
:param context: Bundle context of the Shell bundle
:param current_a... | [
"Returns",
"the",
"list",
"of",
"services",
"IDs",
"matching",
"the",
"current",
"state"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/ipopo.py#L112-L136 |
tcalmant/ipopo | pelix/shell/completion/ipopo.py | ComponentInstanceCompleter.display_hook | def display_hook(prompt, session, context, matches, longest_match_len):
# type: (str, ShellSession, BundleContext, List[str], int) -> None
"""
Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session... | python | def display_hook(prompt, session, context, matches, longest_match_len):
# type: (str, ShellSession, BundleContext, List[str], int) -> None
"""
Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session... | [
"def",
"display_hook",
"(",
"prompt",
",",
"session",
",",
"context",
",",
"matches",
",",
"longest_match_len",
")",
":",
"# type: (str, ShellSession, BundleContext, List[str], int) -> None",
"# Prepare a line pattern for each match (-1 for the trailing space)",
"match_pattern",
"=... | Displays the available services matches and the service details
:param prompt: Shell prompt string
:param session: Current shell session (for display)
:param context: BundleContext of the shell
:param matches: List of words matching the substitution
:param longest_match_len: Len... | [
"Displays",
"the",
"available",
"services",
"matches",
"and",
"the",
"service",
"details"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/ipopo.py#L145-L175 |
tcalmant/ipopo | pelix/shell/completion/ipopo.py | ComponentInstanceCompleter.complete | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | python | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | [
"def",
"complete",
"(",
"self",
",",
"config",
",",
"prompt",
",",
"session",
",",
"context",
",",
"current_arguments",
",",
"current",
")",
":",
"# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]",
"# Register a method to display helpful c... | Returns the list of services IDs matching the current state
:param config: Configuration of the current completion
:param prompt: Shell prompt (for re-display)
:param session: Shell session (to display in shell)
:param context: Bundle context of the Shell bundle
:param current_a... | [
"Returns",
"the",
"list",
"of",
"services",
"IDs",
"matching",
"the",
"current",
"state"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/ipopo.py#L177-L201 |
tcalmant/ipopo | pelix/shell/completion/ipopo.py | ComponentFactoryPropertiesCompleter.complete | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | python | def complete(
self, config, prompt, session, context, current_arguments, current
):
# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]
"""
Returns the list of services IDs matching the current state
:param config: Configuration of the cur... | [
"def",
"complete",
"(",
"self",
",",
"config",
",",
"prompt",
",",
"session",
",",
"context",
",",
"current_arguments",
",",
"current",
")",
":",
"# type: (CompletionInfo, str, ShellSession, BundleContext, List[str], str) -> List[str]",
"with",
"use_ipopo",
"(",
"context"... | Returns the list of services IDs matching the current state
:param config: Configuration of the current completion
:param prompt: Shell prompt (for re-display)
:param session: Shell session (to display in shell)
:param context: Bundle context of the Shell bundle
:param current_a... | [
"Returns",
"the",
"list",
"of",
"services",
"IDs",
"matching",
"the",
"current",
"state"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/ipopo.py#L209-L254 |
tcalmant/ipopo | pelix/http/basic.py | _HTTPServletRequest.get_header | def get_header(self, name, default=None):
"""
Retrieves the value of a header
"""
return self._handler.headers.get(name, default) | python | def get_header(self, name, default=None):
"""
Retrieves the value of a header
"""
return self._handler.headers.get(name, default) | [
"def",
"get_header",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"_handler",
".",
"headers",
".",
"get",
"(",
"name",
",",
"default",
")"
] | Retrieves the value of a header | [
"Retrieves",
"the",
"value",
"of",
"a",
"header"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L135-L139 |
tcalmant/ipopo | pelix/http/basic.py | _HTTPServletResponse.end_headers | def end_headers(self):
"""
Ends the headers part
"""
# Send them all at once
for name, value in self._headers.items():
self._handler.send_header(name, value)
self._handler.end_headers() | python | def end_headers(self):
"""
Ends the headers part
"""
# Send them all at once
for name, value in self._headers.items():
self._handler.send_header(name, value)
self._handler.end_headers() | [
"def",
"end_headers",
"(",
"self",
")",
":",
"# Send them all at once",
"for",
"name",
",",
"value",
"in",
"self",
".",
"_headers",
".",
"items",
"(",
")",
":",
"self",
".",
"_handler",
".",
"send_header",
"(",
"name",
",",
"value",
")",
"self",
".",
"... | Ends the headers part | [
"Ends",
"the",
"headers",
"part"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L219-L227 |
tcalmant/ipopo | pelix/http/basic.py | _RequestHandler.log_error | def log_error(self, message, *args, **kwargs):
# pylint: disable=W0221
"""
Log server error
"""
self._service.log(logging.ERROR, message, *args, **kwargs) | python | def log_error(self, message, *args, **kwargs):
# pylint: disable=W0221
"""
Log server error
"""
self._service.log(logging.ERROR, message, *args, **kwargs) | [
"def",
"log_error",
"(",
"self",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=W0221",
"self",
".",
"_service",
".",
"log",
"(",
"logging",
".",
"ERROR",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwar... | Log server error | [
"Log",
"server",
"error"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L315-L320 |
tcalmant/ipopo | pelix/http/basic.py | _RequestHandler.log_request | def log_request(self, code="-", size="-"):
"""
Logs a request to the server
"""
self._service.log(logging.DEBUG, '"%s" %s', self.requestline, code) | python | def log_request(self, code="-", size="-"):
"""
Logs a request to the server
"""
self._service.log(logging.DEBUG, '"%s" %s', self.requestline, code) | [
"def",
"log_request",
"(",
"self",
",",
"code",
"=",
"\"-\"",
",",
"size",
"=",
"\"-\"",
")",
":",
"self",
".",
"_service",
".",
"log",
"(",
"logging",
".",
"DEBUG",
",",
"'\"%s\" %s'",
",",
"self",
".",
"requestline",
",",
"code",
")"
] | Logs a request to the server | [
"Logs",
"a",
"request",
"to",
"the",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L322-L326 |
tcalmant/ipopo | pelix/http/basic.py | _RequestHandler.send_no_servlet_response | def send_no_servlet_response(self):
"""
Default response sent when no servlet is found for the requested path
"""
# Use the helper to send the error page
response = _HTTPServletResponse(self)
response.send_content(404, self._service.make_not_found_page(self.path)) | python | def send_no_servlet_response(self):
"""
Default response sent when no servlet is found for the requested path
"""
# Use the helper to send the error page
response = _HTTPServletResponse(self)
response.send_content(404, self._service.make_not_found_page(self.path)) | [
"def",
"send_no_servlet_response",
"(",
"self",
")",
":",
"# Use the helper to send the error page",
"response",
"=",
"_HTTPServletResponse",
"(",
"self",
")",
"response",
".",
"send_content",
"(",
"404",
",",
"self",
".",
"_service",
".",
"make_not_found_page",
"(",
... | Default response sent when no servlet is found for the requested path | [
"Default",
"response",
"sent",
"when",
"no",
"servlet",
"is",
"found",
"for",
"the",
"requested",
"path"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L328-L334 |
tcalmant/ipopo | pelix/http/basic.py | _RequestHandler.send_exception | def send_exception(self, response):
"""
Sends an exception page with a 500 error code.
Must be called from inside the exception handling block.
:param response: The response handler
"""
# Get a formatted stack trace
stack = traceback.format_exc()
# Log t... | python | def send_exception(self, response):
"""
Sends an exception page with a 500 error code.
Must be called from inside the exception handling block.
:param response: The response handler
"""
# Get a formatted stack trace
stack = traceback.format_exc()
# Log t... | [
"def",
"send_exception",
"(",
"self",
",",
"response",
")",
":",
"# Get a formatted stack trace",
"stack",
"=",
"traceback",
".",
"format_exc",
"(",
")",
"# Log the error",
"self",
".",
"log_error",
"(",
"\"Error handling request upon: %s\\n%s\\n\"",
",",
"self",
".",... | Sends an exception page with a 500 error code.
Must be called from inside the exception handling block.
:param response: The response handler | [
"Sends",
"an",
"exception",
"page",
"with",
"a",
"500",
"error",
"code",
".",
"Must",
"be",
"called",
"from",
"inside",
"the",
"exception",
"handling",
"block",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L336-L354 |
tcalmant/ipopo | pelix/http/basic.py | _HttpServerFamily.server_bind | def server_bind(self):
"""
Override server_bind to store the server name, even in IronPython.
See https://ironpython.codeplex.com/workitem/29477
"""
TCPServer.server_bind(self)
host, port = self.socket.getsockname()[:2]
self.server_port = port
try:
... | python | def server_bind(self):
"""
Override server_bind to store the server name, even in IronPython.
See https://ironpython.codeplex.com/workitem/29477
"""
TCPServer.server_bind(self)
host, port = self.socket.getsockname()[:2]
self.server_port = port
try:
... | [
"def",
"server_bind",
"(",
"self",
")",
":",
"TCPServer",
".",
"server_bind",
"(",
"self",
")",
"host",
",",
"port",
"=",
"self",
".",
"socket",
".",
"getsockname",
"(",
")",
"[",
":",
"2",
"]",
"self",
".",
"server_port",
"=",
"port",
"try",
":",
... | Override server_bind to store the server name, even in IronPython.
See https://ironpython.codeplex.com/workitem/29477 | [
"Override",
"server_bind",
"to",
"store",
"the",
"server",
"name",
"even",
"in",
"IronPython",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/basic.py#L419-L432 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | encode_list | def encode_list(key, list_):
# type: (str, Iterable) -> Dict[str, str]
"""
Converts a list into a space-separated string and puts it in a dictionary
:param key: Dictionary key to store the list
:param list_: A list of objects
:return: A dictionary key->string or an empty dictionary
"""
... | python | def encode_list(key, list_):
# type: (str, Iterable) -> Dict[str, str]
"""
Converts a list into a space-separated string and puts it in a dictionary
:param key: Dictionary key to store the list
:param list_: A list of objects
:return: A dictionary key->string or an empty dictionary
"""
... | [
"def",
"encode_list",
"(",
"key",
",",
"list_",
")",
":",
"# type: (str, Iterable) -> Dict[str, str]",
"if",
"not",
"list_",
":",
"return",
"{",
"}",
"return",
"{",
"key",
":",
"\" \"",
".",
"join",
"(",
"str",
"(",
"i",
")",
"for",
"i",
"in",
"list_",
... | Converts a list into a space-separated string and puts it in a dictionary
:param key: Dictionary key to store the list
:param list_: A list of objects
:return: A dictionary key->string or an empty dictionary | [
"Converts",
"a",
"list",
"into",
"a",
"space",
"-",
"separated",
"string",
"and",
"puts",
"it",
"in",
"a",
"dictionary"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L89-L100 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | package_name | def package_name(package):
# type: (str) -> str
"""
Returns the package name of the given module name
"""
if not package:
return ""
lastdot = package.rfind(".")
if lastdot == -1:
return package
return package[:lastdot] | python | def package_name(package):
# type: (str) -> str
"""
Returns the package name of the given module name
"""
if not package:
return ""
lastdot = package.rfind(".")
if lastdot == -1:
return package
return package[:lastdot] | [
"def",
"package_name",
"(",
"package",
")",
":",
"# type: (str) -> str",
"if",
"not",
"package",
":",
"return",
"\"\"",
"lastdot",
"=",
"package",
".",
"rfind",
"(",
"\".\"",
")",
"if",
"lastdot",
"==",
"-",
"1",
":",
"return",
"package",
"return",
"packag... | Returns the package name of the given module name | [
"Returns",
"the",
"package",
"name",
"of",
"the",
"given",
"module",
"name"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L103-L115 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | encode_osgi_props | def encode_osgi_props(ed):
# type: (EndpointDescription) -> Dict[str, str]
"""
Prepares a dictionary of OSGi properties for the given EndpointDescription
"""
result_props = {}
intfs = ed.get_interfaces()
result_props[OBJECTCLASS] = " ".join(intfs)
for intf in intfs:
pkg_name = pa... | python | def encode_osgi_props(ed):
# type: (EndpointDescription) -> Dict[str, str]
"""
Prepares a dictionary of OSGi properties for the given EndpointDescription
"""
result_props = {}
intfs = ed.get_interfaces()
result_props[OBJECTCLASS] = " ".join(intfs)
for intf in intfs:
pkg_name = pa... | [
"def",
"encode_osgi_props",
"(",
"ed",
")",
":",
"# type: (EndpointDescription) -> Dict[str, str]",
"result_props",
"=",
"{",
"}",
"intfs",
"=",
"ed",
".",
"get_interfaces",
"(",
")",
"result_props",
"[",
"OBJECTCLASS",
"]",
"=",
"\" \"",
".",
"join",
"(",
"intf... | Prepares a dictionary of OSGi properties for the given EndpointDescription | [
"Prepares",
"a",
"dictionary",
"of",
"OSGi",
"properties",
"for",
"the",
"given",
"EndpointDescription"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L118-L151 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | decode_list | def decode_list(input_props, name):
# type: (Dict[str, str], str) -> List[str]
"""
Decodes a space-separated list
"""
val_str = input_props.get(name, None)
if val_str:
return val_str.split(" ")
return [] | python | def decode_list(input_props, name):
# type: (Dict[str, str], str) -> List[str]
"""
Decodes a space-separated list
"""
val_str = input_props.get(name, None)
if val_str:
return val_str.split(" ")
return [] | [
"def",
"decode_list",
"(",
"input_props",
",",
"name",
")",
":",
"# type: (Dict[str, str], str) -> List[str]",
"val_str",
"=",
"input_props",
".",
"get",
"(",
"name",
",",
"None",
")",
"if",
"val_str",
":",
"return",
"val_str",
".",
"split",
"(",
"\" \"",
")",... | Decodes a space-separated list | [
"Decodes",
"a",
"space",
"-",
"separated",
"list"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L154-L162 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | decode_osgi_props | def decode_osgi_props(input_props):
# type: (Dict[str, Any]) -> Dict[str, Any]
"""
Decodes the OSGi properties of the given endpoint properties
"""
result_props = {}
intfs = decode_list(input_props, OBJECTCLASS)
result_props[OBJECTCLASS] = intfs
for intf in intfs:
package_key = E... | python | def decode_osgi_props(input_props):
# type: (Dict[str, Any]) -> Dict[str, Any]
"""
Decodes the OSGi properties of the given endpoint properties
"""
result_props = {}
intfs = decode_list(input_props, OBJECTCLASS)
result_props[OBJECTCLASS] = intfs
for intf in intfs:
package_key = E... | [
"def",
"decode_osgi_props",
"(",
"input_props",
")",
":",
"# type: (Dict[str, Any]) -> Dict[str, Any]",
"result_props",
"=",
"{",
"}",
"intfs",
"=",
"decode_list",
"(",
"input_props",
",",
"OBJECTCLASS",
")",
"result_props",
"[",
"OBJECTCLASS",
"]",
"=",
"intfs",
"f... | Decodes the OSGi properties of the given endpoint properties | [
"Decodes",
"the",
"OSGi",
"properties",
"of",
"the",
"given",
"endpoint",
"properties"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L165-L193 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | decode_endpoint_props | def decode_endpoint_props(input_props):
# type: (Dict) -> Dict[str, Any]
"""
Decodes the endpoint properties from the given dictionary
"""
ed_props = decode_osgi_props(input_props)
ed_props[ECF_ENDPOINT_CONTAINERID_NAMESPACE] = input_props[
ECF_ENDPOINT_CONTAINERID_NAMESPACE
]
ed... | python | def decode_endpoint_props(input_props):
# type: (Dict) -> Dict[str, Any]
"""
Decodes the endpoint properties from the given dictionary
"""
ed_props = decode_osgi_props(input_props)
ed_props[ECF_ENDPOINT_CONTAINERID_NAMESPACE] = input_props[
ECF_ENDPOINT_CONTAINERID_NAMESPACE
]
ed... | [
"def",
"decode_endpoint_props",
"(",
"input_props",
")",
":",
"# type: (Dict) -> Dict[str, Any]",
"ed_props",
"=",
"decode_osgi_props",
"(",
"input_props",
")",
"ed_props",
"[",
"ECF_ENDPOINT_CONTAINERID_NAMESPACE",
"]",
"=",
"input_props",
"[",
"ECF_ENDPOINT_CONTAINERID_NAME... | Decodes the endpoint properties from the given dictionary | [
"Decodes",
"the",
"endpoint",
"properties",
"from",
"the",
"given",
"dictionary"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L196-L233 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | encode_endpoint_props | def encode_endpoint_props(ed):
"""
Encodes the properties of the given EndpointDescription
"""
props = encode_osgi_props(ed)
props[ECF_RSVC_ID] = "{0}".format(ed.get_remoteservice_id()[1])
props[ECF_ENDPOINT_ID] = "{0}".format(ed.get_container_id()[1])
props[ECF_ENDPOINT_CONTAINERID_NAMESPAC... | python | def encode_endpoint_props(ed):
"""
Encodes the properties of the given EndpointDescription
"""
props = encode_osgi_props(ed)
props[ECF_RSVC_ID] = "{0}".format(ed.get_remoteservice_id()[1])
props[ECF_ENDPOINT_ID] = "{0}".format(ed.get_container_id()[1])
props[ECF_ENDPOINT_CONTAINERID_NAMESPAC... | [
"def",
"encode_endpoint_props",
"(",
"ed",
")",
":",
"props",
"=",
"encode_osgi_props",
"(",
"ed",
")",
"props",
"[",
"ECF_RSVC_ID",
"]",
"=",
"\"{0}\"",
".",
"format",
"(",
"ed",
".",
"get_remoteservice_id",
"(",
")",
"[",
"1",
"]",
")",
"props",
"[",
... | Encodes the properties of the given EndpointDescription | [
"Encodes",
"the",
"properties",
"of",
"the",
"given",
"EndpointDescription"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L236-L266 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | EndpointDescription.get_package_version | def get_package_version(self, package):
# type: (str) -> Tuple[int, int, int]
"""
Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0)
"""
name = "{0}{1}".forma... | python | def get_package_version(self, package):
# type: (str) -> Tuple[int, int, int]
"""
Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0)
"""
name = "{0}{1}".forma... | [
"def",
"get_package_version",
"(",
"self",
",",
"package",
")",
":",
"# type: (str) -> Tuple[int, int, int]",
"name",
"=",
"\"{0}{1}\"",
".",
"format",
"(",
"ENDPOINT_PACKAGE_VERSION_",
",",
"package",
")",
"try",
":",
"# Get the version string",
"version",
"=",
"self... | Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0) | [
"Provides",
"the",
"version",
"of",
"the",
"given",
"package",
"name",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L555-L571 |
tcalmant/ipopo | pelix/rsa/endpointdescription.py | EndpointDescription.is_same_service | def is_same_service(self, endpoint):
# type: (EndpointDescription) -> bool
"""
Tests if this endpoint and the given one have the same framework UUID
and service ID
:param endpoint: Another endpoint
:return: True if both endpoints represent the same remote service
... | python | def is_same_service(self, endpoint):
# type: (EndpointDescription) -> bool
"""
Tests if this endpoint and the given one have the same framework UUID
and service ID
:param endpoint: Another endpoint
:return: True if both endpoints represent the same remote service
... | [
"def",
"is_same_service",
"(",
"self",
",",
"endpoint",
")",
":",
"# type: (EndpointDescription) -> bool",
"return",
"(",
"self",
".",
"get_framework_uuid",
"(",
")",
"==",
"endpoint",
".",
"get_framework_uuid",
"(",
")",
"and",
"self",
".",
"get_service_id",
"(",... | Tests if this endpoint and the given one have the same framework UUID
and service ID
:param endpoint: Another endpoint
:return: True if both endpoints represent the same remote service | [
"Tests",
"if",
"this",
"endpoint",
"and",
"the",
"given",
"one",
"have",
"the",
"same",
"framework",
"UUID",
"and",
"service",
"ID"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/endpointdescription.py#L582-L594 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.generate_id | def generate_id(cls, prefix="pelix-"):
"""
Generates a random MQTT client ID
:param prefix: Client ID prefix (truncated to 8 chars)
:return: A client ID of 22 or 23 characters
"""
if not prefix:
# Normalize string
prefix = ""
else:
... | python | def generate_id(cls, prefix="pelix-"):
"""
Generates a random MQTT client ID
:param prefix: Client ID prefix (truncated to 8 chars)
:return: A client ID of 22 or 23 characters
"""
if not prefix:
# Normalize string
prefix = ""
else:
... | [
"def",
"generate_id",
"(",
"cls",
",",
"prefix",
"=",
"\"pelix-\"",
")",
":",
"if",
"not",
"prefix",
":",
"# Normalize string",
"prefix",
"=",
"\"\"",
"else",
":",
"# Truncate long prefixes",
"prefix",
"=",
"prefix",
"[",
":",
"8",
"]",
"# Prepare the missing ... | Generates a random MQTT client ID
:param prefix: Client ID prefix (truncated to 8 chars)
:return: A client ID of 22 or 23 characters | [
"Generates",
"a",
"random",
"MQTT",
"client",
"ID"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L141-L165 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.set_will | def set_will(self, topic, payload, qos=0, retain=False):
"""
Sets up the will message
:param topic: Topic of the will message
:param payload: Content of the message
:param qos: Quality of Service
:param retain: The message will be retained
:raise ValueError: Inva... | python | def set_will(self, topic, payload, qos=0, retain=False):
"""
Sets up the will message
:param topic: Topic of the will message
:param payload: Content of the message
:param qos: Quality of Service
:param retain: The message will be retained
:raise ValueError: Inva... | [
"def",
"set_will",
"(",
"self",
",",
"topic",
",",
"payload",
",",
"qos",
"=",
"0",
",",
"retain",
"=",
"False",
")",
":",
"self",
".",
"__mqtt",
".",
"will_set",
"(",
"topic",
",",
"payload",
",",
"qos",
",",
"retain",
"=",
"retain",
")"
] | Sets up the will message
:param topic: Topic of the will message
:param payload: Content of the message
:param qos: Quality of Service
:param retain: The message will be retained
:raise ValueError: Invalid topic
:raise TypeError: Invalid payload | [
"Sets",
"up",
"the",
"will",
"message"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L194-L205 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.connect | def connect(self, host="localhost", port=1883, keepalive=60):
"""
Connects to the MQTT server. The client will automatically try to
reconnect to this server when the connection is lost.
:param host: MQTT server host
:param port: MQTT server port
:param keepalive: Maximum... | python | def connect(self, host="localhost", port=1883, keepalive=60):
"""
Connects to the MQTT server. The client will automatically try to
reconnect to this server when the connection is lost.
:param host: MQTT server host
:param port: MQTT server port
:param keepalive: Maximum... | [
"def",
"connect",
"(",
"self",
",",
"host",
"=",
"\"localhost\"",
",",
"port",
"=",
"1883",
",",
"keepalive",
"=",
"60",
")",
":",
"# Disconnect first (it also stops the timer)",
"self",
".",
"disconnect",
"(",
")",
"# Prepare the connection",
"self",
".",
"__mq... | Connects to the MQTT server. The client will automatically try to
reconnect to this server when the connection is lost.
:param host: MQTT server host
:param port: MQTT server port
:param keepalive: Maximum period in seconds between communications with
the broke... | [
"Connects",
"to",
"the",
"MQTT",
"server",
".",
"The",
"client",
"will",
"automatically",
"try",
"to",
"reconnect",
"to",
"this",
"server",
"when",
"the",
"connection",
"is",
"lost",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L207-L225 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.disconnect | def disconnect(self):
"""
Disconnects from the MQTT server
"""
# Stop the timer
self.__stop_timer()
# Unlock all publishers
for event in self.__in_flight.values():
event.set()
# Disconnect from the server
self.__mqtt.disconnect()
... | python | def disconnect(self):
"""
Disconnects from the MQTT server
"""
# Stop the timer
self.__stop_timer()
# Unlock all publishers
for event in self.__in_flight.values():
event.set()
# Disconnect from the server
self.__mqtt.disconnect()
... | [
"def",
"disconnect",
"(",
"self",
")",
":",
"# Stop the timer",
"self",
".",
"__stop_timer",
"(",
")",
"# Unlock all publishers",
"for",
"event",
"in",
"self",
".",
"__in_flight",
".",
"values",
"(",
")",
":",
"event",
".",
"set",
"(",
")",
"# Disconnect fro... | Disconnects from the MQTT server | [
"Disconnects",
"from",
"the",
"MQTT",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L227-L248 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.publish | def publish(self, topic, payload, qos=0, retain=False, wait=False):
"""
Sends a message through the MQTT connection
:param topic: Message topic
:param payload: Message content
:param qos: Quality of Service
:param retain: Retain flag
:param wait: If True, prepare... | python | def publish(self, topic, payload, qos=0, retain=False, wait=False):
"""
Sends a message through the MQTT connection
:param topic: Message topic
:param payload: Message content
:param qos: Quality of Service
:param retain: Retain flag
:param wait: If True, prepare... | [
"def",
"publish",
"(",
"self",
",",
"topic",
",",
"payload",
",",
"qos",
"=",
"0",
",",
"retain",
"=",
"False",
",",
"wait",
"=",
"False",
")",
":",
"result",
"=",
"self",
".",
"__mqtt",
".",
"publish",
"(",
"topic",
",",
"payload",
",",
"qos",
"... | Sends a message through the MQTT connection
:param topic: Message topic
:param payload: Message content
:param qos: Quality of Service
:param retain: Retain flag
:param wait: If True, prepares an event to wait for the message to be
published
:return:... | [
"Sends",
"a",
"message",
"through",
"the",
"MQTT",
"connection"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L250-L268 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__start_timer | def __start_timer(self, delay):
"""
Starts the reconnection timer
:param delay: Delay (in seconds) before calling the reconnection method
"""
self.__timer = threading.Timer(delay, self.__reconnect)
self.__timer.daemon = True
self.__timer.start() | python | def __start_timer(self, delay):
"""
Starts the reconnection timer
:param delay: Delay (in seconds) before calling the reconnection method
"""
self.__timer = threading.Timer(delay, self.__reconnect)
self.__timer.daemon = True
self.__timer.start() | [
"def",
"__start_timer",
"(",
"self",
",",
"delay",
")",
":",
"self",
".",
"__timer",
"=",
"threading",
".",
"Timer",
"(",
"delay",
",",
"self",
".",
"__reconnect",
")",
"self",
".",
"__timer",
".",
"daemon",
"=",
"True",
"self",
".",
"__timer",
".",
... | Starts the reconnection timer
:param delay: Delay (in seconds) before calling the reconnection method | [
"Starts",
"the",
"reconnection",
"timer"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L300-L308 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__reconnect | def __reconnect(self):
"""
Tries to connect to the MQTT server
"""
# Cancel the timer, if any
self.__stop_timer()
try:
# Try to reconnect the server
result_code = self.__mqtt.reconnect()
if result_code:
# Something wron... | python | def __reconnect(self):
"""
Tries to connect to the MQTT server
"""
# Cancel the timer, if any
self.__stop_timer()
try:
# Try to reconnect the server
result_code = self.__mqtt.reconnect()
if result_code:
# Something wron... | [
"def",
"__reconnect",
"(",
"self",
")",
":",
"# Cancel the timer, if any",
"self",
".",
"__stop_timer",
"(",
")",
"try",
":",
"# Try to reconnect the server",
"result_code",
"=",
"self",
".",
"__mqtt",
".",
"reconnect",
"(",
")",
"if",
"result_code",
":",
"# Som... | Tries to connect to the MQTT server | [
"Tries",
"to",
"connect",
"to",
"the",
"MQTT",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L318-L341 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__on_connect | def __on_connect(self, client, userdata, flags, result_code):
# pylint: disable=W0613
"""
Client connected to the server
:param client: Connected Paho client
:param userdata: User data (unused)
:param flags: Response flags sent by the broker
:param result_code: C... | python | def __on_connect(self, client, userdata, flags, result_code):
# pylint: disable=W0613
"""
Client connected to the server
:param client: Connected Paho client
:param userdata: User data (unused)
:param flags: Response flags sent by the broker
:param result_code: C... | [
"def",
"__on_connect",
"(",
"self",
",",
"client",
",",
"userdata",
",",
"flags",
",",
"result_code",
")",
":",
"# pylint: disable=W0613",
"if",
"result_code",
":",
"# result_code != 0: something wrong happened",
"_logger",
".",
"error",
"(",
"\"Error connecting the MQT... | Client connected to the server
:param client: Connected Paho client
:param userdata: User data (unused)
:param flags: Response flags sent by the broker
:param result_code: Connection result code (0: success, others: error) | [
"Client",
"connected",
"to",
"the",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L343-L369 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__on_disconnect | def __on_disconnect(self, client, userdata, result_code):
# pylint: disable=W0613
"""
Client has been disconnected from the server
:param client: Client that received the message
:param userdata: User data (unused)
:param result_code: Disconnection reason (0: expected, 1... | python | def __on_disconnect(self, client, userdata, result_code):
# pylint: disable=W0613
"""
Client has been disconnected from the server
:param client: Client that received the message
:param userdata: User data (unused)
:param result_code: Disconnection reason (0: expected, 1... | [
"def",
"__on_disconnect",
"(",
"self",
",",
"client",
",",
"userdata",
",",
"result_code",
")",
":",
"# pylint: disable=W0613",
"if",
"result_code",
":",
"# rc != 0: unexpected disconnection",
"_logger",
".",
"error",
"(",
"\"Unexpected disconnection from the MQTT server: %... | Client has been disconnected from the server
:param client: Client that received the message
:param userdata: User data (unused)
:param result_code: Disconnection reason (0: expected, 1: error) | [
"Client",
"has",
"been",
"disconnected",
"from",
"the",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L371-L397 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__on_message | def __on_message(self, client, userdata, msg):
# pylint: disable=W0613
"""
A message has been received from a server
:param client: Client that received the message
:param userdata: User data (unused)
:param msg: A MQTTMessage bean
"""
# Notify the caller... | python | def __on_message(self, client, userdata, msg):
# pylint: disable=W0613
"""
A message has been received from a server
:param client: Client that received the message
:param userdata: User data (unused)
:param msg: A MQTTMessage bean
"""
# Notify the caller... | [
"def",
"__on_message",
"(",
"self",
",",
"client",
",",
"userdata",
",",
"msg",
")",
":",
"# pylint: disable=W0613",
"# Notify the caller, if any",
"if",
"self",
".",
"on_message",
"is",
"not",
"None",
":",
"try",
":",
"self",
".",
"on_message",
"(",
"self",
... | A message has been received from a server
:param client: Client that received the message
:param userdata: User data (unused)
:param msg: A MQTTMessage bean | [
"A",
"message",
"has",
"been",
"received",
"from",
"a",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L399-L413 |
tcalmant/ipopo | pelix/misc/mqtt_client.py | MqttClient.__on_publish | def __on_publish(self, client, userdata, mid):
# pylint: disable=W0613
"""
A message has been published by a server
:param client: Client that received the message
:param userdata: User data (unused)
:param mid: Message ID
"""
try:
self.__in_f... | python | def __on_publish(self, client, userdata, mid):
# pylint: disable=W0613
"""
A message has been published by a server
:param client: Client that received the message
:param userdata: User data (unused)
:param mid: Message ID
"""
try:
self.__in_f... | [
"def",
"__on_publish",
"(",
"self",
",",
"client",
",",
"userdata",
",",
"mid",
")",
":",
"# pylint: disable=W0613",
"try",
":",
"self",
".",
"__in_flight",
"[",
"mid",
"]",
".",
"set",
"(",
")",
"except",
"KeyError",
":",
"pass"
] | A message has been published by a server
:param client: Client that received the message
:param userdata: User data (unused)
:param mid: Message ID | [
"A",
"message",
"has",
"been",
"published",
"by",
"a",
"server"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/mqtt_client.py#L415-L427 |
tcalmant/ipopo | pelix/remote/beans.py | to_import_properties | def to_import_properties(properties):
# type: (dict) -> dict
"""
Returns a dictionary where export properties have been replaced by import
ones
:param properties: A dictionary of service properties (with export keys)
:return: A dictionary with import properties
"""
# Copy the given dict... | python | def to_import_properties(properties):
# type: (dict) -> dict
"""
Returns a dictionary where export properties have been replaced by import
ones
:param properties: A dictionary of service properties (with export keys)
:return: A dictionary with import properties
"""
# Copy the given dict... | [
"def",
"to_import_properties",
"(",
"properties",
")",
":",
"# type: (dict) -> dict",
"# Copy the given dictionary",
"props",
"=",
"properties",
".",
"copy",
"(",
")",
"# Add the \"imported\" property",
"props",
"[",
"pelix",
".",
"remote",
".",
"PROP_IMPORTED",
"]",
... | Returns a dictionary where export properties have been replaced by import
ones
:param properties: A dictionary of service properties (with export keys)
:return: A dictionary with import properties | [
"Returns",
"a",
"dictionary",
"where",
"export",
"properties",
"have",
"been",
"replaced",
"by",
"import",
"ones"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L699-L740 |
tcalmant/ipopo | pelix/remote/beans.py | compute_exported_specifications | def compute_exported_specifications(svc_ref):
# type: (pelix.framework.ServiceReference) -> List[str]
"""
Computes the list of specifications exported by the given service
:param svc_ref: A ServiceReference
:return: The list of exported specifications (or an empty list)
"""
if svc_ref.get_p... | python | def compute_exported_specifications(svc_ref):
# type: (pelix.framework.ServiceReference) -> List[str]
"""
Computes the list of specifications exported by the given service
:param svc_ref: A ServiceReference
:return: The list of exported specifications (or an empty list)
"""
if svc_ref.get_p... | [
"def",
"compute_exported_specifications",
"(",
"svc_ref",
")",
":",
"# type: (pelix.framework.ServiceReference) -> List[str]",
"if",
"svc_ref",
".",
"get_property",
"(",
"pelix",
".",
"remote",
".",
"PROP_EXPORT_NONE",
")",
":",
"# The export of this service is explicitly forbi... | Computes the list of specifications exported by the given service
:param svc_ref: A ServiceReference
:return: The list of exported specifications (or an empty list) | [
"Computes",
"the",
"list",
"of",
"specifications",
"exported",
"by",
"the",
"given",
"service"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L746-L789 |
tcalmant/ipopo | pelix/remote/beans.py | extract_specifications | def extract_specifications(specifications, properties):
# type: (Any[str, List[str]], dict) -> List[str]
"""
Converts "python:/name" specifications to "name". Keeps the other
specifications as is.
:param specifications: The specifications found in a remote registration
:param properties: Servic... | python | def extract_specifications(specifications, properties):
# type: (Any[str, List[str]], dict) -> List[str]
"""
Converts "python:/name" specifications to "name". Keeps the other
specifications as is.
:param specifications: The specifications found in a remote registration
:param properties: Servic... | [
"def",
"extract_specifications",
"(",
"specifications",
",",
"properties",
")",
":",
"# type: (Any[str, List[str]], dict) -> List[str]",
"all_specs",
"=",
"set",
"(",
"pelix",
".",
"utilities",
".",
"to_iterable",
"(",
"specifications",
")",
")",
"try",
":",
"synonyms... | Converts "python:/name" specifications to "name". Keeps the other
specifications as is.
:param specifications: The specifications found in a remote registration
:param properties: Service properties
:return: The filtered specifications (as a list) | [
"Converts",
"python",
":",
"/",
"name",
"specifications",
"to",
"name",
".",
"Keeps",
"the",
"other",
"specifications",
"as",
"is",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L792-L827 |
tcalmant/ipopo | pelix/remote/beans.py | format_specifications | def format_specifications(specifications):
# type: (Iterable[str]) -> List[str]
"""
Transforms the interfaces names into URI strings, with the interface
implementation language as a scheme.
:param specifications: Specifications to transform
:return: The transformed names
"""
transformed... | python | def format_specifications(specifications):
# type: (Iterable[str]) -> List[str]
"""
Transforms the interfaces names into URI strings, with the interface
implementation language as a scheme.
:param specifications: Specifications to transform
:return: The transformed names
"""
transformed... | [
"def",
"format_specifications",
"(",
"specifications",
")",
":",
"# type: (Iterable[str]) -> List[str]",
"transformed",
"=",
"set",
"(",
")",
"for",
"original",
"in",
"specifications",
":",
"try",
":",
"lang",
",",
"spec",
"=",
"_extract_specification_parts",
"(",
"... | Transforms the interfaces names into URI strings, with the interface
implementation language as a scheme.
:param specifications: Specifications to transform
:return: The transformed names | [
"Transforms",
"the",
"interfaces",
"names",
"into",
"URI",
"strings",
"with",
"the",
"interface",
"implementation",
"language",
"as",
"a",
"scheme",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L830-L848 |
tcalmant/ipopo | pelix/remote/beans.py | _extract_specification_parts | def _extract_specification_parts(specification):
# type: (str) -> Tuple[str, str]
"""
Extract the language and the interface from a "language:/interface"
interface name
:param specification: The formatted interface name
:return: A (language, interface name) tuple
:raise ValueError: Invalid ... | python | def _extract_specification_parts(specification):
# type: (str) -> Tuple[str, str]
"""
Extract the language and the interface from a "language:/interface"
interface name
:param specification: The formatted interface name
:return: A (language, interface name) tuple
:raise ValueError: Invalid ... | [
"def",
"_extract_specification_parts",
"(",
"specification",
")",
":",
"# type: (str) -> Tuple[str, str]",
"try",
":",
"# Parse the URI-like string",
"parsed",
"=",
"urlparse",
"(",
"specification",
")",
"except",
":",
"# Invalid URL",
"raise",
"ValueError",
"(",
"\"Inval... | Extract the language and the interface from a "language:/interface"
interface name
:param specification: The formatted interface name
:return: A (language, interface name) tuple
:raise ValueError: Invalid specification content | [
"Extract",
"the",
"language",
"and",
"the",
"interface",
"from",
"a",
"language",
":",
"/",
"interface",
"interface",
"name"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L851-L880 |
tcalmant/ipopo | pelix/remote/beans.py | ExportEndpoint.get_properties | def get_properties(self):
# type: () -> dict
"""
Returns merged properties
:return: Endpoint merged properties
"""
# Get service properties
properties = self.__reference.get_properties()
# Merge with local properties
properties.update(self.__prop... | python | def get_properties(self):
# type: () -> dict
"""
Returns merged properties
:return: Endpoint merged properties
"""
# Get service properties
properties = self.__reference.get_properties()
# Merge with local properties
properties.update(self.__prop... | [
"def",
"get_properties",
"(",
"self",
")",
":",
"# type: () -> dict",
"# Get service properties",
"properties",
"=",
"self",
".",
"__reference",
".",
"get_properties",
"(",
")",
"# Merge with local properties",
"properties",
".",
"update",
"(",
"self",
".",
"__propert... | Returns merged properties
:return: Endpoint merged properties | [
"Returns",
"merged",
"properties"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L152-L172 |
tcalmant/ipopo | pelix/remote/beans.py | ExportEndpoint.make_import_properties | def make_import_properties(self):
# type: () -> dict
"""
Returns the properties of this endpoint where export properties have
been replaced by import ones
:return: A dictionary with import properties
"""
# Convert merged properties
props = to_import_prope... | python | def make_import_properties(self):
# type: () -> dict
"""
Returns the properties of this endpoint where export properties have
been replaced by import ones
:return: A dictionary with import properties
"""
# Convert merged properties
props = to_import_prope... | [
"def",
"make_import_properties",
"(",
"self",
")",
":",
"# type: () -> dict",
"# Convert merged properties",
"props",
"=",
"to_import_properties",
"(",
"self",
".",
"get_properties",
"(",
")",
")",
"# Add the framework UID",
"props",
"[",
"pelix",
".",
"remote",
".",
... | Returns the properties of this endpoint where export properties have
been replaced by import ones
:return: A dictionary with import properties | [
"Returns",
"the",
"properties",
"of",
"this",
"endpoint",
"where",
"export",
"properties",
"have",
"been",
"replaced",
"by",
"import",
"ones"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L174-L187 |
tcalmant/ipopo | pelix/remote/beans.py | EndpointDescription.__check_properties | def __check_properties(props):
# type: (dict) -> None
"""
Checks that the given dictionary doesn't have export keys and has
import keys
:param props: Properties to validate
:raise ValueError: Invalid properties
"""
# Mandatory properties
mandatory... | python | def __check_properties(props):
# type: (dict) -> None
"""
Checks that the given dictionary doesn't have export keys and has
import keys
:param props: Properties to validate
:raise ValueError: Invalid properties
"""
# Mandatory properties
mandatory... | [
"def",
"__check_properties",
"(",
"props",
")",
":",
"# type: (dict) -> None",
"# Mandatory properties",
"mandatory",
"=",
"(",
"pelix",
".",
"remote",
".",
"PROP_ENDPOINT_ID",
",",
"pelix",
".",
"remote",
".",
"PROP_IMPORTED_CONFIGS",
",",
"pelix",
".",
"constants"... | Checks that the given dictionary doesn't have export keys and has
import keys
:param props: Properties to validate
:raise ValueError: Invalid properties | [
"Checks",
"that",
"the",
"given",
"dictionary",
"doesn",
"t",
"have",
"export",
"keys",
"and",
"has",
"import",
"keys"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L452-L479 |
tcalmant/ipopo | pelix/remote/beans.py | EndpointDescription.get_package_version | def get_package_version(self, package):
# type: (str) -> Tuple[int, ...]
"""
Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0)
"""
name = "{0}{1}".format(
... | python | def get_package_version(self, package):
# type: (str) -> Tuple[int, ...]
"""
Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0)
"""
name = "{0}{1}".format(
... | [
"def",
"get_package_version",
"(",
"self",
",",
"package",
")",
":",
"# type: (str) -> Tuple[int, ...]",
"name",
"=",
"\"{0}{1}\"",
".",
"format",
"(",
"pelix",
".",
"remote",
".",
"PROP_ENDPOINT_PACKAGE_VERSION_",
",",
"package",
")",
"try",
":",
"# Get the version... | Provides the version of the given package name.
:param package: The name of the package
:return: The version of the specified package as a tuple or (0,0,0) | [
"Provides",
"the",
"version",
"of",
"the",
"given",
"package",
"name",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L548-L567 |
tcalmant/ipopo | pelix/remote/beans.py | EndpointDescription.matches | def matches(self, ldap_filter):
# type: (Any[str, pelix.ldapfilter.LDAPFilter]) -> bool
"""
Tests the properties of this EndpointDescription against the given
filter
:param ldap_filter: A filter
:return: True if properties matches the filter
"""
return pe... | python | def matches(self, ldap_filter):
# type: (Any[str, pelix.ldapfilter.LDAPFilter]) -> bool
"""
Tests the properties of this EndpointDescription against the given
filter
:param ldap_filter: A filter
:return: True if properties matches the filter
"""
return pe... | [
"def",
"matches",
"(",
"self",
",",
"ldap_filter",
")",
":",
"# type: (Any[str, pelix.ldapfilter.LDAPFilter]) -> bool",
"return",
"pelix",
".",
"ldapfilter",
".",
"get_ldap_filter",
"(",
"ldap_filter",
")",
".",
"matches",
"(",
"self",
".",
"__properties",
")"
] | Tests the properties of this EndpointDescription against the given
filter
:param ldap_filter: A filter
:return: True if properties matches the filter | [
"Tests",
"the",
"properties",
"of",
"this",
"EndpointDescription",
"against",
"the",
"given",
"filter"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L605-L616 |
tcalmant/ipopo | pelix/remote/beans.py | EndpointDescription.to_import | def to_import(self):
# type: () -> ImportEndpoint
"""
Converts an EndpointDescription bean to an ImportEndpoint
:return: An ImportEndpoint bean
"""
# Properties
properties = self.get_properties()
# Framework UUID
fw_uid = self.get_framework_uuid(... | python | def to_import(self):
# type: () -> ImportEndpoint
"""
Converts an EndpointDescription bean to an ImportEndpoint
:return: An ImportEndpoint bean
"""
# Properties
properties = self.get_properties()
# Framework UUID
fw_uid = self.get_framework_uuid(... | [
"def",
"to_import",
"(",
"self",
")",
":",
"# type: () -> ImportEndpoint",
"# Properties",
"properties",
"=",
"self",
".",
"get_properties",
"(",
")",
"# Framework UUID",
"fw_uid",
"=",
"self",
".",
"get_framework_uuid",
"(",
")",
"# Endpoint name",
"try",
":",
"#... | Converts an EndpointDescription bean to an ImportEndpoint
:return: An ImportEndpoint bean | [
"Converts",
"an",
"EndpointDescription",
"bean",
"to",
"an",
"ImportEndpoint"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L618-L652 |
tcalmant/ipopo | pelix/remote/beans.py | EndpointDescription.from_export | def from_export(cls, endpoint):
# type: (ExportEndpoint) -> EndpointDescription
"""
Converts an ExportEndpoint bean to an EndpointDescription
:param endpoint: An ExportEndpoint bean
:return: An EndpointDescription bean
"""
assert isinstance(endpoint, ExportEndpoi... | python | def from_export(cls, endpoint):
# type: (ExportEndpoint) -> EndpointDescription
"""
Converts an ExportEndpoint bean to an EndpointDescription
:param endpoint: An ExportEndpoint bean
:return: An EndpointDescription bean
"""
assert isinstance(endpoint, ExportEndpoi... | [
"def",
"from_export",
"(",
"cls",
",",
"endpoint",
")",
":",
"# type: (ExportEndpoint) -> EndpointDescription",
"assert",
"isinstance",
"(",
"endpoint",
",",
"ExportEndpoint",
")",
"# Service properties",
"properties",
"=",
"endpoint",
".",
"get_properties",
"(",
")",
... | Converts an ExportEndpoint bean to an EndpointDescription
:param endpoint: An ExportEndpoint bean
:return: An EndpointDescription bean | [
"Converts",
"an",
"ExportEndpoint",
"bean",
"to",
"an",
"EndpointDescription"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L655-L693 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFReader._parse_description | def _parse_description(self, node):
# type: (ElementTree.Element) -> EndpointDescription
"""
Parse an endpoint description node
:param node: The endpoint description node
:return: The parsed EndpointDescription bean
:raise KeyError: Attribute missing
:raise Value... | python | def _parse_description(self, node):
# type: (ElementTree.Element) -> EndpointDescription
"""
Parse an endpoint description node
:param node: The endpoint description node
:return: The parsed EndpointDescription bean
:raise KeyError: Attribute missing
:raise Value... | [
"def",
"_parse_description",
"(",
"self",
",",
"node",
")",
":",
"# type: (ElementTree.Element) -> EndpointDescription",
"endpoint",
"=",
"{",
"}",
"for",
"prop_node",
"in",
"node",
".",
"findall",
"(",
"TAG_PROPERTY",
")",
":",
"name",
",",
"value",
"=",
"self"... | Parse an endpoint description node
:param node: The endpoint description node
:return: The parsed EndpointDescription bean
:raise KeyError: Attribute missing
:raise ValueError: Invalid description | [
"Parse",
"an",
"endpoint",
"description",
"node"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L165-L180 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFReader._parse_property | def _parse_property(self, node):
# type: (ElementTree.Element) -> Tuple[str, Any]
"""
Parses a property node
:param node: The property node
:return: A (name, value) tuple
:raise KeyError: Attribute missing
"""
# Get information
name = node.attrib[... | python | def _parse_property(self, node):
# type: (ElementTree.Element) -> Tuple[str, Any]
"""
Parses a property node
:param node: The property node
:return: A (name, value) tuple
:raise KeyError: Attribute missing
"""
# Get information
name = node.attrib[... | [
"def",
"_parse_property",
"(",
"self",
",",
"node",
")",
":",
"# type: (ElementTree.Element) -> Tuple[str, Any]",
"# Get information",
"name",
"=",
"node",
".",
"attrib",
"[",
"ATTR_NAME",
"]",
"vtype",
"=",
"node",
".",
"attrib",
".",
"get",
"(",
"ATTR_VALUE_TYPE... | Parses a property node
:param node: The property node
:return: A (name, value) tuple
:raise KeyError: Attribute missing | [
"Parses",
"a",
"property",
"node"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L182-L203 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFReader._parse_value_node | def _parse_value_node(self, vtype, node):
# type: (str, ElementTree.Element) -> Any
"""
Parses a value node
:param vtype: The value type
:param node: The value node
:return: The parsed value
"""
kind = node.tag
if kind == TAG_XML:
# Ra... | python | def _parse_value_node(self, vtype, node):
# type: (str, ElementTree.Element) -> Any
"""
Parses a value node
:param vtype: The value type
:param node: The value node
:return: The parsed value
"""
kind = node.tag
if kind == TAG_XML:
# Ra... | [
"def",
"_parse_value_node",
"(",
"self",
",",
"vtype",
",",
"node",
")",
":",
"# type: (str, ElementTree.Element) -> Any",
"kind",
"=",
"node",
".",
"tag",
"if",
"kind",
"==",
"TAG_XML",
":",
"# Raw XML value",
"return",
"next",
"(",
"iter",
"(",
"node",
")",
... | Parses a value node
:param vtype: The value type
:param node: The value node
:return: The parsed value | [
"Parses",
"a",
"value",
"node"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L205-L235 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFReader.parse | def parse(self, xml_str):
# type: (str) -> List[EndpointDescription]
"""
Parses an EDEF XML string
:param xml_str: An XML string
:return: The list of parsed EndpointDescription
"""
# Parse the document
root = ElementTree.fromstring(xml_str)
if roo... | python | def parse(self, xml_str):
# type: (str) -> List[EndpointDescription]
"""
Parses an EDEF XML string
:param xml_str: An XML string
:return: The list of parsed EndpointDescription
"""
# Parse the document
root = ElementTree.fromstring(xml_str)
if roo... | [
"def",
"parse",
"(",
"self",
",",
"xml_str",
")",
":",
"# type: (str) -> List[EndpointDescription]",
"# Parse the document",
"root",
"=",
"ElementTree",
".",
"fromstring",
"(",
"xml_str",
")",
"if",
"root",
".",
"tag",
"!=",
"TAG_ENDPOINT_DESCRIPTIONS",
":",
"raise"... | Parses an EDEF XML string
:param xml_str: An XML string
:return: The list of parsed EndpointDescription | [
"Parses",
"an",
"EDEF",
"XML",
"string"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L237-L254 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFWriter._make_endpoint | def _make_endpoint(self, root_node, endpoint):
# type: (ElementTree.Element, EndpointDescription) -> None
"""
Converts the given endpoint bean to an XML Element
:param root_node: The XML root Element
:param endpoint: An EndpointDescription bean
"""
endpoint_node ... | python | def _make_endpoint(self, root_node, endpoint):
# type: (ElementTree.Element, EndpointDescription) -> None
"""
Converts the given endpoint bean to an XML Element
:param root_node: The XML root Element
:param endpoint: An EndpointDescription bean
"""
endpoint_node ... | [
"def",
"_make_endpoint",
"(",
"self",
",",
"root_node",
",",
"endpoint",
")",
":",
"# type: (ElementTree.Element, EndpointDescription) -> None",
"endpoint_node",
"=",
"ElementTree",
".",
"SubElement",
"(",
"root_node",
",",
"TAG_ENDPOINT_DESCRIPTION",
")",
"for",
"name",
... | Converts the given endpoint bean to an XML Element
:param root_node: The XML root Element
:param endpoint: An EndpointDescription bean | [
"Converts",
"the",
"given",
"endpoint",
"bean",
"to",
"an",
"XML",
"Element"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L373-L422 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFWriter._make_xml | def _make_xml(self, endpoints):
# type: (List[EndpointDescription]) -> ElementTree.Element
"""
Converts the given endpoint description beans into an XML Element
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document
"""
... | python | def _make_xml(self, endpoints):
# type: (List[EndpointDescription]) -> ElementTree.Element
"""
Converts the given endpoint description beans into an XML Element
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document
"""
... | [
"def",
"_make_xml",
"(",
"self",
",",
"endpoints",
")",
":",
"# type: (List[EndpointDescription]) -> ElementTree.Element",
"root",
"=",
"ElementTree",
".",
"Element",
"(",
"TAG_ENDPOINT_DESCRIPTIONS",
")",
"for",
"endpoint",
"in",
"endpoints",
":",
"self",
".",
"_make... | Converts the given endpoint description beans into an XML Element
:param endpoints: A list of EndpointDescription beans
:return: A string containing an XML document | [
"Converts",
"the",
"given",
"endpoint",
"description",
"beans",
"into",
"an",
"XML",
"Element"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L424-L438 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFWriter.to_string | def to_string(self, endpoints):
# type: (List[EndpointDescription]) -> str
"""
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 ElementTre... | python | def to_string(self, endpoints):
# type: (List[EndpointDescription]) -> str
"""
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 ElementTre... | [
"def",
"to_string",
"(",
"self",
",",
"endpoints",
")",
":",
"# type: (List[EndpointDescription]) -> str",
"# Make the ElementTree",
"root",
"=",
"self",
".",
"_make_xml",
"(",
"endpoints",
")",
"tree",
"=",
"ElementTree",
".",
"ElementTree",
"(",
"root",
")",
"# ... | 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/rsa/edef.py#L440-L466 |
tcalmant/ipopo | pelix/rsa/edef.py | EDEFWriter.write | def write(self, endpoints, filename):
# type: (List[EndpointDescription], str) -> None
"""
Writes the given endpoint descriptions to the given file
:param endpoints: A list of EndpointDescription beans
:param filename: Name of the file where to write the XML
:raise IOErr... | python | def write(self, endpoints, filename):
# type: (List[EndpointDescription], str) -> None
"""
Writes the given endpoint descriptions to the given file
:param endpoints: A list of EndpointDescription beans
:param filename: Name of the file where to write the XML
:raise IOErr... | [
"def",
"write",
"(",
"self",
",",
"endpoints",
",",
"filename",
")",
":",
"# type: (List[EndpointDescription], str) -> None",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"filep",
":",
"filep",
".",
"write",
"(",
"self",
".",
"to_string",
"(",
"... | Writes the given endpoint descriptions to the given file
:param endpoints: A list of EndpointDescription beans
:param filename: Name of the file where to write the XML
:raise IOError: Error writing the file | [
"Writes",
"the",
"given",
"endpoint",
"descriptions",
"to",
"the",
"given",
"file"
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/edef.py#L468-L478 |
tcalmant/ipopo | pelix/ipopo/decorators.py | is_from_parent | def is_from_parent(cls, attribute_name, value=None):
# type: (type, str, bool) -> bool
"""
Tests if the current attribute value is shared by a parent of the given
class.
Returns None if the attribute value is None.
:param cls: Child class with the requested attribute
:param attribute_name:... | python | def is_from_parent(cls, attribute_name, value=None):
# type: (type, str, bool) -> bool
"""
Tests if the current attribute value is shared by a parent of the given
class.
Returns None if the attribute value is None.
:param cls: Child class with the requested attribute
:param attribute_name:... | [
"def",
"is_from_parent",
"(",
"cls",
",",
"attribute_name",
",",
"value",
"=",
"None",
")",
":",
"# type: (type, str, bool) -> bool",
"if",
"value",
"is",
"None",
":",
"try",
":",
"# Get the current value",
"value",
"=",
"getattr",
"(",
"cls",
",",
"attribute_na... | Tests if the current attribute value is shared by a parent of the given
class.
Returns None if the attribute value is None.
:param cls: Child class with the requested attribute
:param attribute_name: Name of the attribute to be tested
:param value: The exact value in the child class (optional)
... | [
"Tests",
"if",
"the",
"current",
"attribute",
"value",
"is",
"shared",
"by",
"a",
"parent",
"of",
"the",
"given",
"class",
"."
] | train | https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L64-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.