@@ -209,7 +209,8 @@ def load(cls, env, job_uuid):
209209 """
210210 stored = cls .db_records_from_uuids (env , [job_uuid ])
211211 if not stored :
212- raise NoSuchJobError (f"Job { job_uuid } does no longer exist in the storage." )
212+ msg = f"Job { job_uuid } does no longer exist in the storage."
213+ raise NoSuchJobError (msg )
213214 return cls ._load_from_db_record (stored )
214215
215216 @classmethod
@@ -505,7 +506,7 @@ def perform(self):
505506 # traceback and message:
506507 # http://blog.ianbicking.org/2007/09/12/re-raising-exceptions/
507508 new_exc = FailedJobError (
508- "Max. retries (%d ) reached: %s" % ( self . max_retries , value or type_ )
509+ f "Max. retries ({ self . max_retries } ) reached: { value or type_ } "
509510 )
510511 raise new_exc from err
511512 raise
@@ -813,7 +814,7 @@ def set_failed(self, **kw):
813814 setattr (self , k , v )
814815
815816 def __repr__ (self ):
816- return "<Job %s, priority:%d>" % ( self .uuid , self .priority )
817+ return f "<Job { self .uuid } , priority: { self .priority } >"
817818
818819 def _get_retry_seconds (self , seconds = None ):
819820 retry_pattern = self .job_config .retry_pattern
@@ -828,7 +829,7 @@ def _get_retry_seconds(self, seconds=None):
828829 break
829830 elif not seconds :
830831 seconds = RETRY_INTERVAL
831- if isinstance (seconds , ( list | tuple ) ):
832+ if isinstance (seconds , list | tuple ):
832833 seconds = randint (seconds [0 ], seconds [1 ])
833834 return seconds
834835
@@ -856,8 +857,7 @@ def related_action(self):
856857 funcname = record ._default_related_action
857858 if not isinstance (funcname , str ):
858859 raise ValueError (
859- "related_action must be the name of the "
860- "method on queue.job as string"
860+ "related_action must be the name of the method on queue.job as string"
861861 )
862862 action = getattr (record , funcname )
863863 action_kwargs = self .job_config .related_action_kwargs
0 commit comments