annual.registry
Implementation of a registry for date functions and iterators.
Classes
Registry for date functions and iterators. |
Module Contents
- class annual.registry.FunctionRegistry(auto_plugins: bool = True)
Registry for date functions and iterators.
- Parameters:
auto_plugins (bool) – determines whether plugins should be loaded upon initialization (optional, default =
True)
- add_from_plugins(exclude: collections.abc.Sequence[str] = (), only: collections.abc.Sequence[str] = ()) None
Add date functions and iterators from plugins.
- add_from_module(module_name: str) None
Add date functions and iterators from a given module.
- Parameters:
module_name (str) – the name of the module to be scanned for date functions
- add_date_function(date_function: annual.decorators.DateFunction) None
Add the given date function.
- Parameters:
date_function (DateFunction) – the date function to be added
- evaluate(year: int) dict[str, datetime.date | None]
Evaluate all registered functions for the given year.
- Parameters:
year (int) – the year for which the functions are evaluated
- Returns:
a mapping between function names and their results
- Return type:
dict[str, datetime.date | None]