How to use the sgqlc.types.datetime function in sgqlc

To help you get started, we’ve selected a few sgqlc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github profusion / sgqlc / sgqlc / types / datetime.py View on Github external
if not m:
            raise ValueError('not in ISO 8601 format YYYY-MM-DDTHH:MM:SS: %s'
                             % s)

        year = int(m['Y'])
        month = int(m['m'])
        day = int(m['d'])
        hour = int(m['H'])
        minute = int(m['M'])
        second = int(m['S'])
        microsecond = int(m['MS'][1:] or 0)
        tzinfo = None
        if m['TZ'] == 'Z':
            tzinfo = datetime.timezone.utc
        elif m['TZ']:
            d = datetime.timedelta(hours=int(m['TZH']), minutes=int(m['TZM']))
            tzinfo = datetime.timezone(d)

        return datetime.datetime(year, month, day,
                                 hour, minute, second, microsecond, tzinfo)
github profusion / sgqlc / sgqlc / types / datetime.py View on Github external
raise ValueError('not in ISO 8601 format YYYY-MM-DDTHH:MM:SS: %s'
                             % s)

        year = int(m['Y'])
        month = int(m['m'])
        day = int(m['d'])
        hour = int(m['H'])
        minute = int(m['M'])
        second = int(m['S'])
        microsecond = int(m['MS'][1:] or 0)
        tzinfo = None
        if m['TZ'] == 'Z':
            tzinfo = datetime.timezone.utc
        elif m['TZ']:
            d = datetime.timedelta(hours=int(m['TZH']), minutes=int(m['TZM']))
            tzinfo = datetime.timezone(d)

        return datetime.datetime(year, month, day,
                                 hour, minute, second, microsecond, tzinfo)
github profusion / sgqlc / sgqlc / types / datetime.py View on Github external
def converter(cls, s):
        if isinstance(s, datetime.date):
            return s
        m = cls._re_parse.match(s)
        if not m:
            raise ValueError('not in ISO 8601 format YYYY-MM-DD: %s' % s)

        year = int(m['Y'])
        month = int(m['m'])
        day = int(m['d'])
        return datetime.date(year, month, day)
github chaoss / grimoirelab-sortinghat / sortinghat / cli / client / schema.py View on Github external
Automatically generated using sgqlc tools.
"""

import sgqlc.types
import sgqlc.types.datetime


sh_schema = sgqlc.types.Schema()


########################################################################
# Scalars and Enumerations
########################################################################
Boolean = sgqlc.types.Boolean

DateTime = sgqlc.types.datetime.DateTime


class GenericScalar(sgqlc.types.Scalar):
    __schema__ = sh_schema


ID = sgqlc.types.ID

Int = sgqlc.types.Int


class OperationArgsType(sgqlc.types.Scalar):
    __schema__ = sh_schema


class OperationOpType(sgqlc.types.Enum):
github profusion / sgqlc / sgqlc / types / datetime.py View on Github external
year = int(m['Y'])
        month = int(m['m'])
        day = int(m['d'])
        hour = int(m['H'])
        minute = int(m['M'])
        second = int(m['S'])
        microsecond = int(m['MS'][1:] or 0)
        tzinfo = None
        if m['TZ'] == 'Z':
            tzinfo = datetime.timezone.utc
        elif m['TZ']:
            d = datetime.timedelta(hours=int(m['TZH']), minutes=int(m['TZM']))
            tzinfo = datetime.timezone(d)

        return datetime.datetime(year, month, day,
                                 hour, minute, second, microsecond, tzinfo)
github profusion / sgqlc / sgqlc / types / datetime.py View on Github external
if isinstance(s, datetime.time):
            return s
        m = cls._re_parse.match(s)
        if not m:
            raise ValueError('not in ISO 8601 format HH:MM:SS: %s' % s)

        hour = int(m['H'])
        minute = int(m['M'])
        second = int(m['S'])
        microsecond = int(m['MS'][1:] or 0)
        tzinfo = None
        if m['TZ'] == 'Z':
            tzinfo = datetime.timezone.utc
        elif m['TZ']:
            d = datetime.timedelta(hours=int(m['TZH']), minutes=int(m['TZM']))
            tzinfo = datetime.timezone(d)

        return datetime.time(hour, minute, second, microsecond, tzinfo)