Remove miscellaneous PY3 checks
This commit is contained in:
parent
bba97ab2a6
commit
2685b01a4b
@ -35,7 +35,7 @@ from hy.importer import runhy
|
||||
from hy.completer import completion, Completer
|
||||
from hy.macros import macro, require
|
||||
from hy.models import HyExpression, HyString, HySymbol
|
||||
from hy._compat import builtins, PY3, FileNotFoundError
|
||||
from hy._compat import builtins, FileNotFoundError
|
||||
|
||||
|
||||
sys.last_type = None
|
||||
@ -661,7 +661,7 @@ def hy2py_main():
|
||||
if options.with_source:
|
||||
# need special printing on Windows in case the
|
||||
# codepage doesn't support utf-8 characters
|
||||
if PY3 and platform.system() == "Windows":
|
||||
if platform.system() == "Windows":
|
||||
for h in hst:
|
||||
try:
|
||||
print(h)
|
||||
@ -676,7 +676,7 @@ def hy2py_main():
|
||||
_ast = hy_compile(hst, '__main__', filename=filename, source=source)
|
||||
|
||||
if options.with_ast:
|
||||
if PY3 and platform.system() == "Windows":
|
||||
if platform.system() == "Windows":
|
||||
_print_for_windows(astor.dump_tree(_ast))
|
||||
else:
|
||||
print(astor.dump_tree(_ast))
|
||||
@ -684,7 +684,7 @@ def hy2py_main():
|
||||
print()
|
||||
|
||||
if not options.without_python:
|
||||
if PY3 and platform.system() == "Windows":
|
||||
if platform.system() == "Windows":
|
||||
_print_for_windows(astor.code_gen.to_source(_ast))
|
||||
else:
|
||||
print(astor.code_gen.to_source(_ast))
|
||||
|
@ -5,12 +5,10 @@
|
||||
;;;; Hy shadow functions
|
||||
|
||||
(import operator)
|
||||
(import [hy._compat [PY3]])
|
||||
|
||||
(require [hy.core.bootstrap [*]])
|
||||
|
||||
(if PY3
|
||||
(import [functools [reduce]]))
|
||||
(import [functools [reduce]])
|
||||
|
||||
(defn + [&rest args]
|
||||
"Shadowed `+` operator adds `args`."
|
||||
@ -60,7 +58,6 @@
|
||||
"Shadowed `%` operator takes `x` modulo `y`."
|
||||
(% x y))
|
||||
|
||||
(if PY3
|
||||
(defn @ [a1 &rest a-rest]
|
||||
"Shadowed `@` operator matrix multiples `a1` by each `a-rest`."
|
||||
(reduce operator.matmul a-rest a1)))
|
||||
@ -173,5 +170,3 @@
|
||||
'and 'or 'not
|
||||
'is 'is-not 'in 'not-in
|
||||
'get])
|
||||
(if (not PY3)
|
||||
(.remove EXPORTS '@))
|
||||
|
@ -9,7 +9,7 @@ import traceback
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
from hy._compat import PY3, reraise, rename_function
|
||||
from hy._compat import reraise, rename_function
|
||||
from hy.models import replace_hy_obj, HyExpression, HySymbol, wrap_value
|
||||
from hy.lex import mangle
|
||||
from hy.errors import (HyLanguageError, HyMacroExpansionError, HyTypeError,
|
||||
@ -74,9 +74,6 @@ def tag(name):
|
||||
def _(fn):
|
||||
_name = mangle('#{}'.format(name))
|
||||
|
||||
if not PY3:
|
||||
_name = _name.encode('UTF-8')
|
||||
|
||||
fn = rename_function(fn, _name)
|
||||
|
||||
module = inspect.getmodule(fn)
|
||||
|
Loading…
Reference in New Issue
Block a user