Skip to content

Commit

Permalink
Extract _orig property.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 12, 2024
1 parent f9a494e commit add676c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions calendra/holiday.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ def __iter__(self):
tp = self, self.name
return iter(tp)

@property
def _orig(self):
return date(self.year, self.month, self.day)

def replace(self, **kwargs):
orig = date(self.year, self.month, self.day)
return Holiday(orig.replace(**kwargs), **vars(self))
return Holiday(self._orig.replace(**kwargs), **vars(self))

def __add__(self, other):
orig = date(self.year, self.month, self.day)
return Holiday(orig + other, **vars(self))
return Holiday(self._orig + other, **vars(self))

def __sub__(self, other):
orig = date(self.year, self.month, self.day)
return Holiday(orig - other, **vars(self))
return Holiday(self._orig - other, **vars(self))

def nearest_weekday(self, calendar):
"""
Expand Down

0 comments on commit add676c

Please sign in to comment.