Lines Matching refs:tzinfo

15 from datetime import tzinfo as dt_tzinfo
161 tzinfo: Optional[TZ_EXPR] = None,
164 if tzinfo is None:
165 tzinfo = dateutil_tz.tzutc()
168 isinstance(tzinfo, dt_tzinfo)
169 and hasattr(tzinfo, "localize")
170 and hasattr(tzinfo, "zone")
171 and tzinfo.zone # type: ignore[attr-defined]
173 tzinfo = parser.TzinfoParser.parse(tzinfo.zone) # type: ignore[attr-defined]
174 elif isinstance(tzinfo, str):
175 tzinfo = parser.TzinfoParser.parse(tzinfo)
180 year, month, day, hour, minute, second, microsecond, tzinfo, fold=fold
186 def now(cls, tzinfo: Optional[dt_tzinfo] = None) -> "Arrow":
199 if tzinfo is None:
200 tzinfo = dateutil_tz.tzlocal()
202 dt = dt_datetime.now(tzinfo)
212 dt.tzinfo,
238 dt.tzinfo,
246 tzinfo: Optional[TZ_EXPR] = None,
256 if tzinfo is None:
257 tzinfo = dateutil_tz.tzlocal()
258 elif isinstance(tzinfo, str):
259 tzinfo = parser.TzinfoParser.parse(tzinfo)
265 dt = dt_datetime.fromtimestamp(timestamp, tzinfo)
275 dt.tzinfo,
306 def fromdatetime(cls, dt: dt_datetime, tzinfo: Optional[TZ_EXPR] = None) -> "Arrow":
323 if tzinfo is None:
324 if dt.tzinfo is None:
325 tzinfo = dateutil_tz.tzutc()
327 tzinfo = dt.tzinfo
337 tzinfo,
342 def fromdate(cls, date: date, tzinfo: Optional[TZ_EXPR] = None) -> "Arrow":
351 if tzinfo is None:
352 tzinfo = dateutil_tz.tzutc()
354 return cls(date.year, date.month, date.day, tzinfo=tzinfo)
358 cls, date_str: str, fmt: str, tzinfo: Optional[TZ_EXPR] = None
376 if tzinfo is None:
377 tzinfo = dt.tzinfo
387 tzinfo,
415 dt.tzinfo,
482 tzinfo = cls._get_tzinfo(start.tzinfo if tz is None else tz)
484 start = cls._get_datetime(start).replace(tzinfo=tzinfo)
486 end = cls._get_datetime(end).replace(tzinfo=tzinfo)
498 current = cls(*values, tzinfo=tzinfo).shift( # type: ignore
581 floor = self.__class__(*values, tzinfo=self.tzinfo) # type: ignore
696 tzinfo = cls._get_tzinfo(start.tzinfo if tz is None else tz)
697 start = cls.fromdatetime(start, tzinfo).span(frame, exact=exact)[0]
698 end = cls.fromdatetime(end, tzinfo)
823 def tzinfo(self) -> dt_tzinfo: member in Arrow
835 return cast(dt_tzinfo, self._datetime.tzinfo)
866 return self._datetime.replace(tzinfo=None)
978 tzinfo = kwargs.get("tzinfo")
980 if tzinfo is not None:
981 tzinfo = self._get_tzinfo(tzinfo)
982 current = current.replace(tzinfo=tzinfo)
1089 dt.tzinfo,
1154 utc = dt_datetime.utcnow().replace(tzinfo=dateutil_tz.tzutc())
1155 dt = utc.astimezone(self._datetime.tzinfo)
1161 if other.tzinfo is None:
1162 dt = other.replace(tzinfo=self._datetime.tzinfo)
1164 dt = other.astimezone(self._datetime.tzinfo)
1723 return self.fromdatetime(self._datetime + other, self._datetime.tzinfo)
1741 return self.fromdatetime(self._datetime - other, self._datetime.tzinfo)