|
56 | 56 | try: |
57 | 57 | import sys |
58 | 58 |
|
59 | | - __IPYTHON__ and sys.exit(0) |
| 59 | + __IPYTHON__ and sys.exit(0) # type: ignore |
60 | 60 | except NameError: |
61 | 61 | pass |
62 | 62 |
|
@@ -244,6 +244,16 @@ def complete(self, text, state, line=None): |
244 | 244 | return None |
245 | 245 |
|
246 | 246 |
|
| 247 | +def _doc_to_usage(method): |
| 248 | + def inner(self, arg): |
| 249 | + arg = arg.strip() |
| 250 | + if arg.startswith(("-h", "--help")): |
| 251 | + return self.writeline(blue(method.__doc__.strip())) |
| 252 | + return method(self, arg) |
| 253 | + |
| 254 | + return inner |
| 255 | + |
| 256 | + |
247 | 257 | class ImprovedConsole(InteractiveConsole): |
248 | 258 | """ |
249 | 259 | Welcome to lonetwin's pimped up python prompt |
@@ -307,15 +317,6 @@ def __init__(self, *args, **kwargs): |
307 | 317 | ) |
308 | 318 | ) |
309 | 319 |
|
310 | | - def _doc_to_usage(method): |
311 | | - def inner(self, arg): |
312 | | - arg = arg.strip() |
313 | | - if arg.startswith(("-h", "--help")): |
314 | | - return self.writeline(blue(method.__doc__.strip())) |
315 | | - return method(self, arg) |
316 | | - |
317 | | - return inner |
318 | | - |
319 | 320 | def init_color_functions(self): |
320 | 321 | """Populates globals dict with some helper functions for colorizing text""" |
321 | 322 |
|
@@ -826,5 +827,5 @@ def interact(self): |
826 | 827 | if not os.getenv("SKIP_PYMP"): |
827 | 828 | # - create our pimped out console and fire it up ! |
828 | 829 | pymp = ImprovedConsole(locals=CLEAN_NS) |
829 | | - pymp.locals["__pymp__"] = pymp |
| 830 | + CLEAN_NS["__pymp__"] = pymp |
830 | 831 | pymp.interact() |
0 commit comments