From e2c0564351d821e9d0af921605fcfaae1cfb074f Mon Sep 17 00:00:00 2001 From: Terry Tipton Date: Fri, 15 May 2026 16:42:07 -0400 Subject: [PATCH] refactor: remove dead parse_github_timestamp_to_cst and its pytz dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parse_github_timestamp_to_cst converted GitHub ISO timestamps to the America/Chicago timezone. It has no remaining call sites — scoring works entirely in UTC via parse_github_iso_to_utc / parse_optional_github_iso_to_utc. It was the sole consumer of the module-level CHICAGO_TZ constant, which in turn was the sole consumer of 'import pytz'. Removing the function lets the whole chain go: grep -rn confirms 'pytz' now appears nowhere else in gittensor/ or neurons/, so this also drops pytz as a runtime import. Verified via 'grep -rn parse_github_timestamp_to_cst' and 'grep -rn pytz' across gittensor/, neurons/, and tests/. --- gittensor/validator/utils/datetime_utils.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/gittensor/validator/utils/datetime_utils.py b/gittensor/validator/utils/datetime_utils.py index a7254446..181df1ab 100644 --- a/gittensor/validator/utils/datetime_utils.py +++ b/gittensor/validator/utils/datetime_utils.py @@ -2,8 +2,6 @@ from datetime import datetime, timezone from typing import Optional -import pytz - from gittensor.constants import ( SECONDS_PER_HOUR, TIME_DECAY_GRACE_PERIOD_HOURS, @@ -12,8 +10,6 @@ TIME_DECAY_SIGMOID_STEEPNESS_SCALAR, ) -CHICAGO_TZ = pytz.timezone('America/Chicago') - def parse_github_iso_to_utc(timestamp_str: str) -> datetime: """Parse a GitHub-style ISO 8601 string to a timezone-aware UTC datetime. @@ -39,14 +35,6 @@ def parse_optional_github_iso_to_utc(value: Optional[str]) -> Optional[datetime] return parse_github_iso_to_utc(value) if value else None -def parse_github_timestamp_to_cst(timestamp_str: str) -> datetime: - """ - Parse GitHub's ISO format timestamp and convert to Chicago timezone. - GitHub returns timestamps like: 2024-01-15T10:30:00Z - """ - return parse_github_iso_to_utc(timestamp_str).astimezone(CHICAGO_TZ) - - def calculate_time_decay(merged_at: datetime) -> float: """Calculate sigmoid-based time decay multiplier from a merge timestamp.""" now = datetime.now(timezone.utc)