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
samples/handler/logger_minimal.py
_LoggerHandlerFactory.get_handlers
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component ...
python
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component ...
[ "def", "get_handlers", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# Extract information from the context", "logger_field", "=", "component_context", ".", "get_handler", "(", "constants", ".", "HANDLER_LOGGER", ")", "if", "not", "logger_field", ...
Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component (never None)
[ "Sets", "up", "service", "providers", "for", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/samples/handler/logger_minimal.py#L100-L125
tcalmant/ipopo
pelix/shell/console.py
_resolve_file
def _resolve_file(file_name): """ Checks if the file exists. If the file exists, the method returns its absolute path. Else, it returns None :param file_name: The name of the file to check :return: An absolute path, or None """ if not file_name: return None path = os.path....
python
def _resolve_file(file_name): """ Checks if the file exists. If the file exists, the method returns its absolute path. Else, it returns None :param file_name: The name of the file to check :return: An absolute path, or None """ if not file_name: return None path = os.path....
[ "def", "_resolve_file", "(", "file_name", ")", ":", "if", "not", "file_name", ":", "return", "None", "path", "=", "os", ".", "path", ".", "realpath", "(", "file_name", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "pat...
Checks if the file exists. If the file exists, the method returns its absolute path. Else, it returns None :param file_name: The name of the file to check :return: An absolute path, or None
[ "Checks", "if", "the", "file", "exists", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L497-L514
tcalmant/ipopo
pelix/shell/console.py
make_common_parser
def make_common_parser(): """ Creates an argument parser (argparse module) with the options that should be common to all shells. The result can be used as a parent parser (``parents`` argument in ``argparse.ArgumentParser``) :return: An ArgumentParser object """ parser = argparse.Argum...
python
def make_common_parser(): """ Creates an argument parser (argparse module) with the options that should be common to all shells. The result can be used as a parent parser (``parents`` argument in ``argparse.ArgumentParser``) :return: An ArgumentParser object """ parser = argparse.Argum...
[ "def", "make_common_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "add_help", "=", "False", ")", "# Version number", "parser", ".", "add_argument", "(", "\"--version\"", ",", "action", "=", "\"version\"", ",", "version", "=", "...
Creates an argument parser (argparse module) with the options that should be common to all shells. The result can be used as a parent parser (``parents`` argument in ``argparse.ArgumentParser``) :return: An ArgumentParser object
[ "Creates", "an", "argument", "parser", "(", "argparse", "module", ")", "with", "the", "options", "that", "should", "be", "common", "to", "all", "shells", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L517-L594
tcalmant/ipopo
pelix/shell/console.py
handle_common_arguments
def handle_common_arguments(parsed_args): """ Handles the arguments defined by :meth:`~make_common_parser` :param parsed_args: Argument parsed with ``argparse`` (``Namespace``) :return: An :class:`~InitFileHandler` object :raise IOError: Initial or run script not found """ # Setup the logge...
python
def handle_common_arguments(parsed_args): """ Handles the arguments defined by :meth:`~make_common_parser` :param parsed_args: Argument parsed with ``argparse`` (``Namespace``) :return: An :class:`~InitFileHandler` object :raise IOError: Initial or run script not found """ # Setup the logge...
[ "def", "handle_common_arguments", "(", "parsed_args", ")", ":", "# Setup the logger", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", "if", "parsed_args", ".", "verbose", "else", "logging", ".", "WARNING", ")", "# Framework properties dict...
Handles the arguments defined by :meth:`~make_common_parser` :param parsed_args: Argument parsed with ``argparse`` (``Namespace``) :return: An :class:`~InitFileHandler` object :raise IOError: Initial or run script not found
[ "Handles", "the", "arguments", "defined", "by", ":", "meth", ":", "~make_common_parser" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L597-L656
tcalmant/ipopo
pelix/shell/console.py
main
def main(argv=None): """ Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None """ # Parse arguments parser = argparse.ArgumentParser( prog="pelix.shell.console", parents=[make_common_parser()], description="Pelix Shell Console",...
python
def main(argv=None): """ Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None """ # Parse arguments parser = argparse.ArgumentParser( prog="pelix.shell.console", parents=[make_common_parser()], description="Pelix Shell Console",...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "# Parse arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "\"pelix.shell.console\"", ",", "parents", "=", "[", "make_common_parser", "(", ")", "]", ",", "description", "=", "\"...
Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None
[ "Entry", "point" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L659-L702
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell._normal_prompt
def _normal_prompt(self): """ Flushes the prompt before requesting the input :return: The command line """ sys.stdout.write(self.__get_ps1()) sys.stdout.flush() return safe_input()
python
def _normal_prompt(self): """ Flushes the prompt before requesting the input :return: The command line """ sys.stdout.write(self.__get_ps1()) sys.stdout.flush() return safe_input()
[ "def", "_normal_prompt", "(", "self", ")", ":", "sys", ".", "stdout", ".", "write", "(", "self", ".", "__get_ps1", "(", ")", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "return", "safe_input", "(", ")" ]
Flushes the prompt before requesting the input :return: The command line
[ "Flushes", "the", "prompt", "before", "requesting", "the", "input" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L137-L145
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.loop_input
def loop_input(self, on_quit=None): """ Reads the standard input until the shell session is stopped :param on_quit: A call back method, called without argument when the shell session has ended """ # Start the init script self._run_script( ...
python
def loop_input(self, on_quit=None): """ Reads the standard input until the shell session is stopped :param on_quit: A call back method, called without argument when the shell session has ended """ # Start the init script self._run_script( ...
[ "def", "loop_input", "(", "self", ",", "on_quit", "=", "None", ")", ":", "# Start the init script", "self", ".", "_run_script", "(", "self", ".", "__session", ",", "self", ".", "_context", ".", "get_property", "(", "PROP_INIT_FILE", ")", ")", "# Run the script...
Reads the standard input until the shell session is stopped :param on_quit: A call back method, called without argument when the shell session has ended
[ "Reads", "the", "standard", "input", "until", "the", "shell", "session", "is", "stopped" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L147-L173
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell._run_script
def _run_script(self, session, file_path): """ Runs the given script file :param session: Current shell session :param file_path: Path to the file to execute :return: True if a file has been execute """ if file_path: # The 'run' command returns False ...
python
def _run_script(self, session, file_path): """ Runs the given script file :param session: Current shell session :param file_path: Path to the file to execute :return: True if a file has been execute """ if file_path: # The 'run' command returns False ...
[ "def", "_run_script", "(", "self", ",", "session", ",", "file_path", ")", ":", "if", "file_path", ":", "# The 'run' command returns False in case of error", "# The 'execute' method returns False if the run command fails", "return", "self", ".", "_shell", ".", "execute", "("...
Runs the given script file :param session: Current shell session :param file_path: Path to the file to execute :return: True if a file has been execute
[ "Runs", "the", "given", "script", "file" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L175-L188
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell._run_loop
def _run_loop(self, session): """ Runs the main input loop :param session: Current shell session """ try: first_prompt = True # Set up the prompt prompt = ( self._readline_prompt if readline is not None ...
python
def _run_loop(self, session): """ Runs the main input loop :param session: Current shell session """ try: first_prompt = True # Set up the prompt prompt = ( self._readline_prompt if readline is not None ...
[ "def", "_run_loop", "(", "self", ",", "session", ")", ":", "try", ":", "first_prompt", "=", "True", "# Set up the prompt", "prompt", "=", "(", "self", ".", "_readline_prompt", "if", "readline", "is", "not", "None", "else", "self", ".", "_normal_prompt", ")",...
Runs the main input loop :param session: Current shell session
[ "Runs", "the", "main", "input", "loop" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L190-L230
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.readline_completer
def readline_completer(self, text, state): """ A completer for the readline library """ if state == 0: # New completion, reset the list of matches and the display hook self._readline_matches = [] try: readline.set_completion_display_mat...
python
def readline_completer(self, text, state): """ A completer for the readline library """ if state == 0: # New completion, reset the list of matches and the display hook self._readline_matches = [] try: readline.set_completion_display_mat...
[ "def", "readline_completer", "(", "self", ",", "text", ",", "state", ")", ":", "if", "state", "==", "0", ":", "# New completion, reset the list of matches and the display hook", "self", ".", "_readline_matches", "=", "[", "]", "try", ":", "readline", ".", "set_com...
A completer for the readline library
[ "A", "completer", "for", "the", "readline", "library" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L232-L336
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.search_shell
def search_shell(self): """ Looks for a shell service """ with self._lock: if self._shell is not None: # A shell is already there return reference = self._context.get_service_reference(SERVICE_SHELL) if reference is not...
python
def search_shell(self): """ Looks for a shell service """ with self._lock: if self._shell is not None: # A shell is already there return reference = self._context.get_service_reference(SERVICE_SHELL) if reference is not...
[ "def", "search_shell", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_shell", "is", "not", "None", ":", "# A shell is already there", "return", "reference", "=", "self", ".", "_context", ".", "get_service_reference", "(", "SER...
Looks for a shell service
[ "Looks", "for", "a", "shell", "service" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L338-L349
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.service_changed
def service_changed(self, event): """ Called by Pelix when an events changes """ kind = event.get_kind() reference = event.get_service_reference() if kind in (pelix.ServiceEvent.REGISTERED, pelix.ServiceEvent.MODIFIED): # A service matches our filter ...
python
def service_changed(self, event): """ Called by Pelix when an events changes """ kind = event.get_kind() reference = event.get_service_reference() if kind in (pelix.ServiceEvent.REGISTERED, pelix.ServiceEvent.MODIFIED): # A service matches our filter ...
[ "def", "service_changed", "(", "self", ",", "event", ")", ":", "kind", "=", "event", ".", "get_kind", "(", ")", "reference", "=", "event", ".", "get_service_reference", "(", ")", "if", "kind", "in", "(", "pelix", ".", "ServiceEvent", ".", "REGISTERED", "...
Called by Pelix when an events changes
[ "Called", "by", "Pelix", "when", "an", "events", "changes" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L351-L368
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.set_shell
def set_shell(self, svc_ref): """ Binds the given shell service. :param svc_ref: A service reference """ if svc_ref is None: return with self._lock: # Get the service self._shell_ref = svc_ref self._shell = self._context.g...
python
def set_shell(self, svc_ref): """ Binds the given shell service. :param svc_ref: A service reference """ if svc_ref is None: return with self._lock: # Get the service self._shell_ref = svc_ref self._shell = self._context.g...
[ "def", "set_shell", "(", "self", ",", "svc_ref", ")", ":", "if", "svc_ref", "is", "None", ":", "return", "with", "self", ".", "_lock", ":", "# Get the service", "self", ".", "_shell_ref", "=", "svc_ref", "self", ".", "_shell", "=", "self", ".", "_context...
Binds the given shell service. :param svc_ref: A service reference
[ "Binds", "the", "given", "shell", "service", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L370-L389
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.clear_shell
def clear_shell(self): """ Unbinds the active shell service """ with self._lock: # Clear the flag self._shell_event.clear() # Clear the readline completer if readline is not None: readline.set_completer(None) ...
python
def clear_shell(self): """ Unbinds the active shell service """ with self._lock: # Clear the flag self._shell_event.clear() # Clear the readline completer if readline is not None: readline.set_completer(None) ...
[ "def", "clear_shell", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "# Clear the flag", "self", ".", "_shell_event", ".", "clear", "(", ")", "# Clear the readline completer", "if", "readline", "is", "not", "None", ":", "readline", ".", "set_complet...
Unbinds the active shell service
[ "Unbinds", "the", "active", "shell", "service" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L391-L409
tcalmant/ipopo
pelix/shell/console.py
InteractiveShell.stop
def stop(self): """ Clears all members """ # Exit the loop with self._lock: self._stop_event.set() self._shell_event.clear() if self._context is not None: # Unregister from events self._context.remove_service_listener(self)...
python
def stop(self): """ Clears all members """ # Exit the loop with self._lock: self._stop_event.set() self._shell_event.clear() if self._context is not None: # Unregister from events self._context.remove_service_listener(self)...
[ "def", "stop", "(", "self", ")", ":", "# Exit the loop", "with", "self", ".", "_lock", ":", "self", ".", "_stop_event", ".", "set", "(", ")", "self", ".", "_shell_event", ".", "clear", "(", ")", "if", "self", ".", "_context", "is", "not", "None", ":"...
Clears all members
[ "Clears", "all", "members" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/console.py#L411-L426
tcalmant/ipopo
pelix/remote/json_rpc.py
_JsonRpcServlet.do_POST
def do_POST(self, request, response): # pylint: disable=C0103 """ Handles a HTTP POST request :param request: The HTTP request bean :param response: The HTTP response handler """ try: # Get the request content data = to_str(request.read_da...
python
def do_POST(self, request, response): # pylint: disable=C0103 """ Handles a HTTP POST request :param request: The HTTP request bean :param response: The HTTP response handler """ try: # Get the request content data = to_str(request.read_da...
[ "def", "do_POST", "(", "self", ",", "request", ",", "response", ")", ":", "# pylint: disable=C0103", "try", ":", "# Get the request content", "data", "=", "to_str", "(", "request", ".", "read_data", "(", ")", ")", "# Dispatch", "result", "=", "self", ".", "_...
Handles a HTTP POST request :param request: The HTTP request bean :param response: The HTTP response handler
[ "Handles", "a", "HTTP", "POST", "request" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/json_rpc.py#L115-L135
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_HandlerFactory._prepare_requirements
def _prepare_requirements(requirements, requires_filters): """ Overrides the filters specified in the decorator with the given ones :param requirements: Dictionary of requirements (field → Requirement) :param requires_filters: Content of the 'requires.filter' component ...
python
def _prepare_requirements(requirements, requires_filters): """ Overrides the filters specified in the decorator with the given ones :param requirements: Dictionary of requirements (field → Requirement) :param requires_filters: Content of the 'requires.filter' component ...
[ "def", "_prepare_requirements", "(", "requirements", ",", "requires_filters", ")", ":", "if", "not", "requires_filters", "or", "not", "isinstance", "(", "requires_filters", ",", "dict", ")", ":", "# No explicit filter configured", "return", "requirements", "# We need to...
Overrides the filters specified in the decorator with the given ones :param requirements: Dictionary of requirements (field → Requirement) :param requires_filters: Content of the 'requires.filter' component property (field → string) :return: The new requirements
[ "Overrides", "the", "filters", "specified", "in", "the", "decorator", "with", "the", "given", "ones" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L59-L88
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_HandlerFactory.get_handlers
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
python
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
[ "def", "get_handlers", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# Extract information from the context", "requirements", "=", "component_context", ".", "get_handler", "(", "ipopo_constants", ".", "HANDLER_REQUIRES", ")", "requires_filters", "=", ...
Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component
[ "Sets", "up", "service", "providers", "for", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L90-L120
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_RuntimeDependency.manipulate
def manipulate(self, stored_instance, component_instance): """ Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance... self._ipopo_instan...
python
def manipulate(self, stored_instance, component_instance): """ Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance... self._ipopo_instan...
[ "def", "manipulate", "(", "self", ",", "stored_instance", ",", "component_instance", ")", ":", "# Store the stored instance...", "self", ".", "_ipopo_instance", "=", "stored_instance", "# ... and the bundle context", "self", ".", "_context", "=", "stored_instance", ".", ...
Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance
[ "Stores", "the", "given", "StoredInstance", "bean", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L193-L204
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_RuntimeDependency.clear
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self._lock = None self._ipopo_instance = None self._context = None self.requirement = None self._value = None self._field = None
python
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self._lock = None self._ipopo_instance = None self._context = None self.requirement = None self._value = None self._field = None
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_lock", "=", "None", "self", ".", "_ipopo_instance", "=", "None", "self", ".", "_context", "=", "None", "self", ".", "requirement", "=", "None", "self", ".", "_value", "=", "None", "self", ".", "_f...
Cleans up the manager. The manager can't be used after this method has been called
[ "Cleans", "up", "the", "manager", ".", "The", "manager", "can", "t", "be", "used", "after", "this", "method", "has", "been", "called" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L206-L216
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_RuntimeDependency.service_changed
def service_changed(self, event): """ Called by the framework when a service event occurs """ if ( self._ipopo_instance is None or not self._ipopo_instance.check_event(event) ): # stop() and clean() may have been called after we have been put ...
python
def service_changed(self, event): """ Called by the framework when a service event occurs """ if ( self._ipopo_instance is None or not self._ipopo_instance.check_event(event) ): # stop() and clean() may have been called after we have been put ...
[ "def", "service_changed", "(", "self", ",", "event", ")", ":", "if", "(", "self", ".", "_ipopo_instance", "is", "None", "or", "not", "self", ".", "_ipopo_instance", ".", "check_event", "(", "event", ")", ")", ":", "# stop() and clean() may have been called after...
Called by the framework when a service event occurs
[ "Called", "by", "the", "framework", "when", "a", "service", "event", "occurs" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L282-L312
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
_RuntimeDependency.start
def start(self): """ Starts the dependency manager """ self._context.add_service_listener( self, self.requirement.filter, self.requirement.specification )
python
def start(self): """ Starts the dependency manager """ self._context.add_service_listener( self, self.requirement.filter, self.requirement.specification )
[ "def", "start", "(", "self", ")", ":", "self", ".", "_context", ".", "add_service_listener", "(", "self", ",", "self", ".", "requirement", ".", "filter", ",", "self", ".", "requirement", ".", "specification", ")" ]
Starts the dependency manager
[ "Starts", "the", "dependency", "manager" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L314-L320
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.clear
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.reference = None self._pending_ref = None super(SimpleDependency, self).clear()
python
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.reference = None self._pending_ref = None super(SimpleDependency, self).clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "reference", "=", "None", "self", ".", "_pending_ref", "=", "None", "super", "(", "SimpleDependency", ",", "self", ")", ".", "clear", "(", ")" ]
Cleans up the manager. The manager can't be used after this method has been called
[ "Cleans", "up", "the", "manager", ".", "The", "manager", "can", "t", "be", "used", "after", "this", "method", "has", "been", "called" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L348-L355
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.on_service_arrival
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if self._value is None: # Inject the service self.reference = svc_ref ...
python
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if self._value is None: # Inject the service self.reference = svc_ref ...
[ "def", "on_service_arrival", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_value", "is", "None", ":", "# Inject the service", "self", ".", "reference", "=", "svc_ref", "self", ".", "_value", "=", "self", "...
Called when a service has been registered in the framework :param svc_ref: A service reference
[ "Called", "when", "a", "service", "has", "been", "registered", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L369-L384
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.on_service_modify
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values """ with self._lock: if self.reference is None: ...
python
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values """ with self._lock: if self.reference is None: ...
[ "def", "on_service_modify", "(", "self", ",", "svc_ref", ",", "old_properties", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "reference", "is", "None", ":", "# A previously registered service now matches our filter", "self", ".", "on_service_arriv...
Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values
[ "Called", "when", "a", "service", "has", "been", "modified", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L411-L426
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.stop
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ super(SimpleDependency, self).stop() if self.reference is not None: # Return a tuple of tuple return ((self._value, s...
python
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ super(SimpleDependency, self).stop() if self.reference is not None: # Return a tuple of tuple return ((self._value, s...
[ "def", "stop", "(", "self", ")", ":", "super", "(", "SimpleDependency", ",", "self", ")", ".", "stop", "(", ")", "if", "self", ".", "reference", "is", "not", "None", ":", "# Return a tuple of tuple", "return", "(", "(", "self", ".", "_value", ",", "sel...
Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None
[ "Stops", "the", "dependency", "manager", "(", "must", "be", "called", "before", "clear", "()", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L428-L439
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.is_valid
def is_valid(self): """ Tests if the dependency is in a valid state """ return super(SimpleDependency, self).is_valid() or ( self.requirement.immediate_rebind and self._pending_ref is not None )
python
def is_valid(self): """ Tests if the dependency is in a valid state """ return super(SimpleDependency, self).is_valid() or ( self.requirement.immediate_rebind and self._pending_ref is not None )
[ "def", "is_valid", "(", "self", ")", ":", "return", "super", "(", "SimpleDependency", ",", "self", ")", ".", "is_valid", "(", ")", "or", "(", "self", ".", "requirement", ".", "immediate_rebind", "and", "self", ".", "_pending_ref", "is", "not", "None", ")...
Tests if the dependency is in a valid state
[ "Tests", "if", "the", "dependency", "is", "in", "a", "valid", "state" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L441-L447
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
SimpleDependency.try_binding
def try_binding(self): """ Searches for the required service if needed :raise BundleException: Invalid ServiceReference found """ with self._lock: if self.reference is not None: # Already bound return if self._pending_ref ...
python
def try_binding(self): """ Searches for the required service if needed :raise BundleException: Invalid ServiceReference found """ with self._lock: if self.reference is not None: # Already bound return if self._pending_ref ...
[ "def", "try_binding", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "reference", "is", "not", "None", ":", "# Already bound", "return", "if", "self", ".", "_pending_ref", "is", "not", "None", ":", "# Get the reference we chose ...
Searches for the required service if needed :raise BundleException: Invalid ServiceReference found
[ "Searches", "for", "the", "required", "service", "if", "needed" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L449-L472
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
AggregateDependency.clear
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.services.clear() self.services = None self._future_value = None super(AggregateDependency, self).clear()
python
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.services.clear() self.services = None self._future_value = None super(AggregateDependency, self).clear()
[ "def", "clear", "(", "self", ")", ":", "self", ".", "services", ".", "clear", "(", ")", "self", ".", "services", "=", "None", "self", ".", "_future_value", "=", "None", "super", "(", "AggregateDependency", ",", "self", ")", ".", "clear", "(", ")" ]
Cleans up the manager. The manager can't be used after this method has been called
[ "Cleans", "up", "the", "manager", ".", "The", "manager", "can", "t", "be", "used", "after", "this", "method", "has", "been", "called" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L492-L500
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
AggregateDependency.on_service_arrival
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if svc_ref not in self.services: # Get the new service service = self._conte...
python
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if svc_ref not in self.services: # Get the new service service = self._conte...
[ "def", "on_service_arrival", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "if", "svc_ref", "not", "in", "self", ".", "services", ":", "# Get the new service", "service", "=", "self", ".", "_context", ".", "get_service", "(", "s...
Called when a service has been registered in the framework :param svc_ref: A service reference
[ "Called", "when", "a", "service", "has", "been", "registered", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L532-L554
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
AggregateDependency.on_service_departure
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None """ with self._lock: ...
python
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None """ with self._lock: ...
[ "def", "on_service_departure", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "try", ":", "# Get the service instance", "service", "=", "self", ".", "services", ".", "pop", "(", "svc_ref", ")", "except", "KeyError", ":", "# Not a k...
Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None
[ "Called", "when", "a", "service", "has", "been", "unregistered", "from", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L556-L582
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
AggregateDependency.on_service_modify
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has ...
python
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has ...
[ "def", "on_service_modify", "(", "self", ",", "svc_ref", ",", "old_properties", ")", ":", "with", "self", ".", "_lock", ":", "try", ":", "# Look for the service", "service", "=", "self", ".", "services", "[", "svc_ref", "]", "except", "KeyError", ":", "# A p...
Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has been changed, else None
[ "Called", "when", "a", "service", "has", "been", "modified", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L584-L606
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
AggregateDependency.stop
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ super(AggregateDependency, self).stop() if self.services: return [ (service, reference) for refe...
python
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ super(AggregateDependency, self).stop() if self.services: return [ (service, reference) for refe...
[ "def", "stop", "(", "self", ")", ":", "super", "(", "AggregateDependency", ",", "self", ")", ".", "stop", "(", ")", "if", "self", ".", "services", ":", "return", "[", "(", "service", ",", "reference", ")", "for", "reference", ",", "service", "in", "s...
Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None
[ "Stops", "the", "dependency", "manager", "(", "must", "be", "called", "before", "clear", "()", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L608-L622
tcalmant/ipopo
pelix/misc/log.py
LogReaderService._store_entry
def _store_entry(self, entry): """ Stores a new log entry and notifies listeners :param entry: A LogEntry object """ # Get the logger and log the message self.__logs.append(entry) # Notify listeners for listener in self.__listeners.copy(): tr...
python
def _store_entry(self, entry): """ Stores a new log entry and notifies listeners :param entry: A LogEntry object """ # Get the logger and log the message self.__logs.append(entry) # Notify listeners for listener in self.__listeners.copy(): tr...
[ "def", "_store_entry", "(", "self", ",", "entry", ")", ":", "# Get the logger and log the message", "self", ".", "__logs", ".", "append", "(", "entry", ")", "# Notify listeners", "for", "listener", "in", "self", ".", "__listeners", ".", "copy", "(", ")", ":", ...
Stores a new log entry and notifies listeners :param entry: A LogEntry object
[ "Stores", "a", "new", "log", "entry", "and", "notifies", "listeners" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/log.py#L241-L270
tcalmant/ipopo
pelix/misc/log.py
LogServiceInstance.log
def log(self, level, message, exc_info=None, reference=None): # pylint: disable=W0212 """ Logs a message, possibly with an exception :param level: Severity of the message (Python logging level) :param message: Human readable message :param exc_info: The exception context...
python
def log(self, level, message, exc_info=None, reference=None): # pylint: disable=W0212 """ Logs a message, possibly with an exception :param level: Severity of the message (Python logging level) :param message: Human readable message :param exc_info: The exception context...
[ "def", "log", "(", "self", ",", "level", ",", "message", ",", "exc_info", "=", "None", ",", "reference", "=", "None", ")", ":", "# pylint: disable=W0212", "if", "not", "isinstance", "(", "reference", ",", "pelix", ".", "framework", ".", "ServiceReference", ...
Logs a message, possibly with an exception :param level: Severity of the message (Python logging level) :param message: Human readable message :param exc_info: The exception context (sys.exc_info()), if any :param reference: The ServiceReference associated to the log
[ "Logs", "a", "message", "possibly", "with", "an", "exception" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/log.py#L289-L316
tcalmant/ipopo
pelix/misc/log.py
LogServiceFactory._bundle_from_module
def _bundle_from_module(self, module_object): """ Find the bundle associated to a module :param module_object: A Python module object :return: The Bundle object associated to the module, or None """ try: # Get the module name module_object = modul...
python
def _bundle_from_module(self, module_object): """ Find the bundle associated to a module :param module_object: A Python module object :return: The Bundle object associated to the module, or None """ try: # Get the module name module_object = modul...
[ "def", "_bundle_from_module", "(", "self", ",", "module_object", ")", ":", "try", ":", "# Get the module name", "module_object", "=", "module_object", ".", "__name__", "except", "AttributeError", ":", "# We got a string", "pass", "return", "self", ".", "_framework", ...
Find the bundle associated to a module :param module_object: A Python module object :return: The Bundle object associated to the module, or None
[ "Find", "the", "bundle", "associated", "to", "a", "module" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/log.py#L334-L348
tcalmant/ipopo
pelix/misc/log.py
LogServiceFactory.emit
def emit(self, record): # pylint: disable=W0212 """ Handle a message logged with the logger :param record: A log record """ # Get the bundle bundle = self._bundle_from_module(record.module) # Convert to a LogEntry entry = LogEntry( re...
python
def emit(self, record): # pylint: disable=W0212 """ Handle a message logged with the logger :param record: A log record """ # Get the bundle bundle = self._bundle_from_module(record.module) # Convert to a LogEntry entry = LogEntry( re...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "# pylint: disable=W0212", "# Get the bundle", "bundle", "=", "self", ".", "_bundle_from_module", "(", "record", ".", "module", ")", "# Convert to a LogEntry", "entry", "=", "LogEntry", "(", "record", ".", "le...
Handle a message logged with the logger :param record: A log record
[ "Handle", "a", "message", "logged", "with", "the", "logger" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/log.py#L350-L364
tcalmant/ipopo
pelix/services/mqtt.py
_MqttConnection.publish
def publish(self, topic, payload, qos=0, retain=False): """ Publishes an MQTT message """ # TODO: check (full transmission) success return self._client.publish(topic, payload, qos, retain)
python
def publish(self, topic, payload, qos=0, retain=False): """ Publishes an MQTT message """ # TODO: check (full transmission) success return self._client.publish(topic, payload, qos, retain)
[ "def", "publish", "(", "self", ",", "topic", ",", "payload", ",", "qos", "=", "0", ",", "retain", "=", "False", ")", ":", "# TODO: check (full transmission) success", "return", "self", ".", "_client", ".", "publish", "(", "topic", ",", "payload", ",", "qos...
Publishes an MQTT message
[ "Publishes", "an", "MQTT", "message" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/services/mqtt.py#L487-L492
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_HandlerFactory._prepare_requirements
def _prepare_requirements(configs, requires_filters): """ Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content of the 'requires.filter' component ...
python
def _prepare_requirements(configs, requires_filters): """ Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content of the 'requires.filter' component ...
[ "def", "_prepare_requirements", "(", "configs", ",", "requires_filters", ")", ":", "if", "not", "requires_filters", "or", "not", "isinstance", "(", "requires_filters", ",", "dict", ")", ":", "# No explicit filter configured", "return", "configs", "# We need to change a ...
Overrides the filters specified in the decorator with the given ones :param configs: Field → (Requirement, key, allow_none) dictionary :param requires_filters: Content of the 'requires.filter' component property (field → string) :return: The new configuration di...
[ "Overrides", "the", "filters", "specified", "in", "the", "decorator", "with", "the", "given", "ones" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L60-L92
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_HandlerFactory.get_handlers
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
python
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
[ "def", "get_handlers", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# Extract information from the context", "configs", "=", "component_context", ".", "get_handler", "(", "ipopo_constants", ".", "HANDLER_REQUIRES_MAP", ")", "requires_filters", "=", ...
Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component
[ "Sets", "up", "service", "providers", "for", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L94-L129
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_RuntimeDependency.manipulate
def manipulate(self, stored_instance, component_instance): """ Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance... self._ipopo_instan...
python
def manipulate(self, stored_instance, component_instance): """ Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance... self._ipopo_instan...
[ "def", "manipulate", "(", "self", ",", "stored_instance", ",", "component_instance", ")", ":", "# Store the stored instance...", "self", ".", "_ipopo_instance", "=", "stored_instance", "# ... and the bundle context", "self", ".", "_context", "=", "stored_instance", ".", ...
Stores the given StoredInstance bean. :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance
[ "Stores", "the", "given", "StoredInstance", "bean", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L213-L227
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_RuntimeDependency.clear
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.services.clear() self._future_value.clear() self.services = None self._lock = None self._ipopo_instance = None self._context =...
python
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ self.services.clear() self._future_value.clear() self.services = None self._lock = None self._ipopo_instance = None self._context =...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "services", ".", "clear", "(", ")", "self", ".", "_future_value", ".", "clear", "(", ")", "self", ".", "services", "=", "None", "self", ".", "_lock", "=", "None", "self", ".", "_ipopo_instance", "="...
Cleans up the manager. The manager can't be used after this method has been called
[ "Cleans", "up", "the", "manager", ".", "The", "manager", "can", "t", "be", "used", "after", "this", "method", "has", "been", "called" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L229-L245
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_RuntimeDependency.is_valid
def is_valid(self): """ Tests if the dependency is in a valid state """ return ( self.requirement is not None and self.requirement.optional ) or bool(self._future_value)
python
def is_valid(self): """ Tests if the dependency is in a valid state """ return ( self.requirement is not None and self.requirement.optional ) or bool(self._future_value)
[ "def", "is_valid", "(", "self", ")", ":", "return", "(", "self", ".", "requirement", "is", "not", "None", "and", "self", ".", "requirement", ".", "optional", ")", "or", "bool", "(", "self", ".", "_future_value", ")" ]
Tests if the dependency is in a valid state
[ "Tests", "if", "the", "dependency", "is", "in", "a", "valid", "state" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L281-L287
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_RuntimeDependency.stop
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ self._context.remove_service_listener(self) if self.services: return [ (service, reference) for r...
python
def stop(self): """ Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None """ self._context.remove_service_listener(self) if self.services: return [ (service, reference) for r...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_context", ".", "remove_service_listener", "(", "self", ")", "if", "self", ".", "services", ":", "return", "[", "(", "service", ",", "reference", ")", "for", "reference", ",", "service", "in", "self", ...
Stops the dependency manager (must be called before clear()) :return: The removed bindings (list) or None
[ "Stops", "the", "dependency", "manager", "(", "must", "be", "called", "before", "clear", "()", ")" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L354-L367
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
_RuntimeDependency.try_binding
def try_binding(self): """ Searches for the required service if needed :raise BundleException: Invalid ServiceReference found """ with self._lock: if self.services: # We already are alive (not our first call) # => we are updated throug...
python
def try_binding(self): """ Searches for the required service if needed :raise BundleException: Invalid ServiceReference found """ with self._lock: if self.services: # We already are alive (not our first call) # => we are updated throug...
[ "def", "try_binding", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "services", ":", "# We already are alive (not our first call)", "# => we are updated through service events", "return", "# Get all matching services", "refs", "=", "self", ...
Searches for the required service if needed :raise BundleException: Invalid ServiceReference found
[ "Searches", "for", "the", "required", "service", "if", "needed" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L369-L412
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
SimpleDependency.on_service_arrival
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if svc_ref not in self.services: # Get the key property prop_value = svc_ref...
python
def on_service_arrival(self, svc_ref): """ Called when a service has been registered in the framework :param svc_ref: A service reference """ with self._lock: if svc_ref not in self.services: # Get the key property prop_value = svc_ref...
[ "def", "on_service_arrival", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "if", "svc_ref", "not", "in", "self", ".", "services", ":", "# Get the key property", "prop_value", "=", "svc_ref", ".", "get_property", "(", "self", ".", ...
Called when a service has been registered in the framework :param svc_ref: A service reference
[ "Called", "when", "a", "service", "has", "been", "registered", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L420-L446
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
AggregateDependency.__store_service
def __store_service(self, key, service): """ Stores the given service in the dictionary :param key: Dictionary key :param service: Service to add to the dictionary """ self._future_value.setdefault(key, []).append(service)
python
def __store_service(self, key, service): """ Stores the given service in the dictionary :param key: Dictionary key :param service: Service to add to the dictionary """ self._future_value.setdefault(key, []).append(service)
[ "def", "__store_service", "(", "self", ",", "key", ",", "service", ")", ":", "self", ".", "_future_value", ".", "setdefault", "(", "key", ",", "[", "]", ")", ".", "append", "(", "service", ")" ]
Stores the given service in the dictionary :param key: Dictionary key :param service: Service to add to the dictionary
[ "Stores", "the", "given", "service", "in", "the", "dictionary" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L521-L528
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
AggregateDependency.__remove_service
def __remove_service(self, key, service): """ Removes the given service from the future dictionary :param key: Dictionary key :param service: Service to remove from the dictionary """ try: # Remove the injected service prop_services = self._future...
python
def __remove_service(self, key, service): """ Removes the given service from the future dictionary :param key: Dictionary key :param service: Service to remove from the dictionary """ try: # Remove the injected service prop_services = self._future...
[ "def", "__remove_service", "(", "self", ",", "key", ",", "service", ")", ":", "try", ":", "# Remove the injected service", "prop_services", "=", "self", ".", "_future_value", "[", "key", "]", "prop_services", ".", "remove", "(", "service", ")", "# Clean up", "...
Removes the given service from the future dictionary :param key: Dictionary key :param service: Service to remove from the dictionary
[ "Removes", "the", "given", "service", "from", "the", "future", "dictionary" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L530-L549
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
AggregateDependency.get_value
def get_value(self): """ Retrieves the value to inject in the component :return: The value to inject """ with self._lock: # The value field must be a deep copy of our dictionary if self._future_value is not None: return { ...
python
def get_value(self): """ Retrieves the value to inject in the component :return: The value to inject """ with self._lock: # The value field must be a deep copy of our dictionary if self._future_value is not None: return { ...
[ "def", "get_value", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "# The value field must be a deep copy of our dictionary", "if", "self", ".", "_future_value", "is", "not", "None", ":", "return", "{", "key", ":", "value", "[", ":", "]", "for", "...
Retrieves the value to inject in the component :return: The value to inject
[ "Retrieves", "the", "value", "to", "inject", "in", "the", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L551-L564
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
AggregateDependency.on_service_departure
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None """ with self._lock: ...
python
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None """ with self._lock: ...
[ "def", "on_service_departure", "(", "self", ",", "svc_ref", ")", ":", "with", "self", ".", "_lock", ":", "if", "svc_ref", "in", "self", ".", "services", ":", "# Get the service instance", "service", "=", "self", ".", "services", ".", "pop", "(", "svc_ref", ...
Called when a service has been unregistered from the framework :param svc_ref: A service reference :return: A tuple (service, reference) if the service has been lost, else None
[ "Called", "when", "a", "service", "has", "been", "unregistered", "from", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L590-L612
tcalmant/ipopo
pelix/ipopo/handlers/requiresmap.py
AggregateDependency.on_service_modify
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has ...
python
def on_service_modify(self, svc_ref, old_properties): """ Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has ...
[ "def", "on_service_modify", "(", "self", ",", "svc_ref", ",", "old_properties", ")", ":", "with", "self", ".", "_lock", ":", "if", "svc_ref", "not", "in", "self", ".", "services", ":", "# A previously registered service now matches our filter", "return", "self", "...
Called when a service has been modified in the framework :param svc_ref: A service reference :param old_properties: Previous properties values :return: A tuple (added, (service, reference)) if the dependency has been changed, else None
[ "Called", "when", "a", "service", "has", "been", "modified", "in", "the", "framework" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresmap.py#L614-L657
tcalmant/ipopo
pelix/rsa/remoteserviceadmin.py
ExportRegistrationImpl.match_sr
def match_sr(self, svc_ref, cid=None): # type: (ServiceReference, Optional[Tuple[str, str]] ) -> bool """ Checks if this export registration matches the given service reference :param svc_ref: A service reference :param cid: A container ID :return: True if the service ma...
python
def match_sr(self, svc_ref, cid=None): # type: (ServiceReference, Optional[Tuple[str, str]] ) -> bool """ Checks if this export registration matches the given service reference :param svc_ref: A service reference :param cid: A container ID :return: True if the service ma...
[ "def", "match_sr", "(", "self", ",", "svc_ref", ",", "cid", "=", "None", ")", ":", "# type: (ServiceReference, Optional[Tuple[str, str]] ) -> bool", "with", "self", ".", "__lock", ":", "our_sr", "=", "self", ".", "get_reference", "(", ")", "if", "our_sr", "is", ...
Checks if this export registration matches the given service reference :param svc_ref: A service reference :param cid: A container ID :return: True if the service matches this export registration
[ "Checks", "if", "this", "export", "registration", "matches", "the", "given", "service", "reference" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/remoteserviceadmin.py#L886-L908
tcalmant/ipopo
pelix/rsa/remoteserviceadmin.py
ExportRegistrationImpl.get_exception
def get_exception(self): # type: () -> Optional[Tuple[Any, Any, Any]] """ Returns the exception associated to the export :return: An exception tuple, if any """ with self.__lock: return ( self.__updateexception if self.__update...
python
def get_exception(self): # type: () -> Optional[Tuple[Any, Any, Any]] """ Returns the exception associated to the export :return: An exception tuple, if any """ with self.__lock: return ( self.__updateexception if self.__update...
[ "def", "get_exception", "(", "self", ")", ":", "# type: () -> Optional[Tuple[Any, Any, Any]]", "with", "self", ".", "__lock", ":", "return", "(", "self", ".", "__updateexception", "if", "self", ".", "__updateexception", "or", "self", ".", "__closed", "else", "self...
Returns the exception associated to the export :return: An exception tuple, if any
[ "Returns", "the", "exception", "associated", "to", "the", "export" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/remoteserviceadmin.py#L970-L982
tcalmant/ipopo
pelix/rsa/remoteserviceadmin.py
ExportRegistrationImpl.close
def close(self): """ Cleans up the export endpoint """ publish = False exporterid = rsid = exception = export_ref = ed = None with self.__lock: if not self.__closed: exporterid = self.__exportref.get_export_container_id() export...
python
def close(self): """ Cleans up the export endpoint """ publish = False exporterid = rsid = exception = export_ref = ed = None with self.__lock: if not self.__closed: exporterid = self.__exportref.get_export_container_id() export...
[ "def", "close", "(", "self", ")", ":", "publish", "=", "False", "exporterid", "=", "rsid", "=", "exception", "=", "export_ref", "=", "ed", "=", "None", "with", "self", ".", "__lock", ":", "if", "not", "self", ".", "__closed", ":", "exporterid", "=", ...
Cleans up the export endpoint
[ "Cleans", "up", "the", "export", "endpoint" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/remoteserviceadmin.py#L1026-L1055
tcalmant/ipopo
pelix/rsa/providers/discovery/__init__.py
EndpointAdvertiser.advertise_endpoint
def advertise_endpoint(self, endpoint_description): """ Advertise and endpoint_description for remote discovery. If it hasn't already been a endpoint_description will be advertised via a some protocol. :param endpoint_description: an instance of EndpointDescription to ad...
python
def advertise_endpoint(self, endpoint_description): """ Advertise and endpoint_description for remote discovery. If it hasn't already been a endpoint_description will be advertised via a some protocol. :param endpoint_description: an instance of EndpointDescription to ad...
[ "def", "advertise_endpoint", "(", "self", ",", "endpoint_description", ")", ":", "endpoint_id", "=", "endpoint_description", ".", "get_id", "(", ")", "with", "self", ".", "_published_endpoints_lock", ":", "if", "self", ".", "get_advertised_endpoint", "(", "endpoint_...
Advertise and endpoint_description for remote discovery. If it hasn't already been a endpoint_description will be advertised via a some protocol. :param endpoint_description: an instance of EndpointDescription to advertise. Must not be None. :return: True if advertised, False if...
[ "Advertise", "and", "endpoint_description", "for", "remote", "discovery", ".", "If", "it", "hasn", "t", "already", "been", "a", "endpoint_description", "will", "be", "advertised", "via", "a", "some", "protocol", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/discovery/__init__.py#L77-L98
tcalmant/ipopo
pelix/rsa/providers/discovery/__init__.py
EndpointAdvertiser.update_endpoint
def update_endpoint(self, updated_ed): """ Update a previously advertised endpoint_description. :param endpoint_description: an instance of EndpointDescription to update. Must not be None. :return: True if advertised, False if not (e.g. it's already been advertised) ...
python
def update_endpoint(self, updated_ed): """ Update a previously advertised endpoint_description. :param endpoint_description: an instance of EndpointDescription to update. Must not be None. :return: True if advertised, False if not (e.g. it's already been advertised) ...
[ "def", "update_endpoint", "(", "self", ",", "updated_ed", ")", ":", "endpoint_id", "=", "updated_ed", ".", "get_id", "(", ")", "with", "self", ".", "_published_endpoints_lock", ":", "if", "self", ".", "get_advertised_endpoint", "(", "endpoint_id", ")", "is", "...
Update a previously advertised endpoint_description. :param endpoint_description: an instance of EndpointDescription to update. Must not be None. :return: True if advertised, False if not (e.g. it's already been advertised)
[ "Update", "a", "previously", "advertised", "endpoint_description", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/discovery/__init__.py#L100-L120
tcalmant/ipopo
pelix/rsa/providers/discovery/__init__.py
EndpointAdvertiser.unadvertise_endpoint
def unadvertise_endpoint(self, endpointid): """ Unadvertise a previously-advertised endpointid (string). :param endpointid. The string returned from ed.get_id() or the value of property endpoint.id. Should not be None :return True if removed, False if not removed (hasn't been...
python
def unadvertise_endpoint(self, endpointid): """ Unadvertise a previously-advertised endpointid (string). :param endpointid. The string returned from ed.get_id() or the value of property endpoint.id. Should not be None :return True if removed, False if not removed (hasn't been...
[ "def", "unadvertise_endpoint", "(", "self", ",", "endpointid", ")", ":", "with", "self", ".", "_published_endpoints_lock", ":", "with", "self", ".", "_published_endpoints_lock", ":", "advertised", "=", "self", ".", "get_advertised_endpoint", "(", "endpointid", ")", ...
Unadvertise a previously-advertised endpointid (string). :param endpointid. The string returned from ed.get_id() or the value of property endpoint.id. Should not be None :return True if removed, False if not removed (hasn't been previously advertised by this advertiser
[ "Unadvertise", "a", "previously", "-", "advertised", "endpointid", "(", "string", ")", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/discovery/__init__.py#L122-L142
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
_HandlerFactory.get_handlers
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
python
def get_handlers(self, component_context, instance): """ Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component """ ...
[ "def", "get_handlers", "(", "self", ",", "component_context", ",", "instance", ")", ":", "# Retrieve the handler configuration", "provides", "=", "component_context", ".", "get_handler", "(", "ipopo_constants", ".", "HANDLER_PROVIDES", ")", "if", "not", "provides", ":...
Sets up service providers for the given component :param component_context: The ComponentContext bean :param instance: The component instance :return: The list of handlers associated to the given component
[ "Sets", "up", "service", "providers", "for", "the", "given", "component" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L56-L78
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler._field_controller_generator
def _field_controller_generator(self): """ Generates the methods called by the injected controller """ # Local variable, to avoid messing with "self" stored_instance = self._ipopo_instance def get_value(self, name): # pylint: disable=W0613 """ ...
python
def _field_controller_generator(self): """ Generates the methods called by the injected controller """ # Local variable, to avoid messing with "self" stored_instance = self._ipopo_instance def get_value(self, name): # pylint: disable=W0613 """ ...
[ "def", "_field_controller_generator", "(", "self", ")", ":", "# Local variable, to avoid messing with \"self\"", "stored_instance", "=", "self", ".", "_ipopo_instance", "def", "get_value", "(", "self", ",", "name", ")", ":", "# pylint: disable=W0613", "\"\"\"\n R...
Generates the methods called by the injected controller
[ "Generates", "the", "methods", "called", "by", "the", "injected", "controller" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L154-L187
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler.manipulate
def manipulate(self, stored_instance, component_instance): """ Manipulates the component instance :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance self._ipopo_instance = s...
python
def manipulate(self, stored_instance, component_instance): """ Manipulates the component instance :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance """ # Store the stored instance self._ipopo_instance = s...
[ "def", "manipulate", "(", "self", ",", "stored_instance", ",", "component_instance", ")", ":", "# Store the stored instance", "self", ".", "_ipopo_instance", "=", "stored_instance", "if", "self", ".", "__controller", "is", "None", ":", "# No controller: do nothing", "...
Manipulates the component instance :param stored_instance: The iPOPO component StoredInstance :param component_instance: The component instance
[ "Manipulates", "the", "component", "instance" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L189-L224
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler.on_controller_change
def on_controller_change(self, name, value): """ Called by the instance manager when a controller value has been modified :param name: The name of the controller :param value: The new value of the controller """ if self.__controller != name: # Nothing...
python
def on_controller_change(self, name, value): """ Called by the instance manager when a controller value has been modified :param name: The name of the controller :param value: The new value of the controller """ if self.__controller != name: # Nothing...
[ "def", "on_controller_change", "(", "self", ",", "name", ",", "value", ")", ":", "if", "self", ".", "__controller", "!=", "name", ":", "# Nothing to do", "return", "# Update the controller value", "self", ".", "__controller_on", "=", "value", "if", "value", ":",...
Called by the instance manager when a controller value has been modified :param name: The name of the controller :param value: The new value of the controller
[ "Called", "by", "the", "instance", "manager", "when", "a", "controller", "value", "has", "been", "modified" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L251-L270
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler.on_property_change
def on_property_change(self, name, old_value, new_value): """ Called by the instance manager when a component property is modified :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value """ if...
python
def on_property_change(self, name, old_value, new_value): """ Called by the instance manager when a component property is modified :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value """ if...
[ "def", "on_property_change", "(", "self", ",", "name", ",", "old_value", ",", "new_value", ")", ":", "if", "self", ".", "_registration", "is", "not", "None", ":", "# use the registration to trigger the service event", "self", ".", "_registration", ".", "set_properti...
Called by the instance manager when a component property is modified :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value
[ "Called", "by", "the", "instance", "manager", "when", "a", "component", "property", "is", "modified" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L272-L282
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler._register_service
def _register_service(self): """ Registers the provided service, if possible """ if ( self._registration is None and self.specifications and self.__validated and self.__controller_on ): # Use a copy of component properti...
python
def _register_service(self): """ Registers the provided service, if possible """ if ( self._registration is None and self.specifications and self.__validated and self.__controller_on ): # Use a copy of component properti...
[ "def", "_register_service", "(", "self", ")", ":", "if", "(", "self", ".", "_registration", "is", "None", "and", "self", ".", "specifications", "and", "self", ".", "__validated", "and", "self", ".", "__controller_on", ")", ":", "# Use a copy of component propert...
Registers the provided service, if possible
[ "Registers", "the", "provided", "service", "if", "possible" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L302-L330
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
ServiceRegistrationHandler._unregister_service
def _unregister_service(self): """ Unregisters the provided service, if needed """ if self._registration is not None: # Ignore error try: self._registration.unregister() except BundleException as ex: # Only log the error...
python
def _unregister_service(self): """ Unregisters the provided service, if needed """ if self._registration is not None: # Ignore error try: self._registration.unregister() except BundleException as ex: # Only log the error...
[ "def", "_unregister_service", "(", "self", ")", ":", "if", "self", ".", "_registration", "is", "not", "None", ":", "# Ignore error", "try", ":", "self", ".", "_registration", ".", "unregister", "(", ")", "except", "BundleException", "as", "ex", ":", "# Only ...
Unregisters the provided service, if needed
[ "Unregisters", "the", "provided", "service", "if", "needed" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L332-L354
tcalmant/ipopo
pelix/utilities.py
use_service
def use_service(bundle_context, svc_reference): """ Utility context to safely use a service in a "with" block. It looks after the the given service and releases its reference when exiting the context. :param bundle_context: The calling bundle context :param svc_reference: The reference of the s...
python
def use_service(bundle_context, svc_reference): """ Utility context to safely use a service in a "with" block. It looks after the the given service and releases its reference when exiting the context. :param bundle_context: The calling bundle context :param svc_reference: The reference of the s...
[ "def", "use_service", "(", "bundle_context", ",", "svc_reference", ")", ":", "if", "svc_reference", "is", "None", ":", "raise", "TypeError", "(", "\"Invalid ServiceReference\"", ")", "try", ":", "# Give the service", "yield", "bundle_context", ".", "get_service", "(...
Utility context to safely use a service in a "with" block. It looks after the the given service and releases its reference when exiting the context. :param bundle_context: The calling bundle context :param svc_reference: The reference of the service to use :return: The requested service :raise ...
[ "Utility", "context", "to", "safely", "use", "a", "service", "in", "a", "with", "block", ".", "It", "looks", "after", "the", "the", "given", "service", "and", "releases", "its", "reference", "when", "exiting", "the", "context", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L64-L88
tcalmant/ipopo
pelix/utilities.py
SynchronizedClassMethod
def SynchronizedClassMethod(*locks_attr_names, **kwargs): # pylint: disable=C1801 """ A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is ...
python
def SynchronizedClassMethod(*locks_attr_names, **kwargs): # pylint: disable=C1801 """ A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is ...
[ "def", "SynchronizedClassMethod", "(", "*", "locks_attr_names", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=C1801", "# Filter the names (remove empty ones)", "locks_attr_names", "=", "[", "lock_name", "for", "lock_name", "in", "locks_attr_names", "if", "lock_nam...
A synchronizer decorator for class methods. An AttributeError can be raised at runtime if the given lock attribute doesn't exist or if it is None. If a parameter ``sorted`` is found in ``kwargs`` and its value is True, then the list of locks names will be sorted before locking. :param locks_attr_names...
[ "A", "synchronizer", "decorator", "for", "class", "methods", ".", "An", "AttributeError", "can", "be", "raised", "at", "runtime", "if", "the", "given", "lock", "attribute", "doesn", "t", "exist", "or", "if", "it", "is", "None", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L250-L326
tcalmant/ipopo
pelix/utilities.py
is_lock
def is_lock(lock): """ Tests if the given lock is an instance of a lock class """ if lock is None: # Don't do useless tests return False for attr in "acquire", "release", "__enter__", "__exit__": if not hasattr(lock, attr): # Missing something return ...
python
def is_lock(lock): """ Tests if the given lock is an instance of a lock class """ if lock is None: # Don't do useless tests return False for attr in "acquire", "release", "__enter__", "__exit__": if not hasattr(lock, attr): # Missing something return ...
[ "def", "is_lock", "(", "lock", ")", ":", "if", "lock", "is", "None", ":", "# Don't do useless tests", "return", "False", "for", "attr", "in", "\"acquire\"", ",", "\"release\"", ",", "\"__enter__\"", ",", "\"__exit__\"", ":", "if", "not", "hasattr", "(", "loc...
Tests if the given lock is an instance of a lock class
[ "Tests", "if", "the", "given", "lock", "is", "an", "instance", "of", "a", "lock", "class" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L329-L343
tcalmant/ipopo
pelix/utilities.py
remove_duplicates
def remove_duplicates(items): """ Returns a list without duplicates, keeping elements order :param items: A list of items :return: The list without duplicates, in the same order """ if items is None: return items new_list = [] for item in items: if item not in new_list:...
python
def remove_duplicates(items): """ Returns a list without duplicates, keeping elements order :param items: A list of items :return: The list without duplicates, in the same order """ if items is None: return items new_list = [] for item in items: if item not in new_list:...
[ "def", "remove_duplicates", "(", "items", ")", ":", "if", "items", "is", "None", ":", "return", "items", "new_list", "=", "[", "]", "for", "item", "in", "items", ":", "if", "item", "not", "in", "new_list", ":", "new_list", ".", "append", "(", "item", ...
Returns a list without duplicates, keeping elements order :param items: A list of items :return: The list without duplicates, in the same order
[ "Returns", "a", "list", "without", "duplicates", "keeping", "elements", "order" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L373-L387
tcalmant/ipopo
pelix/utilities.py
add_listener
def add_listener(registry, listener): """ Adds a listener in the registry, if it is not yet in :param registry: A registry (a list) :param listener: The listener to register :return: True if the listener has been added """ if listener is None or listener in registry: return False ...
python
def add_listener(registry, listener): """ Adds a listener in the registry, if it is not yet in :param registry: A registry (a list) :param listener: The listener to register :return: True if the listener has been added """ if listener is None or listener in registry: return False ...
[ "def", "add_listener", "(", "registry", ",", "listener", ")", ":", "if", "listener", "is", "None", "or", "listener", "in", "registry", ":", "return", "False", "registry", ".", "append", "(", "listener", ")", "return", "True" ]
Adds a listener in the registry, if it is not yet in :param registry: A registry (a list) :param listener: The listener to register :return: True if the listener has been added
[ "Adds", "a", "listener", "in", "the", "registry", "if", "it", "is", "not", "yet", "in" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L393-L405
tcalmant/ipopo
pelix/utilities.py
remove_listener
def remove_listener(registry, listener): """ Removes a listener from the registry :param registry: A registry (a list) :param listener: The listener to remove :return: True if the listener was in the list """ if listener is not None and listener in registry: registry.remove(listener...
python
def remove_listener(registry, listener): """ Removes a listener from the registry :param registry: A registry (a list) :param listener: The listener to remove :return: True if the listener was in the list """ if listener is not None and listener in registry: registry.remove(listener...
[ "def", "remove_listener", "(", "registry", ",", "listener", ")", ":", "if", "listener", "is", "not", "None", "and", "listener", "in", "registry", ":", "registry", ".", "remove", "(", "listener", ")", "return", "True", "return", "False" ]
Removes a listener from the registry :param registry: A registry (a list) :param listener: The listener to remove :return: True if the listener was in the list
[ "Removes", "a", "listener", "from", "the", "registry" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L408-L420
tcalmant/ipopo
pelix/utilities.py
to_iterable
def to_iterable(value, allow_none=True): """ Tries to convert the given value to an iterable, if necessary. If the given value is a list, a list is returned; if it is a string, a list containing one string is returned, ... :param value: Any object :param allow_none: If True, the method returns ...
python
def to_iterable(value, allow_none=True): """ Tries to convert the given value to an iterable, if necessary. If the given value is a list, a list is returned; if it is a string, a list containing one string is returned, ... :param value: Any object :param allow_none: If True, the method returns ...
[ "def", "to_iterable", "(", "value", ",", "allow_none", "=", "True", ")", ":", "if", "value", "is", "None", ":", "# None given", "if", "allow_none", ":", "return", "None", "return", "[", "]", "elif", "isinstance", "(", "value", ",", "(", "list", ",", "t...
Tries to convert the given value to an iterable, if necessary. If the given value is a list, a list is returned; if it is a string, a list containing one string is returned, ... :param value: Any object :param allow_none: If True, the method returns None if value is None, else it...
[ "Tries", "to", "convert", "the", "given", "value", "to", "an", "iterable", "if", "necessary", ".", "If", "the", "given", "value", "is", "a", "list", "a", "list", "is", "returned", ";", "if", "it", "is", "a", "string", "a", "list", "containing", "one", ...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L551-L574
tcalmant/ipopo
pelix/utilities.py
Deprecated.__log
def __log(self, method_name): """ Logs the deprecation message on first call, does nothing after :param method_name: Name of the deprecated method """ if not self.__already_logged: # Print only if not already done stack = "\n\t".join(traceback.format_stac...
python
def __log(self, method_name): """ Logs the deprecation message on first call, does nothing after :param method_name: Name of the deprecated method """ if not self.__already_logged: # Print only if not already done stack = "\n\t".join(traceback.format_stac...
[ "def", "__log", "(", "self", ",", "method_name", ")", ":", "if", "not", "self", ".", "__already_logged", ":", "# Print only if not already done", "stack", "=", "\"\\n\\t\"", ".", "join", "(", "traceback", ".", "format_stack", "(", ")", ")", "logging", ".", "...
Logs the deprecation message on first call, does nothing after :param method_name: Name of the deprecated method
[ "Logs", "the", "deprecation", "message", "on", "first", "call", "does", "nothing", "after" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L177-L190
tcalmant/ipopo
pelix/utilities.py
CountdownEvent.step
def step(self): # type: () -> bool """ Decreases the internal counter. Raises an error if the counter goes below 0 :return: True if this step was the final one, else False :raise ValueError: The counter has gone below 0 """ with self.__lock: s...
python
def step(self): # type: () -> bool """ Decreases the internal counter. Raises an error if the counter goes below 0 :return: True if this step was the final one, else False :raise ValueError: The counter has gone below 0 """ with self.__lock: s...
[ "def", "step", "(", "self", ")", ":", "# type: () -> bool", "with", "self", ".", "__lock", ":", "self", ".", "__value", "-=", "1", "if", "self", ".", "__value", "==", "0", ":", "# All done", "self", ".", "__event", ".", "set", "(", ")", "return", "Tr...
Decreases the internal counter. Raises an error if the counter goes below 0 :return: True if this step was the final one, else False :raise ValueError: The counter has gone below 0
[ "Decreases", "the", "internal", "counter", ".", "Raises", "an", "error", "if", "the", "counter", "goes", "below", "0" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/utilities.py#L692-L711
tcalmant/ipopo
pelix/shell/completion/pelix.py
BundleCompleter.display_hook
def display_hook(prompt, session, context, matches, longest_match_len): # type: (str, ShellSession, BundleContext, List[str], int) -> None """ Displays the available bundle matches and the bundle name :param prompt: Shell prompt string :param session: Current shell session (for ...
python
def display_hook(prompt, session, context, matches, longest_match_len): # type: (str, ShellSession, BundleContext, List[str], int) -> None """ Displays the available bundle matches and the bundle name :param prompt: Shell prompt string :param session: Current shell session (for ...
[ "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", "match_pattern", "=", "\"{{0: >{}}}: {{1}}\""...
Displays the available bundle matches and the bundle name :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: Length of...
[ "Displays", "the", "available", "bundle", "matches", "and", "the", "bundle", "name" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/pelix.py#L71-L97
tcalmant/ipopo
pelix/shell/completion/pelix.py
BundleCompleter.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 bundle IDs matching the current state :param config: Configuration of the curre...
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 bundle IDs matching the current state :param config: Configuration of the curre...
[ "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 bundle 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_arg...
[ "Returns", "the", "list", "of", "bundle", "IDs", "matching", "the", "current", "state" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/completion/pelix.py#L99-L125
tcalmant/ipopo
pelix/shell/completion/pelix.py
ServiceCompleter.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", "try", ":", "# Prepare a line pattern for each match", "match_pattern", "=", "\"{{0:...
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/pelix.py#L134-L165
tcalmant/ipopo
pelix/shell/completion/pelix.py
ServiceCompleter.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/pelix.py#L167-L193
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
ExportDistributionProvider.supports_export
def supports_export(self, exported_configs, service_intents, export_props): """ Method called by rsa.export_service to ask if this ExportDistributionProvider supports export for given exported_configs (list), service_intents (list), and export_props (dict). If a ExportCo...
python
def supports_export(self, exported_configs, service_intents, export_props): """ Method called by rsa.export_service to ask if this ExportDistributionProvider supports export for given exported_configs (list), service_intents (list), and export_props (dict). If a ExportCo...
[ "def", "supports_export", "(", "self", ",", "exported_configs", ",", "service_intents", ",", "export_props", ")", ":", "return", "self", ".", "_get_or_create_container", "(", "exported_configs", ",", "service_intents", ",", "export_props", ")" ]
Method called by rsa.export_service to ask if this ExportDistributionProvider supports export for given exported_configs (list), service_intents (list), and export_props (dict). If a ExportContainer instance is returned then it is used to export the service. If None is returned...
[ "Method", "called", "by", "rsa", ".", "export_service", "to", "ask", "if", "this", "ExportDistributionProvider", "supports", "export", "for", "given", "exported_configs", "(", "list", ")", "service_intents", "(", "list", ")", "and", "export_props", "(", "dict", ...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L351-L366
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
ImportDistributionProvider.supports_import
def supports_import( self, exported_configs, service_intents, endpoint_props ): """ Method called by rsa.export_service to ask if this ImportDistributionProvider supports import for given exported_configs (list), service_intents (list), and export_props (dict). ...
python
def supports_import( self, exported_configs, service_intents, endpoint_props ): """ Method called by rsa.export_service to ask if this ImportDistributionProvider supports import for given exported_configs (list), service_intents (list), and export_props (dict). ...
[ "def", "supports_import", "(", "self", ",", "exported_configs", ",", "service_intents", ",", "endpoint_props", ")", ":", "return", "self", ".", "_get_or_create_container", "(", "exported_configs", ",", "service_intents", ",", "endpoint_props", ")" ]
Method called by rsa.export_service to ask if this ImportDistributionProvider supports import for given exported_configs (list), service_intents (list), and export_props (dict). If a ImportContainer instance is returned then it is used to import the service. If None is returned...
[ "Method", "called", "by", "rsa", ".", "export_service", "to", "ask", "if", "this", "ImportDistributionProvider", "supports", "import", "for", "given", "exported_configs", "(", "list", ")", "service_intents", "(", "list", ")", "and", "export_props", "(", "dict", ...
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L386-L403
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
Container.is_valid
def is_valid(self): # type: () -> bool """ Checks if the component is valid :return: Always True if it doesn't raise an exception :raises AssertionError: Invalid properties """ assert self._bundle_context assert self._container_props is not None a...
python
def is_valid(self): # type: () -> bool """ Checks if the component is valid :return: Always True if it doesn't raise an exception :raises AssertionError: Invalid properties """ assert self._bundle_context assert self._container_props is not None a...
[ "def", "is_valid", "(", "self", ")", ":", "# type: () -> bool", "assert", "self", ".", "_bundle_context", "assert", "self", ".", "_container_props", "is", "not", "None", "assert", "self", ".", "_get_distribution_provider", "(", ")", "assert", "self", ".", "get_c...
Checks if the component is valid :return: Always True if it doesn't raise an exception :raises AssertionError: Invalid properties
[ "Checks", "if", "the", "component", "is", "valid" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L429-L442
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
Container._validate_component
def _validate_component(self, bundle_context, container_props): # type: (BundleContext, Dict[str, Any]) -> None """ Component validated :param bundle_context: Bundle context :param container_props: Instance properties :raises AssertionError: Invalid properties ""...
python
def _validate_component(self, bundle_context, container_props): # type: (BundleContext, Dict[str, Any]) -> None """ Component validated :param bundle_context: Bundle context :param container_props: Instance properties :raises AssertionError: Invalid properties ""...
[ "def", "_validate_component", "(", "self", ",", "bundle_context", ",", "container_props", ")", ":", "# type: (BundleContext, Dict[str, Any]) -> None", "self", ".", "_bundle_context", "=", "bundle_context", "self", ".", "_container_props", "=", "container_props", "self", "...
Component validated :param bundle_context: Bundle context :param container_props: Instance properties :raises AssertionError: Invalid properties
[ "Component", "validated" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L445-L456
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
Container._add_export
def _add_export(self, ed_id, inst): # type: (str, Tuple[Any, EndpointDescription]) -> None """ Keeps track of an exported service :param ed_id: ID of the endpoint description :param inst: A tuple: (service instance, endpoint description) """ with self._exported_i...
python
def _add_export(self, ed_id, inst): # type: (str, Tuple[Any, EndpointDescription]) -> None """ Keeps track of an exported service :param ed_id: ID of the endpoint description :param inst: A tuple: (service instance, endpoint description) """ with self._exported_i...
[ "def", "_add_export", "(", "self", ",", "ed_id", ",", "inst", ")", ":", "# type: (str, Tuple[Any, EndpointDescription]) -> None", "with", "self", ".", "_exported_instances_lock", ":", "self", ".", "_exported_services", "[", "ed_id", "]", "=", "inst" ]
Keeps track of an exported service :param ed_id: ID of the endpoint description :param inst: A tuple: (service instance, endpoint description)
[ "Keeps", "track", "of", "an", "exported", "service" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L478-L487
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
Container._find_export
def _find_export(self, func): # type: (Callable[[Tuple[Any, EndpointDescription]], bool]) -> Optional[Tuple[Any, EndpointDescription]] """ Look for an export using the given lookup method The lookup method must accept a single parameter, which is a tuple containing a service ins...
python
def _find_export(self, func): # type: (Callable[[Tuple[Any, EndpointDescription]], bool]) -> Optional[Tuple[Any, EndpointDescription]] """ Look for an export using the given lookup method The lookup method must accept a single parameter, which is a tuple containing a service ins...
[ "def", "_find_export", "(", "self", ",", "func", ")", ":", "# type: (Callable[[Tuple[Any, EndpointDescription]], bool]) -> Optional[Tuple[Any, EndpointDescription]]", "with", "self", ".", "_exported_instances_lock", ":", "for", "val", "in", "self", ".", "_exported_services", ...
Look for an export using the given lookup method The lookup method must accept a single parameter, which is a tuple containing a service instance and endpoint description. :param func: A function to look for the excepted export :return: The found tuple or None
[ "Look", "for", "an", "export", "using", "the", "given", "lookup", "method" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L513-L529
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
ExportContainer._export_service
def _export_service(self, svc, ed): # type: (Any, EndpointDescription) -> None """ Registers a service export :param svc: Service instance :param ed: Endpoint description """ self._add_export(ed.get_id(), (svc, ed))
python
def _export_service(self, svc, ed): # type: (Any, EndpointDescription) -> None """ Registers a service export :param svc: Service instance :param ed: Endpoint description """ self._add_export(ed.get_id(), (svc, ed))
[ "def", "_export_service", "(", "self", ",", "svc", ",", "ed", ")", ":", "# type: (Any, EndpointDescription) -> None", "self", ".", "_add_export", "(", "ed", ".", "get_id", "(", ")", ",", "(", "svc", ",", "ed", ")", ")" ]
Registers a service export :param svc: Service instance :param ed: Endpoint description
[ "Registers", "a", "service", "export" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L586-L594
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
ExportContainer.prepare_endpoint_props
def prepare_endpoint_props(self, intfs, svc_ref, export_props): # type: (List[str], ServiceReference, Dict[str, Any]) -> Dict[str, Any] """ Sets up the properties of an endpoint :param intfs: Specifications to export :param svc_ref: Reference of the exported service :par...
python
def prepare_endpoint_props(self, intfs, svc_ref, export_props): # type: (List[str], ServiceReference, Dict[str, Any]) -> Dict[str, Any] """ Sets up the properties of an endpoint :param intfs: Specifications to export :param svc_ref: Reference of the exported service :par...
[ "def", "prepare_endpoint_props", "(", "self", ",", "intfs", ",", "svc_ref", ",", "export_props", ")", ":", "# type: (List[str], ServiceReference, Dict[str, Any]) -> Dict[str, Any]", "pkg_vers", "=", "rsa", ".", "get_package_versions", "(", "intfs", ",", "export_props", ")...
Sets up the properties of an endpoint :param intfs: Specifications to export :param svc_ref: Reference of the exported service :param export_props: Export properties :return: The properties of the endpoint
[ "Sets", "up", "the", "properties", "of", "an", "endpoint" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L611-L661
tcalmant/ipopo
pelix/rsa/providers/distribution/__init__.py
ExportContainer.export_service
def export_service(self, svc_ref, export_props): # type: (ServiceReference, Dict[str, Any]) -> EndpointDescription """ Exports the given service :param svc_ref: Reference to the service to export :param export_props: Export properties :return: The endpoint description ...
python
def export_service(self, svc_ref, export_props): # type: (ServiceReference, Dict[str, Any]) -> EndpointDescription """ Exports the given service :param svc_ref: Reference to the service to export :param export_props: Export properties :return: The endpoint description ...
[ "def", "export_service", "(", "self", ",", "svc_ref", ",", "export_props", ")", ":", "# type: (ServiceReference, Dict[str, Any]) -> EndpointDescription", "ed", "=", "EndpointDescription", ".", "fromprops", "(", "export_props", ")", "self", ".", "_export_service", "(", "...
Exports the given service :param svc_ref: Reference to the service to export :param export_props: Export properties :return: The endpoint description
[ "Exports", "the", "given", "service" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/rsa/providers/distribution/__init__.py#L663-L676
tcalmant/ipopo
pelix/shell/xmpp.py
main
def main(argv=None): """ Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None """ # Prepare arguments parser = argparse.ArgumentParser( prog="pelix.shell.xmpp", parents=[make_common_parser()], description="Pelix XMPP Shell", ...
python
def main(argv=None): """ Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None """ # Prepare arguments parser = argparse.ArgumentParser( prog="pelix.shell.xmpp", parents=[make_common_parser()], description="Pelix XMPP Shell", ...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "# Prepare arguments", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "\"pelix.shell.xmpp\"", ",", "parents", "=", "[", "make_common_parser", "(", ")", "]", ",", "description", "=", "\"P...
Entry point :param argv: Script arguments (None for sys.argv) :return: An exit code or None
[ "Entry", "point" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/xmpp.py#L364-L474
tcalmant/ipopo
pelix/shell/xmpp.py
_XmppOutStream.flush
def flush(self): """ Sends buffered data to the target """ # Flush buffer content = self._buffer.getvalue() self._buffer = StringIO() if content: # Send message self._client.send_message(self._target, content, mtype="chat")
python
def flush(self): """ Sends buffered data to the target """ # Flush buffer content = self._buffer.getvalue() self._buffer = StringIO() if content: # Send message self._client.send_message(self._target, content, mtype="chat")
[ "def", "flush", "(", "self", ")", ":", "# Flush buffer", "content", "=", "self", ".", "_buffer", ".", "getvalue", "(", ")", "self", ".", "_buffer", "=", "StringIO", "(", ")", "if", "content", ":", "# Send message", "self", ".", "_client", ".", "send_mess...
Sends buffered data to the target
[ "Sends", "buffered", "data", "to", "the", "target" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/xmpp.py#L114-L124
tcalmant/ipopo
pelix/internals/registry.py
_FactoryCounter._get_from_factory
def _get_from_factory(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns a service instance from a Prototype Service Factory :param factory: The prototype service factory :param svc_registration: The ServiceRegistration object :return...
python
def _get_from_factory(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns a service instance from a Prototype Service Factory :param factory: The prototype service factory :param svc_registration: The ServiceRegistration object :return...
[ "def", "_get_from_factory", "(", "self", ",", "factory", ",", "svc_registration", ")", ":", "# type: (Any, ServiceRegistration) -> Any", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "try", ":", "# Use the existing service", "service", ",", "counte...
Returns a service instance from a Prototype Service Factory :param factory: The prototype service factory :param svc_registration: The ServiceRegistration object :return: The requested service instance returned by the factory
[ "Returns", "a", "service", "instance", "from", "a", "Prototype", "Service", "Factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L138-L161
tcalmant/ipopo
pelix/internals/registry.py
_FactoryCounter._get_from_prototype
def _get_from_prototype(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns a service instance from a Prototype Service Factory :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The re...
python
def _get_from_prototype(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns a service instance from a Prototype Service Factory :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The re...
[ "def", "_get_from_prototype", "(", "self", ",", "factory", ",", "svc_registration", ")", ":", "# type: (Any, ServiceRegistration) -> Any", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "service", "=", "factory", ".", "get_service", "(", "self", ...
Returns a service instance from a Prototype Service Factory :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The requested service instance returned by the factory
[ "Returns", "a", "service", "instance", "from", "a", "Prototype", "Service", "Factory" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L163-L187
tcalmant/ipopo
pelix/internals/registry.py
_FactoryCounter.get_service
def get_service(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns the service required by the bundle. The Service Factory is called only when necessary while the Prototype Service Factory is called each time :param factory: The servi...
python
def get_service(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> Any """ Returns the service required by the bundle. The Service Factory is called only when necessary while the Prototype Service Factory is called each time :param factory: The servi...
[ "def", "get_service", "(", "self", ",", "factory", ",", "svc_registration", ")", ":", "# type: (Any, ServiceRegistration) -> Any", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "if", "svc_ref", ".", "is_prototype", "(", ")", ":", "return", "s...
Returns the service required by the bundle. The Service Factory is called only when necessary while the Prototype Service Factory is called each time :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: The requested service instan...
[ "Returns", "the", "service", "required", "by", "the", "bundle", ".", "The", "Service", "Factory", "is", "called", "only", "when", "necessary", "while", "the", "Prototype", "Service", "Factory", "is", "called", "each", "time" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L189-L204
tcalmant/ipopo
pelix/internals/registry.py
_FactoryCounter.unget_service
def unget_service(self, factory, svc_registration, service=None): # type: (Any, ServiceRegistration, Any) -> bool """ Releases references to the given service reference :param factory: The service factory :param svc_registration: The ServiceRegistration object :param ser...
python
def unget_service(self, factory, svc_registration, service=None): # type: (Any, ServiceRegistration, Any) -> bool """ Releases references to the given service reference :param factory: The service factory :param svc_registration: The ServiceRegistration object :param ser...
[ "def", "unget_service", "(", "self", ",", "factory", ",", "svc_registration", ",", "service", "=", "None", ")", ":", "# type: (Any, ServiceRegistration, Any) -> bool", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "try", ":", "_", ",", "count...
Releases references to the given service reference :param factory: The service factory :param svc_registration: The ServiceRegistration object :param service: Service instance (for prototype factories) :return: True if all service references to this service factory have...
[ "Releases", "references", "to", "the", "given", "service", "reference" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L206-L242
tcalmant/ipopo
pelix/internals/registry.py
_FactoryCounter.cleanup_service
def cleanup_service(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> bool """ If this bundle used that factory, releases the reference; else does nothing :param factory: The service factory :param svc_registration: The ServiceRegistration object ...
python
def cleanup_service(self, factory, svc_registration): # type: (Any, ServiceRegistration) -> bool """ If this bundle used that factory, releases the reference; else does nothing :param factory: The service factory :param svc_registration: The ServiceRegistration object ...
[ "def", "cleanup_service", "(", "self", ",", "factory", ",", "svc_registration", ")", ":", "# type: (Any, ServiceRegistration) -> bool", "svc_ref", "=", "svc_registration", ".", "get_reference", "(", ")", "try", ":", "# \"service\" for factories, \"services\" for prototypes", ...
If this bundle used that factory, releases the reference; else does nothing :param factory: The service factory :param svc_registration: The ServiceRegistration object :return: True if the bundle was using the factory, else False
[ "If", "this", "bundle", "used", "that", "factory", "releases", "the", "reference", ";", "else", "does", "nothing" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L244-L277
tcalmant/ipopo
pelix/internals/registry.py
ServiceReference.unused_by
def unused_by(self, bundle): """ Indicates that this reference is not being used anymore by the given bundle. This method should only be used by the framework. :param bundle: A bundle that used this reference """ if bundle is None or bundle is self.__bundle: ...
python
def unused_by(self, bundle): """ Indicates that this reference is not being used anymore by the given bundle. This method should only be used by the framework. :param bundle: A bundle that used this reference """ if bundle is None or bundle is self.__bundle: ...
[ "def", "unused_by", "(", "self", ",", "bundle", ")", ":", "if", "bundle", "is", "None", "or", "bundle", "is", "self", ".", "__bundle", ":", "# Ignore", "return", "with", "self", ".", "__usage_lock", ":", "try", ":", "if", "not", "self", ".", "__using_b...
Indicates that this reference is not being used anymore by the given bundle. This method should only be used by the framework. :param bundle: A bundle that used this reference
[ "Indicates", "that", "this", "reference", "is", "not", "being", "used", "anymore", "by", "the", "given", "bundle", ".", "This", "method", "should", "only", "be", "used", "by", "the", "framework", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L454-L474
tcalmant/ipopo
pelix/internals/registry.py
ServiceReference.used_by
def used_by(self, bundle): """ Indicates that this reference is being used by the given bundle. This method should only be used by the framework. :param bundle: A bundle using this reference """ if bundle is None or bundle is self.__bundle: # Ignore ...
python
def used_by(self, bundle): """ Indicates that this reference is being used by the given bundle. This method should only be used by the framework. :param bundle: A bundle using this reference """ if bundle is None or bundle is self.__bundle: # Ignore ...
[ "def", "used_by", "(", "self", ",", "bundle", ")", ":", "if", "bundle", "is", "None", "or", "bundle", "is", "self", ".", "__bundle", ":", "# Ignore", "return", "with", "self", ".", "__usage_lock", ":", "self", ".", "__using_bundles", ".", "setdefault", "...
Indicates that this reference is being used by the given bundle. This method should only be used by the framework. :param bundle: A bundle using this reference
[ "Indicates", "that", "this", "reference", "is", "being", "used", "by", "the", "given", "bundle", ".", "This", "method", "should", "only", "be", "used", "by", "the", "framework", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L476-L488
tcalmant/ipopo
pelix/internals/registry.py
ServiceRegistration.set_properties
def set_properties(self, properties): """ Updates the service properties :param properties: The new properties :raise TypeError: The argument is not a dictionary """ if not isinstance(properties, dict): raise TypeError("Waiting for dictionary") # Key...
python
def set_properties(self, properties): """ Updates the service properties :param properties: The new properties :raise TypeError: The argument is not a dictionary """ if not isinstance(properties, dict): raise TypeError("Waiting for dictionary") # Key...
[ "def", "set_properties", "(", "self", ",", "properties", ")", ":", "if", "not", "isinstance", "(", "properties", ",", "dict", ")", ":", "raise", "TypeError", "(", "\"Waiting for dictionary\"", ")", "# Keys that must not be updated", "for", "forbidden_key", "in", "...
Updates the service properties :param properties: The new properties :raise TypeError: The argument is not a dictionary
[ "Updates", "the", "service", "properties" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L562-L618
tcalmant/ipopo
pelix/internals/registry.py
EventDispatcher.clear
def clear(self): """ Clears the event dispatcher """ with self.__bnd_lock: self.__bnd_listeners = [] with self.__svc_lock: self.__svc_listeners.clear() with self.__fw_lock: self.__fw_listeners = []
python
def clear(self): """ Clears the event dispatcher """ with self.__bnd_lock: self.__bnd_listeners = [] with self.__svc_lock: self.__svc_listeners.clear() with self.__fw_lock: self.__fw_listeners = []
[ "def", "clear", "(", "self", ")", ":", "with", "self", ".", "__bnd_lock", ":", "self", ".", "__bnd_listeners", "=", "[", "]", "with", "self", ".", "__svc_lock", ":", "self", ".", "__svc_listeners", ".", "clear", "(", ")", "with", "self", ".", "__fw_loc...
Clears the event dispatcher
[ "Clears", "the", "event", "dispatcher" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L661-L672
tcalmant/ipopo
pelix/internals/registry.py
EventDispatcher.add_bundle_listener
def add_bundle_listener(self, listener): """ Adds a bundle listener :param listener: The bundle listener to register :return: True if the listener has been registered, False if it was already known :raise BundleException: An invalid listener has been given ...
python
def add_bundle_listener(self, listener): """ Adds a bundle listener :param listener: The bundle listener to register :return: True if the listener has been registered, False if it was already known :raise BundleException: An invalid listener has been given ...
[ "def", "add_bundle_listener", "(", "self", ",", "listener", ")", ":", "if", "listener", "is", "None", "or", "not", "hasattr", "(", "listener", ",", "\"bundle_changed\"", ")", ":", "raise", "BundleException", "(", "\"Invalid bundle listener given\"", ")", "with", ...
Adds a bundle listener :param listener: The bundle listener to register :return: True if the listener has been registered, False if it was already known :raise BundleException: An invalid listener has been given
[ "Adds", "a", "bundle", "listener" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L674-L694
tcalmant/ipopo
pelix/internals/registry.py
EventDispatcher.add_framework_listener
def add_framework_listener(self, listener): """ Registers a listener that will be called back right before the framework stops. :param listener: The framework stop listener :return: True if the listener has been registered, False if it was already known ...
python
def add_framework_listener(self, listener): """ Registers a listener that will be called back right before the framework stops. :param listener: The framework stop listener :return: True if the listener has been registered, False if it was already known ...
[ "def", "add_framework_listener", "(", "self", ",", "listener", ")", ":", "if", "listener", "is", "None", "or", "not", "hasattr", "(", "listener", ",", "\"framework_stopping\"", ")", ":", "raise", "BundleException", "(", "\"Invalid framework listener given\"", ")", ...
Registers a listener that will be called back right before the framework stops. :param listener: The framework stop listener :return: True if the listener has been registered, False if it was already known :raise BundleException: An invalid listener has been given
[ "Registers", "a", "listener", "that", "will", "be", "called", "back", "right", "before", "the", "framework", "stops", "." ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L696-L717
tcalmant/ipopo
pelix/internals/registry.py
EventDispatcher.add_service_listener
def add_service_listener( self, bundle_context, listener, specification=None, ldap_filter=None ): """ Registers a service listener :param bundle_context: The bundle_context of the service listener :param listener: The service listener :param specification: The specif...
python
def add_service_listener( self, bundle_context, listener, specification=None, ldap_filter=None ): """ Registers a service listener :param bundle_context: The bundle_context of the service listener :param listener: The service listener :param specification: The specif...
[ "def", "add_service_listener", "(", "self", ",", "bundle_context", ",", "listener", ",", "specification", "=", "None", ",", "ldap_filter", "=", "None", ")", ":", "if", "listener", "is", "None", "or", "not", "hasattr", "(", "listener", ",", "\"service_changed\"...
Registers a service listener :param bundle_context: The bundle_context of the service listener :param listener: The service listener :param specification: The specification that must provide the service (optional, None to accept all services) :param ldap_fi...
[ "Registers", "a", "service", "listener" ]
train
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/internals/registry.py#L719-L755