changeset 8229:c24b02266077

chore(ruff): handle magic number warnings. Suppressed one error as the error message that follows provides enough context.
author John Rouillard <rouilj@ieee.org>
date Thu, 19 Dec 2024 17:56:24 -0500
parents 11ebd3a19c9a
children eb45feb1d01e
files roundup/rest.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/rest.py	Thu Dec 19 17:51:48 2024 -0500
+++ b/roundup/rest.py	Thu Dec 19 17:56:24 2024 -0500
@@ -109,7 +109,8 @@
 
         # decorate it
         self.client.response_code = code
-        if code >= 400:  # any error require error format
+        ERROR_CODE_LOWER_BOUND = 400
+        if code >= ERROR_CODE_LOWER_BOUND:  # any error require error format
             logmethod = getattr(logger, self.db.config.WEB_REST_LOGGING, None)
             if logmethod:
                 logmethod("statuscode: %s" % code)
@@ -751,7 +752,8 @@
                     # Do not show the (possibly HUGE) content prop
                     # unless very verbose, we display the standard
                     # download link instead
-                    if verbose < 3:
+                    MIN_VERBOSE_LEVEL_SHOW_CONTENT = 3
+                    if verbose < MIN_VERBOSE_LEVEL_SHOW_CONTENT:
                         u = self.db.config.TRACKER_WEB
                         p = u + '%s%s/' % (class_name, node.id)
                         result[pn] = {"link": p}
@@ -1254,7 +1256,7 @@
         except ValueError:
             raise UsageError("Value 'lifetime' must be an integer specify lifetime in seconds. Got %s." % input_payload['lifetime'].value)
 
-        if lifetime > 3600 or lifetime < 1:
+        if lifetime > 3600 or lifetime < 1:  # noqa: PLR2004
             raise UsageError("Value 'lifetime' must be between 1 second and 1 hour (3600 seconds). Got %s." % input_payload['lifetime'].value)
 
         try:

Roundup Issue Tracker: http://roundup-tracker.org/