prefer-self-documenting-constant
Encode a constant's units or HTTP status meaning in its name, type, or value.
Why
A comment-only fact is lost at use sites and can drift independently from the constant it describes.
Fix
Add the unit to the name or type, use a unit-bearing value such as timedelta, or replace status integers with HTTPStatus members.
Examples
# Retry HTTP responses 408 and 429.RETRYABLE_HTTP_STATUS_CODES = {408, 429}from http import HTTPStatus
RETRYABLE_HTTP_STATUS_CODES = { HTTPStatus.REQUEST_TIMEOUT, HTTPStatus.TOO_MANY_REQUESTS,}# Request deadline in seconds.REQUEST_DEADLINE = 10# The upstream gateway closes idle requests first.REQUEST_DEADLINE_SECONDS = 10