# Path: giraffez/fmt.py
# def safe_name(s):
#     return s.replace(" ", "_").lower()
# 
# Path: giraffez/logging.py
# def run_once(f):
#     def wrapper(*args, **kwargs):
# def setup_logging():
#     def colorize(cls, color, s):
#     def blue(cls, s):
#     def green(cls, s):
#     def gray(cls, s):
#     def white(cls, s):
#     def disabled(cls, s):
#     def bold(cls, s):
#     def fail(cls, s):
# def highlight(s):
#     def __init__(self, fd=None, level=INFO):
#     def level(self):
#     def level(self, v):
#     def _write(self, args, level=None, console=False):
#     def write(self, *args, **kwargs):
#     def info(self, *args, **kwargs):
#     def verbose(self, *args, **kwargs):
#     def debug(self, *args, **kwargs):
#     def fatal(self, msg=""):
#     def __init__(self, fd=None, level=INFO):
#     def _write(self, args, level=None, console=True):
# CONSOLE_HEADER = "\033[95m"
# CONSOLE_BLUE = "\033[94m"
# CONSOLE_GREEN = "\033[92m"
# CONSOLE_GRAY = "\033[37m"
# CONSOLE_WHITE = "\033[97m"
# CONSOLE_WARNING = "\033[93m"
# CONSOLE_ENDC = "\033[0m"
# CONSOLE_FAIL = "\033[91m"
# CONSOLE_BOLD = "\033[1m"
# CONSOLE_UNDERLINE = "\033[4m" 
# CONSOLE_DISABLED = "\033[38;5;240m" 
# class colors(object):
# class Logger(object):
# class LockingLogger(Logger):


import datetime
import math
import struct
from .constants import *
from .errors import *
from .fmt import safe_name
from .logging import log
from ._compat import *

    def to_string(self, length=None):
        hms = "{0:02}:{1:02}:{2:02}".format(self.hour, self.minute, self.second)
        if length is not None and length > 8:
            ms = "{:06}".format(self.microsecond)[:length - 9]
            return "{0}.{1}".format(hms, ms)
        return hms


class Timestamp(Date):
    """
    Represents Teradata date/time data types such as TIMESTAMP(n).
    """

    def __init__(self, *args, **kwargs):
        super(Timestamp, self).__init__(*args, **kwargs)
        self._original_length = None

    @classmethod
    def from_string(cls, s):
        s = s.strip()
        format = TIME_FORMATS.get(len(s))
        if format is not None:
            try:
                if len(s) > 26:
                    s = s[:26]
                ts = cls.strptime(str(s), format)
                ts._original_length = len(s)
                return ts
            except ValueError as error:

# Path: giraffez/fmt.py
# def safe_name(s):
#     return s.replace(" ", "_").lower()
# 
# Path: giraffez/logging.py
# def run_once(f):
#     def wrapper(*args, **kwargs):
# def setup_logging():
#     def colorize(cls, color, s):
#     def blue(cls, s):
#     def green(cls, s):
#     def gray(cls, s):
#     def white(cls, s):
#     def disabled(cls, s):
#     def bold(cls, s):
#     def fail(cls, s):
# def highlight(s):
#     def __init__(self, fd=None, level=INFO):
#     def level(self):
#     def level(self, v):
#     def _write(self, args, level=None, console=False):
#     def write(self, *args, **kwargs):
#     def info(self, *args, **kwargs):
#     def verbose(self, *args, **kwargs):
#     def debug(self, *args, **kwargs):
#     def fatal(self, msg=""):
#     def __init__(self, fd=None, level=INFO):
#     def _write(self, args, level=None, console=True):
# CONSOLE_HEADER = "\033[95m"
# CONSOLE_BLUE = "\033[94m"
# CONSOLE_GREEN = "\033[92m"
# CONSOLE_GRAY = "\033[37m"
# CONSOLE_WHITE = "\033[97m"
# CONSOLE_WARNING = "\033[93m"
# CONSOLE_ENDC = "\033[0m"
# CONSOLE_FAIL = "\033[91m"
# CONSOLE_BOLD = "\033[1m"
# CONSOLE_UNDERLINE = "\033[4m" 
# CONSOLE_DISABLED = "\033[38;5;240m" 
# class colors(object):
# class Logger(object):
# class LockingLogger(Logger):


# Path: giraffez/types.py
import datetime
import math
import struct
from .constants import *
from .errors import *
from .fmt import safe_name
from .logging import log
from ._compat import *


    def to_string(self, length=None):
        hms = "{0:02}:{1:02}:{2:02}".format(self.hour, self.minute, self.second)
        if length is not None and length > 8:
            ms = "{:06}".format(self.microsecond)[:length - 9]
            return "{0}.{1}".format(hms, ms)
        return hms


class Timestamp(Date):
    """
    Represents Teradata date/time data types such as TIMESTAMP(n).
    """

    def __init__(self, *args, **kwargs):
        super(Timestamp, self).__init__(*args, **kwargs)
        self._original_length = None

    @classmethod
    def from_string(cls, s):
        s = s.strip()
        format = TIME_FORMATS.get(len(s))
        if format is not None:
            try:
                if len(s) > 26:
                    s = s[:26]
                ts = cls.strptime(str(s), format)
                ts._original_length = len(s)
                return ts
            except ValueError as error:

                log.debug("GiraffeTimestamp: ", error)