diff --git a/README.md b/README.md index 40a2aa6..d67177d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Requires python 3.6 and above. Usage example: ```python ->>> from yes import yes +>>> import yes >>> print 3 File "", line 1 print 3 diff --git a/__pycache__/yes.cpython-37.pyc b/__pycache__/yes.cpython-37.pyc new file mode 100644 index 0000000..688250b Binary files /dev/null and b/__pycache__/yes.cpython-37.pyc differ diff --git a/yes.py b/yes.py index 4b2233c..3021d80 100644 --- a/yes.py +++ b/yes.py @@ -6,8 +6,11 @@ import re did_you_mean = re.compile(r'Did you mean (.*)\?', re.IGNORECASE) what = 'what?' +class Yes(sys.__class__): + def __init__(self, other): + for attr in dir(other): + setattr(self, attr, getattr(other, attr)) -class Yes: def __repr__(self): try: last_error = sys.last_value @@ -41,4 +44,4 @@ class Yes: return(f'{sys.ps1}{suggestion} \n{eval_output.getvalue()[:-1]}') -yes = Yes() +sys.modules[__name__] = Yes(sys.modules[__name__])