# Path: typepy/_common.py
# def strip_ansi_escape(value: Any) -> str:
#     return ansi_escape.sub("", value)
# 
# Path: typepy/_const.py
# class DefaultValue:
#     FLOAT_TYPE = Decimal
#     STRIP_ANSI_ESCAPE = True
# 
# class ParamKey:
#     STRIP_ANSI_ESCAPE = "strip_ansi_escape"
#     TIMEZONE = "timezone"
# 
# Path: typepy/error.py
# class TypeConversionError(TypeError):
#     """
#     Exception raised when failed to convert data.
#     """
# 
# Path: typepy/converter/_interface.py
# class AbstractValueConverter(ValueConverterInterface):
#     __slots__ = "_value"
# 
#     def __init__(self, value, params):
#         self._value = value
#         self._params = params
# 
#     def __repr__(self):
#         try:
#             string = str(self.force_convert())
#         except TypeConversionError:
#             string = "[ValueConverter ERROR] failed to force_convert"
# 
#         return string


from datetime import date, datetime
from .._common import strip_ansi_escape
from .._const import DefaultValue, ParamKey
from ..error import TypeConversionError
from ._interface import AbstractValueConverter
        from ..type._integer import Integer
        from ..type._realnumber import RealNumber
        from packaging.version import InvalidVersion, Version
        import dateutil.parser
        import pytz
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""




class DateTimeConverter(AbstractValueConverter):

    __DAYS_TO_SECONDS_COEF = 60 ** 2 * 24
    __MICROSECONDS_TO_SECONDS_COEF = 1000 ** 2
    __COMMON_DST_TIMEZONE_TABLE = {
        -36000: "America/Adak",  # -1000
        -32400: "US/Alaska",  # -0900
        -28800: "US/Pacific",  # -0800
        -25200: "US/Mountain",  # -0700
        -21600: "US/Central",  # -0600
        -18000: "US/Eastern",  # -0500
        -14400: "Canada/Atlantic",  # -0400
        -12600: "America/St_Johns",  # -0330
        -10800: "America/Miquelon",  # -0300
        7200: "Africa/Tripoli",  # 0200
    }

    def __init__(self, value, params):
        super().__init__(value, params)

        self.__datetime = None

# Path: typepy/_common.py
# def strip_ansi_escape(value: Any) -> str:
#     return ansi_escape.sub("", value)
# 
# Path: typepy/_const.py
# class DefaultValue:
#     FLOAT_TYPE = Decimal
#     STRIP_ANSI_ESCAPE = True
# 
# class ParamKey:
#     STRIP_ANSI_ESCAPE = "strip_ansi_escape"
#     TIMEZONE = "timezone"
# 
# Path: typepy/error.py
# class TypeConversionError(TypeError):
#     """
#     Exception raised when failed to convert data.
#     """
# 
# Path: typepy/converter/_interface.py
# class AbstractValueConverter(ValueConverterInterface):
#     __slots__ = "_value"
# 
#     def __init__(self, value, params):
#         self._value = value
#         self._params = params
# 
#     def __repr__(self):
#         try:
#             string = str(self.force_convert())
#         except TypeConversionError:
#             string = "[ValueConverter ERROR] failed to force_convert"
# 
#         return string


# Path: typepy/converter/_datetime.py
from datetime import date, datetime
from .._common import strip_ansi_escape
from .._const import DefaultValue, ParamKey
from ..error import TypeConversionError
from ._interface import AbstractValueConverter
        from ..type._integer import Integer
        from ..type._realnumber import RealNumber
        from packaging.version import InvalidVersion, Version
        import dateutil.parser
        import pytz

"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""




class DateTimeConverter(AbstractValueConverter):

    __DAYS_TO_SECONDS_COEF = 60 ** 2 * 24
    __MICROSECONDS_TO_SECONDS_COEF = 1000 ** 2
    __COMMON_DST_TIMEZONE_TABLE = {
        -36000: "America/Adak",  # -1000
        -32400: "US/Alaska",  # -0900
        -28800: "US/Pacific",  # -0800
        -25200: "US/Mountain",  # -0700
        -21600: "US/Central",  # -0600
        -18000: "US/Eastern",  # -0500
        -14400: "Canada/Atlantic",  # -0400
        -12600: "America/St_Johns",  # -0330
        -10800: "America/Miquelon",  # -0300
        7200: "Africa/Tripoli",  # 0200
    }

    def __init__(self, value, params):
        super().__init__(value, params)

        self.__datetime = None

        self.__timezone = self._params.get(ParamKey.TIMEZONE)