Teifion/human_time — pull request #5 by vasilcovsky (2013-12-24 03:54:40+00:00)
Title: Generic generators

Summary:
1. Introduced decorator generic_filter (see below)
2. Multiple function definition in \_apply\_time reduced by functools.partial
3. Update for \_get\_xs\_in\_month
4. Filter \_end\_of\_month renamed to \_filter\_end\_of\_month
5. added support of expression "end of every month" (see prev. pull request)

Generic filters:

Each function that starts with _filter should a generator, that yield value based on some conditions.

Function like:

>>> def _filter_monday(regexp_result):
... monday =
... def f(gen):
... for v in gen:
... if v == monday:
... yield v
... return f

might be defined in more generalized form:

>>> @generic_filter
... def _filter_monday(regexp_result, item):
... monday =
... return item == monday