bexchange.matching package¶
Submodules¶
bexchange.matching.filters module¶
- class bexchange.matching.filters.always_filter[source]¶
Bases:
node_filter
always filter for returning true
- class bexchange.matching.filters.and_filter(childs)[source]¶
Bases:
node_filter
and filter for combining several different expressions
- class bexchange.matching.filters.attribute_filter(name, op, t, v)[source]¶
Bases:
node_filter
an attribute filter that is used to match a specific attribute against a value.
- classmethod from_value(v, manager)[source]¶
- Used to create an attribute filter from a dictionary containing the information about this attribute filter. Format is:
- {“filter_type”: “attribute_filter”,
“name”: “_bdb/source_name”, “operation”: “in”, “value_type”: “string”, “value”: [“sehem”,”seang”]}
- Parameters:
v – The dictionary
manager – The manager used to instantiate objects
- class bexchange.matching.filters.filter_manager[source]¶
Bases:
object
The filter manager is used to create a filter from a dictionary or json entry
- from_json(s)[source]¶
Creates a object from a json entry if it can be parsed :param value: The json entry. If json entry (dictionary) contains “filter_type” and “value”, an atempt will be made to create the filter” :return: A filter object on success :raise KeyError: If filter_type has not been registered
- from_value(value)[source]¶
Creates a object from a dictionary if it can be parsed :param value: The dictionary. If dictionary contains “filter_type” and “value”, an atempt will be made to create the filter” :return: A filter object on success :raise KeyError: If filter_type has not been registered
- class bexchange.matching.filters.not_filter(child)[source]¶
Bases:
node_filter
not filter for negating an expression
- class bexchange.matching.filters.or_filter(childs)[source]¶
Bases:
node_filter
or filter for combining several different expressions
bexchange.matching.metadata_matcher module¶
- class bexchange.matching.metadata_matcher.metadata_matcher[source]¶
Bases:
object
Used for matching metadata against an expression
- find_plain(name, ttype)[source]¶
Finds any name within the metadata. :param name: The name of the attribute :param ttype: Not used :return: The value
- find_source(name, source)[source]¶
Finds a source identifier within the source. :param name: The source identifier :param source: The data source :return the found value
- find_value(name, ttype)[source]¶
Finds a value within the metadata with specified name :param name: The name that is requested :param ttype: The type we are looking for :return: the value if found
- in_(lhs, rhs)[source]¶
Matches if items in lhs exists in the rhs. :param lhs: Left hand side which is a list of values :param rhs: Right hand side which is matched against :return: True or False
- like(lhs, rhs)[source]¶
Matches against a *-pattern. :param lhs: Left hand side which is a list of value :param rhs: Right hand side which is pattern :return: True or False