Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
54 lines (40 loc) · 1.1 KB

File metadata and controls

54 lines (40 loc) · 1.1 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import functools
import imp
import sys
from six.moves import builtins
from bpython._py3compat import py3
def resetquit(builtins):
"""Redefine builtins 'quit' and 'exit' not so close stdin
"""
def __call__(self, code=None):
raise SystemExit(code)
__call__.__name__ = 'FakeQuitCall'
builtins.quit.__class__.__call__ = __call__
def monkeypatch_quit():
if 'site' in sys.modules:
resetquit(builtins)
orig_reload = None
if py3:
import importlib
if hasattr(importlib, 'reload'):
orig_reload = importlib.reload
elif hasattr(imp, 'reload'):
orig_reload = imp.reload
else:
orig_reload = builtins.reload
def reload(module):
if module is sys:
orig_stdout = sys.stdout
orig_stderr = sys.stderr
orig_stdin = sys.stdin
r = orig_reload(sys)
sys.stdout = orig_stdout
sys.stderr = orig_stderr
sys.stdin = orig_stdin
return r
else:
return orig_reload(module)
functools.update_wrapper(reload, orig_reload)
def monkeypatch_reload():
if not py3:
builtins.reload = reload
Morty Proxy This is a proxified and sanitized view of the page, visit original site.