libestg3b package¶
Submodules¶
libestg3b.estg3b module¶
-
class
libestg3b.estg3b.EstG3bBase(country, groups, add_matchers=None, replace_matchers=None)[source]¶ Bases:
object
-
libestg3b.estg3b.EstG3b(country)[source]¶ Get an instance for the given country.
Parameters: country ( str) – ISO short code of the desired country, e.g."DE"Return type: EstG3bBase
-
libestg3b.estg3b.EstG3bs()[source]¶ Get a list containing instances for all implemented countries.
Return type: List[EstG3bBase]
libestg3b.matcher module¶
-
class
libestg3b.matcher.Matcher(slug, description, impl, *, multiply=None, add=None, tests=[])[source]¶ Bases:
objectDefines a bonus rule, e.g. “if someone works between 8pm and 6am, give them 25% more”
-
class
libestg3b.matcher.DayMatcher(slug, month, day, **kwargs)[source]¶ Bases:
libestg3b.matcher.Matchermatch, if the given minute is within the given day. Keyword arguments are passed onto Matcher.
-
class
libestg3b.matcher.DayTimeMatcher(slug, month, day, hour, **kwargs)[source]¶ Bases:
libestg3b.matcher.Matchermatch, if the given minute is within the given day after the given hour. Keyword arguments are passed onto Matcher.
-
class
libestg3b.matcher.MatcherGroup(description, matchers)[source]¶ Bases:
objectA collection of similar
Matcherinstances. When the group is evaluated, only the highest matching machter is returned.Parameters: - description (
str) – a short, human-readable text, explaining why the given matchers are grouped together. - matchers (
Iterable[Matcher]) – the initial set of matchers.
-
append(matcher)[source]¶ Parameters: matcher ( Matcher) – matcher to add; it must not yet exist in the group.Return type: None
-
match(minute, start, holidays)[source]¶ Evaluate this group. The given shift is tested using each of the stored matchers. The matcher with the highest bonus is the returned. If not a single one matches,
Noneis returned.This method is to be used by
libestg3b.EstG3bonly, but you can use it to implement more complex scenarios yourself.Parameters: - minute (
datetime) – minute to evaluate (seelibestgb3.EstG3b) - start (
datetime) – the first minute in this shift (seelibestgb3.EstG3b)
Return type: Optional[Matcher]- minute (
- description (
Module contents¶
-
libestg3b.EstG3b(country)[source]¶ Get an instance for the given country.
Parameters: country ( str) – ISO short code of the desired country, e.g."DE"Return type: EstG3bBase
-
libestg3b.EstG3bs()[source]¶ Get a list containing instances for all implemented countries.
Return type: List[EstG3bBase]