8000 Further de-linting of zoneinfo module (#20499) · python/cpython@364b5ea · GitHub
[go: up one dir, main page]

Skip to content

Commit 364b5ea

Browse files
authored
Further de-linting of zoneinfo module (#20499)
* Remove unused imports in zoneinfo * Remove unused variables in zoneinfo * Remove else after raise
1 parent 895c9c1 commit 364b5ea

File tree

4 files changed

+5
-12
lines changed

4 files changed

+5
-12
lines changed

Lib/test/test_zoneinfo/test_zoneinfo.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
from functools import cached_property
2020

2121
from . import _support as test_support
22-
from ._support import (
23-
OS_ENV_LOCK,
24-
TZPATH_LOCK,
25-
TZPATH_TEST_LOCK,
26-
ZoneInfoTestBase,
27-
)
22+
from ._support import OS_ENV_LOCK, TZPATH_TEST_LOCK, ZoneInfoTestBase
2823

2924
py_zoneinfo, c_zoneinfo = test_support.get_modules()
3025

@@ -365,7 +360,6 @@ def test_folds_and_gaps(self):
365360
self.assertEqual(dt.dst(), offset.dst, dt)
366361

367362
def test_folds_from_utc(self):
368-
tests = []
369363
for key in self.zones():
370364
zi = self.zone_from_key(key)
371365
with self.subTest(key=key):
@@ -927,7 +921,7 @@ def populate_tzstr_header(cls):
927921
# the Version 2+ file. In this case, we have no transitions, just
928922
# the tzstr in the footer, so up to the footer, the files are
929923
# identical and we can just write the same file twice in a row.
930-
for i in range(2):
924+
for _ in range(2):
931925
out += b"TZif" # Magic value
932926
out += b"3" # Version
933927
out += b" " * 15 # Reserved
@@ -952,7 +946,6 @@ def zone_from_tzstr(self, tzstr):
952946
return self.klass.from_file(zonefile, key=tzstr)
953947

954948
def test_tzstr_localized(self):
955-
i = 0
956949
for tzstr, cases in self.test_cases.items():
957950
with self.subTest(tzstr=tzstr):
958951
zi = self.zone_from_tzstr(tzstr)

Lib/zoneinfo/_common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def load_data(fobj):
8080
# not by position in the array but by position in the unsplit
8181
# abbreviation string. I suppose this makes more sense in C, which uses
8282
# null to terminate the strings, but it's inconvenient here...
83-
char_total = 0
8483
abbr_vals = {}
8584
abbr_chars = fobj.read(charcnt)
8685

Lib/zoneinfo/_tzpath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def reset_tzpath(to=None):
1212
f"tzpaths must be a list or tuple, "
1313
+ f"not {type(tzpaths)}: {tzpaths!r}"
1414
)
15-
elif not all(map(os.path.isabs, tzpaths)):
15+
16+
if not all(map(os.path.isabs, tzpaths)):
1617
raise ValueError(_get_invalid_paths_message(tzpaths))
1718
base_tzpath = tzpaths
1819
else:

Lib/zoneinfo/_zoneinfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import functools
55
import re
66
import weakref
7-
from datetime import datetime, timedelta, timezone, tzinfo
7+
from datetime import datetime, timedelta, tzinfo
88

99
from . import _common, _tzpath
1010

0 commit comments

Comments
 (0)
0