# Path: coconut/_pyparsing.py
#     PYPARSING_PACKAGE = "cPyparsing"
#     PYPARSING_INFO = "Cython cPyparsing v" + __version__
#         PYPARSING_PACKAGE = "pyparsing"
#         PYPARSING_INFO = "Python pyparsing v" + __version__
#         PYPARSING_PACKAGE = "cPyparsing"
#         PYPARSING_INFO = None
#     MODERN_PYPARSING = True
#     MODERN_PYPARSING = False
# USE_COMPUTATION_GRAPH = (
#     not MODERN_PYPARSING  # not yet supported
#     and not PYPY  # experimentally determined
# )
#     def fast_repr(cls):
# def set_fast_pyparsing_reprs():
# def unset_fast_pyparsing_reprs():
# def add_timing_to_method(cls, method_name, method):
# def collect_timing_info():
# def print_timing_info():
# class _timing_sentinel(object):
# 
# Path: coconut/constants.py
# def fixpath(path):
# def str_to_bool(boolstr, default=False):
# WINDOWS = os.name == "nt"
# PYPY = platform.python_implementation() == "PyPy"
# CPYTHON = platform.python_implementation() == "CPython"
# PY32 = sys.version_info >= (3, 2)
# PY33 = sys.version_info >= (3, 3)
# PY34 = sys.version_info >= (3, 4)
# PY35 = sys.version_info >= (3, 5)
# PY36 = sys.version_info >= (3, 6)
# PY38 = sys.version_info >= (3, 8)
# PY310 = sys.version_info >= (3, 10)
# IPY = (
#     ((PY2 and not PY26) or PY35)
#     and not (PYPY and WINDOWS)
#     # necessary until jupyter-console fixes https://github.com/jupyter/jupyter_console/issues/245
#     and not PY310
# )
# MYPY = (
#     PY34
#     and not WINDOWS
#     and not PYPY
# )
# PURE_PYTHON = str_to_bool(os.environ.get(pure_python_env_var, ""))


from coconut.root import *  # NOQA
from coconut._pyparsing import lineno
from coconut.constants import (
    openindent,
    closeindent,
    taberrfmt,
    default_encoding,
    report_this_text,
)
import sys

# -----------------------------------------------------------------------------------------------------------------------
# INFO:
# -----------------------------------------------------------------------------------------------------------------------

"""
Author: Evan Hubinger
License: Apache 2.0
Description: Exceptions for use in the compiler.
"""

# -----------------------------------------------------------------------------------------------------------------------
# IMPORTS:
# -----------------------------------------------------------------------------------------------------------------------

from __future__ import print_function, absolute_import, unicode_literals, division





# -----------------------------------------------------------------------------------------------------------------------
# FUNCTIONS:
# -----------------------------------------------------------------------------------------------------------------------


def get_encoding(fileobj):
    """Get encoding of a file."""
    # sometimes fileobj.encoding is undefined, but sometimes it is None; we need to handle both cases
    obj_encoding = getattr(fileobj, "encoding", None)

# Path: coconut/_pyparsing.py
#     PYPARSING_PACKAGE = "cPyparsing"
#     PYPARSING_INFO = "Cython cPyparsing v" + __version__
#         PYPARSING_PACKAGE = "pyparsing"
#         PYPARSING_INFO = "Python pyparsing v" + __version__
#         PYPARSING_PACKAGE = "cPyparsing"
#         PYPARSING_INFO = None
#     MODERN_PYPARSING = True
#     MODERN_PYPARSING = False
# USE_COMPUTATION_GRAPH = (
#     not MODERN_PYPARSING  # not yet supported
#     and not PYPY  # experimentally determined
# )
#     def fast_repr(cls):
# def set_fast_pyparsing_reprs():
# def unset_fast_pyparsing_reprs():
# def add_timing_to_method(cls, method_name, method):
# def collect_timing_info():
# def print_timing_info():
# class _timing_sentinel(object):
# 
# Path: coconut/constants.py
# def fixpath(path):
# def str_to_bool(boolstr, default=False):
# WINDOWS = os.name == "nt"
# PYPY = platform.python_implementation() == "PyPy"
# CPYTHON = platform.python_implementation() == "CPython"
# PY32 = sys.version_info >= (3, 2)
# PY33 = sys.version_info >= (3, 3)
# PY34 = sys.version_info >= (3, 4)
# PY35 = sys.version_info >= (3, 5)
# PY36 = sys.version_info >= (3, 6)
# PY38 = sys.version_info >= (3, 8)
# PY310 = sys.version_info >= (3, 10)
# IPY = (
#     ((PY2 and not PY26) or PY35)
#     and not (PYPY and WINDOWS)
#     # necessary until jupyter-console fixes https://github.com/jupyter/jupyter_console/issues/245
#     and not PY310
# )
# MYPY = (
#     PY34
#     and not WINDOWS
#     and not PYPY
# )
# PURE_PYTHON = str_to_bool(os.environ.get(pure_python_env_var, ""))


# Path: coconut/exceptions.py
from coconut.root import *  # NOQA
from coconut._pyparsing import lineno
from coconut.constants import (
    openindent,
    closeindent,
    taberrfmt,
    default_encoding,
    report_this_text,
)
import sys


# -----------------------------------------------------------------------------------------------------------------------
# INFO:
# -----------------------------------------------------------------------------------------------------------------------

"""
Author: Evan Hubinger
License: Apache 2.0
Description: Exceptions for use in the compiler.
"""

# -----------------------------------------------------------------------------------------------------------------------
# IMPORTS:
# -----------------------------------------------------------------------------------------------------------------------

from __future__ import print_function, absolute_import, unicode_literals, division





# -----------------------------------------------------------------------------------------------------------------------
# FUNCTIONS:
# -----------------------------------------------------------------------------------------------------------------------


def get_encoding(fileobj):
    """Get encoding of a file."""
    # sometimes fileobj.encoding is undefined, but sometimes it is None; we need to handle both cases
    obj_encoding = getattr(fileobj, "encoding", None)

    return obj_encoding if obj_encoding is not None else default_encoding