comect.sidecar.filters package

class comect.sidecar.filters.Filter

Bases: abc.ABC

Filters decide whether a line should be processed by the current pipeline or not.

Subclass this class and provide an instance in your pipeline, or use a function if that suits your project better.

If you’re subclassing, then you must implement __call__().

abstract __call__(line, path)

Check whether a line should be processed.

Parameters
  • line (Union[str, bytes]) – The line to be checked

  • path (Path) – The path to the file the line is from

Return type

bool

Returns

True if the line should be processed, False otherwise

class comect.sidecar.filters.JSONFilter

Bases: comect.sidecar.filters.base.Filter

A filter that rejects lines that aren’t valid JSON.

If you are also parsing these lines, then it may be more efficient to just use the JSONParser and allow the exception to propagate.

class comect.sidecar.filters.XMLFilter

Bases: comect.sidecar.filters.base.Filter

A filter that rejects lines that aren’t valid, well-formed XML.

If you are also parsing these lines, then it may be more efficient to just use the XMLParser and allow the exception to propagate.