Skip to content

Commit

Permalink
Format files with black
Browse files Browse the repository at this point in the history
  • Loading branch information
SijmenHuizenga committed Nov 12, 2023
1 parent 302204d commit 36d07b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 10 additions & 3 deletions schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ def tag(self, *tags: Hashable):
return self

def at(self, time_str: str, tz: Optional[str] = None):

"""
Specify a particular time that the job should be run at.
Expand Down Expand Up @@ -797,11 +796,19 @@ def _schedule_next_run(self) -> None:
# Usually when normalization of a timestamp causes the timestamp to change,
# it preserves the moment in time and changes the local timestamp.
# This method applies pytz normalization but preserves the local timestamp, in fact changing the moment in time.
def _normalize_preserve_timestamp(self, input: datetime.datetime) -> datetime.datetime:
def _normalize_preserve_timestamp(
self, input: datetime.datetime
) -> datetime.datetime:
if self.at_time_zone is None or input is None:
return input
normalized = self.at_time_zone.normalize(input)
return normalized.replace(day=input.day, hour=input.hour, minute=input.minute, second=input.second, microsecond=input.microsecond)
return normalized.replace(
day=input.day,
hour=input.hour,
minute=input.minute,
second=input.second,
microsecond=input.microsecond,
)

def _to_at_timezone(self, input: Optional[datetime.datetime]) -> datetime.datetime:
if self.at_time_zone is None or input is None:
Expand Down
4 changes: 0 additions & 4 deletions test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ def tst_next_run_time_hour_end(self, tz, offsetMinutes):
assert job.next_run.hour == 14
assert job.next_run.minute == 10 + offsetMinutes


def test_next_run_time_minute_end(self):
self.tst_next_run_time_minute_end(None)

Expand Down Expand Up @@ -770,9 +769,6 @@ def test_at_timezone(self):
assert next.hour == 1
assert next.minute == 0




with self.assertRaises(pytz.exceptions.UnknownTimeZoneError):
every().day.at("10:30", "FakeZone").do(mock_job)

Expand Down

0 comments on commit 36d07b3

Please sign in to comment.