# This file was generated by stubgen-pyx v0.2.18 from /Users/long2ice/Developer/long2ice/asyncmy/asyncmy/converters.pyx

import re
import time

import datetime

from .constants.FIELD_TYPE import *

DATETIME_RE = re.compile(
    "(\\d{1,4})-(\\d{1,2})-(\\d{1,2})[T ](\\d{1,2}):(\\d{1,2}):(\\d{1,2})(?:.(\\d{1,6}))?"
)
TIMEDELTA_RE = re.compile("(-)?(\\d{1,3}):(\\d{1,2}):(\\d{1,2})(?:.(\\d{1,6}))?")
TIME_RE = re.compile("(\\d{1,2}):(\\d{1,2}):(\\d{1,2})(?:.(\\d{1,6}))?")
convert_bit = through
conversions: dict

def escape_item(val, charset: str, mapping: dict | None = None): ...
def escape_sequence(val: tuple, charset: str, mapping: dict | None = None) -> str: ...
def escape_set(val: set, charset: str, mapping: dict | None = None) -> str: ...
def escape_bool(value: int, mapping: dict | None = None) -> str: ...
def escape_int(value, mapping: dict | None = None) -> str: ...
def escape_float(value: float, mapping: dict | None = None) -> str: ...
def escape_string(value, mapping: dict | None = None) -> str:
    """
    escapes *value* without adding quote.

    Value should be unicode
    """

def escape_bytes_prefixed(value: bytes, mapping: dict | None = None) -> str: ...
def escape_bytes(value: bytes, mapping: dict | None = None) -> str: ...
def escape_str(value, mapping: dict | None = None) -> str: ...
def escape_None(value, mapping: dict | None = None) -> str: ...
def escape_timedelta(obj: datetime.timedelta, mapping: dict | None = None) -> str: ...
def escape_time(obj, mapping: dict | None = None) -> str: ...
def escape_datetime(obj: datetime.datetime, mapping: dict | None = None) -> str: ...
def escape_date(obj: datetime.date, mapping: dict | None = None) -> str: ...
def escape_struct_time(obj: time.struct_time, mapping: dict | None = None) -> str: ...
def decimal2literal(o, d) -> str: ...
def convert_datetime(obj: object) -> object:
    """Returns a DATETIME or TIMESTAMP column value as a datetime object:

      >>> convert_datetime('2007-02-25 23:06:20')
      datetime.datetime(2007, 2, 25, 23, 6, 20)
      >>> convert_datetime('2007-02-25T23:06:20')
      datetime.datetime(2007, 2, 25, 23, 6, 20)

    Illegal values are returned as str:

      >>> convert_datetime('2007-02-31T23:06:20')
      '2007-02-31T23:06:20'
      >>> convert_datetime('0000-00-00 00:00:00')
      '0000-00-00 00:00:00'

    """

def convert_timedelta(obj: object) -> object:
    """Returns a TIME column as a timedelta object:

      >>> convert_timedelta('25:06:17')
      datetime.timedelta(1, 3977)
      >>> convert_timedelta('-25:06:17')
      datetime.timedelta(-2, 83177)

    Illegal values are returned as str:

      >>> convert_timedelta('random crap')
      'random crap'

    Note that MySQL always returns TIME columns as (+|-)HH:MM:SS, but
    can accept values as (+|-)DD HH:MM:SS. The latter format will not
    be parsed correctly by this function.
    """

def convert_time(obj: object) -> object:
    """Returns a TIME column as a time object:

      >>> convert_time('15:06:17')
      datetime.time(15, 6, 17)

    Illegal values are returned as str:

      >>> convert_time('-25:06:17')
      '-25:06:17'
      >>> convert_time('random crap')
      'random crap'

    Note that MySQL always returns TIME columns as (+|-)HH:MM:SS, but
    can accept values as (+|-)DD HH:MM:SS. The latter format will not
    be parsed correctly by this function.

    Also note that MySQL's TIME column corresponds more closely to
    Python's timedelta and not time. However if you want TIME columns
    to be treated as time-of-day and not a time offset, then you can
    use set this function as the converter for TIME.
    """

def convert_date(obj) -> object:
    """Returns a DATE column as a date object:

      >>> convert_date('2007-02-26')
      datetime.date(2007, 2, 26)

    Illegal values are returned as str:

      >>> convert_date('2007-02-31')
      '2007-02-31'
      >>> convert_date('0000-00-00')
      '0000-00-00'

    """

def through(x): ...
