| 2296 | # Sentinel value to disallow None |
| 2297 | _Omitted = object() |
| 2298 | def __new__(cls, offset, name=_Omitted): |
| 2299 | if not isinstance(offset, timedelta): |
| 2300 | raise TypeError("offset must be a timedelta") |
| 2301 | if name is cls._Omitted: |
| 2302 | if not offset: |
| 2303 | return cls.utc |
| 2304 | name = None |
| 2305 | elif not isinstance(name, str): |
| 2306 | raise TypeError("name must be a string") |
| 2307 | if not cls._minoffset <= offset <= cls._maxoffset: |
| 2308 | raise ValueError("offset must be a timedelta " |
| 2309 | "strictly between -timedelta(hours=24) and " |
| 2310 | "timedelta(hours=24).") |
| 2311 | return cls._create(offset, name) |
| 2312 | |
| 2313 | @classmethod |
| 2314 | def _create(cls, offset, name=None): |