Skip to content

Commit 043620b

Browse files
committed
mypy clean pythonrc.py
1 parent 69f9993 commit 043620b

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

pythonrc.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
try:
5757
import sys
5858

59-
__IPYTHON__ and sys.exit(0)
59+
__IPYTHON__ and sys.exit(0) # type: ignore
6060
except NameError:
6161
pass
6262

@@ -244,6 +244,16 @@ def complete(self, text, state, line=None):
244244
return None
245245

246246

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+
247257
class ImprovedConsole(InteractiveConsole):
248258
"""
249259
Welcome to lonetwin's pimped up python prompt
@@ -307,15 +317,6 @@ def __init__(self, *args, **kwargs):
307317
)
308318
)
309319

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-
319320
def init_color_functions(self):
320321
"""Populates globals dict with some helper functions for colorizing text"""
321322

@@ -826,5 +827,5 @@ def interact(self):
826827
if not os.getenv("SKIP_PYMP"):
827828
# - create our pimped out console and fire it up !
828829
pymp = ImprovedConsole(locals=CLEAN_NS)
829-
pymp.locals["__pymp__"] = pymp
830+
CLEAN_NS["__pymp__"] = pymp
830831
pymp.interact()

0 commit comments

Comments
 (0)