datetime-utc-alias
What it does
Section titled “What it does”Reports datetime.timezone.utc, also written timezone.utc after an import, when the target_version has datetime.UTC (3.11 and later).
Why it matters
Section titled “Why it matters”datetime.UTC is the shorter name of the same object, added in Python 3.11. One spelling of UTC in a code base is easier to search for.
To fix, write datetime.UTC.
Example
Section titled “Example”... pass
import datetimex = datetime.timezone.utc
...
...Configuration
Section titled “Configuration”python: lint: rules: datetime-utc-alias: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line datetime-utc-alias in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | UP017 |
full |