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_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
tcalmant/ipopo
pelix/ipopo/decorators.py
get_factory_context
def get_factory_context(cls): # type: (type) -> FactoryContext """ Retrieves the factory context object associated to a factory. Creates it if needed :param cls: The factory class :return: The factory class context """ context = getattr(cls, constants.IPOPO_FACTORY_CONTEXT, None) i...
python
def get_factory_context(cls): # type: (type) -> FactoryContext """ Retrieves the factory context object associated to a factory. Creates it if needed :param cls: The factory class :return: The factory class context """ context = getattr(cls, constants.IPOPO_FACTORY_CONTEXT, None) i...
Retrieves the factory context object associated to a factory. Creates it if needed :param cls: The factory class :return: The factory class context
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L96-L121
tcalmant/ipopo
pelix/ipopo/decorators.py
get_method_description
def get_method_description(method): # type: (Callable) -> str """ Retrieves a description of the given method. If possible, the description contains the source file name and line. :param method: A method :return: A description of the method (at least its name) :raise AttributeError: Given o...
python
def get_method_description(method): # type: (Callable) -> str """ Retrieves a description of the given method. If possible, the description contains the source file name and line. :param method: A method :return: A description of the method (at least its name) :raise AttributeError: Given o...
Retrieves a description of the given method. If possible, the description contains the source file name and line. :param method: A method :return: A description of the method (at least its name) :raise AttributeError: Given object has no __name__ attribute
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L124-L146
tcalmant/ipopo
pelix/ipopo/decorators.py
validate_method_arity
def validate_method_arity(method, *needed_args): # type: (Callable, *str) -> None """ Tests if the decorated method has a sufficient number of parameters. :param method: The method to be tested :param needed_args: The name (for description only) of the needed arguments, with...
python
def validate_method_arity(method, *needed_args): # type: (Callable, *str) -> None """ Tests if the decorated method has a sufficient number of parameters. :param method: The method to be tested :param needed_args: The name (for description only) of the needed arguments, with...
Tests if the decorated method has a sufficient number of parameters. :param method: The method to be tested :param needed_args: The name (for description only) of the needed arguments, without "self". :return: Nothing :raise TypeError: Invalid number of parameter
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L149-L196
tcalmant/ipopo
pelix/ipopo/decorators.py
_ipopo_setup_callback
def _ipopo_setup_callback(cls, context): # type: (type, FactoryContext) -> None """ Sets up the class _callback dictionary :param cls: The class to handle :param context: The factory class context """ assert inspect.isclass(cls) assert isinstance(context, FactoryContext) if context...
python
def _ipopo_setup_callback(cls, context): # type: (type, FactoryContext) -> None """ Sets up the class _callback dictionary :param cls: The class to handle :param context: The factory class context """ assert inspect.isclass(cls) assert isinstance(context, FactoryContext) if context...
Sets up the class _callback dictionary :param cls: The class to handle :param context: The factory class context
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L202-L257
tcalmant/ipopo
pelix/ipopo/decorators.py
_ipopo_setup_field_callback
def _ipopo_setup_field_callback(cls, context): # type: (type, FactoryContext) -> None """ Sets up the class _field_callback dictionary :param cls: The class to handle :param context: The factory class context """ assert inspect.isclass(cls) assert isinstance(context, FactoryContext) ...
python
def _ipopo_setup_field_callback(cls, context): # type: (type, FactoryContext) -> None """ Sets up the class _field_callback dictionary :param cls: The class to handle :param context: The factory class context """ assert inspect.isclass(cls) assert isinstance(context, FactoryContext) ...
Sets up the class _field_callback dictionary :param cls: The class to handle :param context: The factory class context
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L260-L317
tcalmant/ipopo
pelix/ipopo/decorators.py
_append_object_entry
def _append_object_entry(obj, list_name, entry): # type: (Any, str, Any) -> None """ Appends the given entry in the given object list. Creates the list field if needed. :param obj: The object that contains the list :param list_name: The name of the list member in *obj* :param entry: The ent...
python
def _append_object_entry(obj, list_name, entry): # type: (Any, str, Any) -> None """ Appends the given entry in the given object list. Creates the list field if needed. :param obj: The object that contains the list :param list_name: The name of the list member in *obj* :param entry: The ent...
Appends the given entry in the given object list. Creates the list field if needed. :param obj: The object that contains the list :param list_name: The name of the list member in *obj* :param entry: The entry to be added to the list :raise ValueError: Invalid attribute content
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L335-L357
tcalmant/ipopo
pelix/ipopo/decorators.py
_ipopo_class_field_property
def _ipopo_class_field_property(name, value, methods_prefix): # type: (str, Any, str) -> property """ Sets up an iPOPO field property, using Python property() capabilities :param name: The property name :param value: The property default value :param methods_prefix: The common prefix of the get...
python
def _ipopo_class_field_property(name, value, methods_prefix): # type: (str, Any, str) -> property """ Sets up an iPOPO field property, using Python property() capabilities :param name: The property name :param value: The property default value :param methods_prefix: The common prefix of the get...
Sets up an iPOPO field property, using Python property() capabilities :param name: The property name :param value: The property default value :param methods_prefix: The common prefix of the getter and setter injected methods :return: A generated Python property()
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L376-L424
tcalmant/ipopo
pelix/ipopo/decorators.py
_get_specifications
def _get_specifications(specifications): """ Computes the list of strings corresponding to the given specifications :param specifications: A string, a class or a list of specifications :return: A list of strings :raise ValueError: Invalid specification found """ if not specifications or spe...
python
def _get_specifications(specifications): """ Computes the list of strings corresponding to the given specifications :param specifications: A string, a class or a list of specifications :return: A list of strings :raise ValueError: Invalid specification found """ if not specifications or spe...
Computes the list of strings corresponding to the given specifications :param specifications: A string, a class or a list of specifications :return: A list of strings :raise ValueError: Invalid specification found
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L839-L885
tcalmant/ipopo
pelix/ipopo/decorators.py
Bind
def Bind(method): # pylint: disable=C0103 """ The ``@Bind`` callback decorator is called when a component is bound to a dependency. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Bind def bind_method...
python
def Bind(method): # pylint: disable=C0103 """ The ``@Bind`` callback decorator is called when a component is bound to a dependency. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Bind def bind_method...
The ``@Bind`` callback decorator is called when a component is bound to a dependency. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Bind def bind_method(self, service, service_reference): ''' ...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L1674-L1710
tcalmant/ipopo
pelix/ipopo/decorators.py
Update
def Update(method): # pylint: disable=C0103 """ The ``@Update`` callback decorator is called when the properties of an injected service have been modified. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` and the previous properties...
python
def Update(method): # pylint: disable=C0103 """ The ``@Update`` callback decorator is called when the properties of an injected service have been modified. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` and the previous properties...
The ``@Update`` callback decorator is called when the properties of an injected service have been modified. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` and the previous properties as arguments:: @Update def update_method...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L1713-L1750
tcalmant/ipopo
pelix/ipopo/decorators.py
Unbind
def Unbind(method): # pylint: disable=C0103 """ The ``@Unbind`` callback decorator is called when a component dependency is unbound. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Unbind def unbind_m...
python
def Unbind(method): # pylint: disable=C0103 """ The ``@Unbind`` callback decorator is called when a component dependency is unbound. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Unbind def unbind_m...
The ``@Unbind`` callback decorator is called when a component dependency is unbound. The decorated method must accept the injected service object and its :class:`~pelix.framework.ServiceReference` as arguments:: @Unbind def unbind_method(self, service, service_reference): ''' ...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L1753-L1789
tcalmant/ipopo
pelix/ipopo/decorators.py
PostRegistration
def PostRegistration(method): # pylint: disable=C0103 """ The service post-registration callback decorator is called after a service of the component has been registered to the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered servi...
python
def PostRegistration(method): # pylint: disable=C0103 """ The service post-registration callback decorator is called after a service of the component has been registered to the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered servi...
The service post-registration callback decorator is called after a service of the component has been registered to the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered service as argument:: @PostRegistration def callback_method(...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L1994-L2024
tcalmant/ipopo
pelix/ipopo/decorators.py
PostUnregistration
def PostUnregistration(method): # pylint: disable=C0103 """ The service post-unregistration callback decorator is called after a service of the component has been unregistered from the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered ...
python
def PostUnregistration(method): # pylint: disable=C0103 """ The service post-unregistration callback decorator is called after a service of the component has been unregistered from the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered ...
The service post-unregistration callback decorator is called after a service of the component has been unregistered from the framework. The decorated method must accept the :class:`~pelix.framework.ServiceReference` of the registered service as argument:: @PostUnregistration def callback...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/decorators.py#L2027-L2057
tcalmant/ipopo
pelix/shell/core.py
_ShellUtils.bundlestate_to_str
def bundlestate_to_str(state): """ Converts a bundle state integer to a string """ states = { pelix.Bundle.INSTALLED: "INSTALLED", pelix.Bundle.ACTIVE: "ACTIVE", pelix.Bundle.RESOLVED: "RESOLVED", pelix.Bundle.STARTING: "STARTING", ...
python
def bundlestate_to_str(state): """ Converts a bundle state integer to a string """ states = { pelix.Bundle.INSTALLED: "INSTALLED", pelix.Bundle.ACTIVE: "ACTIVE", pelix.Bundle.RESOLVED: "RESOLVED", pelix.Bundle.STARTING: "STARTING", ...
Converts a bundle state integer to a string
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L80-L93
tcalmant/ipopo
pelix/shell/core.py
_ShellUtils.make_table
def make_table(headers, lines, prefix=None): """ Generates an ASCII table according to the given headers and lines :param headers: List of table headers (N-tuple) :param lines: List of table lines (N-tuples) :param prefix: Optional prefix for each line :return: The ASCII...
python
def make_table(headers, lines, prefix=None): """ Generates an ASCII table according to the given headers and lines :param headers: List of table headers (N-tuple) :param lines: List of table lines (N-tuples) :param prefix: Optional prefix for each line :return: The ASCII...
Generates an ASCII table according to the given headers and lines :param headers: List of table headers (N-tuple) :param lines: List of table lines (N-tuples) :param prefix: Optional prefix for each line :return: The ASCII representation of the table :raise ValueError: Different...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L96-L180
tcalmant/ipopo
pelix/shell/core.py
_ShellService.bind_handler
def bind_handler(self, svc_ref): """ Called if a command service has been found. Registers the methods of this service. :param svc_ref: A reference to the found service :return: True if the commands have been registered """ if svc_ref in self._bound_references: ...
python
def bind_handler(self, svc_ref): """ Called if a command service has been found. Registers the methods of this service. :param svc_ref: A reference to the found service :return: True if the commands have been registered """ if svc_ref in self._bound_references: ...
Called if a command service has been found. Registers the methods of this service. :param svc_ref: A reference to the found service :return: True if the commands have been registered
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L239-L266
tcalmant/ipopo
pelix/shell/core.py
_ShellService.unbind_handler
def unbind_handler(self, svc_ref): """ Called if a command service is gone. Unregisters its commands. :param svc_ref: A reference to the unbound service :return: True if the commands have been unregistered """ if svc_ref not in self._bound_references: ...
python
def unbind_handler(self, svc_ref): """ Called if a command service is gone. Unregisters its commands. :param svc_ref: A reference to the unbound service :return: True if the commands have been unregistered """ if svc_ref not in self._bound_references: ...
Called if a command service is gone. Unregisters its commands. :param svc_ref: A reference to the unbound service :return: True if the commands have been unregistered
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L268-L289
tcalmant/ipopo
pelix/shell/core.py
_ShellService.var_set
def var_set(self, session, **kwargs): """ Sets the given variables or prints the current ones. "set answer=42" """ if not kwargs: session.write_line( self._utils.make_table( ("Name", "Value"), session.variables.items() ) ...
python
def var_set(self, session, **kwargs): """ Sets the given variables or prints the current ones. "set answer=42" """ if not kwargs: session.write_line( self._utils.make_table( ("Name", "Value"), session.variables.items() ) ...
Sets the given variables or prints the current ones. "set answer=42"
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L298-L312
tcalmant/ipopo
pelix/shell/core.py
_ShellService.bundle_details
def bundle_details(self, io_handler, bundle_id): """ Prints the details of the bundle with the given ID or name """ bundle = None try: # Convert the given ID into an integer bundle_id = int(bundle_id) except ValueError: # Not an intege...
python
def bundle_details(self, io_handler, bundle_id): """ Prints the details of the bundle with the given ID or name """ bundle = None try: # Convert the given ID into an integer bundle_id = int(bundle_id) except ValueError: # Not an intege...
Prints the details of the bundle with the given ID or name
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L315-L379
tcalmant/ipopo
pelix/shell/core.py
_ShellService.bundles_list
def bundles_list(self, io_handler, name=None): """ Lists the bundles in the framework and their state. Possibility to filter on the bundle name. """ # Head of the table headers = ("ID", "Name", "State", "Version") # Get the bundles bundles = self._context...
python
def bundles_list(self, io_handler, name=None): """ Lists the bundles in the framework and their state. Possibility to filter on the bundle name. """ # Head of the table headers = ("ID", "Name", "State", "Version") # Get the bundles bundles = self._context...
Lists the bundles in the framework and their state. Possibility to filter on the bundle name.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L381-L423
tcalmant/ipopo
pelix/shell/core.py
_ShellService.service_details
def service_details(self, io_handler, service_id): """ Prints the details of the service with the given ID """ svc_ref = self._context.get_service_reference( None, "({0}={1})".format(constants.SERVICE_ID, service_id) ) if svc_ref is None: io_handle...
python
def service_details(self, io_handler, service_id): """ Prints the details of the service with the given ID """ svc_ref = self._context.get_service_reference( None, "({0}={1})".format(constants.SERVICE_ID, service_id) ) if svc_ref is None: io_handle...
Prints the details of the service with the given ID
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L426-L459
tcalmant/ipopo
pelix/shell/core.py
_ShellService.services_list
def services_list(self, io_handler, specification=None): """ Lists the services in the framework. Possibility to filter on an exact specification. """ # Head of the table headers = ("ID", "Specifications", "Bundle", "Ranking") # Lines references = ( ...
python
def services_list(self, io_handler, specification=None): """ Lists the services in the framework. Possibility to filter on an exact specification. """ # Head of the table headers = ("ID", "Specifications", "Bundle", "Ranking") # Lines references = ( ...
Lists the services in the framework. Possibility to filter on an exact specification.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L461-L496
tcalmant/ipopo
pelix/shell/core.py
_ShellService.properties_list
def properties_list(self, io_handler): """ Lists the properties of the framework """ # Get the framework framework = self._context.get_framework() # Head of the table headers = ("Property Name", "Value") # Lines lines = [item for item in framewor...
python
def properties_list(self, io_handler): """ Lists the properties of the framework """ # Get the framework framework = self._context.get_framework() # Head of the table headers = ("Property Name", "Value") # Lines lines = [item for item in framewor...
Lists the properties of the framework
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L498-L515
tcalmant/ipopo
pelix/shell/core.py
_ShellService.property_value
def property_value(self, io_handler, name): """ Prints the value of the given property, looking into framework properties then environment variables. """ value = self._context.get_property(name) if value is None: # Avoid printing "None" value = "" ...
python
def property_value(self, io_handler, name): """ Prints the value of the given property, looking into framework properties then environment variables. """ value = self._context.get_property(name) if value is None: # Avoid printing "None" value = "" ...
Prints the value of the given property, looking into framework properties then environment variables.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L517-L527
tcalmant/ipopo
pelix/shell/core.py
_ShellService.environment_list
def environment_list(self, io_handler): """ Lists the framework process environment variables """ # Head of the table headers = ("Environment Variable", "Value") # Lines lines = [item for item in os.environ.items()] # Sort lines lines.sort() ...
python
def environment_list(self, io_handler): """ Lists the framework process environment variables """ # Head of the table headers = ("Environment Variable", "Value") # Lines lines = [item for item in os.environ.items()] # Sort lines lines.sort() ...
Lists the framework process environment variables
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L529-L543
tcalmant/ipopo
pelix/shell/core.py
_ShellService.threads_list
def threads_list(io_handler, max_depth=1): """ Lists the active threads and their current code line """ # Normalize maximum depth try: max_depth = int(max_depth) if max_depth < 1: max_depth = None except (ValueError, TypeError): ...
python
def threads_list(io_handler, max_depth=1): """ Lists the active threads and their current code line """ # Normalize maximum depth try: max_depth = int(max_depth) if max_depth < 1: max_depth = None except (ValueError, TypeError): ...
Lists the active threads and their current code line
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L553-L616
tcalmant/ipopo
pelix/shell/core.py
_ShellService.thread_details
def thread_details(io_handler, thread_id, max_depth=0): """ Prints details about the thread with the given ID (not its name) """ # Normalize maximum depth try: max_depth = int(max_depth) if max_depth < 1: max_depth = None except (Va...
python
def thread_details(io_handler, thread_id, max_depth=0): """ Prints details about the thread with the given ID (not its name) """ # Normalize maximum depth try: max_depth = int(max_depth) if max_depth < 1: max_depth = None except (Va...
Prints details about the thread with the given ID (not its name)
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L619-L674
tcalmant/ipopo
pelix/shell/core.py
_ShellService.log_level
def log_level(io_handler, level=None, name=None): """ Prints/Changes log level """ # Get the logger logger = logging.getLogger(name) # Normalize the name if not name: name = "Root" if not level: # Level not given: print the logger...
python
def log_level(io_handler, level=None, name=None): """ Prints/Changes log level """ # Get the logger logger = logging.getLogger(name) # Normalize the name if not name: name = "Root" if not level: # Level not given: print the logger...
Prints/Changes log level
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L677-L702
tcalmant/ipopo
pelix/shell/core.py
_ShellService.change_dir
def change_dir(self, session, path): """ Changes the working directory """ if path == "-": # Previous directory path = self._previous_path or "." try: previous = os.getcwd() os.chdir(path) except IOError as ex: ...
python
def change_dir(self, session, path): """ Changes the working directory """ if path == "-": # Previous directory path = self._previous_path or "." try: previous = os.getcwd() os.chdir(path) except IOError as ex: ...
Changes the working directory
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L704-L721
tcalmant/ipopo
pelix/shell/core.py
_ShellService.__get_bundle
def __get_bundle(self, io_handler, bundle_id): """ Retrieves the Bundle object with the given bundle ID. Writes errors through the I/O handler if any. :param io_handler: I/O Handler :param bundle_id: String or integer bundle ID :return: The Bundle object matching the giv...
python
def __get_bundle(self, io_handler, bundle_id): """ Retrieves the Bundle object with the given bundle ID. Writes errors through the I/O handler if any. :param io_handler: I/O Handler :param bundle_id: String or integer bundle ID :return: The Bundle object matching the giv...
Retrieves the Bundle object with the given bundle ID. Writes errors through the I/O handler if any. :param io_handler: I/O Handler :param bundle_id: String or integer bundle ID :return: The Bundle object matching the given ID, None if not found
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L732-L747
tcalmant/ipopo
pelix/shell/core.py
_ShellService.start
def start(self, io_handler, bundle_id, *bundles_ids): """ Starts the bundles with the given IDs. Stops on first failure. """ for bid in (bundle_id,) + bundles_ids: try: # Got an int => it's a bundle ID bid = int(bid) except ValueErr...
python
def start(self, io_handler, bundle_id, *bundles_ids): """ Starts the bundles with the given IDs. Stops on first failure. """ for bid in (bundle_id,) + bundles_ids: try: # Got an int => it's a bundle ID bid = int(bid) except ValueErr...
Starts the bundles with the given IDs. Stops on first failure.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L750-L773
tcalmant/ipopo
pelix/shell/core.py
_ShellService.stop
def stop(self, io_handler, bundle_id, *bundles_ids): """ Stops the bundles with the given IDs. Stops on first failure. """ for bid in (bundle_id,) + bundles_ids: bundle = self.__get_bundle(io_handler, bid) if bundle is not None: io_handler.write_li...
python
def stop(self, io_handler, bundle_id, *bundles_ids): """ Stops the bundles with the given IDs. Stops on first failure. """ for bid in (bundle_id,) + bundles_ids: bundle = self.__get_bundle(io_handler, bid) if bundle is not None: io_handler.write_li...
Stops the bundles with the given IDs. Stops on first failure.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L776-L792
tcalmant/ipopo
pelix/shell/core.py
_ShellService.install
def install(self, io_handler, module_name): """ Installs the bundle with the given module name """ bundle = self._context.install_bundle(module_name) io_handler.write_line("Bundle ID: {0}", bundle.get_bundle_id()) return bundle.get_bundle_id()
python
def install(self, io_handler, module_name): """ Installs the bundle with the given module name """ bundle = self._context.install_bundle(module_name) io_handler.write_line("Bundle ID: {0}", bundle.get_bundle_id()) return bundle.get_bundle_id()
Installs the bundle with the given module name
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L813-L819
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
_HandlerFactory._prepare_configs
def _prepare_configs(configs, requires_filters, temporal_timeouts): """ 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_configs(configs, requires_filters, temporal_timeouts): """ 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 ...
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) :param temporal_timeouts: Content...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L59-L111
tcalmant/ipopo
pelix/ipopo/handlers/temporal.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 """ ...
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
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L113-L141
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
TemporalDependency.clear
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ # Cancel timer self.__cancel_timer() self.__timer = None self.__timer_args = None self.__still_valid = False self._value = None ...
python
def clear(self): """ Cleans up the manager. The manager can't be used after this method has been called """ # Cancel timer self.__cancel_timer() self.__timer = None self.__timer_args = None self.__still_valid = False self._value = None ...
Cleans up the manager. The manager can't be used after this method has been called
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L275-L287
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
TemporalDependency.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.reference is None: # Inject the service service = self._context.get_...
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.reference is None: # Inject the service service = self._context.get_...
Called when a service has been registered in the framework :param svc_ref: A service reference
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L289-L310
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
TemporalDependency.on_service_departure
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference """ with self._lock: if svc_ref is self.reference: # Forget about the service self._value.u...
python
def on_service_departure(self, svc_ref): """ Called when a service has been unregistered from the framework :param svc_ref: A service reference """ with self._lock: if svc_ref is self.reference: # Forget about the service self._value.u...
Called when a service has been unregistered from the framework :param svc_ref: A service reference
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L312-L345
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
TemporalDependency.__cancel_timer
def __cancel_timer(self): """ Cancels the timer, and calls its target method immediately """ if self.__timer is not None: self.__timer.cancel() self.__unbind_call(True) self.__timer_args = None self.__timer = None
python
def __cancel_timer(self): """ Cancels the timer, and calls its target method immediately """ if self.__timer is not None: self.__timer.cancel() self.__unbind_call(True) self.__timer_args = None self.__timer = None
Cancels the timer, and calls its target method immediately
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L347-L356
tcalmant/ipopo
pelix/ipopo/handlers/temporal.py
TemporalDependency.__unbind_call
def __unbind_call(self, still_valid): """ Calls the iPOPO unbind method """ with self._lock: if self.__timer is not None: # Timeout expired, we're not valid anymore self.__timer = None self.__still_valid = still_valid ...
python
def __unbind_call(self, still_valid): """ Calls the iPOPO unbind method """ with self._lock: if self.__timer is not None: # Timeout expired, we're not valid anymore self.__timer = None self.__still_valid = still_valid ...
Calls the iPOPO unbind method
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/temporal.py#L358-L369
tcalmant/ipopo
pelix/remote/transport/jabsorb_rpc.py
_JabsorbRpcServlet.do_POST
def do_POST(self, request, response): # pylint: disable=C0103 """ Handle a POST request :param request: The HTTP request bean :param response: The HTTP response handler """ # Get the request JSON content data = jsonrpclib.loads(to_str(request.read_data())...
python
def do_POST(self, request, response): # pylint: disable=C0103 """ Handle a POST request :param request: The HTTP request bean :param response: The HTTP response handler """ # Get the request JSON content data = jsonrpclib.loads(to_str(request.read_data())...
Handle a POST request :param request: The HTTP request bean :param response: The HTTP response handler
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/transport/jabsorb_rpc.py#L124-L157
tcalmant/ipopo
pelix/http/routing.py
RestDispatcher._rest_dispatch
def _rest_dispatch(self, request, response): # type: (AbstractHTTPServletRequest, AbstractHTTPServletResponse) -> None """ Dispatches the request :param request: Request bean :param response: Response bean """ # Extract request information http_verb = req...
python
def _rest_dispatch(self, request, response): # type: (AbstractHTTPServletRequest, AbstractHTTPServletResponse) -> None """ Dispatches the request :param request: Request bean :param response: Response bean """ # Extract request information http_verb = req...
Dispatches the request :param request: Request bean :param response: Response bean
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/routing.py#L280-L364
tcalmant/ipopo
pelix/http/routing.py
RestDispatcher._setup_rest_dispatcher
def _setup_rest_dispatcher(self): """ Finds all methods to call when handling a route """ for _, method in inspect.getmembers(self, inspect.isroutine): try: config = getattr(method, HTTP_ROUTE_ATTRIBUTE) except AttributeError: # Not...
python
def _setup_rest_dispatcher(self): """ Finds all methods to call when handling a route """ for _, method in inspect.getmembers(self, inspect.isroutine): try: config = getattr(method, HTTP_ROUTE_ATTRIBUTE) except AttributeError: # Not...
Finds all methods to call when handling a route
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/routing.py#L366-L381
tcalmant/ipopo
pelix/http/routing.py
RestDispatcher.__convert_route
def __convert_route(route): # type: (str) -> Tuple[Pattern[str], Dict[str, Callable[[str], Any]]] """ Converts a route pattern into a regex. The result is a tuple containing the regex pattern to match and a dictionary associating arguments names and their converter (if any) ...
python
def __convert_route(route): # type: (str) -> Tuple[Pattern[str], Dict[str, Callable[[str], Any]]] """ Converts a route pattern into a regex. The result is a tuple containing the regex pattern to match and a dictionary associating arguments names and their converter (if any) ...
Converts a route pattern into a regex. The result is a tuple containing the regex pattern to match and a dictionary associating arguments names and their converter (if any) A route can be: "/hello/<name>/<age:int>" :param route: A route string, i.e. a path with type markers :re...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/http/routing.py#L384-L436
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.check_event
def check_event(self, event): # type: (ServiceEvent) -> bool """ Tests if the given service event must be handled or ignored, based on the state of the iPOPO service and on the content of the event. :param event: A service event :return: True if the event can be handled,...
python
def check_event(self, event): # type: (ServiceEvent) -> bool """ Tests if the given service event must be handled or ignored, based on the state of the iPOPO service and on the content of the event. :param event: A service event :return: True if the event can be handled,...
Tests if the given service event must be handled or ignored, based on the state of the iPOPO service and on the content of the event. :param event: A service event :return: True if the event can be handled, False if it must be ignored
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L167-L182
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.bind
def bind(self, dependency, svc, svc_ref): # type: (Any, Any, ServiceReference) -> None """ Called by a dependency manager to inject a new service and update the component life cycle. """ with self._lock: self.__set_binding(dependency, svc, svc_ref) ...
python
def bind(self, dependency, svc, svc_ref): # type: (Any, Any, ServiceReference) -> None """ Called by a dependency manager to inject a new service and update the component life cycle. """ with self._lock: self.__set_binding(dependency, svc, svc_ref) ...
Called by a dependency manager to inject a new service and update the component life cycle.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L184-L192
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.update
def update(self, dependency, svc, svc_ref, old_properties, new_value=False): # type: (Any, Any, ServiceReference, dict, bool) -> None """ Called by a dependency manager when the properties of an injected dependency have been updated. :param dependency: The dependency handler ...
python
def update(self, dependency, svc, svc_ref, old_properties, new_value=False): # type: (Any, Any, ServiceReference, dict, bool) -> None """ Called by a dependency manager when the properties of an injected dependency have been updated. :param dependency: The dependency handler ...
Called by a dependency manager when the properties of an injected dependency have been updated. :param dependency: The dependency handler :param svc: The injected service :param svc_ref: The reference of the injected service :param old_properties: Previous properties of the depe...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L194-L210
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.unbind
def unbind(self, dependency, svc, svc_ref): # type: (Any, Any, ServiceReference) -> None """ Called by a dependency manager to remove an injected service and to update the component life cycle. """ with self._lock: # Invalidate first (if needed) se...
python
def unbind(self, dependency, svc, svc_ref): # type: (Any, Any, ServiceReference) -> None """ Called by a dependency manager to remove an injected service and to update the component life cycle. """ with self._lock: # Invalidate first (if needed) se...
Called by a dependency manager to remove an injected service and to update the component life cycle.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L212-L227
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.set_controller_state
def set_controller_state(self, name, value): # type: (str, bool) -> None """ Sets the state of the controller with the given name :param name: The name of the controller :param value: The new value of the controller """ with self._lock: self._controll...
python
def set_controller_state(self, name, value): # type: (str, bool) -> None """ Sets the state of the controller with the given name :param name: The name of the controller :param value: The new value of the controller """ with self._lock: self._controll...
Sets the state of the controller with the given name :param name: The name of the controller :param value: The new value of the controller
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L240-L250
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.update_property
def update_property(self, name, old_value, new_value): # type: (str, Any, Any) -> None """ Handles a property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value """ w...
python
def update_property(self, name, old_value, new_value): # type: (str, Any, Any) -> None """ Handles a property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value """ w...
Handles a property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L252-L264
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.update_hidden_property
def update_hidden_property(self, name, old_value, new_value): # type: (str, Any, Any) -> None """ Handles an hidden property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value ...
python
def update_hidden_property(self, name, old_value, new_value): # type: (str, Any, Any) -> None """ Handles an hidden property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value ...
Handles an hidden property changed event :param name: The changed property name :param old_value: The previous property value :param new_value: The new property value
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L266-L278
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.get_handlers
def get_handlers(self, kind=None): """ Retrieves the handlers of the given kind. If kind is None, all handlers are returned. :param kind: The kind of the handlers to return :return: A list of handlers, or an empty list """ with self._lock: if kind is ...
python
def get_handlers(self, kind=None): """ Retrieves the handlers of the given kind. If kind is None, all handlers are returned. :param kind: The kind of the handlers to return :return: A list of handlers, or an empty list """ with self._lock: if kind is ...
Retrieves the handlers of the given kind. If kind is None, all handlers are returned. :param kind: The kind of the handlers to return :return: A list of handlers, or an empty list
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L280-L295
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.check_lifecycle
def check_lifecycle(self): """ Tests if the state of the component must be updated, based on its own state and on the state of its dependencies """ with self._lock: # Validation flags was_valid = self.state == StoredInstance.VALID can_validate ...
python
def check_lifecycle(self): """ Tests if the state of the component must be updated, based on its own state and on the state of its dependencies """ with self._lock: # Validation flags was_valid = self.state == StoredInstance.VALID can_validate ...
Tests if the state of the component must be updated, based on its own state and on the state of its dependencies
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L297-L322
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.update_bindings
def update_bindings(self): # type: () -> bool """ Updates the bindings of the given component :return: True if the component can be validated """ with self._lock: all_valid = True for handler in self.get_handlers(handlers_const.KIND_DEPENDENCY): ...
python
def update_bindings(self): # type: () -> bool """ Updates the bindings of the given component :return: True if the component can be validated """ with self._lock: all_valid = True for handler in self.get_handlers(handlers_const.KIND_DEPENDENCY): ...
Updates the bindings of the given component :return: True if the component can be validated
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L324-L341
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.retry_erroneous
def retry_erroneous(self, properties_update): # type: (dict) -> int """ Removes the ERRONEOUS state from a component and retries a validation :param properties_update: A dictionary to update component properties :return: The new state of the component """ with se...
python
def retry_erroneous(self, properties_update): # type: (dict) -> int """ Removes the ERRONEOUS state from a component and retries a validation :param properties_update: A dictionary to update component properties :return: The new state of the component """ with se...
Removes the ERRONEOUS state from a component and retries a validation :param properties_update: A dictionary to update component properties :return: The new state of the component
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L350-L375
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.invalidate
def invalidate(self, callback=True): # type: (bool) -> bool """ Applies the component invalidation. :param callback: If True, call back the component before the invalidation :return: False if the component wasn't valid """ with self._lock...
python
def invalidate(self, callback=True): # type: (bool) -> bool """ Applies the component invalidation. :param callback: If True, call back the component before the invalidation :return: False if the component wasn't valid """ with self._lock...
Applies the component invalidation. :param callback: If True, call back the component before the invalidation :return: False if the component wasn't valid
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L377-L413
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.kill
def kill(self): # type: () -> bool """ This instance is killed : invalidate it if needed, clean up all members When this method is called, this StoredInstance object must have been removed from the registry :return: True if the component has been killed, False if it alr...
python
def kill(self): # type: () -> bool """ This instance is killed : invalidate it if needed, clean up all members When this method is called, this StoredInstance object must have been removed from the registry :return: True if the component has been killed, False if it alr...
This instance is killed : invalidate it if needed, clean up all members When this method is called, this StoredInstance object must have been removed from the registry :return: True if the component has been killed, False if it already was
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L415-L475
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.validate
def validate(self, safe_callback=True): # type: (bool) -> bool """ Ends the component validation, registering services :param safe_callback: If True, calls the component validation callback :return: True if the component has been validated, else False :raise RuntimeError...
python
def validate(self, safe_callback=True): # type: (bool) -> bool """ Ends the component validation, registering services :param safe_callback: If True, calls the component validation callback :return: True if the component has been validated, else False :raise RuntimeError...
Ends the component validation, registering services :param safe_callback: If True, calls the component validation callback :return: True if the component has been validated, else False :raise RuntimeError: You try to awake a dead component
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L477-L533
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__callback
def __callback(self, event, *args, **kwargs): # type: (str, *Any, **Any) -> Any """ Calls the registered method in the component for the given event :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None :raise Exception: Something we...
python
def __callback(self, event, *args, **kwargs): # type: (str, *Any, **Any) -> Any """ Calls the registered method in the component for the given event :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None :raise Exception: Something we...
Calls the registered method in the component for the given event :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None :raise Exception: Something went wrong
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L535-L555
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__validation_callback
def __validation_callback(self, event): # type: (str) -> Any """ Specific handling for the ``@ValidateComponent`` and ``@InvalidateComponent`` callback, as it requires checking arguments count and order :param event: The kind of life-cycle callback (in/validation) ...
python
def __validation_callback(self, event): # type: (str) -> Any """ Specific handling for the ``@ValidateComponent`` and ``@InvalidateComponent`` callback, as it requires checking arguments count and order :param event: The kind of life-cycle callback (in/validation) ...
Specific handling for the ``@ValidateComponent`` and ``@InvalidateComponent`` callback, as it requires checking arguments count and order :param event: The kind of life-cycle callback (in/validation) :return: The callback result, or None :raise Exception: Something went wrong
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L557-L595
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__field_callback
def __field_callback(self, field, event, *args, **kwargs): # type: (str, str, *Any, **Any) -> Any """ Calls the registered method in the component for the given field event :param field: A field name :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The call...
python
def __field_callback(self, field, event, *args, **kwargs): # type: (str, str, *Any, **Any) -> Any """ Calls the registered method in the component for the given field event :param field: A field name :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The call...
Calls the registered method in the component for the given field event :param field: A field name :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None :raise Exception: Something went wrong
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L597-L626
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.safe_callback
def safe_callback(self, event, *args, **kwargs): # type: (str, *Any, **Any) -> Any """ Calls the registered method in the component for the given event, ignoring raised exceptions :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None...
python
def safe_callback(self, event, *args, **kwargs): # type: (str, *Any, **Any) -> Any """ Calls the registered method in the component for the given event, ignoring raised exceptions :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None...
Calls the registered method in the component for the given event, ignoring raised exceptions :param event: An event (IPOPO_CALLBACK_VALIDATE, ...) :return: The callback result, or None
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L628-L665
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__safe_validation_callback
def __safe_validation_callback(self, event): # type: (str) -> Any """ Calls the ``@ValidateComponent`` or ``@InvalidateComponent`` callback, ignoring raised exceptions :param event: The kind of life-cycle callback (in/validation) :return: The callback result, or None ...
python
def __safe_validation_callback(self, event): # type: (str) -> Any """ Calls the ``@ValidateComponent`` or ``@InvalidateComponent`` callback, ignoring raised exceptions :param event: The kind of life-cycle callback (in/validation) :return: The callback result, or None ...
Calls the ``@ValidateComponent`` or ``@InvalidateComponent`` callback, ignoring raised exceptions :param event: The kind of life-cycle callback (in/validation) :return: The callback result, or None
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L667-L710
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__safe_handler_callback
def __safe_handler_callback(self, handler, method_name, *args, **kwargs): # type: (Any, str, *Any, **Any) -> Any """ Calls the given method with the given arguments in the given handler. Logs exceptions, but doesn't propagate them. Special arguments can be given in kwargs: ...
python
def __safe_handler_callback(self, handler, method_name, *args, **kwargs): # type: (Any, str, *Any, **Any) -> Any """ Calls the given method with the given arguments in the given handler. Logs exceptions, but doesn't propagate them. Special arguments can be given in kwargs: ...
Calls the given method with the given arguments in the given handler. Logs exceptions, but doesn't propagate them. Special arguments can be given in kwargs: * 'none_as_true': If set to True and the method returned None or doesn't exist, the result is considered as Tru...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L753-L810
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__safe_handlers_callback
def __safe_handlers_callback(self, method_name, *args, **kwargs): # type: (str, *Any, **Any) -> bool """ Calls the given method with the given arguments in all handlers. Logs exceptions, but doesn't propagate them. Methods called in handlers must return None, True or False. ...
python
def __safe_handlers_callback(self, method_name, *args, **kwargs): # type: (str, *Any, **Any) -> bool """ Calls the given method with the given arguments in all handlers. Logs exceptions, but doesn't propagate them. Methods called in handlers must return None, True or False. ...
Calls the given method with the given arguments in all handlers. Logs exceptions, but doesn't propagate them. Methods called in handlers must return None, True or False. Special parameters can be given in kwargs: * 'exception_as_error': if it is set to True and an exception is raised ...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L812-L870
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__set_binding
def __set_binding(self, dependency, service, reference): # type: (Any, Any, ServiceReference) -> None """ Injects a service in the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected ser...
python
def __set_binding(self, dependency, service, reference): # type: (Any, Any, ServiceReference) -> None """ Injects a service in the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected ser...
Injects a service in the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected service
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L872-L892
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__update_binding
def __update_binding( self, dependency, service, reference, old_properties, new_value ): # type: (Any, Any, ServiceReference, dict, bool) -> None """ Calls back component binding and field binding methods when the properties of an injected dependency have been updated. ...
python
def __update_binding( self, dependency, service, reference, old_properties, new_value ): # type: (Any, Any, ServiceReference, dict, bool) -> None """ Calls back component binding and field binding methods when the properties of an injected dependency have been updated. ...
Calls back component binding and field binding methods when the properties of an injected dependency have been updated. :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected service :param old_properties: P...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L894-L925
tcalmant/ipopo
pelix/ipopo/instance.py
StoredInstance.__unset_binding
def __unset_binding(self, dependency, service, reference): # type: (Any, Any, ServiceReference) -> None """ Removes a service from the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected...
python
def __unset_binding(self, dependency, service, reference): # type: (Any, Any, ServiceReference) -> None """ Removes a service from the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected...
Removes a service from the component :param dependency: The dependency handler :param service: The injected service :param reference: The reference of the injected service
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/instance.py#L927-L950
tcalmant/ipopo
pelix/misc/eventadmin_printer.py
_parse_boolean
def _parse_boolean(value): """ Returns a boolean value corresponding to the given value. :param value: Any value :return: Its boolean value """ if not value: return False try: # Lower string to check known "false" value value = value.lower() return value not...
python
def _parse_boolean(value): """ Returns a boolean value corresponding to the given value. :param value: Any value :return: Its boolean value """ if not value: return False try: # Lower string to check known "false" value value = value.lower() return value not...
Returns a boolean value corresponding to the given value. :param value: Any value :return: Its boolean value
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/misc/eventadmin_printer.py#L58-L74
tcalmant/ipopo
pelix/ipopo/handlers/requiresvarfilter.py
_VariableFilterMixIn._find_keys
def _find_keys(self): """ Looks for the property keys in the filter string :return: A list of property keys """ formatter = string.Formatter() return [ val[1] for val in formatter.parse(self._original_filter) if val[1] ]
python
def _find_keys(self): """ Looks for the property keys in the filter string :return: A list of property keys """ formatter = string.Formatter() return [ val[1] for val in formatter.parse(self._original_filter) if val[1] ]
Looks for the property keys in the filter string :return: A list of property keys
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresvarfilter.py#L162-L171
tcalmant/ipopo
pelix/ipopo/handlers/requiresvarfilter.py
_VariableFilterMixIn.update_filter
def update_filter(self): """ Update the filter according to the new properties :return: True if the filter changed, else False :raise ValueError: The filter is invalid """ # Consider the filter invalid self.valid_filter = False try: # Format ...
python
def update_filter(self): """ Update the filter according to the new properties :return: True if the filter changed, else False :raise ValueError: The filter is invalid """ # Consider the filter invalid self.valid_filter = False try: # Format ...
Update the filter according to the new properties :return: True if the filter changed, else False :raise ValueError: The filter is invalid
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresvarfilter.py#L173-L210
tcalmant/ipopo
pelix/ipopo/handlers/requiresvarfilter.py
_VariableFilterMixIn.on_property_change
def on_property_change(self, name, old_value, new_value): # pylint: disable=W0613 """ A component property has been updated :param name: Name of the property :param old_value: Previous value of the property :param new_value: New value of the property """ ...
python
def on_property_change(self, name, old_value, new_value): # pylint: disable=W0613 """ A component property has been updated :param name: Name of the property :param old_value: Previous value of the property :param new_value: New value of the property """ ...
A component property has been updated :param name: Name of the property :param old_value: Previous value of the property :param new_value: New value of the property
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresvarfilter.py#L212-L231
tcalmant/ipopo
pelix/ipopo/handlers/requiresvarfilter.py
_VariableFilterMixIn._reset
def _reset(self): """ Called when the filter has been changed """ with self._lock: # Start listening to services with the new filter self.stop() self.start() for svc_ref in self.get_bindings(): # Check if the current refere...
python
def _reset(self): """ Called when the filter has been changed """ with self._lock: # Start listening to services with the new filter self.stop() self.start() for svc_ref in self.get_bindings(): # Check if the current refere...
Called when the filter has been changed
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requiresvarfilter.py#L233-L249
tcalmant/ipopo
pelix/threadpool.py
EventData.set
def set(self, data=None): """ Sets the event """ self.__data = data self.__exception = None self.__event.set()
python
def set(self, data=None): """ Sets the event """ self.__data = data self.__exception = None self.__event.set()
Sets the event
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L97-L103
tcalmant/ipopo
pelix/threadpool.py
EventData.raise_exception
def raise_exception(self, exception): """ Raises an exception in wait() :param exception: An Exception object """ self.__data = None self.__exception = exception self.__event.set()
python
def raise_exception(self, exception): """ Raises an exception in wait() :param exception: An Exception object """ self.__data = None self.__exception = exception self.__event.set()
Raises an exception in wait() :param exception: An Exception object
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L105-L113
tcalmant/ipopo
pelix/threadpool.py
EventData.wait
def wait(self, timeout=None): """ Waits for the event or for the timeout :param timeout: Wait timeout (in seconds) :return: True if the event as been set, else False """ # The 'or' part is for Python 2.6 result = self.__event.wait(timeout) # pylint: disab...
python
def wait(self, timeout=None): """ Waits for the event or for the timeout :param timeout: Wait timeout (in seconds) :return: True if the event as been set, else False """ # The 'or' part is for Python 2.6 result = self.__event.wait(timeout) # pylint: disab...
Waits for the event or for the timeout :param timeout: Wait timeout (in seconds) :return: True if the event as been set, else False
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L115-L129
tcalmant/ipopo
pelix/threadpool.py
FutureResult.__notify
def __notify(self): """ Notify the given callback about the result of the execution """ if self.__callback is not None: try: self.__callback( self._done_event.data, self._done_event.exception, self.__...
python
def __notify(self): """ Notify the given callback about the result of the execution """ if self.__callback is not None: try: self.__callback( self._done_event.data, self._done_event.exception, self.__...
Notify the given callback about the result of the execution
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L153-L165
tcalmant/ipopo
pelix/threadpool.py
FutureResult.set_callback
def set_callback(self, method, extra=None): """ Sets a callback method, called once the result has been computed or in case of exception. The callback method must have the following signature: ``callback(result, exception, extra)``. :param method: The method to call bac...
python
def set_callback(self, method, extra=None): """ Sets a callback method, called once the result has been computed or in case of exception. The callback method must have the following signature: ``callback(result, exception, extra)``. :param method: The method to call bac...
Sets a callback method, called once the result has been computed or in case of exception. The callback method must have the following signature: ``callback(result, exception, extra)``. :param method: The method to call back in the end of the execution :param extra: Extra parame...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L167-L182
tcalmant/ipopo
pelix/threadpool.py
FutureResult.execute
def execute(self, method, args, kwargs): """ Execute the given method and stores its result. The result is considered "done" even if the method raises an exception :param method: The method to execute :param args: Method positional arguments :param kwargs: Method keyword...
python
def execute(self, method, args, kwargs): """ Execute the given method and stores its result. The result is considered "done" even if the method raises an exception :param method: The method to execute :param args: Method positional arguments :param kwargs: Method keyword...
Execute the given method and stores its result. The result is considered "done" even if the method raises an exception :param method: The method to execute :param args: Method positional arguments :param kwargs: Method keyword arguments :raise Exception: The exception raised by ...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L184-L213
tcalmant/ipopo
pelix/threadpool.py
FutureResult.result
def result(self, timeout=None): """ Waits up to timeout for the result the threaded job. Returns immediately the result if the job has already been done. :param timeout: The maximum time to wait for a result (in seconds) :raise OSError: The timeout raised before the job finished...
python
def result(self, timeout=None): """ Waits up to timeout for the result the threaded job. Returns immediately the result if the job has already been done. :param timeout: The maximum time to wait for a result (in seconds) :raise OSError: The timeout raised before the job finished...
Waits up to timeout for the result the threaded job. Returns immediately the result if the job has already been done. :param timeout: The maximum time to wait for a result (in seconds) :raise OSError: The timeout raised before the job finished :raise Exception: The exception encountered...
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L221-L233
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.start
def start(self): """ Starts the thread pool. Does nothing if the pool is already started. """ if not self._done_event.is_set(): # Stop event not set: we're running return # Clear the stop event self._done_event.clear() # Compute the numbe...
python
def start(self): """ Starts the thread pool. Does nothing if the pool is already started. """ if not self._done_event.is_set(): # Stop event not set: we're running return # Clear the stop event self._done_event.clear() # Compute the numbe...
Starts the thread pool. Does nothing if the pool is already started.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L308-L334
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.__start_thread
def __start_thread(self): """ Starts a new thread, if possible """ with self.__lock: if self.__nb_threads >= self._max_threads: # Can't create more threads return False if self._done_event.is_set(): # We're stopped:...
python
def __start_thread(self): """ Starts a new thread, if possible """ with self.__lock: if self.__nb_threads >= self._max_threads: # Can't create more threads return False if self._done_event.is_set(): # We're stopped:...
Starts a new thread, if possible
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L336-L362
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.stop
def stop(self): """ Stops the thread pool. Does nothing if the pool is already stopped. """ if self._done_event.is_set(): # Stop event set: we're stopped return # Set the stop event self._done_event.set() with self.__lock: # A...
python
def stop(self): """ Stops the thread pool. Does nothing if the pool is already stopped. """ if self._done_event.is_set(): # Stop event set: we're stopped return # Set the stop event self._done_event.set() with self.__lock: # A...
Stops the thread pool. Does nothing if the pool is already stopped.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L364-L400
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.enqueue
def enqueue(self, method, *args, **kwargs): """ Queues a task in the pool :param method: Method to call :return: A FutureResult object, to get the result of the task :raise ValueError: Invalid method :raise Full: The task queue is full """ if not hasattr(...
python
def enqueue(self, method, *args, **kwargs): """ Queues a task in the pool :param method: Method to call :return: A FutureResult object, to get the result of the task :raise ValueError: Invalid method :raise Full: The task queue is full """ if not hasattr(...
Queues a task in the pool :param method: Method to call :return: A FutureResult object, to get the result of the task :raise ValueError: Invalid method :raise Full: The task queue is full
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L402-L429
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.clear
def clear(self): """ Empties the current queue content. Returns once the queue have been emptied. """ with self.__lock: # Empty the current queue try: while True: self._queue.get_nowait() self._queue....
python
def clear(self): """ Empties the current queue content. Returns once the queue have been emptied. """ with self.__lock: # Empty the current queue try: while True: self._queue.get_nowait() self._queue....
Empties the current queue content. Returns once the queue have been emptied.
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L431-L447
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.join
def join(self, timeout=None): """ Waits for all the tasks to be executed :param timeout: Maximum time to wait (in seconds) :return: True if the queue has been emptied, else False """ if self._queue.empty(): # Nothing to wait for... return True ...
python
def join(self, timeout=None): """ Waits for all the tasks to be executed :param timeout: Maximum time to wait (in seconds) :return: True if the queue has been emptied, else False """ if self._queue.empty(): # Nothing to wait for... return True ...
Waits for all the tasks to be executed :param timeout: Maximum time to wait (in seconds) :return: True if the queue has been emptied, else False
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L449-L467
tcalmant/ipopo
pelix/threadpool.py
ThreadPool.__run
def __run(self): """ The main loop """ already_cleaned = False try: while not self._done_event.is_set(): try: # Wait for an action (blocking) task = self._queue.get(True, self._timeout) if tas...
python
def __run(self): """ The main loop """ already_cleaned = False try: while not self._done_event.is_set(): try: # Wait for an action (blocking) task = self._queue.get(True, self._timeout) if tas...
The main loop
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/threadpool.py#L469-L534
cfhamlet/os-docid
src/os_docid/x.py
docid
def docid(url, encoding='ascii'): """Get DocID from URL. DocID generation depends on bytes of the URL string. So, if non-ascii charactors in the URL, encoding should be considered properly. Args: url (str or bytes): Pre-encoded bytes or string will be encoded with the 'encoding...
python
def docid(url, encoding='ascii'): """Get DocID from URL. DocID generation depends on bytes of the URL string. So, if non-ascii charactors in the URL, encoding should be considered properly. Args: url (str or bytes): Pre-encoded bytes or string will be encoded with the 'encoding...
Get DocID from URL. DocID generation depends on bytes of the URL string. So, if non-ascii charactors in the URL, encoding should be considered properly. Args: url (str or bytes): Pre-encoded bytes or string will be encoded with the 'encoding' argument. encoding (str, option...
https://github.com/cfhamlet/os-docid/blob/d3730aa118182f903b540ea738cd47c83f6b5e89/src/os_docid/x.py#L172-L229
hasgeek/coaster
coaster/logger.py
init_app
def init_app(app): """ Enables logging for an app using :class:`LocalVarFormatter`. Requires the app to be configured and checks for the following configuration parameters. All are optional: * ``LOGFILE``: Name of the file to log to (default ``error.log``) * ``ADMINS``: List of email addresses ...
python
def init_app(app): """ Enables logging for an app using :class:`LocalVarFormatter`. Requires the app to be configured and checks for the following configuration parameters. All are optional: * ``LOGFILE``: Name of the file to log to (default ``error.log``) * ``ADMINS``: List of email addresses ...
Enables logging for an app using :class:`LocalVarFormatter`. Requires the app to be configured and checks for the following configuration parameters. All are optional: * ``LOGFILE``: Name of the file to log to (default ``error.log``) * ``ADMINS``: List of email addresses of admins who will be mailed er...
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/logger.py#L246-L329
hasgeek/coaster
coaster/logger.py
LocalVarFormatter.format
def format(self, record): """ Format the specified record as text. Overrides :meth:`logging.Formatter.format` to remove cache of :attr:`record.exc_text` unless it was produced by this formatter. """ if record.exc_info: if record.exc_text: if "S...
python
def format(self, record): """ Format the specified record as text. Overrides :meth:`logging.Formatter.format` to remove cache of :attr:`record.exc_text` unless it was produced by this formatter. """ if record.exc_info: if record.exc_text: if "S...
Format the specified record as text. Overrides :meth:`logging.Formatter.format` to remove cache of :attr:`record.exc_text` unless it was produced by this formatter.
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/logger.py#L40-L50
hasgeek/coaster
coaster/utils/text.py
sanitize_html
def sanitize_html(value, valid_tags=VALID_TAGS, strip=True): """ Strips unwanted markup out of HTML. """ return bleach.clean(value, tags=list(VALID_TAGS.keys()), attributes=VALID_TAGS, strip=strip)
python
def sanitize_html(value, valid_tags=VALID_TAGS, strip=True): """ Strips unwanted markup out of HTML. """ return bleach.clean(value, tags=list(VALID_TAGS.keys()), attributes=VALID_TAGS, strip=strip)
Strips unwanted markup out of HTML.
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/utils/text.py#L61-L65
hasgeek/coaster
coaster/utils/text.py
word_count
def word_count(text, html=True): """ Return the count of words in the given text. If the text is HTML (default True), tags are stripped before counting. Handles punctuation and bad formatting like.this when counting words, but assumes conventions for Latin script languages. May not be reliable for o...
python
def word_count(text, html=True): """ Return the count of words in the given text. If the text is HTML (default True), tags are stripped before counting. Handles punctuation and bad formatting like.this when counting words, but assumes conventions for Latin script languages. May not be reliable for o...
Return the count of words in the given text. If the text is HTML (default True), tags are stripped before counting. Handles punctuation and bad formatting like.this when counting words, but assumes conventions for Latin script languages. May not be reliable for other languages.
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/utils/text.py#L138-L149
hasgeek/coaster
coaster/utils/text.py
deobfuscate_email
def deobfuscate_email(text): """ Deobfuscate email addresses in provided text """ text = unescape(text) # Find the "dot" text = _deobfuscate_dot1_re.sub('.', text) text = _deobfuscate_dot2_re.sub(r'\1.\2', text) text = _deobfuscate_dot3_re.sub(r'\1.\2', text) # Find the "at" text...
python
def deobfuscate_email(text): """ Deobfuscate email addresses in provided text """ text = unescape(text) # Find the "dot" text = _deobfuscate_dot1_re.sub('.', text) text = _deobfuscate_dot2_re.sub(r'\1.\2', text) text = _deobfuscate_dot3_re.sub(r'\1.\2', text) # Find the "at" text...
Deobfuscate email addresses in provided text
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/utils/text.py#L161-L175
hasgeek/coaster
coaster/utils/text.py
simplify_text
def simplify_text(text): """ Simplify text to allow comparison. >>> simplify_text("Awesome Coder wanted at Awesome Company") 'awesome coder wanted at awesome company' >>> simplify_text("Awesome Coder, wanted at Awesome Company! ") 'awesome coder wanted at awesome company' >>> simplify_text...
python
def simplify_text(text): """ Simplify text to allow comparison. >>> simplify_text("Awesome Coder wanted at Awesome Company") 'awesome coder wanted at awesome company' >>> simplify_text("Awesome Coder, wanted at Awesome Company! ") 'awesome coder wanted at awesome company' >>> simplify_text...
Simplify text to allow comparison. >>> simplify_text("Awesome Coder wanted at Awesome Company") 'awesome coder wanted at awesome company' >>> simplify_text("Awesome Coder, wanted at Awesome Company! ") 'awesome coder wanted at awesome company' >>> simplify_text(u"Awesome Coder, wanted at Awesome ...
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/utils/text.py#L178-L196
hasgeek/coaster
coaster/nlp.py
extract_named_entities
def extract_named_entities(text_blocks): """ Return a list of named entities extracted from provided text blocks (list of text strings). """ sentences = [] for text in text_blocks: sentences.extend(nltk.sent_tokenize(text)) tokenized_sentences = [nltk.word_tokenize(sentence) for sentenc...
python
def extract_named_entities(text_blocks): """ Return a list of named entities extracted from provided text blocks (list of text strings). """ sentences = [] for text in text_blocks: sentences.extend(nltk.sent_tokenize(text)) tokenized_sentences = [nltk.word_tokenize(sentence) for sentenc...
Return a list of named entities extracted from provided text blocks (list of text strings).
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/nlp.py#L20-L48
hasgeek/coaster
coaster/manage.py
set_alembic_revision
def set_alembic_revision(path=None): """Create/Update alembic table to latest revision number""" config = Config() try: config.set_main_option("script_location", path or "migrations") script = ScriptDirectory.from_config(config) head = script.get_current_head() # create alemb...
python
def set_alembic_revision(path=None): """Create/Update alembic table to latest revision number""" config = Config() try: config.set_main_option("script_location", path or "migrations") script = ScriptDirectory.from_config(config) head = script.get_current_head() # create alemb...
Create/Update alembic table to latest revision number
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/manage.py#L54-L75
hasgeek/coaster
coaster/manage.py
dropdb
def dropdb(): """Drop database tables""" manager.db.engine.echo = True if prompt_bool("Are you sure you want to lose all your data"): manager.db.drop_all() metadata, alembic_version = alembic_table_metadata() alembic_version.drop() manager.db.session.commit()
python
def dropdb(): """Drop database tables""" manager.db.engine.echo = True if prompt_bool("Are you sure you want to lose all your data"): manager.db.drop_all() metadata, alembic_version = alembic_table_metadata() alembic_version.drop() manager.db.session.commit()
Drop database tables
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/manage.py#L79-L86
hasgeek/coaster
coaster/manage.py
createdb
def createdb(): """Create database tables from sqlalchemy models""" manager.db.engine.echo = True manager.db.create_all() set_alembic_revision()
python
def createdb(): """Create database tables from sqlalchemy models""" manager.db.engine.echo = True manager.db.create_all() set_alembic_revision()
Create database tables from sqlalchemy models
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/manage.py#L90-L94
hasgeek/coaster
coaster/manage.py
sync_resources
def sync_resources(): """Sync the client's resources with the Lastuser server""" print("Syncing resources with Lastuser...") resources = manager.app.lastuser.sync_resources()['results'] for rname, resource in six.iteritems(resources): if resource['status'] == 'error': print("Error f...
python
def sync_resources(): """Sync the client's resources with the Lastuser server""" print("Syncing resources with Lastuser...") resources = manager.app.lastuser.sync_resources()['results'] for rname, resource in six.iteritems(resources): if resource['status'] == 'error': print("Error f...
Sync the client's resources with the Lastuser server
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/manage.py#L98-L113
hasgeek/coaster
coaster/manage.py
init_manager
def init_manager(app, db, **kwargs): """ Initialise Manager :param app: Flask app object :parm db: db instance :param kwargs: Additional keyword arguments to be made available as shell context """ manager.app = app manager.db = db manager.context = kwargs manager.add_command('db...
python
def init_manager(app, db, **kwargs): """ Initialise Manager :param app: Flask app object :parm db: db instance :param kwargs: Additional keyword arguments to be made available as shell context """ manager.app = app manager.db = db manager.context = kwargs manager.add_command('db...
Initialise Manager :param app: Flask app object :parm db: db instance :param kwargs: Additional keyword arguments to be made available as shell context
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/manage.py#L122-L139