exporters.filters package

Submodules

exporters.filters.base_filter module

class exporters.filters.base_filter.BaseFilter(options, metadata)[source]

Bases: exporters.pipeline.base_pipeline_item.BasePipelineItem

This module receives a batch, filter it according to some parameters, and returns it.

filter(item)[source]

It receives an item and returns True if the filter must be included, or False if not

filter_batch(batch)[source]

Receives the batch, filters it, and returns it.

get_all_metadata(module='filter')[source]
get_metadata(key, module='filter')[source]
log_at_every = 1000
set_metadata(key, value, module='filter')[source]
supported_options = {}
update_metadata(data, module='filter')[source]

exporters.filters.key_value_filter module

exporters.filters.key_value_regex_filter module

exporters.filters.no_filter module

class exporters.filters.no_filter.NoFilter(*args, **kwargs)[source]

Bases: exporters.filters.base_filter.BaseFilter

It leaves the batch as is. This is provided for the cases where no filters are needed on the original items.

filter_batch(batch)[source]
supported_options = {}

exporters.filters.pythonexp_filter module

class exporters.filters.pythonexp_filter.PythonexpFilter(*args, **kwargs)[source]

Bases: exporters.filters.base_filter.BaseFilter

Filter items depending on python expression. This is NOT sure, so make sure you only use it in contained environments

  • python_expression (str)
    Python expression to filter by
  • imports(dict)
    An object with neede imports for expressions
filter(item)[source]
supported_options = {'imports': {'default': {}, 'type': <type 'dict'>}, 'python_expression': {'type': (<type 'basestring'>,)}}
exporters.filters.pythonexp_filter.load_imports(imports)[source]

Module contents

class exporters.filters.KeyValueFilter(*args, **kwargs)[source]

Bases: exporters.filters.key_value_filters.KeyValueBaseFilter

Filter items depending on keys and values

  • keys (list)
    It is a list of dicts with the following structure: {“key”: “value”}. The filter will delete those items that do not contain a key “key” or, if they do, that key is not the same as “value”.
supported_options = {'keys': {'type': <class 'exporters.utils.list[dict]'>}, 'nested_field_separator': {'default': '.', 'type': (<type 'basestring'>,)}}
class exporters.filters.KeyValueRegexFilter(*args, **kwargs)[source]

Bases: exporters.filters.key_value_filters.KeyValueBaseFilter

Filter items depending on keys and values using regular expressions

  • keys (list)
    It is a list of dicts with the following structure: {“key”: “regex”}. The filter will delete those items that do not contain a key “key” or, if they do, that key value does not match “regex”.
supported_options = {'keys': {'type': <class 'exporters.utils.list[dict]'>}, 'nested_field_separator': {'default': '.', 'type': (<type 'basestring'>,)}}
class exporters.filters.NoFilter(*args, **kwargs)[source]

Bases: exporters.filters.base_filter.BaseFilter

It leaves the batch as is. This is provided for the cases where no filters are needed on the original items.

filter_batch(batch)[source]
supported_options = {}
class exporters.filters.PythonexpFilter(*args, **kwargs)[source]

Bases: exporters.filters.base_filter.BaseFilter

Filter items depending on python expression. This is NOT sure, so make sure you only use it in contained environments

  • python_expression (str)
    Python expression to filter by
  • imports(dict)
    An object with neede imports for expressions
filter(item)[source]
supported_options = {'imports': {'default': {}, 'type': <type 'dict'>}, 'python_expression': {'type': (<type 'basestring'>,)}}