text
stringlengths
81
112k
Given two URLs, return a list of any mismatches. If the list is empty, the URLs are equivalent. Implemented by parsing and comparing the elements. See RFC 1738 for details. def find_url_mismatches(a_url, b_url): """Given two URLs, return a list of any mismatches. If the list is empty, the URLs are eq...
Run the program. def main(): """Run the program.""" args = parse_arguments() ext = os.path.splitext(args.input_file)[-1].lower() with gzip.open(args.output_file, mode='wt') as outfile: csvwriter = csv.writer(outfile, delimiter=str('\t'), lineterminator='\n') try: if ext in...
CN search. def search(self, line): """CN search.""" if self._session.get(d1_cli.impl.session.QUERY_ENGINE_NAME) == "solr": return self._search_solr(line) raise d1_cli.impl.exceptions.InvalidArguments( "Unsupported query engine: {}".format( self._session.g...
Get Object Locations for Object. def resolve(self, pid): """Get Object Locations for Object.""" client = d1_cli.impl.client.CLICNClient( **self._cn_client_connect_params_from_session() ) object_location_list_pyxb = client.resolve(pid) for location in object_location_...
First try the MN set in the session. Then try to resolve via the CN set in the session. def science_object_get(self, pid, path): """First try the MN set in the session. Then try to resolve via the CN set in the session. """ mn_client = d1_cli.impl.client.CLIMNClient( ...
Create a new Science Object on a Member Node. def science_object_create(self, pid, path, format_id=None): """Create a new Science Object on a Member Node.""" self._queue_science_object_create(pid, path, format_id)
Obsolete a Science Object on a Member Node with a different one. def science_object_update(self, pid_old, path, pid_new, format_id=None): """Obsolete a Science Object on a Member Node with a different one.""" self._queue_science_object_update(pid_old, path, pid_new, format_id)
Display or save file like object. def _output(self, file_like_object, path=None): """Display or save file like object.""" if not path: self._output_to_display(file_like_object) else: self._output_to_file(file_like_object, path)
Perform a SOLR search. def _search_solr(self, line): """Perform a SOLR search.""" try: query_str = self._create_solr_query(line) client = d1_cli.impl.client.CLICNClient( **self._cn_client_connect_params_from_session() ) object_list_pyxb = ...
Actual search - easier to test. def _create_solr_query(self, line): """Actual search - easier to test. """ p0 = "" if line: p0 = line.strip() p1 = self._query_string_to_solr_filter(line) p2 = self._object_format_to_solr_filter(line) p3 = self._time_span_to_so...
Apply `func` to list or tuple `obj` element-wise and directly otherwise. def apply_filter_list(func, obj): """Apply `func` to list or tuple `obj` element-wise and directly otherwise.""" if isinstance(obj, (list, tuple)): return [func(item) for item in obj] return func(obj)
Get data object field. def _get_data_attr(data, attr): """Get data object field.""" if isinstance(data, dict): # `Data` object's id is hydrated as `__id` in expression engine data = data['__id'] data_obj = Data.objects.get(id=data) return getattr(data_obj, attr)
Return a hydrated value of the ``input`` field. def input_(data, field_path): """Return a hydrated value of the ``input`` field.""" data_obj = Data.objects.get(id=data['__id']) inputs = copy.deepcopy(data_obj.input) # XXX: Optimize by hydrating only the required field (major refactoring). hydrate_...
Return HydratedPath object for file-type field. def _get_hydrated_path(field): """Return HydratedPath object for file-type field.""" # Get only file path if whole file object is given. if isinstance(field, str) and hasattr(field, 'file_name'): # field is already actually a HydratedPath object ...
Return file's url based on base url set in settings. def get_url(field): """Return file's url based on base url set in settings.""" hydrated_path = _get_hydrated_path(field) base_url = getattr(settings, 'RESOLWE_HOST_URL', 'localhost') return "{}/data/{}/{}".format(base_url, hydrated_path.data_id, hydr...
Return descriptor of given object. If ``path`` is specified, only the content on that path is returned. def descriptor(obj, path=''): """Return descriptor of given object. If ``path`` is specified, only the content on that path is returned. """ if isinstance(obj, dict): # Current ...
If a date range is missing the start or end date, close it by copying the date from the existing value. def _close_open_date_ranges(self, record): """If a date range is missing the start or end date, close it by copying the date from the existing value.""" date_ranges = (('beginDate', '...
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \ def escapeQueryTerm(self, term): """ + - && || ! ( ) { } [ ] ^ " ~ * ? : \ """ reserved = [ '+', '-', '&', '|', '!', '(', ')', '{', '}', ...
Prepare a query term for inclusion in a query. This escapes the term and if necessary, wraps the term in quotes. def prepareQueryTerm(self, field, term): """Prepare a query term for inclusion in a query. This escapes the term and if necessary, wraps the term in quotes. """ if...
Returns unicode(value) after trying to coerce it into the SOLR field type. @param ftype(string) The SOLR field type for the value @param value(any) The value that is to be represented as Unicode text. def coerceType(self, ftype, value): """Returns unicode(value) after trying to coerce it into ...
Returns the SOLR type of the specified field name. Assumes the convention of dynamic fields using an underscore + type character code for the field name. def getSolrType(self, field): """Returns the SOLR type of the specified field name. Assumes the convention of dynamic fields using ...
docs is a list of fields that are a dictionary of name:value for a record. def addDocs(self, docs): """docs is a list of fields that are a dictionary of name:value for a record.""" lst = ['<add>'] for fields in docs: self.__add(lst, fields) lst.append('</add>') xstr ...
Return the number of entries that match query. def count(self, q='*:*', fq=None): """Return the number of entries that match query.""" params = {'q': q, 'rows': '0'} if fq is not None: params['fq'] = fq res = self.search(params) hits = res['response']['numFound'] ...
Returns a dictionary of: matches: number of matches failed: if true, then an exception was thrown start: starting index ids: [id, id, ...] See also the SOLRSearchResponseIterator class def getIds(self, query='*:*', fq=None, start=0, rows=1000): """Returns a dictionary of: matches: number of ma...
Retrieves the specified document. def get(self, id): """Retrieves the specified document.""" params = {'q': 'id:%s' % str(id), 'wt': 'python'} request = urllib.parse.urlencode(params, doseq=True) data = None try: rsp = self.doPost(self.solrBase + '', request, self.fo...
Retrieve a list of fields. The response looks something like: { 'responseHeader':{ 'status':0, 'QTime':44}, 'index':{ 'numDocs':2000, 'maxDoc':2000, 'numTerms':23791, 'version':1227298371173, 'optimized':True, 'current':True, 'hasDeletions':False, 'directory':'org.apache.lucen...
Retrieve the unique values for a field, along with their usage counts. http://localhost:8080/solr/select/?q=*:*&rows=0&facet=true&inde nt=on&wt=python&facet.field=genus_s&facet.limit=10&facet.zeros=false&fa cet.sort=false. @param name(string) Name of field to retrieve values for ...
Returns the minimum and maximum values of the specified field. This requires two search calls to the service, each requesting a single value of a single field. @param name(string) Name of the field @param q(string) Query identifying range of records for min and max values @param...
Returns the python type for the specified field name. The field list is cached so multiple calls do not invoke a getFields request each time. @param name(string) The name of the SOLR field @returns Python type of the field. def getftype(self, name): """Returns the python type for the ...
Generates a histogram of values from a string field. Output is: [[low, high, count, query], ... ] Bin edges is determined by equal division of the fields def fieldAlphaHistogram( self, name, q='*:*', fq=None, nbins=10, includequeries=True ): """Generates a histogram of values fr...
Generates a histogram of values. Expects the field to be integer or floating point. @param name(string) Name of the field to compute @param q(string) The query identifying the set of records for the histogram @param fq(string) Filter query to restrict application of query @param...
Generates a 2d histogram of values. Expects the field to be integer or floating point. @param name1(string) Name of field1 columns to compute @param name2(string) Name of field2 rows to compute @param q(string) The query identifying the set of records for the histogram @param fq...
Retrieves the next set of results from the service. def _nextPage(self, offset): """Retrieves the next set of results from the service.""" self.logger.debug("Iterator crecord=%s" % str(self.crecord)) params = { 'q': self.q, 'start': str(offset), 'rows': str(s...
Retrieves the next set of results from the service. def _nextPage(self, offset): """Retrieves the next set of results from the service.""" self.logger.debug("Iterator crecord=%s" % str(self.crecord)) params = { 'q': self.q, 'rows': '0', 'facet': 'true', ...
MNCore.ping() → Boolean. def get_monitor_ping(request): """MNCore.ping() → Boolean.""" response = d1_gmn.app.views.util.http_response_with_boolean_true_type() d1_gmn.app.views.headers.add_http_date_header(response) return response
MNCore.getLogRecords(session[, fromDate][, toDate][, idFilter][, event] [, start=0][, count=1000]) → Log Sorted by timestamp, id. def get_log(request): """MNCore.getLogRecords(session[, fromDate][, toDate][, idFilter][, event] [, start=0][, count=1000]) → Log Sorted by timestamp, id. """ ...
MNCore.getCapabilities() → Node. def get_node(request): """MNCore.getCapabilities() → Node.""" api_major_int = 2 if d1_gmn.app.views.util.is_v2_api(request) else 1 node_pretty_xml = d1_gmn.app.node.get_pretty_xml(api_major_int) return django.http.HttpResponse(node_pretty_xml, d1_common.const.CONTENT_TY...
MNRead.get(session, did) → OctetStream. def get_object(request, pid): """MNRead.get(session, did) → OctetStream.""" sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid) content_type_str = d1_gmn.app.object_format_cache.get_content_type( sciobj.format.format ) # Return local or...
MNRead.getSystemMetadata(session, pid) → SystemMetadata. def get_meta(request, pid): """MNRead.getSystemMetadata(session, pid) → SystemMetadata.""" d1_gmn.app.event_log.log_read_event(pid, request) return django.http.HttpResponse( d1_gmn.app.views.util.generate_sysmeta_xml_matching_api_version(requ...
MNRead.describe(session, did) → DescribeResponse. def head_object(request, pid): """MNRead.describe(session, did) → DescribeResponse.""" sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid) response = django.http.HttpResponse() d1_gmn.app.views.headers.add_sciobj_properties_headers_to_res...
MNRead.getChecksum(session, did[, checksumAlgorithm]) → Checksum. def get_checksum(request, pid): """MNRead.getChecksum(session, did[, checksumAlgorithm]) → Checksum.""" # MNRead.getChecksum() requires that a new checksum be calculated. Cannot # simply return the checksum from the sysmeta. # # If t...
MNRead.synchronizationFailed(session, message) def post_error(request): """MNRead.synchronizationFailed(session, message)""" d1_gmn.app.views.assert_db.post_has_mime_parts(request, (('file', 'message'),)) try: synchronization_failed = d1_gmn.app.views.util.deserialize( request.FILES['me...
MNReplication.getReplica(session, did) → OctetStream. def get_replica(request, pid): """MNReplication.getReplica(session, did) → OctetStream.""" _assert_node_is_authorized(request, pid) sciobj = d1_gmn.app.models.ScienceObject.objects.get(pid__did=pid) content_type_str = d1_gmn.app.object_format_cache....
MNStorage.updateSystemMetadata(session, pid, sysmeta) → boolean. TODO: Currently, this call allows making breaking changes to SysMeta. We need to clarify what can be modified and what the behavior should be when working with SIDs and chains. def put_meta(request): """MNStorage.updateSystemMetadata(ses...
MNAuthorization.isAuthorized(did, action) -> Boolean. def get_is_authorized(request, pid): """MNAuthorization.isAuthorized(did, action) -> Boolean.""" if 'action' not in request.GET: raise d1_common.types.exceptions.InvalidRequest( 0, 'Missing required parameter. required="action"' ...
MNStorage.systemMetadataChanged(session, did, serialVersion, dateSysMetaLastModified) → boolean. def post_refresh_system_metadata(request): """MNStorage.systemMetadataChanged(session, did, serialVersion, dateSysMetaLastModified) → boolean.""" d1_gmn.app.views.assert_db.post_has_mime_parts( requ...
MNStorage.create(session, did, object, sysmeta) → Identifier. def post_object_list(request): """MNStorage.create(session, did, object, sysmeta) → Identifier.""" d1_gmn.app.views.assert_db.post_has_mime_parts( request, (('field', 'pid'), ('file', 'object'), ('file', 'sysmeta')) ) url_pid = reque...
MNStorage.update(session, pid, object, newPid, sysmeta) → Identifier. def put_object(request, old_pid): """MNStorage.update(session, pid, object, newPid, sysmeta) → Identifier.""" if django.conf.settings.REQUIRE_WHITELIST_FOR_UPDATE: d1_gmn.app.auth.assert_create_update_delete_permission(request) d...
MNStorage.generateIdentifier(session, scheme[, fragment]) → Identifier. def post_generate_identifier(request): """MNStorage.generateIdentifier(session, scheme[, fragment]) → Identifier.""" d1_gmn.app.views.assert_db.post_has_mime_parts(request, (('field', 'scheme'),)) if request.POST['scheme'] != 'UUID': ...
MNStorage.archive(session, did) → Identifier. def put_archive(request, pid): """MNStorage.archive(session, did) → Identifier.""" d1_gmn.app.views.assert_db.is_not_replica(pid) d1_gmn.app.views.assert_db.is_not_archived(pid) d1_gmn.app.sysmeta.archive_sciobj(pid) return pid
MNReplication.replicate(session, sysmeta, sourceNode) → boolean. def post_replicate(request): """MNReplication.replicate(session, sysmeta, sourceNode) → boolean.""" d1_gmn.app.views.assert_db.post_has_mime_parts( request, (('field', 'sourceNode'), ('file', 'sysmeta')) ) sysmeta_pyxb = d1_gmn.ap...
Register this field with a specific process. :param process: Process descriptor instance :param fields: Fields registry to use :param name: Field name def contribute_to_class(self, process, fields, name): """Register this field with a specific process. :param process: Process ...
Return field schema for this field. def to_schema(self): """Return field schema for this field.""" if not self.name or not self.process: raise ValueError("field is not registered with process") schema = { 'name': self.name, 'type': self.get_field_type(), ...
Validate field value. def validate(self, value): """Validate field value.""" if self.required and value is None: raise ValidationError("field is required") if value is not None and self.choices is not None: choices = [choice for choice, _ in self.choices] if...
Run validators and return the clean value. def clean(self, value): """Run validators and return the clean value.""" if value is None: value = self.default try: value = self.to_python(value) self.validate(value) except ValidationError as error: ...
Validate field value. def validate(self, value): """Validate field value.""" if value is not None and not isinstance(value, str): raise ValidationError("field must be a string") super().validate(value)
Validate field value. def validate(self, value): """Validate field value.""" if value is not None and not isinstance(value, bool): raise ValidationError("field must be a boolean") super().validate(value)
Convert value to process output format. def to_output(self, value): """Convert value to process output format.""" return json.loads(resolwe_runtime_utils.save(self.name, str(value)))
Convert value if needed. def to_python(self, value): """Convert value if needed.""" if isinstance(value, str): return value elif isinstance(value, dict): try: value = value['url'] except KeyError: raise ValidationError("diction...
Import field source file to working directory. :param imported_format: Import file format (extracted, compressed or both) :param progress_from: Initial progress value :param progress_to: Final progress value :return: Destination file path (if extracted and compressed, extracted path giv...
Convert value if needed. def to_python(self, value): """Convert value if needed.""" if isinstance(value, FileDescriptor): return value elif isinstance(value, str): return FileDescriptor(value) elif isinstance(value, dict): try: path = ...
Convert value to process output format. def to_output(self, value): """Convert value to process output format.""" return json.loads(resolwe_runtime_utils.save_file(self.name, value.path, *value.refs))
Convert value if needed. def to_python(self, value): """Convert value if needed.""" if isinstance(value, DirDescriptor): return value elif isinstance(value, str): return DirDescriptor(value) elif isinstance(value, dict): try: path = va...
Register this field with a specific process. :param process: Process descriptor instance :param fields: Fields registry to use :param name: Field name def contribute_to_class(self, process, fields, name): """Register this field with a specific process. :param process: Process ...
Convert value to process output format. def to_output(self, value): """Convert value to process output format.""" return {self.name: [self.inner.to_output(v)[self.name] for v in value]}
Validate field value. def validate(self, value): """Validate field value.""" if value is not None: if not isinstance(value, list): raise ValidationError("field must be a list") for index, element in enumerate(value): try: self...
Return given key from cache. def _get(self, key): """Return given key from cache.""" self._populate_cache() if key not in self._cache: raise AttributeError("DataField has no member {}".format(key)) return self._cache[key]
Convert value if needed. def to_python(self, value): """Convert value if needed.""" cache = None if value is None: return None if isinstance(value, DataDescriptor): return value elif isinstance(value, dict): # Allow pre-hydrated data objects....
Register this field with a specific process. :param process: Process descriptor instance :param fields: Fields registry to use :param name: Field name def contribute_to_class(self, process, fields, name): """Register this field with a specific process. :param process: Process ...
Convert value if needed. def to_python(self, value): """Convert value if needed.""" if isinstance(value, GroupDescriptor): value = value._value # pylint: disable=protected-access result = {} for name, field in self.fields.items(): result[name] = field.to_python...
Return field schema for this field. def to_schema(self): """Return field schema for this field.""" schema = super().to_schema() if self.disabled is not None: schema['disabled'] = self.disabled if self.collapsed is not None: schema['collapsed'] = self.collapsed ...
Recreate channel name constants with changed settings. This kludge is mostly needed due to the way Django settings are patched for testing and how modules need to be imported throughout the project. On import time, settings are not patched yet, but some of the code needs static values immediately. Upda...
Destroy Redis channels managed by this state instance. def destroy_channels(self): """Destroy Redis channels managed by this state instance.""" for item_name in dir(self): item = getattr(self, item_name) if isinstance(item, self.RedisAtomicBase): self.redis.delet...
Render the SubjectInfo to an image file. Args: image_out_path : str Path to where image image will be written. Valid extensions are ``.svg,`` ``.pdf``, and ``.png``. width_pixels : int Width of image to write. height_pixels :...
Browse and edit the SubjectInfo in a simple Qt5 based UI. def browse_in_qt5_ui(self): """Browse and edit the SubjectInfo in a simple Qt5 based UI.""" self._render_type = "browse" self._tree.show(tree_style=self._get_tree_style())
Copy SubjectInfoTree to a ETE Tree. def _gen_etetoolkit_tree(self, node, subject_info_tree): """Copy SubjectInfoTree to a ETE Tree.""" for si_node in subject_info_tree.child_list: if si_node.type_str == TYPE_NODE_TAG: child = self._add_type_node(node, si_node.label_str) ...
Add a node representing a SubjectInfo type. def _add_type_node(self, node, label): """Add a node representing a SubjectInfo type.""" child = node.add_child(name=label) child.add_feature(TYPE_NODE_TAG, True) return child
Add a node containing a subject string. def _add_subject_node(self, node, subj_str): """Add a node containing a subject string.""" child = node.add_child(name=subj_str) child.add_feature(SUBJECT_NODE_TAG, True) return child
Return the path from the root to ``node`` as a list of node names. def _get_node_path(self, node): """Return the path from the root to ``node`` as a list of node names.""" path = [] while node.up: path.append(node.name) node = node.up return list(reversed(path))
ETE calls this function to style each node before rendering. - ETE terms: - A Style is a specification for how to render the node itself - A Face defines extra information that is rendered outside of the node - Face objects are used here to provide more control on how to draw the nodes....
Prevent processes requiring access to secrets from being run. def extend_settings(self, data_id, files, secrets): """Prevent processes requiring access to secrets from being run.""" process = Data.objects.get(pk=data_id).process if process.requirements.get('resources', {}).get('secrets', False)...
Get a process finder. def get_finder(import_path): """Get a process finder.""" finder_class = import_string(import_path) if not issubclass(finder_class, BaseProcessesFinder): raise ImproperlyConfigured( 'Finder "{}" is not a subclass of "{}"'.format(finder_class, BaseProcessesFinder)) ...
Return a list of sub-directories. def _find_folders(self, folder_name): """Return a list of sub-directories.""" found_folders = [] for app_config in apps.get_app_configs(): folder_path = os.path.join(app_config.path, folder_name) if os.path.isdir(folder_path): ...
Check that sysmeta_pyxb is suitable for creating a new object and matches the uploaded sciobj bytes. def sanity(request, sysmeta_pyxb): """Check that sysmeta_pyxb is suitable for creating a new object and matches the uploaded sciobj bytes.""" _does_not_contain_replica_sections(sysmeta_pyxb) _is_not...
Assert that any SID in ``sysmeta_pyxb`` can be assigned to a new standalone object. def is_valid_sid_for_new_standalone(sysmeta_pyxb): """Assert that any SID in ``sysmeta_pyxb`` can be assigned to a new standalone object.""" sid = d1_common.xml.get_opt_val(sysmeta_pyxb, 'seriesId') if not d1_gmn.ap...
Assert that ``sid`` can be assigned to the single object ``pid`` or to the chain to which ``pid`` belongs. - If the chain does not have a SID, the new SID must be previously unused. - If the chain already has a SID, the new SID must match the existing SID. def is_valid_sid_for_chain(pid, sid): """Asse...
Assert that ``sysmeta_pyxb`` does not contain any replica information. def _does_not_contain_replica_sections(sysmeta_pyxb): """Assert that ``sysmeta_pyxb`` does not contain any replica information.""" if len(getattr(sysmeta_pyxb, 'replica', [])): raise d1_common.types.exceptions.InvalidSystemMetadata(...
Assert that ``sysmeta_pyxb`` does not have have the archived flag set. def _is_not_archived(sysmeta_pyxb): """Assert that ``sysmeta_pyxb`` does not have have the archived flag set.""" if _is_archived(sysmeta_pyxb): raise d1_common.types.exceptions.InvalidSystemMetadata( 0, 'Arch...
Given the BaseURL for a CN, return the DataONE environment dict for the CN's environemnt. def get_d1_env_by_base_url(cn_base_url): """Given the BaseURL for a CN, return the DataONE environment dict for the CN's environemnt.""" for k, v in D1_ENV_DICT: if v['base_url'].startswith(cn_base_url): ...
Match the SMEFT Warsaw basis onto the WET JMS basis. def match_all(d_SMEFT, parameters=None): """Match the SMEFT Warsaw basis onto the WET JMS basis.""" p = default_parameters.copy() if parameters is not None: # if parameters are passed in, overwrite the default values p.update(parameters) ...
Extra functionality available in debug mode. - If pretty printed output was requested, force the content type to text. This causes the browser to not try to format the output in any way. - If SQL profiling is turned on, return a page with SQL query timing information instead of the ...
CNRead.query(session, queryEngine, query) → OctetStream https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNRead.query MNQuery.query(session, queryEngine, query) → OctetStream http://jenkins. -1.dataone.org/jenkins/job/API%20Documentation%20-%20trunk/ws/api...
See Also: queryResponse() Args: queryEngine: query_str: vendorSpecific: do_post: **kwargs: Returns: def query( self, queryEngine, query_str, vendorSpecific=None, do_post=False, **kwargs ): """See Also: queryResponse() Args...
CNRead.getQueryEngineDescription(session, queryEngine) → QueryEngineDescription https://releases.dataone.org/online/api- documentation-v2.0.1/apis/CN_APIs.html#CNRead.getQueryEngineDescription MNQuery.getQueryEngineDescription(session, queryEngine) → QueryEngineDescription http://jenkins...
See Also: getQueryEngineDescriptionResponse() Args: queryEngine: **kwargs: Returns: def getQueryEngineDescription(self, queryEngine, **kwargs): """See Also: getQueryEngineDescriptionResponse() Args: queryEngine: **kwargs: Returns: ...
Derive cache key for given object. def _get_cache_key(self, obj): """Derive cache key for given object.""" if obj is not None: # Make sure that key is REALLY unique. return '{}-{}'.format(id(self), obj.pk) return "{}-None".format(id(self))
Set cached value. def set(self, obj, build_kwargs): """Set cached value.""" if build_kwargs is None: build_kwargs = {} cached = {} if 'queryset' in build_kwargs: cached = { 'model': build_kwargs['queryset'].model, 'pks': list(buil...
Get cached value and clean cache. def take(self, obj): """Get cached value and clean cache.""" cached = self._thread_local.cache[self._get_cache_key(obj)] build_kwargs = {} if 'model' in cached and 'pks' in cached: build_kwargs['queryset'] = cached['model'].objects.filter(p...
Connect a specific signal type to this receiver. def connect(self, signal, **kwargs): """Connect a specific signal type to this receiver.""" signal.connect(self, **kwargs) self.connections.append((signal, kwargs))
Disconnect all connected signal types from this receiver. def disconnect(self): """Disconnect all connected signal types from this receiver.""" for signal, kwargs in self.connections: signal.disconnect(self, **kwargs)