_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q9600
_IPopoService.__get_stored_instances
train
def __get_stored_instances(self, factory_name): # type: (str) -> List[StoredInstance] """ Retrieves the list of all stored instances objects corresponding to the given factory name :param factory_name: A factory name :return: All components instantiated from the given fa...
python
{ "resource": "" }
q9601
_IPopoService.__try_instantiate
train
def __try_instantiate(self, component_context, instance): # type: (ComponentContext, object) -> bool """ Instantiates a component, if all of its handlers are there. Returns False if a handler is missing. :param component_context: A ComponentContext bean :param instance: ...
python
{ "resource": "" }
q9602
_IPopoService._autorestart_store_components
train
def _autorestart_store_components(self, bundle): # type: (Bundle) -> None """ Stores the components of the given bundle with the auto-restart property :param bundle: A Bundle object """ with self.__instances_lock: # Prepare the list of components ...
python
{ "resource": "" }
q9603
_IPopoService._autorestart_components
train
def _autorestart_components(self, bundle): # type: (Bundle) -> None """ Restart the components of the given bundle :param bundle: A Bundle object """ with self.__instances_lock: instances = self.__auto_restart.get(bundle) if not instances: ...
python
{ "resource": "" }
q9604
_IPopoService._fire_ipopo_event
train
def _fire_ipopo_event(self, kind, factory_name, instance_name=None): # type: (int, str, Optional[str]) -> None """ Triggers an iPOPO event :param kind: Kind of event :param factory_name: Name of the factory associated to the event :param instance_name: Name of the compon...
python
{ "resource": "" }
q9605
_IPopoService._prepare_instance_properties
train
def _prepare_instance_properties(self, properties, factory_properties): # type: (dict, dict) -> dict """ Prepares the properties of a component instance, based on its configuration, factory and framework properties :param properties: Component instance properties :param ...
python
{ "resource": "" }
q9606
_IPopoService._register_bundle_factories
train
def _register_bundle_factories(self, bundle): # type: (Bundle) -> None """ Registers all factories found in the given bundle :param bundle: A bundle """ # Load the bundle factories factories = _load_bundle_factories(bundle) for context, factory_class in ...
python
{ "resource": "" }
q9607
_IPopoService._register_factory
train
def _register_factory(self, factory_name, factory, override): # type: (str, type, bool) -> None """ Registers a component factory :param factory_name: The name of the factory :param factory: The factory class object :param override: If true, previous factory is overridde...
python
{ "resource": "" }
q9608
_IPopoService._unregister_bundle_factories
train
def _unregister_bundle_factories(self, bundle): # type: (Bundle) -> None """ Unregisters all factories of the given bundle :param bundle: A bundle """ with self.__factories_lock: # Find out which factories must be removed to_remove = [ ...
python
{ "resource": "" }
q9609
_IPopoService.bundle_changed
train
def bundle_changed(self, event): # type: (BundleEvent) -> None """ A bundle event has been triggered :param event: The bundle event """ kind = event.get_kind() bundle = event.get_bundle() if kind == BundleEvent.STOPPING_PRECLEAN: # A bundle i...
python
{ "resource": "" }
q9610
_IPopoService.instantiate
train
def instantiate(self, factory_name, name, properties=None): # type: (str, str, dict) -> Any """ Instantiates a component from the given factory, with the given name :param factory_name: Name of the component factory :param name: Name of the instance to be started :param ...
python
{ "resource": "" }
q9611
_IPopoService.retry_erroneous
train
def retry_erroneous(self, name, properties_update=None): # type: (str, dict) -> int """ Removes the ERRONEOUS state of the given component, and retries a validation :param name: Name of the component to retry :param properties_update: A dictionary to update the initial p...
python
{ "resource": "" }
q9612
_IPopoService.invalidate
train
def invalidate(self, name): # type: (str) -> None """ Invalidates the given component :param name: Name of the component to invalidate :raise ValueError: Invalid component name """ with self.__instances_lock: try: stored_instance = sel...
python
{ "resource": "" }
q9613
_IPopoService.kill
train
def kill(self, name): # type: (str) -> None """ Kills the given component :param name: Name of the component to kill :raise ValueError: Invalid component name """ if not name: raise ValueError("Name can't be None or empty") with self.__instan...
python
{ "resource": "" }
q9614
_IPopoService.register_factory
train
def register_factory(self, bundle_context, factory): # type: (BundleContext, type) -> bool """ Registers a manually created factory, using decorators programmatically :param bundle_context: The factory bundle context :param factory: A manipulated class :return: True if t...
python
{ "resource": "" }
q9615
_IPopoService.unregister_factory
train
def unregister_factory(self, factory_name): # type: (str) -> bool """ Unregisters the given component factory :param factory_name: Name of the factory to unregister :return: True the factory has been removed, False if the factory is unknown """ i...
python
{ "resource": "" }
q9616
_IPopoService.get_instances
train
def get_instances(self): # type: () -> List[Tuple[str, str, int]] """ Retrieves the list of the currently registered component instances :return: A list of (name, factory name, state) tuples. """ with self.__instances_lock: return sorted( (nam...
python
{ "resource": "" }
q9617
_IPopoService.get_waiting_components
train
def get_waiting_components(self): # type: () -> List[Tuple[str, str, Set[str]]] """ Returns the list of the instances waiting for their handlers :return: A list of (name, factory name, missing handlers) tuples """ with self.__instances_lock: result = [] ...
python
{ "resource": "" }
q9618
_IPopoService.get_factory_bundle
train
def get_factory_bundle(self, name): # type: (str) -> Bundle """ Retrieves the Pelix Bundle object that registered the given factory :param name: The name of a factory :return: The Bundle that registered the given factory :raise ValueError: Invalid factory """ ...
python
{ "resource": "" }
q9619
_IPopoService.get_factory_details
train
def get_factory_details(self, name): # type: (str) -> Dict[str, Any] """ Retrieves a dictionary with details about the given factory * ``name``: The factory name * ``bundle``: The Bundle object of the bundle providing the factory * ``properties``: Copy of the components ...
python
{ "resource": "" }
q9620
set_double_stack
train
def set_double_stack(socket_obj, double_stack=True): # type: (socket.socket, bool) -> None """ Sets up the IPv6 double stack according to the operating system :param socket_obj: A socket object :param double_stack: If True, use the double stack, else only support IPv6 :raise AttributeError: Pyt...
python
{ "resource": "" }
q9621
escape_LDAP
train
def escape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Escape a string to let it go in an LDAP filter :param ldap_string: The string to escape :return: The protected string """ if not ldap_string: # No content return ldap_string # Protect esc...
python
{ "resource": "" }
q9622
unescape_LDAP
train
def unescape_LDAP(ldap_string): # type: (str) -> str # pylint: disable=C0103 """ Unespaces an LDAP string :param ldap_string: The string to unescape :return: The unprotected string """ if ldap_string is None: return None if ESCAPE_CHARACTER not in ldap_string: # No ...
python
{ "resource": "" }
q9623
_comparator_presence
train
def _comparator_presence(_, tested_value): """ Tests a filter which simply a joker, i.e. a value presence test """ # The filter value is a joker : simple presence test if tested_value is None: return False elif hasattr(tested_value, "__len__"): # Refuse empty values # pyl...
python
{ "resource": "" }
q9624
_comparator_eq
train
def _comparator_eq(filter_value, tested_value): """ Tests if the filter value is equal to the tested value """ if isinstance(tested_value, ITERABLES): # Convert the list items to strings for value in tested_value: # Try with the string conversion if not is_string(...
python
{ "resource": "" }
q9625
_comparator_approximate
train
def _comparator_approximate(filter_value, tested_value): """ Tests if the filter value is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() if is_string(tested_value): ...
python
{ "resource": "" }
q9626
_comparator_approximate_star
train
def _comparator_approximate_star(filter_value, tested_value): """ Tests if the filter value, which contains a joker, is nearly equal to the tested value. If the tested value is a string or an array of string, it compares their lower case forms """ lower_filter_value = filter_value.lower() ...
python
{ "resource": "" }
q9627
_comparator_lt
train
def _comparator_lt(filter_value, tested_value): """ Tests if the filter value is strictly greater than the tested value tested_value < filter_value """ if is_string(filter_value): value_type = type(tested_value) try: # Try a conversion filter_value = value_ty...
python
{ "resource": "" }
q9628
_compute_comparator
train
def _compute_comparator(string, idx): # type: (str, int) -> Optional[Callable[[Any, Any], bool]] """ Tries to compute the LDAP comparator at the given index Valid operators are : * = : equality * <= : less than * >= : greater than * ~= : approximate :param string: A LDAP filter st...
python
{ "resource": "" }
q9629
_compute_operation
train
def _compute_operation(string, idx): # type: (str, int) -> Optional[int] """ Tries to compute the LDAP operation at the given index Valid operations are : * & : AND * | : OR * ! : NOT :param string: A LDAP filter string :param idx: An index in the given string :return: The cor...
python
{ "resource": "" }
q9630
_skip_spaces
train
def _skip_spaces(string, idx): # type: (str, int) -> int """ Retrieves the next non-space character after idx index in the given string :param string: The string to look into :param idx: The base search index :return: The next non-space character index, -1 if not found """ i = idx f...
python
{ "resource": "" }
q9631
_parse_ldap
train
def _parse_ldap(ldap_filter): # type: (str) -> Optional[LDAPFilter] """ Parses the given LDAP filter string :param ldap_filter: An LDAP filter string :return: An LDAPFilter object, None if the filter was empty :raise ValueError: The LDAP filter string is invalid """ if ldap_filter is No...
python
{ "resource": "" }
q9632
get_ldap_filter
train
def get_ldap_filter(ldap_filter): # type: (Any) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Retrieves the LDAP filter object corresponding to the given filter. Parses it the argument if it is an LDAPFilter instance :param ldap_filter: An LDAP filter (LDAPFilter or string) :return: The corr...
python
{ "resource": "" }
q9633
combine_filters
train
def combine_filters(filters, operator=AND): # type: (Iterable[Any], int) -> Optional[Union[LDAPFilter, LDAPCriteria]] """ Combines two LDAP filters, which can be strings or LDAPFilter objects :param filters: Filters to combine :param operator: The operator for combination :return: The combined ...
python
{ "resource": "" }
q9634
LDAPFilter.append
train
def append(self, ldap_filter): """ Appends a filter or a criterion to this filter :param ldap_filter: An LDAP filter or criterion :raise TypeError: If the parameter is not of a known type :raise ValueError: If the more than one filter is associated to a ...
python
{ "resource": "" }
q9635
LDAPFilter.matches
train
def matches(self, properties): """ Tests if the given properties matches this LDAP filter and its children :param properties: A dictionary of properties :return: True if the properties matches this filter, else False """ # Use a generator, and declare it outside of the m...
python
{ "resource": "" }
q9636
LDAPFilter.normalize
train
def normalize(self): """ Returns the first meaningful object in this filter. """ if not self.subfilters: # No sub-filters return None # New sub-filters list new_filters = [] for subfilter in self.subfilters: # Normalize the sub...
python
{ "resource": "" }
q9637
LDAPCriteria.matches
train
def matches(self, properties): """ Tests if the given criterion matches this LDAP criterion :param properties: A dictionary of properties :return: True if the properties matches this criterion, else False """ try: # Use the comparator return self....
python
{ "resource": "" }
q9638
InstallUtils.discovery_multicast
train
def discovery_multicast(self): """ Installs the multicast discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.multicast").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
python
{ "resource": "" }
q9639
InstallUtils.discovery_mdns
train
def discovery_mdns(self): """ Installs the mDNS discovery bundles and instantiates components """ # Remove Zeroconf debug output logging.getLogger("zeroconf").setLevel(logging.WARNING) # Install the bundle self.context.install_bundle("pelix.remote.discovery.mdns"...
python
{ "resource": "" }
q9640
InstallUtils.discovery_mqtt
train
def discovery_mqtt(self): """ Installs the MQTT discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.mqtt").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery...
python
{ "resource": "" }
q9641
InstallUtils.discovery_redis
train
def discovery_redis(self): """ Installs the Redis discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.redis").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discov...
python
{ "resource": "" }
q9642
InstallUtils.discovery_zookeeper
train
def discovery_zookeeper(self): """ Installs the ZooKeeper discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.zookeeper").start() with use_waiting_list(self.context) as ipopo: # Instantiat...
python
{ "resource": "" }
q9643
InstallUtils.transport_jsonrpc
train
def transport_jsonrpc(self): """ Installs the JSON-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.json_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discover...
python
{ "resource": "" }
q9644
InstallUtils.transport_jabsorbrpc
train
def transport_jabsorbrpc(self): """ Installs the JABSORB-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle( "pelix.remote.transport.jabsorb_rpc" ).start() with use_waiting_list(self.context) as ipop...
python
{ "resource": "" }
q9645
InstallUtils.transport_mqttrpc
train
def transport_mqttrpc(self): """ Installs the MQTT-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.transport.mqtt_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate th...
python
{ "resource": "" }
q9646
InstallUtils.transport_xmlrpc
train
def transport_xmlrpc(self): """ Installs the XML-RPC transport bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.xml_rpc").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discovery ...
python
{ "resource": "" }
q9647
Configuration.get_properties
train
def get_properties(self): """ Return the properties of this Configuration object. The Dictionary object returned is a private copy for the caller and may be changed without influencing the stored configuration. If called just after the configuration is created and before update ...
python
{ "resource": "" }
q9648
Configuration.__properties_update
train
def __properties_update(self, properties): """ Internal update of configuration properties. Does not notifies the ConfigurationAdmin of this modification. :param properties: the new set of properties for this configuration :return: True if the properties have been updated, else ...
python
{ "resource": "" }
q9649
Configuration.update
train
def update(self, properties=None): # pylint: disable=W0212 """ If called without properties, only notifies listeners Update the properties of this Configuration object. Stores the properties in persistent storage after adding or overwriting the following properties: ...
python
{ "resource": "" }
q9650
Configuration.delete
train
def delete(self, directory_updated=False): # pylint: disable=W0212 """ Delete this configuration :param directory_updated: If True, tell ConfigurationAdmin to not recall the directory of this deletion (internal use only...
python
{ "resource": "" }
q9651
Configuration.matches
train
def matches(self, ldap_filter): """ Tests if this configuration matches the given filter. :param ldap_filter: A parsed LDAP filter object :return: True if the properties of this configuration matches the filter """ if not self.is_valid(): # D...
python
{ "resource": "" }
q9652
_package_exists
train
def _package_exists(path): # type: (str) -> bool """ Checks if the given Python path matches a valid file or a valid container file :param path: A Python path :return: True if the module or its container exists """ while path: if os.path.exists(path): return True ...
python
{ "resource": "" }
q9653
normalize_path
train
def normalize_path(): """ Normalizes sys.path to avoid the use of relative folders """ # Normalize Python paths whole_path = [ os.path.abspath(path) for path in sys.path if os.path.exists(path) ] # Keep the "dynamic" current folder indicator and add the "static" # current path ...
python
{ "resource": "" }
q9654
Bundle.__get_activator_method
train
def __get_activator_method(self, method_name): """ Retrieves the requested method of the activator, or returns None :param method_name: A method name :return: A method, or None """ # Get the activator activator = getattr(self.__module, ACTIVATOR, None) if...
python
{ "resource": "" }
q9655
Bundle._fire_bundle_event
train
def _fire_bundle_event(self, kind): # type: (int) -> None """ Fires a bundle event of the given kind :param kind: Kind of event """ self.__framework._dispatcher.fire_bundle_event(BundleEvent(kind, self))
python
{ "resource": "" }
q9656
Bundle.get_registered_services
train
def get_registered_services(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it has registered or an empty list The list is valid at the time of the call to this method, however, as the Framework is a very dynam...
python
{ "resource": "" }
q9657
Bundle.get_services_in_use
train
def get_services_in_use(self): # type: () -> List[ServiceReference] """ Returns this bundle's ServiceReference list for all services it is using or an empty list. A bundle is considered to be using a service if its use count for that service is greater than zero. ...
python
{ "resource": "" }
q9658
Bundle.start
train
def start(self): """ Starts the bundle. Does nothing if the bundle is already starting or active. :raise BundleException: The framework is not yet started or the bundle activator failed. """ if self.__framework._state not in (Bundle.STARTI...
python
{ "resource": "" }
q9659
Bundle.stop
train
def stop(self): """ Stops the bundle. Does nothing if the bundle is already stopped. :raise BundleException: The bundle activator failed. """ if self._state != Bundle.ACTIVE: # Invalid state return exception = None with self._lock: ...
python
{ "resource": "" }
q9660
Bundle.__unregister_services
train
def __unregister_services(self): """ Unregisters all bundle services """ # Copy the services list, as it will be modified during the process with self.__registration_lock: registered_services = self.__registered_services.copy() for registration in registered_...
python
{ "resource": "" }
q9661
Bundle.uninstall
train
def uninstall(self): """ Uninstalls the bundle """ with self._lock: if self._state == Bundle.ACTIVE: self.stop() # Change the bundle state self._state = Bundle.UNINSTALLED # Call the framework self.__framework....
python
{ "resource": "" }
q9662
Bundle.update
train
def update(self): """ Updates the bundle """ with self._lock: # Was it active ? restart = self._state == Bundle.ACTIVE # Send the update event self._fire_bundle_event(BundleEvent.UPDATE_BEGIN) try: # Stop the b...
python
{ "resource": "" }
q9663
Framework.get_bundle_by_id
train
def get_bundle_by_id(self, bundle_id): # type: (int) -> Union[Bundle, Framework] """ Retrieves the bundle with the given ID :param bundle_id: ID of an installed bundle :return: The requested bundle :raise BundleException: The ID is invalid """ if bundle_i...
python
{ "resource": "" }
q9664
Framework.get_bundle_by_name
train
def get_bundle_by_name(self, bundle_name): # type: (str) -> Optional[Bundle] """ Retrieves the bundle with the given name :param bundle_name: Name of the bundle to look for :return: The requested bundle, None if not found """ if bundle_name is None: #...
python
{ "resource": "" }
q9665
Framework.get_bundles
train
def get_bundles(self): # type: () -> List[Bundle] """ Returns the list of all installed bundles :return: the list of all installed bundles """ with self.__bundles_lock: return [ self.__bundles[bundle_id] for bundle_id in sorted...
python
{ "resource": "" }
q9666
Framework.get_property
train
def get_property(self, name): # type: (str) -> object """ Retrieves a framework or system property. As framework properties don't change while it's running, this method don't need to be protected. :param name: The property name """ with self.__properties_lock: ...
python
{ "resource": "" }
q9667
Framework.install_bundle
train
def install_bundle(self, name, path=None): # type: (str, str) -> Bundle """ Installs the bundle with the given name *Note:* Before Pelix 0.5.0, this method returned the ID of the installed bundle, instead of the Bundle object. **WARNING:** The behavior of the loading pr...
python
{ "resource": "" }
q9668
Framework.install_package
train
def install_package(self, path, recursive=False, prefix=None): # type: (str, bool, str) -> tuple """ Installs all the modules found in the given package :param path: Path of the package (folder) :param recursive: If True, install the sub-packages too :param prefix: (**in...
python
{ "resource": "" }
q9669
Framework.install_visiting
train
def install_visiting(self, path, visitor, prefix=None): """ Installs all the modules found in the given path if they are accepted by the visitor. The visitor must be a callable accepting 3 parameters: * fullname: The full name of the module * is_package: If True, ...
python
{ "resource": "" }
q9670
Framework.register_service
train
def register_service( self, bundle, clazz, service, properties, send_event, factory=False, prototype=False, ): # type: (Bundle, Union[List[Any], type, str], object, dict, bool, bool, bool) -> ServiceRegistration """ Registers a ...
python
{ "resource": "" }
q9671
Framework.start
train
def start(self): # type: () -> bool """ Starts the framework :return: True if the bundle has been started, False if it was already running :raise BundleException: A bundle failed to start """ with self._lock: if self._state in (Bundle...
python
{ "resource": "" }
q9672
Framework.stop
train
def stop(self): # type: () -> bool """ Stops the framework :return: True if the framework stopped, False it wasn't running """ with self._lock: if self._state != Bundle.ACTIVE: # Invalid state return False # Hide a...
python
{ "resource": "" }
q9673
Framework.delete
train
def delete(self, force=False): """ Deletes the current framework :param force: If True, stops the framework before deleting it :return: True if the framework has been delete, False if is couldn't """ if not force and self._state not in ( Bundle.INSTALLED, ...
python
{ "resource": "" }
q9674
Framework.unregister_service
train
def unregister_service(self, registration): # type: (ServiceRegistration) -> bool """ Unregisters the given service :param registration: A ServiceRegistration to the service to unregister :raise BundleException: Invalid reference """ # Get the Service Reference ...
python
{ "resource": "" }
q9675
Framework.update
train
def update(self): """ Stops and starts the framework, if the framework is active. :raise BundleException: Something wrong occurred while stopping or starting the framework. """ with self._lock: if self._state == Bundle.ACTIVE: ...
python
{ "resource": "" }
q9676
Framework.wait_for_stop
train
def wait_for_stop(self, timeout=None): # type: (Optional[int]) -> bool """ Waits for the framework to stop. Does nothing if the framework bundle is not in ACTIVE state. Uses a threading.Condition object :param timeout: The maximum time to wait (in seconds) :retu...
python
{ "resource": "" }
q9677
ServiceObjects.unget_service
train
def unget_service(self, service): # type: (Any) -> bool """ Releases a service object for the associated service. :param service: An instance of a service returned by ``get_service()`` :return: True if the bundle usage has been removed """ return self.__registry....
python
{ "resource": "" }
q9678
BundleContext.get_service_reference
train
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
{ "resource": "" }
q9679
BundleContext.get_service_references
train
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
{ "resource": "" }
q9680
BundleContext.register_service
train
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
{ "resource": "" }
q9681
BundleContext.unget_service
train
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
{ "resource": "" }
q9682
FrameworkFactory.get_framework
train
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
{ "resource": "" }
q9683
FrameworkFactory.delete_framework
train
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
{ "resource": "" }
q9684
get_matching_interfaces
train
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
{ "resource": "" }
q9685
get_prop_value
train
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
{ "resource": "" }
q9686
set_prop_if_null
train
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
{ "resource": "" }
q9687
get_string_plus_property_value
train
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
{ "resource": "" }
q9688
get_string_plus_property
train
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
{ "resource": "" }
q9689
get_exported_interfaces
train
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
{ "resource": "" }
q9690
validate_exported_interfaces
train
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
{ "resource": "" }
q9691
get_package_versions
train
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
{ "resource": "" }
q9692
get_rsa_props
train
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
{ "resource": "" }
q9693
get_ecf_props
train
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
{ "resource": "" }
q9694
get_edef_props
train
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
{ "resource": "" }
q9695
get_dot_properties
train
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
{ "resource": "" }
q9696
copy_non_reserved
train
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
{ "resource": "" }
q9697
copy_non_ecf
train
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
{ "resource": "" }
q9698
set_append
train
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
{ "resource": "" }
q9699
RemoteServiceAdminEvent.fromimportreg
train
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
{ "resource": "" }