Skip to content

Commit

Permalink
Remove pytz dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
mareuter committed Mar 11, 2024
1 parent f332639 commit 9d5d58c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ repos:
additional_dependencies:
- "pydantic==2.6.3"
- "fastapi==0.110.0"
- "types-pytz==2024.1.0.20240203"
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ requires-python = ">=3.11"
dependencies = [
"fastapi==0.110.0",
"uvicorn[standard]==0.27.1",
"pylunar==0.7.2"
"pylunar==0.7.2",
"tzdata==2024.1"
]

[project.urls]
Expand Down
7 changes: 3 additions & 4 deletions src/lct_web/models/dateloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
from __future__ import annotations

from math import fabs
import zoneinfo

from fastapi import Query
from pydantic import BaseModel, field_validator
import pytz
from pytz.exceptions import UnknownTimeZoneError

__all__ = ["DateLoc"]

Expand All @@ -37,7 +36,7 @@ class DateLoc(BaseModel):
def check_timezone(cls, tz: str) -> str:
"""Check for timezone name."""
try:
pytz.timezone(tz)
except UnknownTimeZoneError:
zoneinfo.ZoneInfo(tz)
except zoneinfo.ZoneInfoNotFoundError:
raise ValueError(f"Unknown timezone {tz}") from None
return tz

0 comments on commit 9d5d58c

Please sign in to comment.