Skip to content

Commit

Permalink
avoid help module is not in __builtins__
Browse files Browse the repository at this point in the history
  • Loading branch information
songjhaha committed Jul 31, 2024
1 parent 1ab808a commit 46e2bb7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tyjuliacall/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def _setup_help():
class Helper(object):
def __init__(self):
if isinstance(__builtins__, dict):
self.help = __builtins__["help"]
if "help" in __builtins__:
self.help = __builtins__["help"]
else:
self.help = __builtins__.help
if hasattr(__builtins__, "help"):
self.help = __builtins__.help

def __call__(self, obj):
if isinstance(obj, JV):
Expand All @@ -26,9 +28,11 @@ def __call__(self, obj):
return self.help(obj)

if isinstance(__builtins__, dict):
__builtins__["help"] = Helper()
if "help" in __builtins__:
__builtins__["help"] = Helper()
else:
__builtins__.help = Helper()
if hasattr(__builtins__, "help"):
__builtins__.help = Helper()


_setup_help()
Expand Down

0 comments on commit 46e2bb7

Please sign in to comment.