Skip to content

Commit 994d488

Browse files
committed
chore(ruff): handle magic number warnings.
Suppressed one error as the error message that follows provides enough context.
1 parent 30041d4 commit 994d488

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

roundup/rest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def format_object(self, *args, **kwargs):
109109

110110
# decorate it
111111
self.client.response_code = code
112-
if code >= 400: # any error require error format
112+
ERROR_CODE_LOWER_BOUND = 400
113+
if code >= ERROR_CODE_LOWER_BOUND: # any error require error format
113114
logmethod = getattr(logger, self.db.config.WEB_REST_LOGGING, None)
114115
if logmethod:
115116
logmethod("statuscode: %s" % code)
@@ -751,7 +752,8 @@ def format_item(self, node, item_id, props=None, verbose=1):
751752
# Do not show the (possibly HUGE) content prop
752753
# unless very verbose, we display the standard
753754
# download link instead
754-
if verbose < 3:
755+
MIN_VERBOSE_LEVEL_SHOW_CONTENT = 3
756+
if verbose < MIN_VERBOSE_LEVEL_SHOW_CONTENT:
755757
u = self.db.config.TRACKER_WEB
756758
p = u + '%s%s/' % (class_name, node.id)
757759
result[pn] = {"link": p}
@@ -1254,7 +1256,7 @@ def get_post_once_exactly(self, class_name, input_payload):
12541256
except ValueError:
12551257
raise UsageError("Value 'lifetime' must be an integer specify lifetime in seconds. Got %s." % input_payload['lifetime'].value)
12561258

1257-
if lifetime > 3600 or lifetime < 1:
1259+
if lifetime > 3600 or lifetime < 1: # noqa: PLR2004
12581260
raise UsageError("Value 'lifetime' must be between 1 second and 1 hour (3600 seconds). Got %s." % input_payload['lifetime'].value)
12591261

12601262
try:

0 commit comments

Comments
 (0)