Skip to content

Commit

Permalink
Merge branch 'fix_python_comp_check' into 'master'
Browse files Browse the repository at this point in the history
Found inconsitency with __builtin__ module, when it changes based on module or main

See merge request evernym/utilities/devlab!17
  • Loading branch information
absltkaos committed Aug 2, 2022
2 parents 5c68a73 + 4de2a90 commit 59ebb26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions devlab_bench/helpers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
#Python2/3 compatibility
try:
#Python2
text_input = globals()['__builtins__'].raw_input #pylint: disable=invalid-name
## NOTE __builtins__ is a "dict" when used inside a module, otherwise in "__main__" it is a module.
## See the "implementation detail" at the bottom of: https://docs.python.org/3.8/library/builtins.html
text_input = __builtins__['raw_input'] #pylint: disable=invalid-name
from pipes import quote #pylint: disable=unused-import
try:
from pathlib2 import Path #pylint: disable=unused-import
Expand All @@ -34,7 +36,7 @@ def home(self=None): #pylint: disable=bad-staticmethod-argument,unused-argument
Return the expanded path to the user's home
"""
return os.path.expanduser('~')
except AttributeError:
except KeyError:
#Python3
text_input = input #pylint: disable=invalid-name
quote = shlex.quote #pylint: disable=invalid-name
Expand Down

0 comments on commit 59ebb26

Please sign in to comment.