Skip to content

Commit 6e6b0b7

Browse files
committed
Update code
1 parent 4aeb3a3 commit 6e6b0b7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

holidays/countries/taiwan.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,19 @@ def __init__(self, *args, **kwargs):
9797
super().__init__(*args, **kwargs)
9898

9999
def _get_weekend(self, dt: date) -> set[int]:
100-
if dt.year >= 2001:
101-
return {SAT, SUN}
102-
else:
103-
# 1998–2000: Sundays as well as the 2nd & 4th Saturdays of each Month.
100+
# 1998–2000: Sundays as well as the 2nd & 4th Saturday of each month.
101+
if dt.year <= 2000:
104102
weekend = {SUN}
105103
if dt.weekday() == SAT:
106-
second_sat = _get_nth_weekday_of_month(2, SAT, dt.month, dt.year)
107-
fourth_sat = _get_nth_weekday_of_month(4, SAT, dt.month, dt.year)
108-
if dt in {second_sat, fourth_sat}:
104+
if dt in {
105+
_get_nth_weekday_of_month(2, SAT, dt.month, dt.year), # 2nd Saturday.
106+
_get_nth_weekday_of_month(4, SAT, dt.month, dt.year), # 4th Saturday.
107+
}:
109108
weekend.add(SAT)
110-
return weekend
109+
else:
110+
weekend = {SAT, SUN}
111+
112+
return weekend
111113

112114
def _populate_observed(
113115
self,

0 commit comments

Comments
 (0)