Skip to content

Commit 6a7c91c

Browse files
authored
Avoid repeated loop over timezones (#1238)
By removing repeated iteration over timezones, the import time is reduced by 5-10%.
1 parent f114394 commit 6a7c91c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

dateparser/timezone_parser.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ def get_offset(tz_obj, regex, repl="", replw=""):
7272
search_regex_parts.append(tz_obj[0])
7373
yield get_offset(tz_obj, regex)
7474

75-
# alternate patterns
76-
for replace, replacewith in tz_info.get("replace", []):
77-
for tz_obj in tz_info["timezones"]:
75+
# alternate patterns
76+
for replace, replacewith in tz_info.get("replace", []):
7877
search_regex_parts.append(re.sub(replace, replacewith, tz_obj[0]))
7978
yield get_offset(tz_obj, regex, repl=replace, replw=replacewith)
8079

0 commit comments

Comments
 (0)