Replace pytz with standard library timezone (#16197)

Refactored code to use Python's built-in datetime.timezone and zoneinfo instead of pytz for timezone handling. This modernizes the codebase and removes the dependency on pytz, aligning with current best practices for timezone-aware datetime objects.
This commit is contained in:
Hao Liu
2026-01-09 16:05:08 -05:00
committed by GitHub
parent dbe979b425
commit fee71b8917
5 changed files with 23 additions and 30 deletions

View File

@@ -4,7 +4,6 @@
# Python
import datetime
import logging
import pytz
import re
@@ -43,7 +42,7 @@ def partition_name_dt(part_name):
if not m:
return m
dt_str = f"{m.group(3)}_{m.group(4)}"
dt = datetime.datetime.strptime(dt_str, '%Y%m%d_%H').replace(tzinfo=pytz.UTC)
dt = datetime.datetime.strptime(dt_str, '%Y%m%d_%H').replace(tzinfo=datetime.timezone.utc)
return dt