Skip to content

Commit

Permalink
Merge pull request #20 from Suzhou-Tongyuan/sjh/avoid-no-help
Browse files Browse the repository at this point in the history
avoid help module is not in __builtins__
  • Loading branch information
songjhaha authored Sep 7, 2024
2 parents 1ab808a + 46e2bb7 commit c1f58ce
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 c1f58ce

Please sign in to comment.