Remove aliases: builtins
, FileNotFoundError
This commit is contained in:
parent
2685b01a4b
commit
ecf0352d37
@ -2,10 +2,6 @@
|
|||||||
# This file is part of Hy, which is free software licensed under the Expat
|
# This file is part of Hy, which is free software licensed under the Expat
|
||||||
# license. See the LICENSE.
|
# license. See the LICENSE.
|
||||||
|
|
||||||
try:
|
|
||||||
import __builtin__ as builtins
|
|
||||||
except ImportError:
|
|
||||||
import builtins # NOQA
|
|
||||||
import sys, keyword, textwrap
|
import sys, keyword, textwrap
|
||||||
|
|
||||||
PY3 = sys.version_info[0] >= 3
|
PY3 = sys.version_info[0] >= 3
|
||||||
@ -97,8 +93,3 @@ def isidentifier(x):
|
|||||||
# https://bugs.python.org/issue33899
|
# https://bugs.python.org/issue33899
|
||||||
tokens = [t for t in tokens if t[0] != T.NEWLINE]
|
tokens = [t for t in tokens if t[0] != T.NEWLINE]
|
||||||
return len(tokens) == 2 and tokens[0][0] == T.NAME
|
return len(tokens) == 2 and tokens[0][0] == T.NAME
|
||||||
|
|
||||||
try:
|
|
||||||
FileNotFoundError = FileNotFoundError
|
|
||||||
except NameError:
|
|
||||||
FileNotFoundError = IOError
|
|
||||||
|
@ -19,6 +19,7 @@ import time
|
|||||||
import linecache
|
import linecache
|
||||||
import hashlib
|
import hashlib
|
||||||
import codeop
|
import codeop
|
||||||
|
import builtins
|
||||||
|
|
||||||
import astor.code_gen
|
import astor.code_gen
|
||||||
|
|
||||||
@ -35,7 +36,6 @@ from hy.importer import runhy
|
|||||||
from hy.completer import completion, Completer
|
from hy.completer import completion, Completer
|
||||||
from hy.macros import macro, require
|
from hy.macros import macro, require
|
||||||
from hy.models import HyExpression, HyString, HySymbol
|
from hy.models import HyExpression, HyString, HySymbol
|
||||||
from hy._compat import builtins, FileNotFoundError
|
|
||||||
|
|
||||||
|
|
||||||
sys.last_type = None
|
sys.last_type = None
|
||||||
@ -256,7 +256,7 @@ class HyREPL(code.InteractiveConsole, object):
|
|||||||
module, f = '.'.join(parts[:-1]), parts[-1]
|
module, f = '.'.join(parts[:-1]), parts[-1]
|
||||||
self.output_fn = getattr(importlib.import_module(module), f)
|
self.output_fn = getattr(importlib.import_module(module), f)
|
||||||
else:
|
else:
|
||||||
self.output_fn = __builtins__[mangle(output_fn)]
|
self.output_fn = getattr(builtins, mangle(output_fn))
|
||||||
|
|
||||||
# Pre-mangle symbols for repl recent results: *1, *2, *3
|
# Pre-mangle symbols for repl recent results: *1, *2, *3
|
||||||
self._repl_results_symbols = [mangle("*{}".format(i + 1)) for i in range(3)]
|
self._repl_results_symbols = [mangle("*{}".format(i + 1)) for i in range(3)]
|
||||||
|
@ -28,15 +28,12 @@ import types
|
|||||||
import ast
|
import ast
|
||||||
import sys
|
import sys
|
||||||
import copy
|
import copy
|
||||||
|
import builtins
|
||||||
import __future__
|
import __future__
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
if PY3:
|
|
||||||
import builtins
|
|
||||||
else:
|
|
||||||
import __builtin__ as builtins
|
|
||||||
|
|
||||||
Inf = float('inf')
|
Inf = float('inf')
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@ import contextlib
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import builtins
|
||||||
|
|
||||||
import hy.macros
|
import hy.macros
|
||||||
import hy.compiler
|
import hy.compiler
|
||||||
from hy._compat import builtins
|
|
||||||
|
|
||||||
|
|
||||||
docomplete = True
|
docomplete = True
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
(defn @ [a1 &rest a-rest]
|
(defn @ [a1 &rest a-rest]
|
||||||
"Shadowed `@` operator matrix multiples `a1` by each `a-rest`."
|
"Shadowed `@` operator matrix multiples `a1` by each `a-rest`."
|
||||||
(reduce operator.matmul a-rest a1)))
|
(reduce operator.matmul a-rest a1))
|
||||||
|
|
||||||
(defn << [a1 a2 &rest a-rest]
|
(defn << [a1 a2 &rest a-rest]
|
||||||
"Shadowed `<<` operator performs left-shift on `a1` by `a2`, ..., `a-rest`."
|
"Shadowed `<<` operator performs left-shift on `a1` by `a2`, ..., `a-rest`."
|
||||||
|
@ -8,13 +8,12 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import builtins
|
||||||
|
|
||||||
from hy.importer import cache_from_source
|
from hy.importer import cache_from_source
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from hy._compat import builtins
|
|
||||||
|
|
||||||
|
|
||||||
hy_dir = os.environ.get('HY_DIR', '')
|
hy_dir = os.environ.get('HY_DIR', '')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user