Skip to content

Commit b7dfca2

Browse files
author
Alexander Mancevice
committed
directly import importlib helpers
1 parent f92aace commit b7dfca2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lambda_gateway/event_proxy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import asyncio
2-
import importlib
32
import json
43
import os
54
import sys
5+
from importlib.util import (spec_from_file_location, module_from_spec)
66

77
from lambda_gateway import lambda_context
88

@@ -24,8 +24,8 @@ def get_handler(self):
2424
raise ValueError(f"Bad handler signature '{self.handler}'")
2525
try:
2626
pypath = os.path.join(os.path.curdir, f'{name}.py')
27-
spec = importlib.util.spec_from_file_location(name, pypath)
28-
module = importlib.util.module_from_spec(spec)
27+
spec = spec_from_file_location(name, pypath)
28+
module = module_from_spec(spec)
2929
spec.loader.exec_module(module)
3030
return getattr(module, func)
3131
except FileNotFoundError:

0 commit comments

Comments
 (0)