11from typing import Sequence , Union , Optional , Iterator
22import datetime as dt
33
4+ # %% --------------------------------------------------------------------------
5+
46try :
57 from ._metadata import (
68 __version__ ,
1517 __copyright__ ,
1618 )
1719except ImportError :
18- __version__ = "Failed to load from _metadata.py"
19- __author__ = __version__
20- __email__ = __version__
21- __license__ = __version__
22- __status__ = __version__
23- __maintainer__ = __version__
24- __credits__ = __version__
25- __url__ = __version__
26- __description__ = __version__
27- __copyright__ = __version__
20+ try :
21+ from _metadata import (
22+ __version__ ,
23+ __author__ ,
24+ __email__ ,
25+ __license__ ,
26+ __status__ ,
27+ __maintainer__ ,
28+ __credits__ ,
29+ __url__ ,
30+ __description__ ,
31+ __copyright__ ,
32+ )
33+ except ImportError :
34+ # _metadata.py failed to load,
35+ # fill in with dummy values (script may be standalone)
36+ __version__ = "Failed to load from _metadata.py"
37+ __author__ = __version__
38+ __email__ = __version__
39+ __license__ = __version__
40+ __status__ = __version__
41+ __maintainer__ = __version__
42+ __credits__ = __version__
43+ __url__ = __version__
44+ __description__ = __version__
45+ __copyright__ = __version__
46+
47+ # %% --------------------------------------------------------------------------
2848
2949FEB28 = (2 , 28 )
3050FEB29 = (2 , 29 )
3858_month_days_29 = (0 , 31 , 29 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 )
3959_month_days_28 = (0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 )
4060
61+ # %% --------------------------------------------------------------------------
62+
4163
4264def _is_leap (year : int ) -> bool :
4365 return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0 )
@@ -57,6 +79,8 @@ def _intervals_to_array(cycles: Sequence[tuple[int, int]]) -> tuple[tuple[int, i
5779 """
5880 return tuple (sorted (set ([(r [0 ], r [1 ]) for r in cycles ])))
5981
82+ # %% --------------------------------------------------------------------------
83+
6084
6185class DateIntervalCycler :
6286 """
@@ -1658,6 +1682,8 @@ def __next__(self) -> tuple[dt.datetime, dt.datetime]:
16581682 # return rng
16591683 raise StopIteration
16601684
1685+ # %% --------------------------------------------------------------------------
1686+
16611687
16621688if __name__ == "__main__" :
16631689 print (f"Version: { __version__ } " )
0 commit comments