plexpy/lib/pytz_deprecation_shim/_compat_py3.py
dependabot[bot] 54c9214b03
Bump apscheduler from 3.8.0 to 3.9.1 (#1675)
* Bump apscheduler from 3.8.0 to 3.9.1

Bumps [apscheduler](https://github.com/agronholm/apscheduler) from 3.8.0 to 3.9.1.
- [Release notes](https://github.com/agronholm/apscheduler/releases)
- [Changelog](https://github.com/agronholm/apscheduler/blob/3.9.1/docs/versionhistory.rst)
- [Commits](https://github.com/agronholm/apscheduler/compare/3.8.0...3.9.1)

---
updated-dependencies:
- dependency-name: apscheduler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update apscheduler==3.9.1

* Update pytz==2022.1

* Add pytz-deprecation-shim==0.1.0.post0

* Update tzdata==2022.1

* Update tzlocal==4.2

* Update requirements.txt

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
2022-05-16 20:32:37 -07:00

59 lines
1.3 KiB
Python

# Note: This file could use Python 3-only syntax, but at the moment this breaks
# the coverage job on Python 2. Until we make it so that coverage can ignore
# this file only on Python 2, we'll have to stick to 2/3-compatible syntax.
try:
import zoneinfo
except ImportError:
from backports import zoneinfo
import datetime
UTC = datetime.timezone.utc
def get_timezone(key):
try:
return zoneinfo.ZoneInfo(key)
except (ValueError, OSError):
# TODO: Use `from e` when this file can use Python 3 syntax
raise KeyError(key)
def get_timezone_file(f, key=None):
return zoneinfo.ZoneInfo.from_file(f, key=key)
def get_fixed_offset_zone(offset):
return datetime.timezone(datetime.timedelta(minutes=offset))
def is_imaginary(dt):
dt_rt = dt.astimezone(UTC).astimezone(dt.tzinfo)
return not (dt == dt_rt)
def is_ambiguous(dt):
if is_imaginary(dt):
return False
wall_0 = dt
wall_1 = dt.replace(fold=not dt.fold)
# Ambiguous datetimes can only exist if the offset changes, so we don't
# actually have to check whether dst() or tzname() are different.
same_offset = wall_0.utcoffset() == wall_1.utcoffset()
return not same_offset
def enfold(dt, fold=1):
if dt.fold != fold:
return dt.replace(fold=fold)
else:
return dt
def get_fold(dt):
return dt.fold