Filter system for files.
Example
>>> # Create a filter:
>>> f = DocumentsFilters(FilesList)
Then, apply a filter with some pattern like in the following examples. The result can be combined with operators & and |, like for any other 'set' in Python, 'an unordered collection of distinct hashable objects'.
Four different filters can be applied: 1. author (str) 2. date (datetime.date or datetime.datetime) 3. filename (str) 4. filetype (str)
Example
>>> # folder name indicates author is "toto"
>>> f.author(exact='toto')
>>> # folder date indicates date is between 2022 and 2024
>>> f.date(gt=(2024,3,12)) & f.date(lt=(2024,5,1))
>>> # It's equivalent to write - the latter is faster:
>>> f.date(gt=(2024,3,12), lt=(2024,5,1), logic_bool="and")
>>> # author is toto and date is after or equal 2024
>>> f.author(exact='toto') & f.date(ge=(2024,1,1)) & f.filetype(exact='pptx')
The classical "and" and "or" logical boolean predicates are accepted; "and" is the default one. It defines whether all the functions must be True ("and") or any of them ("or").