---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP017.py:10:11: UP017 [*] Use `datetime.UTC` alias
   |
 8 |     from datetime import timezone
 9 | 
10 |     print(timezone.utc)
   |           ^^^^^^^^^^^^ UP017
   |
   = help: Convert to `datetime.UTC` alias

ℹ Safe fix
   1  |+from datetime import UTC
1  2  | def func():
2  3  |     import datetime
3  4  | 
--------------------------------------------------------------------------------
7  8  | def func():
8  9  |     from datetime import timezone
9  10 | 
10    |-    print(timezone.utc)
   11 |+    print(UTC)
11 12 | 
12 13 | 
13 14 | def func():

UP017.py:16:11: UP017 [*] Use `datetime.UTC` alias
   |
14 |     from datetime import timezone as tz
15 | 
16 |     print(tz.utc)
   |           ^^^^^^ UP017
   |
   = help: Convert to `datetime.UTC` alias

ℹ Safe fix
   1  |+from datetime import UTC
1  2  | def func():
2  3  |     import datetime
3  4  | 
--------------------------------------------------------------------------------
13 14 | def func():
14 15 |     from datetime import timezone as tz
15 16 | 
16    |-    print(tz.utc)
   17 |+    print(UTC)
17 18 | 
18 19 | 
19 20 | def func():

UP017.py:22:11: UP017 [*] Use `datetime.UTC` alias
   |
20 |     import datetime
21 | 
22 |     print(datetime.timezone.utc)
   |           ^^^^^^^^^^^^^^^^^^^^^ UP017
   |
   = help: Convert to `datetime.UTC` alias

ℹ Safe fix
19 19 | def func():
20 20 |     import datetime
21 21 | 
22    |-    print(datetime.timezone.utc)
   22 |+    print(datetime.UTC)
23 23 | 
24 24 | 
25 25 | def func():

UP017.py:28:11: UP017 [*] Use `datetime.UTC` alias
   |
26 |     import datetime as dt
27 | 
28 |     print(dt.timezone.utc)
   |           ^^^^^^^^^^^^^^^ UP017
   |
   = help: Convert to `datetime.UTC` alias

ℹ Safe fix
25 25 | def func():
26 26 |     import datetime as dt
27 27 | 
28    |-    print(dt.timezone.utc)
   28 |+    print(dt.UTC)
