Keep pkg_resources import function-local (~0.06s)

This commit is contained in:
Stijn Seghers 2020-01-16 17:30:50 +13:00
parent 1fbf76b95a
commit e2af07df44
No known key found for this signature in database
GPG Key ID: BF6A2BFEA196E7B6

View File

@ -20,7 +20,6 @@ import six
from six.moves.urllib.parse import parse_qs, urlparse
import xmltodict
from pkg_resources import resource_filename
from werkzeug.exceptions import HTTPException
import boto3
@ -766,6 +765,9 @@ class AWSServiceSpec(object):
"""
def __init__(self, path):
# Importing pkg_resources takes ~60ms; keep it local
from pkg_resources import resource_filename # noqa
self.path = resource_filename("botocore", path)
with io.open(self.path, "r", encoding="utf-8") as f:
spec = json.load(f)