MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / _get_tzinfo_name

Function _get_tzinfo_name

src/pendulum/_helpers.py:323–337  ·  view source on GitHub ↗
(tzinfo: datetime.tzinfo | None)

Source from the content-addressed store, hash-verified

321
322
323def _get_tzinfo_name(tzinfo: datetime.tzinfo | None) -> str | None:
324 if tzinfo is None:
325 return None
326
327 if hasattr(tzinfo, "key"):
328 # zoneinfo timezone
329 return cast("zoneinfo.ZoneInfo", tzinfo).key
330 elif hasattr(tzinfo, "name"):
331 # Pendulum timezone
332 return cast("Timezone", tzinfo).name
333 elif hasattr(tzinfo, "zone"):
334 # pytz timezone
335 return tzinfo.zone # type: ignore[no-any-return]
336
337 return None

Callers 1

precise_diffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…