Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
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):
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)
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)