summaryrefslogtreecommitdiff
path: root/Lib/zoneinfo/_common.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-12-28 16:05:27 -0500
committerJason R. Coombs <jaraco@jaraco.com>2022-01-21 09:35:38 -0500
commitdd4c2469054efd7d0c6ca49b95a95e1aeba7a6c5 (patch)
tree19f2dd66d47371eff80540590c91b3c4be3472d1 /Lib/zoneinfo/_common.py
parente650eb2a2fd2bb180e4de9213b0720e85a4d91f1 (diff)
downloadcpython-git-bpo-46124/zoneinfo-resources.tar.gz
Prefer resources namespace for context.bpo-46124/zoneinfo-resources
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
Diffstat (limited to 'Lib/zoneinfo/_common.py')
-rw-r--r--Lib/zoneinfo/_common.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/zoneinfo/_common.py b/Lib/zoneinfo/_common.py
index 4c6e0ba5e9..98cdfe37ca 100644
--- a/Lib/zoneinfo/_common.py
+++ b/Lib/zoneinfo/_common.py
@@ -2,14 +2,14 @@ import struct
def load_tzdata(key):
- from importlib.resources import files
+ from importlib import resources
components = key.split("/")
package_name = ".".join(["tzdata.zoneinfo"] + components[:-1])
resource_name = components[-1]
try:
- return files(package_name).joinpath(resource_name).open('rb')
+ return resources.files(package_name).joinpath(resource_name).open("rb")
except (ImportError, FileNotFoundError, UnicodeEncodeError):
# There are three types of exception that can be raised that all amount
# to "we cannot find this key":