holidays 0.77__py3-none-any.whl → 0.79__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- holidays/calendars/__init__.py +1 -0
- holidays/calendars/chinese.py +14 -4
- holidays/calendars/ethiopian.py +31 -0
- holidays/calendars/islamic.py +48 -5
- holidays/calendars/julian.py +14 -0
- holidays/calendars/mandaean.py +59 -0
- holidays/calendars/tibetan.py +1466 -0
- holidays/constants.py +2 -0
- holidays/countries/__init__.py +14 -0
- holidays/countries/afghanistan.py +6 -39
- holidays/countries/albania.py +3 -22
- holidays/countries/argentina.py +3 -18
- holidays/countries/azerbaijan.py +6 -39
- holidays/countries/bahrain.py +29 -38
- holidays/countries/bhutan.py +194 -0
- holidays/countries/bosnia_and_herzegovina.py +2 -27
- holidays/countries/brunei.py +7 -117
- holidays/countries/burkina_faso.py +4 -15
- holidays/countries/cameroon.py +3 -34
- holidays/countries/canada.py +2 -1
- holidays/countries/central_african_republic.py +3 -16
- holidays/countries/chad.py +4 -17
- holidays/countries/chile.py +20 -4
- holidays/countries/christmas_island.py +4 -15
- holidays/countries/cocos_islands.py +5 -24
- holidays/countries/egypt.py +175 -51
- holidays/countries/ethiopia.py +18 -47
- holidays/countries/fiji.py +1 -2
- holidays/countries/gabon.py +3 -23
- holidays/countries/gambia.py +168 -0
- holidays/countries/germany.py +41 -0
- holidays/countries/guinea.py +5 -27
- holidays/countries/guinea_bissau.py +100 -0
- holidays/countries/guyana.py +2 -17
- holidays/countries/india.py +12 -25
- holidays/countries/indonesia.py +11 -160
- holidays/countries/iran.py +16 -126
- holidays/countries/iraq.py +276 -0
- holidays/countries/kazakhstan.py +2 -18
- holidays/countries/kenya.py +2 -8
- holidays/countries/kiribati.py +124 -0
- holidays/countries/lebanon.py +5 -87
- holidays/countries/liberia.py +80 -0
- holidays/countries/libya.py +5 -37
- holidays/countries/luxembourg.py +13 -0
- holidays/countries/malaysia.py +9 -130
- holidays/countries/mali.py +4 -9
- holidays/countries/mauritius.py +1 -2
- holidays/countries/montenegro.py +3 -18
- holidays/countries/nepal.py +42 -44
- holidays/countries/niger.py +14 -74
- holidays/countries/north_macedonia.py +3 -39
- holidays/countries/oman.py +6 -28
- holidays/countries/pakistan.py +12 -35
- holidays/countries/palestine.py +2 -5
- holidays/countries/philippines.py +3 -33
- holidays/countries/pitcairn_islands.py +85 -0
- holidays/countries/qatar.py +3 -45
- holidays/countries/saudi_arabia.py +46 -35
- holidays/countries/senegal.py +6 -16
- holidays/countries/sierra_leone.py +4 -20
- holidays/countries/singapore.py +3 -59
- holidays/countries/south_georgia_and_the_south_sandwich_islands.py +160 -0
- holidays/countries/spain.py +3 -10
- holidays/countries/sri_lanka.py +3 -14
- holidays/countries/suriname.py +11 -19
- holidays/countries/syrian_arab_republic.py +134 -0
- holidays/countries/tanzania.py +3 -9
- holidays/countries/timor_leste.py +2 -17
- holidays/countries/togo.py +4 -29
- holidays/countries/trinidad_and_tobago.py +2 -9
- holidays/countries/turkey.py +2 -116
- holidays/countries/turkmenistan.py +158 -0
- holidays/countries/united_arab_emirates.py +5 -29
- holidays/countries/uzbekistan.py +3 -31
- holidays/countries/yemen.py +8 -52
- holidays/groups/__init__.py +2 -0
- holidays/groups/christian.py +48 -12
- holidays/groups/international.py +17 -1
- holidays/groups/islamic.py +1 -11
- holidays/groups/mandaean.py +107 -0
- holidays/groups/tibetan.py +153 -0
- holidays/holiday_base.py +86 -91
- holidays/locale/ar/LC_MESSAGES/BH.mo +0 -0
- holidays/locale/ar/LC_MESSAGES/IQ.mo +0 -0
- holidays/locale/ar/LC_MESSAGES/SY.mo +0 -0
- holidays/locale/{ar → ar_EG}/LC_MESSAGES/EG.mo +0 -0
- holidays/locale/de/LC_MESSAGES/DE.mo +0 -0
- holidays/locale/de/LC_MESSAGES/LU.mo +0 -0
- holidays/locale/en_GM/LC_MESSAGES/GM.mo +0 -0
- holidays/locale/en_GS/LC_MESSAGES/GS.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/BH.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/CL.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/DE.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/EG.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/GM.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/GS.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/GW.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/IQ.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/LU.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/SY.mo +0 -0
- holidays/locale/en_US/LC_MESSAGES/TM.mo +0 -0
- holidays/locale/fr/LC_MESSAGES/EG.mo +0 -0
- holidays/locale/fr/LC_MESSAGES/LU.mo +0 -0
- holidays/locale/lb/LC_MESSAGES/LU.mo +0 -0
- holidays/locale/pt_GW/LC_MESSAGES/GW.mo +0 -0
- holidays/locale/ru/LC_MESSAGES/TM.mo +0 -0
- holidays/locale/th/LC_MESSAGES/DE.mo +0 -0
- holidays/locale/tk/LC_MESSAGES/TM.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/CL.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/DE.mo +0 -0
- holidays/locale/uk/LC_MESSAGES/LU.mo +0 -0
- holidays/registry.py +14 -0
- holidays/utils.py +18 -18
- holidays/version.py +1 -1
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/METADATA +79 -9
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/RECORD +121 -92
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/licenses/CONTRIBUTORS +3 -0
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/WHEEL +0 -0
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/licenses/LICENSE +0 -0
- {holidays-0.77.dist-info → holidays-0.79.dist-info}/top_level.txt +0 -0
holidays/holiday_base.py
CHANGED
|
@@ -55,57 +55,32 @@ YearArg = Union[int, Iterable[int]]
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
class HolidayBase(dict[date, str]):
|
|
58
|
-
"""
|
|
59
|
-
A `dict`-like object containing the holidays for a specific country (and
|
|
60
|
-
province or state if so initiated); inherits the `dict` class (so behaves
|
|
61
|
-
similarly to a `dict`). Dates without a key in the Holiday object are not
|
|
62
|
-
holidays.
|
|
63
|
-
|
|
64
|
-
The key of the object is the date of the holiday and the value is the name
|
|
65
|
-
of the holiday itself. When passing the date as a key, the date can be
|
|
66
|
-
expressed as one of the following formats:
|
|
67
|
-
|
|
68
|
-
* `datetime.datetime` type;
|
|
69
|
-
* `datetime.date` types;
|
|
70
|
-
* a `float` representing a Unix timestamp;
|
|
71
|
-
* or a string of any format (recognized by `dateutil.parser.parse()`).
|
|
58
|
+
"""Represent a dictionary-like collection of holidays for a specific country or region.
|
|
72
59
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
the moment a key is accessed it will build that entire year's list of
|
|
78
|
-
holidays. To pre-populate holidays, instantiate the class with the years
|
|
79
|
-
argument:
|
|
80
|
-
|
|
81
|
-
us_holidays = holidays.US(years=2020)
|
|
60
|
+
This class inherits from `dict` and maps holiday dates to their names. It supports
|
|
61
|
+
customization by country and, optionally, by province or state (subdivision). A date
|
|
62
|
+
not present as a key is not considered a holiday (or, if `observed` is `False`, not
|
|
63
|
+
considered an observed holiday).
|
|
82
64
|
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
Keys are holiday dates, and values are corresponding holiday names. When accessing or
|
|
66
|
+
assigning holidays by date, the following input formats are accepted:
|
|
85
67
|
|
|
86
|
-
|
|
87
|
-
`
|
|
88
|
-
|
|
89
|
-
|
|
68
|
+
* `datetime.date`
|
|
69
|
+
* `datetime.datetime`
|
|
70
|
+
* `float` or `int` (Unix timestamp)
|
|
71
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
90
72
|
|
|
91
|
-
|
|
92
|
-
following types:
|
|
73
|
+
Keys are always returned as `datetime.date` objects.
|
|
93
74
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
75
|
+
To maximize performance, the holiday list is lazily populated one year at a time.
|
|
76
|
+
On instantiation, the object is empty. Once a date is accessed, the full calendar
|
|
77
|
+
year for that date is generated, unless `expand` is set to `False`. To pre-populate
|
|
78
|
+
holidays, instantiate the class with the `years` argument:
|
|
98
79
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
To maximize speed, the list of public holidays is built on the fly as
|
|
102
|
-
needed, one calendar year at a time. When the object is instantiated
|
|
103
|
-
without a **years** parameter, it is empty, but, unless **expand** is set
|
|
104
|
-
to False, as soon as a key is accessed the class will calculate that entire
|
|
105
|
-
year's list of holidays and set the keys with them.
|
|
80
|
+
us_holidays = holidays.US(years=2020)
|
|
106
81
|
|
|
107
|
-
|
|
108
|
-
|
|
82
|
+
It is recommended to use the
|
|
83
|
+
[country_holidays()][holidays.utils.country_holidays] function for instantiation.
|
|
109
84
|
|
|
110
85
|
Example usage:
|
|
111
86
|
|
|
@@ -163,14 +138,13 @@ class HolidayBase(dict[date, str]):
|
|
|
163
138
|
>>> assert '2018-01-06' not in us_holidays
|
|
164
139
|
>>> assert '2018-01-06' in us_pr_holidays
|
|
165
140
|
|
|
166
|
-
Append custom holiday dates by passing one of:
|
|
141
|
+
Append custom holiday dates by passing one of the following:
|
|
167
142
|
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
used as a description:
|
|
143
|
+
* A dict mapping date values to holiday names (e.g. `{'2010-07-10': 'My birthday!'}`).
|
|
144
|
+
* A list of date values (`datetime.date`, `datetime.datetime`, `str`, `int`, or `float`);
|
|
145
|
+
each will be added with 'Holiday' as the default name.
|
|
146
|
+
* A single date value of any of the supported types above; 'Holiday' will be used as
|
|
147
|
+
the default name.
|
|
174
148
|
|
|
175
149
|
```python
|
|
176
150
|
>>> custom_holidays = country_holidays('US', years=2015)
|
|
@@ -325,7 +299,7 @@ class HolidayBase(dict[date, str]):
|
|
|
325
299
|
Requested holiday categories.
|
|
326
300
|
|
|
327
301
|
Returns:
|
|
328
|
-
A `HolidayBase` object matching the
|
|
302
|
+
A `HolidayBase` object matching the `country` or `market`.
|
|
329
303
|
"""
|
|
330
304
|
super().__init__()
|
|
331
305
|
|
|
@@ -436,10 +410,10 @@ class HolidayBase(dict[date, str]):
|
|
|
436
410
|
|
|
437
411
|
The method supports the following input types:
|
|
438
412
|
|
|
439
|
-
* `datetime.date
|
|
440
|
-
* `datetime.datetime
|
|
441
|
-
*
|
|
442
|
-
*
|
|
413
|
+
* `datetime.date`
|
|
414
|
+
* `datetime.datetime`
|
|
415
|
+
* `float` or `int` (Unix timestamp)
|
|
416
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
443
417
|
|
|
444
418
|
Args:
|
|
445
419
|
key:
|
|
@@ -617,10 +591,11 @@ class HolidayBase(dict[date, str]):
|
|
|
617
591
|
"""Convert various date-like formats to `datetime.date`.
|
|
618
592
|
|
|
619
593
|
The method supports the following input types:
|
|
620
|
-
|
|
621
|
-
* `datetime.
|
|
622
|
-
*
|
|
623
|
-
*
|
|
594
|
+
|
|
595
|
+
* `datetime.date`
|
|
596
|
+
* `datetime.datetime`
|
|
597
|
+
* `float` or `int` (Unix timestamp)
|
|
598
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
624
599
|
|
|
625
600
|
Args:
|
|
626
601
|
key:
|
|
@@ -816,9 +791,7 @@ class HolidayBase(dict[date, str]):
|
|
|
816
791
|
self.tr = gettext
|
|
817
792
|
|
|
818
793
|
def _is_leap_year(self) -> bool:
|
|
819
|
-
"""
|
|
820
|
-
Returns True if the year is leap. Returns False otherwise.
|
|
821
|
-
"""
|
|
794
|
+
"""Returns True if the year is leap. Returns False otherwise."""
|
|
822
795
|
return isleap(self._year)
|
|
823
796
|
|
|
824
797
|
def _add_holiday(self, name: str, *args) -> Optional[date]:
|
|
@@ -899,12 +872,13 @@ class HolidayBase(dict[date, str]):
|
|
|
899
872
|
return dt.weekday() in self.weekend
|
|
900
873
|
|
|
901
874
|
def _populate(self, year: int) -> None:
|
|
902
|
-
"""This is a private
|
|
875
|
+
"""This is a private method that populates (generates and adds) holidays
|
|
903
876
|
for a given year. To keep things fast, it assumes that no holidays for
|
|
904
877
|
the year have already been populated. It is required to be called
|
|
905
|
-
internally by any country populate() method, while should not be called
|
|
878
|
+
internally by any country `populate()` method, while should not be called
|
|
906
879
|
directly from outside.
|
|
907
|
-
To add holidays to an object, use the update()
|
|
880
|
+
To add holidays to an object, use the [update()][holidays.holiday_base.HolidayBase.update]
|
|
881
|
+
method.
|
|
908
882
|
|
|
909
883
|
Args:
|
|
910
884
|
year: The year to populate with holidays.
|
|
@@ -980,10 +954,10 @@ class HolidayBase(dict[date, str]):
|
|
|
980
954
|
key:
|
|
981
955
|
The date expressed in one of the following types:
|
|
982
956
|
|
|
983
|
-
* `datetime.date
|
|
984
|
-
* `datetime.datetime
|
|
985
|
-
*
|
|
986
|
-
*
|
|
957
|
+
* `datetime.date`
|
|
958
|
+
* `datetime.datetime`
|
|
959
|
+
* `float` or `int` (Unix timestamp)
|
|
960
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
987
961
|
|
|
988
962
|
default:
|
|
989
963
|
The default value to return if no value is found.
|
|
@@ -1001,10 +975,10 @@ class HolidayBase(dict[date, str]):
|
|
|
1001
975
|
key:
|
|
1002
976
|
The date expressed in one of the following types:
|
|
1003
977
|
|
|
1004
|
-
* `datetime.date
|
|
1005
|
-
* `datetime.datetime
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
978
|
+
* `datetime.date`
|
|
979
|
+
* `datetime.datetime`
|
|
980
|
+
* `float` or `int` (Unix timestamp)
|
|
981
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
1008
982
|
|
|
1009
983
|
Returns:
|
|
1010
984
|
A list of holiday names if the date is a holiday, otherwise an empty list.
|
|
@@ -1116,6 +1090,7 @@ class HolidayBase(dict[date, str]):
|
|
|
1116
1090
|
"""Find the n-th working day from a given date.
|
|
1117
1091
|
|
|
1118
1092
|
Moves forward if n is positive, or backward if n is negative.
|
|
1093
|
+
If n is 0, returns the given date if it is a working day; otherwise the next working day.
|
|
1119
1094
|
|
|
1120
1095
|
Args:
|
|
1121
1096
|
key:
|
|
@@ -1128,10 +1103,11 @@ class HolidayBase(dict[date, str]):
|
|
|
1128
1103
|
Returns:
|
|
1129
1104
|
The calculated working day after shifting by n working days.
|
|
1130
1105
|
"""
|
|
1131
|
-
direction = +1 if n
|
|
1106
|
+
direction = +1 if n >= 0 else -1
|
|
1132
1107
|
dt = self.__keytransform__(key)
|
|
1133
|
-
for _ in range(abs(n)):
|
|
1134
|
-
|
|
1108
|
+
for _ in range(abs(n) or 1):
|
|
1109
|
+
if n:
|
|
1110
|
+
dt = _timedelta(dt, direction)
|
|
1135
1111
|
while not self.is_working_day(dt):
|
|
1136
1112
|
dt = _timedelta(dt, direction)
|
|
1137
1113
|
return dt
|
|
@@ -1159,6 +1135,20 @@ class HolidayBase(dict[date, str]):
|
|
|
1159
1135
|
days = (dt2 - dt1).days + 1
|
|
1160
1136
|
return sum(self.is_working_day(_timedelta(dt1, n)) for n in range(days))
|
|
1161
1137
|
|
|
1138
|
+
def is_weekend(self, key: DateLike) -> bool:
|
|
1139
|
+
"""Check if the given date's week day is a weekend day.
|
|
1140
|
+
|
|
1141
|
+
Args:
|
|
1142
|
+
key:
|
|
1143
|
+
The date to check.
|
|
1144
|
+
|
|
1145
|
+
Returns:
|
|
1146
|
+
True if the date's week day is a weekend day, False otherwise.
|
|
1147
|
+
"""
|
|
1148
|
+
# To prioritize performance we avoid reusing the internal
|
|
1149
|
+
# `HolidayBase._is_weekend` method and perform the check directly instead.
|
|
1150
|
+
return self.__keytransform__(key).weekday() in self.weekend
|
|
1151
|
+
|
|
1162
1152
|
def is_working_day(self, key: DateLike) -> bool:
|
|
1163
1153
|
"""Check if the given date is considered a working day.
|
|
1164
1154
|
|
|
@@ -1183,10 +1173,10 @@ class HolidayBase(dict[date, str]):
|
|
|
1183
1173
|
key:
|
|
1184
1174
|
The date expressed in one of the following types:
|
|
1185
1175
|
|
|
1186
|
-
* `datetime.date
|
|
1187
|
-
* `datetime.datetime
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1176
|
+
* `datetime.date`
|
|
1177
|
+
* `datetime.datetime`
|
|
1178
|
+
* `float` or `int` (Unix timestamp)
|
|
1179
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
1190
1180
|
|
|
1191
1181
|
default:
|
|
1192
1182
|
The default value to return if no match is found.
|
|
@@ -1290,10 +1280,10 @@ class HolidayBase(dict[date, str]):
|
|
|
1290
1280
|
|
|
1291
1281
|
Dates can be expressed in one or more of the following types:
|
|
1292
1282
|
|
|
1293
|
-
* `datetime.date
|
|
1294
|
-
* `datetime.datetime
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1283
|
+
* `datetime.date`
|
|
1284
|
+
* `datetime.datetime`
|
|
1285
|
+
* `float` or `int` (Unix timestamp)
|
|
1286
|
+
* `str` of any format recognized by `dateutil.parser.parse()`
|
|
1297
1287
|
"""
|
|
1298
1288
|
for arg in args:
|
|
1299
1289
|
if isinstance(arg, dict):
|
|
@@ -1308,12 +1298,17 @@ class HolidayBase(dict[date, str]):
|
|
|
1308
1298
|
|
|
1309
1299
|
class HolidaySum(HolidayBase):
|
|
1310
1300
|
"""
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1301
|
+
Combine multiple holiday collections into a single dictionary-like object.
|
|
1302
|
+
|
|
1303
|
+
This class represents the sum of two or more `HolidayBase` instances.
|
|
1304
|
+
The resulting object behaves like a dictionary mapping dates to holiday
|
|
1305
|
+
names, with the following behaviors:
|
|
1306
|
+
|
|
1307
|
+
* The `holidays` attribute stores the original holiday collections as a list.
|
|
1308
|
+
* The `country` and `subdiv` attributes are combined from all operands and
|
|
1309
|
+
may become lists.
|
|
1310
|
+
* If multiple holidays fall on the same date, their names are merged.
|
|
1311
|
+
* Holidays are generated (expanded) for all years included in the operands.
|
|
1317
1312
|
"""
|
|
1318
1313
|
|
|
1319
1314
|
country: Union[str, list[str]] # type: ignore[assignment]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
holidays/registry.py
CHANGED
|
@@ -44,6 +44,7 @@ COUNTRIES: RegistryDict = {
|
|
|
44
44
|
"belize": ("Belize", "BZ", "BLZ"),
|
|
45
45
|
"benin": ("Benin", "BJ", "BEN"),
|
|
46
46
|
"bermuda": ("Bermuda", "BM", "BMU"),
|
|
47
|
+
"bhutan": ("Bhutan", "BT", "BTN"),
|
|
47
48
|
"bolivia": ("Bolivia", "BO", "BOL"),
|
|
48
49
|
"bonaire_sint_eustatius_and_saba": ("BonaireSintEustatiusAndSaba", "BQ", "BES"),
|
|
49
50
|
"bosnia_and_herzegovina": ("BosniaAndHerzegovina", "BA", "BIH"),
|
|
@@ -96,6 +97,7 @@ COUNTRIES: RegistryDict = {
|
|
|
96
97
|
"french_polynesia": ("FrenchPolynesia", "PF", "PYF", "HolidaysPF"),
|
|
97
98
|
"french_southern_territories": ("FrenchSouthernTerritories", "TF", "ATF", "HolidaysTF"),
|
|
98
99
|
"gabon": ("Gabon", "GA", "GAB"),
|
|
100
|
+
"gambia": ("Gambia", "GM", "GMB"),
|
|
99
101
|
"georgia": ("Georgia", "GE", "GEO"),
|
|
100
102
|
"germany": ("Germany", "DE", "DEU"),
|
|
101
103
|
"ghana": ("Ghana", "GH", "GHA"),
|
|
@@ -108,6 +110,7 @@ COUNTRIES: RegistryDict = {
|
|
|
108
110
|
"guatemala": ("Guatemala", "GT", "GUA"),
|
|
109
111
|
"guernsey": ("Guernsey", "GG", "GGY"),
|
|
110
112
|
"guinea": ("Guinea", "GN", "GIN"),
|
|
113
|
+
"guinea_bissau": ("GuineaBissau", "GW", "GNB"),
|
|
111
114
|
"guyana": ("Guyana", "GY", "GUY"),
|
|
112
115
|
"haiti": ("Haiti", "HT", "HTI"),
|
|
113
116
|
"honduras": ("Honduras", "HN", "HND"),
|
|
@@ -117,6 +120,7 @@ COUNTRIES: RegistryDict = {
|
|
|
117
120
|
"india": ("India", "IN", "IND"),
|
|
118
121
|
"indonesia": ("Indonesia", "ID", "IDN"),
|
|
119
122
|
"iran": ("Iran", "IR", "IRN"),
|
|
123
|
+
"iraq": ("Iraq", "IQ", "IRQ"),
|
|
120
124
|
"ireland": ("Ireland", "IE", "IRL"),
|
|
121
125
|
"isle_of_man": ("IsleOfMan", "IM", "IMN"),
|
|
122
126
|
"israel": ("Israel", "IL", "ISR"),
|
|
@@ -127,12 +131,14 @@ COUNTRIES: RegistryDict = {
|
|
|
127
131
|
"jersey": ("Jersey", "JE", "JEY"),
|
|
128
132
|
"kazakhstan": ("Kazakhstan", "KZ", "KAZ"),
|
|
129
133
|
"kenya": ("Kenya", "KE", "KEN"),
|
|
134
|
+
"kiribati": ("Kiribati", "KI", "KIR"),
|
|
130
135
|
"kuwait": ("Kuwait", "KW", "KWT"),
|
|
131
136
|
"kyrgyzstan": ("Kyrgyzstan", "KG", "KGZ"),
|
|
132
137
|
"laos": ("Laos", "LA", "LAO"),
|
|
133
138
|
"latvia": ("Latvia", "LV", "LVA"),
|
|
134
139
|
"lebanon": ("Lebanon", "LB", "LBN"),
|
|
135
140
|
"lesotho": ("Lesotho", "LS", "LSO"),
|
|
141
|
+
"liberia": ("Liberia", "LR", "LBR"),
|
|
136
142
|
"libya": ("Libya", "LY", "LBY"),
|
|
137
143
|
"liechtenstein": ("Liechtenstein", "LI", "LIE"),
|
|
138
144
|
"lithuania": ("Lithuania", "LT", "LTU"),
|
|
@@ -181,6 +187,7 @@ COUNTRIES: RegistryDict = {
|
|
|
181
187
|
"paraguay": ("Paraguay", "PY", "PRY"),
|
|
182
188
|
"peru": ("Peru", "PE", "PER"),
|
|
183
189
|
"philippines": ("Philippines", "PH", "PHL"),
|
|
190
|
+
"pitcairn_islands": ("PitcairnIslands", "PN", "PCN"),
|
|
184
191
|
"poland": ("Poland", "PL", "POL"),
|
|
185
192
|
"portugal": ("Portugal", "PT", "PRT"),
|
|
186
193
|
"puerto_rico": ("PuertoRico", "PR", "PRI", "HolidaysPR"),
|
|
@@ -208,6 +215,11 @@ COUNTRIES: RegistryDict = {
|
|
|
208
215
|
"slovenia": ("Slovenia", "SI", "SVN"),
|
|
209
216
|
"solomon_islands": ("SolomonIslands", "SB", "SLB"),
|
|
210
217
|
"south_africa": ("SouthAfrica", "ZA", "ZAF"),
|
|
218
|
+
"south_georgia_and_the_south_sandwich_islands": (
|
|
219
|
+
"SouthGeorgiaAndTheSouthSandwichIslands",
|
|
220
|
+
"GS",
|
|
221
|
+
"SGS",
|
|
222
|
+
),
|
|
211
223
|
"south_korea": ("SouthKorea", "KR", "KOR", "Korea"),
|
|
212
224
|
"spain": ("Spain", "ES", "ESP"),
|
|
213
225
|
"sri_lanka": ("SriLanka", "LK", "LKA"),
|
|
@@ -215,6 +227,7 @@ COUNTRIES: RegistryDict = {
|
|
|
215
227
|
"svalbard_and_jan_mayen": ("SvalbardAndJanMayen", "SJ", "SJM", "HolidaysSJ"),
|
|
216
228
|
"sweden": ("Sweden", "SE", "SWE"),
|
|
217
229
|
"switzerland": ("Switzerland", "CH", "CHE"),
|
|
230
|
+
"syrian_arab_republic": ("SyrianArabRepublic", "SY", "SYR"),
|
|
218
231
|
"taiwan": ("Taiwan", "TW", "TWN"),
|
|
219
232
|
"tanzania": ("Tanzania", "TZ", "TZA"),
|
|
220
233
|
"thailand": ("Thailand", "TH", "THA"),
|
|
@@ -225,6 +238,7 @@ COUNTRIES: RegistryDict = {
|
|
|
225
238
|
"trinidad_and_tobago": ("TrinidadAndTobago", "TT", "TTO"),
|
|
226
239
|
"tunisia": ("Tunisia", "TN", "TUN"),
|
|
227
240
|
"turkey": ("Turkey", "TR", "TUR"),
|
|
241
|
+
"turkmenistan": ("Turkmenistan", "TM", "TKM"),
|
|
228
242
|
"turks_and_caicos_islands": ("TurksAndCaicosIslands", "TC", "TCA"),
|
|
229
243
|
"tuvalu": ("Tuvalu", "TV", "TUV"),
|
|
230
244
|
"ukraine": ("Ukraine", "UA", "UKR"),
|
holidays/utils.py
CHANGED
|
@@ -40,9 +40,9 @@ def country_holidays(
|
|
|
40
40
|
language: Optional[str] = None,
|
|
41
41
|
categories: Optional[CategoryArg] = None,
|
|
42
42
|
) -> HolidayBase:
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
holidays
|
|
43
|
+
"""Return a new dictionary-like [HolidayBase][holidays.holiday_base.HolidayBase] object.
|
|
44
|
+
|
|
45
|
+
Include public holidays for the country matching `country` and other keyword arguments.
|
|
46
46
|
|
|
47
47
|
Args:
|
|
48
48
|
country:
|
|
@@ -60,9 +60,9 @@ def country_holidays(
|
|
|
60
60
|
is requested.
|
|
61
61
|
|
|
62
62
|
observed:
|
|
63
|
-
Whether to include the dates of when public
|
|
63
|
+
Whether to include the dates of when public holidays are observed
|
|
64
64
|
(e.g. a holiday falling on a Sunday being observed the following
|
|
65
|
-
Monday). False may not work for all countries.
|
|
65
|
+
Monday). `False` may not work for all countries.
|
|
66
66
|
|
|
67
67
|
prov:
|
|
68
68
|
*deprecated* use `subdiv` instead.
|
|
@@ -106,12 +106,12 @@ def country_holidays(
|
|
|
106
106
|
Requested holiday categories.
|
|
107
107
|
|
|
108
108
|
Returns:
|
|
109
|
-
A `HolidayBase` object matching the
|
|
109
|
+
A `HolidayBase` object matching the `country`.
|
|
110
110
|
|
|
111
111
|
The key of the `dict`-like `HolidayBase` object is the
|
|
112
112
|
`date` of the holiday, and the value is the name of the holiday itself.
|
|
113
113
|
Dates where a key is not present are not public holidays (or, if
|
|
114
|
-
|
|
114
|
+
`observed` is `False`, days when a public holiday is observed).
|
|
115
115
|
|
|
116
116
|
When passing the `date` as a key, the `date` can be expressed in one of the
|
|
117
117
|
following types:
|
|
@@ -125,12 +125,12 @@ def country_holidays(
|
|
|
125
125
|
|
|
126
126
|
To maximize speed, the list of public holidays is built on the fly as
|
|
127
127
|
needed, one calendar year at a time. When the object is instantiated
|
|
128
|
-
without a
|
|
129
|
-
to False
|
|
128
|
+
without a `years` parameter, it is empty, but, unless `expand` is set
|
|
129
|
+
to `False`, as soon as a key is accessed the class will calculate that entire
|
|
130
130
|
year's list of holidays and set the keys with them.
|
|
131
131
|
|
|
132
132
|
If you need to list the holidays as opposed to querying individual dates,
|
|
133
|
-
instantiate the class with the
|
|
133
|
+
instantiate the class with the `years` parameter.
|
|
134
134
|
|
|
135
135
|
Example usage:
|
|
136
136
|
|
|
@@ -236,14 +236,14 @@ def financial_holidays(
|
|
|
236
236
|
observed: bool = True,
|
|
237
237
|
language: Optional[str] = None,
|
|
238
238
|
) -> HolidayBase:
|
|
239
|
-
"""
|
|
240
|
-
|
|
241
|
-
holidays
|
|
239
|
+
"""Return a new dictionary-like [HolidayBase][holidays.holiday_base.HolidayBase] object.
|
|
240
|
+
|
|
241
|
+
Include public holidays for the financial market matching `market` and other keyword
|
|
242
242
|
arguments.
|
|
243
243
|
|
|
244
244
|
Args:
|
|
245
245
|
market:
|
|
246
|
-
An ISO
|
|
246
|
+
An ISO 10383 MIC code.
|
|
247
247
|
|
|
248
248
|
subdiv:
|
|
249
249
|
Currently not implemented for markets (see documentation).
|
|
@@ -256,9 +256,9 @@ def financial_holidays(
|
|
|
256
256
|
is requested.
|
|
257
257
|
|
|
258
258
|
observed:
|
|
259
|
-
Whether to include the dates of when public
|
|
259
|
+
Whether to include the dates of when public holidays are observed
|
|
260
260
|
(e.g. a holiday falling on a Sunday being observed the following
|
|
261
|
-
Monday). False may not work for all
|
|
261
|
+
Monday). `False` may not work for all markets.
|
|
262
262
|
|
|
263
263
|
language:
|
|
264
264
|
Specifies the language in which holiday names are returned.
|
|
@@ -293,7 +293,7 @@ def financial_holidays(
|
|
|
293
293
|
This behavior will be updated and formalized in v1.
|
|
294
294
|
|
|
295
295
|
Returns:
|
|
296
|
-
A `HolidayBase` object matching the
|
|
296
|
+
A `HolidayBase` object matching the `market`.
|
|
297
297
|
|
|
298
298
|
Example usage:
|
|
299
299
|
|
|
@@ -428,7 +428,7 @@ def list_supported_financial(include_aliases: bool = True) -> dict[str, list[str
|
|
|
428
428
|
|
|
429
429
|
Args:
|
|
430
430
|
include_aliases:
|
|
431
|
-
Whether to include entity aliases (e.g.
|
|
431
|
+
Whether to include entity aliases (e.g. NYSE for XNYS, TAR for XECB).
|
|
432
432
|
|
|
433
433
|
Returns:
|
|
434
434
|
A dictionary where key is a market code and value is a list of supported
|
holidays/version.py
CHANGED