Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagster/dagster/seven/__init__.py
Show All 18 Lines | |||||
TemporaryDirectory = tempfile.TemporaryDirectory | TemporaryDirectory = tempfile.TemporaryDirectory | ||||
try: | try: | ||||
# pylint:disable=redefined-builtin,self-assigning-variable | # pylint:disable=redefined-builtin,self-assigning-variable | ||||
FileNotFoundError = FileNotFoundError | FileNotFoundError = FileNotFoundError | ||||
except NameError: | except NameError: | ||||
FileNotFoundError = IOError | FileNotFoundError = IOError | ||||
try: | try: | ||||
# pylint:disable=redefined-builtin,self-assigning-variable | # pylint:disable=redefined-builtin,self-assigning-variable | ||||
ModuleNotFoundError = ModuleNotFoundError | ModuleNotFoundError = ModuleNotFoundError | ||||
except NameError: | except NameError: | ||||
ModuleNotFoundError = ImportError | ModuleNotFoundError = ImportError | ||||
try: | try: | ||||
import _thread as thread | import _thread as thread | ||||
except ImportError: | except ImportError: | ||||
import thread | import thread | ||||
if sys.version_info > (3,): | |||||
from pathlib import Path # pylint: disable=import-error | |||||
else: | |||||
from pathlib2 import Path # pylint: disable=import-error | |||||
IS_WINDOWS = os.name == 'nt' | IS_WINDOWS = os.name == 'nt' | ||||
# TODO implement a generic import by name -- see https://stackoverflow.com/questions/301134/how-to-import-a-module-given-its-name | # TODO implement a generic import by name -- see https://stackoverflow.com/questions/301134/how-to-import-a-module-given-its-name | ||||
# https://stackoverflow.com/a/67692/324449 | # https://stackoverflow.com/a/67692/324449 | ||||
def import_module_from_path(module_name, path_to_file): | def import_module_from_path(module_name, path_to_file): | ||||
version = sys.version_info | version = sys.version_info | ||||
if version.major >= 3 and version.minor >= 5: | if version.major >= 3 and version.minor >= 5: | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |