books: Introduce Year type alias.
This is going to be repeated a lot as we write book-loading methods.
This commit is contained in:
parent
51137815d3
commit
adf402442b
1 changed files with 3 additions and 4 deletions
|
@ -23,6 +23,8 @@ from typing import (
|
|||
Union,
|
||||
)
|
||||
|
||||
Year = Union[int, datetime.date]
|
||||
|
||||
class FiscalYear(NamedTuple):
|
||||
month: int = 3
|
||||
day: int = 1
|
||||
|
@ -35,10 +37,7 @@ class FiscalYear(NamedTuple):
|
|||
else:
|
||||
return date.year
|
||||
|
||||
def range(self,
|
||||
from_fy: Union[int, datetime.date],
|
||||
to_fy: Union[int, datetime.date, None]=None,
|
||||
) -> Iterable[int]:
|
||||
def range(self, from_fy: Year, to_fy: Optional[Year]=None) -> Iterable[int]:
|
||||
"""Return a range of fiscal years
|
||||
|
||||
Both arguments can be either a year (represented as an integer) or a
|
||||
|
|
Loading…
Reference in a new issue