import os import re import sys import traceback import pkgutil from functools import reduce from colorama import Fore from contextlib import contextmanager from hy import _initialize_env_var from hy._compat import PYPY _hy_filter_internal_errors = _initialize_env_var('HY_FILTER_INTERNAL_ERRORS', True) COLORED = _initialize_env_var('HY_COLORED_ERRORS', False) class HyError(Exception): pass class HyInternalError(HyError): """Unexpected errors occurring during compilation or parsing of Hy code. Errors sub-classing this are not intended to be user-facing, and will, hopefully, never be seen by users! """ class HyLanguageError(HyError): """Errors caused by invalid use of the Hy language.
# Copyright 2019 the authors. # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. from __future__ import unicode_literals from contextlib import contextmanager from math import isnan, isinf from hy import _initialize_env_var from hy._compat import PY3, str_type, bytes_type, long_type, string_types from hy.errors import HyWrapperError from fractions import Fraction from clint.textui import colored PRETTY = True _hy_colored_ast_objects = _initialize_env_var('HY_COLORED_AST_OBJECTS', False) @contextmanager def pretty(pretty=True): """ Context manager to temporarily enable or disable pretty-printing of Hy model reprs. """ global PRETTY old, PRETTY = PRETTY, pretty try: yield finally: PRETTY = old
import operator import re from contextlib import contextmanager from fractions import Fraction from functools import reduce from itertools import groupby from math import isinf, isnan from colorama import Fore from hy import _initialize_env_var from hy.errors import HyWrapperError PRETTY = True COLORED = _initialize_env_var("HY_COLORED_AST_OBJECTS", False) @contextmanager def pretty(pretty=True): """ Context manager to temporarily enable or disable pretty-printing of Hy model reprs. """ global PRETTY old, PRETTY = PRETTY, pretty try: yield finally: PRETTY = old
# Copyright 2021 the authors. # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. from __future__ import unicode_literals from contextlib import contextmanager from math import isnan, isinf from hy import _initialize_env_var from hy.errors import HyWrapperError from fractions import Fraction from colorama import Fore PRETTY = True COLORED = _initialize_env_var('HY_COLORED_AST_OBJECTS', False) @contextmanager def pretty(pretty=True): """ Context manager to temporarily enable or disable pretty-printing of Hy model reprs. """ global PRETTY old, PRETTY = PRETTY, pretty try: yield finally: PRETTY = old class _ColoredModel:
# Copyright 2019 the authors. # This file is part of Hy, which is free software licensed under the Expat # license. See the LICENSE. import os import re import sys import traceback import pkgutil from functools import reduce from contextlib import contextmanager from hy import _initialize_env_var from clint.textui import colored _hy_filter_internal_errors = _initialize_env_var('HY_FILTER_INTERNAL_ERRORS', True) _hy_colored_errors = _initialize_env_var('HY_COLORED_ERRORS', False) class HyError(Exception): pass class HyInternalError(HyError): """Unexpected errors occurring during compilation or parsing of Hy code. Errors sub-classing this are not intended to be user-facing, and will, hopefully, never be seen by users! """