simplify if

This commit is contained in:
chrys87 2017-01-27 10:52:53 +01:00 committed by GitHub
parent 60591530ff
commit 9f52036318

View File

@ -4,13 +4,13 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import sys import sys
version = sys.version[:3] # we only need major.minor version. version = sys.version[:3] # we only need major.minor version.
if version == "3.3" or version == "3.4": if version in ["3.3","3.4"]:
from importlib.machinery import SourceFileLoader from importlib.machinery import SourceFileLoader
else: # Python 3.5+, no support for python < 3.3. else: # Python 3.5+, no support for python < 3.3.
import importlib.util import importlib.util
def importModule(moduleName, moduleLocation): def importModule(moduleName, moduleLocation):
if version == "3.3" or version == "3.4": if version in ["3.3","3.4"]:
return SourceFileLoader(moduleName, moduleLocation).load_module() return SourceFileLoader(moduleName, moduleLocation).load_module()
else: else:
spec = importlib.util.spec_from_file_location(moduleName, moduleLocation) spec = importlib.util.spec_from_file_location(moduleName, moduleLocation)