MCPcopy
hub / github.com/celery/celery / to_local_fallback

Method to_local_fallback

celery/utils/time.py:151–155  ·  view source on GitHub ↗

Converts a datetime to the local timezone, or the system timezone.

(self, dt: datetime)

Source from the content-addressed store, hash-verified

149 return dt.astimezone(tz=None)
150
151 def to_local_fallback(self, dt: datetime) -> datetime:
152 """Converts a datetime to the local timezone, or the system timezone."""
153 if is_naive(dt):
154 return make_aware(dt, self.local)
155 return localize(dt, self.local)
156
157 def get_timezone(self, zone: str | tzinfo) -> tzinfo:
158 """Returns ZoneInfo timezone if the provided zone is a string, otherwise return the zone."""

Callers 2

to_localMethod · 0.80

Calls 3

is_naiveFunction · 0.85
make_awareFunction · 0.85
localizeFunction · 0.85

Tested by 1