MCPcopy
hub / github.com/celery/celery / to_local

Method to_local

celery/utils/time.py:137–142  ·  view source on GitHub ↗

Converts a datetime to the local timezone.

(self, dt: datetime, local=None, orig=None)

Source from the content-addressed store, hash-verified

135 return self.get_timezone(tzinfo)
136
137 def to_local(self, dt: datetime, local=None, orig=None):
138 """Converts a datetime to the local timezone."""
139
140 if is_naive(dt):
141 dt = make_aware(dt, orig or self.utc)
142 return localize(dt, self.tz_or_local(local))
143
144 def to_system(self, dt: datetime) -> datetime:
145 """Converts a datetime to the system timezone."""

Callers 2

test_to_localMethod · 0.45
test_to_localMethod · 0.45

Calls 4

tz_or_localMethod · 0.95
is_naiveFunction · 0.85
make_awareFunction · 0.85
localizeFunction · 0.85

Tested by 2

test_to_localMethod · 0.36
test_to_localMethod · 0.36