Skip to content

Commit

Permalink
PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
KJhellico committed Apr 29, 2024
1 parent 332751d commit 8ca5908
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions holidays/holiday_base.py
Expand Up @@ -231,7 +231,7 @@ def _populate(self, year):
ones."""
weekend: Set[int] = {SAT, SUN}
"""Country weekend days."""
workdays: Set[date] = set()
weekend_workdays: Set[date] = set()
"""Working days moved to weekends."""
default_category: str = PUBLIC
"""The entity category used by default."""
Expand Down Expand Up @@ -356,7 +356,7 @@ def __init__(
self.language = language.lower() if language else None
self.observed = observed
self.subdiv = subdiv
self.workdays = set()
self.weekend_workdays = set()

supported_languages = set(self.supported_languages)
self.tr = (
Expand Down Expand Up @@ -765,7 +765,7 @@ def _add_special_holidays(self, mapping_names, observed=False):
to_month,
to_day,
)
self.workdays.add(from_date)
self.weekend_workdays.add(from_date)

def _check_weekday(self, weekday: int, *args) -> bool:
"""
Expand Down Expand Up @@ -984,7 +984,7 @@ def get_workdays_number(self, key1: DateLike, key2: DateLike) -> int:
def is_workday(self, key: DateLike) -> bool:
"""Return True if date is a working day (not a holiday or a weekend)."""
dt = self.__keytransform__(key)
return not (dt in self or (self._is_weekend(dt) and (dt not in self.workdays)))
return dt in self.weekend_workdays if self._is_weekend(dt) else dt not in self

def pop(self, key: DateLike, default: Union[str, Any] = None) -> Union[str, Any]:
"""If date is a holiday, remove it and return its date, else return
Expand Down

0 comments on commit 8ca5908

Please sign in to comment.