pymap.filter

pymap.filter.filters: Plugin[FilterCompilerInterface[Any]] = Plugin('pymap.filter')

Registers filter compiler plugins.

class pymap.filter.PluginFilterSet(plugin_name, value_type)[source]

Base class for filter set implementations that use a filter compiler declared in the pymap.filter entry point. The declared entry points must sub-class FilterCompiler.

Parameters:
  • plugin_name (str | None) – The filter plugin name, or None for default.

  • value_type (type[FilterValueT]) – The filter value representation type.

property compiler: FilterCompilerInterface[FilterValueT]

Compiles filter values into an implementation.

class pymap.filter.SingleFilterSet(*args, **kwargs)[source]

Base class for a filter set that does not use named filter implementations, it contains only a single active filter implementation.

property name: str

The permanent name for the active filter.

async put(name, value)[source]

Add or update the named filter value.

Parameters:
  • name (str) – The filter name.

  • value (FilterValueT) – The filter value.

Return type:

None

async delete(name)[source]

Delete the named filter. If the named filter is active, ValueError is raised.

Parameters:

name (str) – The filter name.

Raises:

KeyError

Return type:

None

async rename(before_name, after_name)[source]

Rename the filter, maintaining its active status. An exception is raised if before_name does not exist or after_name already exists.

Parameters:
  • before_name (str) – The current filter name.

  • after_name (str) – The intended filter name.

Raises:

KeyError

Return type:

None

async clear_active()[source]

Disable any active filters.

Return type:

None

async set_active(name)[source]

Set the named filter to be active.

Parameters:

name (str) – The filter name.

Raises:

KeyError

Return type:

None

async get(name)[source]

Return the named filter value.

Parameters:

name (str) – The filter name.

Raises:

KeyError

Return type:

FilterValueT

async get_all()[source]

Return the active filter name and a list of all filter names.

Return type:

tuple[str | None, Sequence[str]]

async replace_active(value)[source]

Replace the current active filter value with a new value.

Parameters:

value (FilterValueT | None) – The new filter value.

Return type:

None

abstract async get_active()[source]

Return the active filter value, if any.

Return type:

FilterValueT | None