dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.73k stars 959 forks source link

Increase the usage of augmented assignment statements #494

Open elfring opened 2 years ago

elfring commented 2 years ago

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/schedule/__init__.py b/schedule/__init__.py
index 83a9581..666c044 100644
--- a/schedule/__init__.py
+++ b/schedule/__init__.py
@@ -726,7 +726,7 @@ class Job(object):
                     and self.at_time > now.time()
                     and self.interval == 1
                 ):
-                    self.next_run = self.next_run - datetime.timedelta(days=1)
+                    self.next_run -= datetime.timedelta(days=1)
                 elif self.unit == "hours" and (
                     self.at_time.minute > now.minute
                     or (
@@ -734,9 +734,9 @@ class Job(object):
                         and self.at_time.second > now.second
                     )
                 ):
-                    self.next_run = self.next_run - datetime.timedelta(hours=1)
+                    self.next_run -= datetime.timedelta(hours=1)
                 elif self.unit == "minutes" and self.at_time.second > now.second:
-                    self.next_run = self.next_run - datetime.timedelta(minutes=1)
+                    self.next_run -= datetime.timedelta(minutes=1)
         if self.start_day is not None and self.at_time is not None:
             # Let's see if we will still make that time we specified today
             if (self.next_run - datetime.datetime.now()).days >= 7: