Пример #1
0
STRF_DT_MAP = {'%d': lambda tdt, yds: '%02d' % tdt.day,
               '%f': lambda tdt, yds: '%d' % tdt.microsecond,
               '%H': lambda tdt, yds: '%02d' % tdt.hour,
               '%j': lambda tdt, yds: '%03d' % (tdt.toordinal() -
                                            date(tdt.year, 1, 1).toordinal() +
                                            1),
               '%m': lambda tdt, yds: '%02d' % tdt.month,
               '%M': lambda tdt, yds: '%02d' % tdt.minute,
               '%S': lambda tdt, yds: '%02d' % tdt.second,
               '%w': lambda tdt, yds: '%1d' % tdt.isoweekday(),
               '%W': lambda tdt, yds: '%02d' % tdt.isocalendar()[1],
               '%Y': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % yds) % tdt.year),
               '%C': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % (yds - 2)) % (tdt.year / 100)),
               '%h': lambda tdt, yds: tz_isoformat(tdt, '%h'),
               '%Z': lambda tdt, yds: tz_isoformat(tdt, '%Z'),
               '%z': lambda tdt, yds: tz_isoformat(tdt, '%z'),
               '%%': lambda tdt, yds: '%'}

STRF_D_MAP = {'%d': lambda tdt, yds: '%02d' % tdt.days,
              '%f': lambda tdt, yds: '%d' % tdt.microseconds,
              '%H': lambda tdt, yds: '%02d' % (tdt.seconds / 60 / 60),
              '%m': lambda tdt, yds: '%02d' % tdt.months,
              '%M': lambda tdt, yds: '%02d' % ((tdt.seconds / 60) % 60),
              '%S': lambda tdt, yds: '%02d' % (tdt.seconds % 60),
              '%W': lambda tdt, yds: '%02d' % (abs(tdt.days / 7)),
              '%Y': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % yds) % tdt.years),
              '%C': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % (yds - 2)) %
Пример #2
0
STRF_DT_MAP = {'%d': lambda tdt, yds: '%02d' % tdt.day,
               '%f': lambda tdt, yds: '%d' % tdt.microseconds,
               '%H': lambda tdt, yds: '%02d' % tdt.hour,
               '%j': lambda tdt, yds: '%03d' % (tdt.toordinal() -
                                            date(tdt.year, 1, 1).toordinal() +
                                            1),
               '%m': lambda tdt, yds: '%02d' % tdt.month,
               '%M': lambda tdt, yds: '%02d' % tdt.minute,
               '%S': lambda tdt, yds: '%02d' % tdt.second,
               '%w': lambda tdt, yds: '%1d' % tdt.isoweekday(),
               '%W': lambda tdt, yds: '%02d' % tdt.isocalendar()[1],
               '%Y': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % yds) % tdt.year),
               '%C': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % (yds - 2)) % (tdt.year / 100)),
               '%h': lambda tdt, yds: tz_isoformat(tdt.tzinfo, '%h'),
               '%Z': lambda tdt, yds: tz_isoformat(tdt.tzinfo, '%Z'),
               '%z': lambda tdt, yds: tz_isoformat(tdt.tzinfo, '%z'),
               '%%': lambda tdt, yds: '%'}

STRF_D_MAP = {'%d': lambda tdt, yds: '%02d' % tdt.days,
              '%f': lambda tdt, yds: '%d' % tdt.microseconds,
              '%H': lambda tdt, yds: '%02d' % (tdt.seconds / 60 / 60),
              '%m': lambda tdt, yds: '%02d' % tdt.months,
              '%M': lambda tdt, yds: '%02d' % ((tdt.seconds / 60) % 60),
              '%S': lambda tdt, yds: '%02d' % (tdt.seconds % 60),
              '%W': lambda tdt, yds: '%02d' % (abs(tdt.days / 7)),
              '%Y': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % yds) % tdt.years),
              '%C': lambda tdt, yds: (((yds != 4) and '+') or '') +\
                                   (('%%0%dd' % (yds - 2)) %
Пример #3
0
    "%M":
    lambda tdt, yds: "%02d" % tdt.minute,
    "%S":
    lambda tdt, yds: "%02d" % tdt.second,
    "%w":
    lambda tdt, yds: "%1d" % tdt.isoweekday(),
    "%W":
    lambda tdt, yds: "%02d" % tdt.isocalendar()[1],
    "%Y":
    lambda tdt, yds: (((yds != 4) and "+") or "") + (
        ("%%0%dd" % yds) % tdt.year),
    "%C":
    lambda tdt, yds: (((yds != 4) and "+") or "") + (("%%0%dd" % (yds - 2)) %
                                                     (tdt.year / 100)),
    "%h":
    lambda tdt, yds: tz_isoformat(tdt, "%h"),
    "%Z":
    lambda tdt, yds: tz_isoformat(tdt, "%Z"),
    "%z":
    lambda tdt, yds: tz_isoformat(tdt, "%z"),
    "%%":
    lambda tdt, yds: "%",
}

STRF_D_MAP = {
    "%d":
    lambda tdt, yds: "%02d" % tdt.days,
    "%f":
    lambda tdt, yds: "%06d" % tdt.microseconds,
    "%H":
    lambda tdt, yds: "%02d" % (tdt.seconds / 60 / 60),
Пример #4
0
D_ALT_EXT_ORD = "P" + DATE_EXT_ORD_COMPLETE + "T" + TIME_EXT_COMPLETE
D_ALT_BAS_ORD = "P" + DATE_BAS_ORD_COMPLETE + "T" + TIME_BAS_COMPLETE

STRF_DT_MAP = {
    "%d": lambda tdt, yds: "%02d" % tdt.day,
    "%f": lambda tdt, yds: "%d" % tdt.microsecond,
    "%H": lambda tdt, yds: "%02d" % tdt.hour,
    "%j": lambda tdt, yds: "%03d" % (tdt.toordinal() - date(tdt.year, 1, 1).toordinal() + 1),
    "%m": lambda tdt, yds: "%02d" % tdt.month,
    "%M": lambda tdt, yds: "%02d" % tdt.minute,
    "%S": lambda tdt, yds: "%02d" % tdt.second,
    "%w": lambda tdt, yds: "%1d" % tdt.isoweekday(),
    "%W": lambda tdt, yds: "%02d" % tdt.isocalendar()[1],
    "%Y": lambda tdt, yds: (((yds != 4) and "+") or "") + (("%%0%dd" % yds) % tdt.year),
    "%C": lambda tdt, yds: (((yds != 4) and "+") or "") + (("%%0%dd" % (yds - 2)) % (tdt.year / 100)),
    "%h": lambda tdt, yds: tz_isoformat(tdt, "%h"),
    "%Z": lambda tdt, yds: tz_isoformat(tdt, "%Z"),
    "%z": lambda tdt, yds: tz_isoformat(tdt, "%z"),
    "%%": lambda tdt, yds: "%",
}

STRF_D_MAP = {
    "%d": lambda tdt, yds: "%02d" % tdt.days,
    "%f": lambda tdt, yds: "%d" % tdt.microseconds,
    "%H": lambda tdt, yds: "%02d" % (tdt.seconds / 60 / 60),
    "%m": lambda tdt, yds: "%02d" % tdt.months,
    "%M": lambda tdt, yds: "%02d" % ((tdt.seconds / 60) % 60),
    "%S": lambda tdt, yds: "%02d" % (tdt.seconds % 60),
    "%W": lambda tdt, yds: "%02d" % (abs(tdt.days / 7)),
    "%Y": lambda tdt, yds: (((yds != 4) and "+") or "") + (("%%0%dd" % yds) % tdt.years),
    "%C": lambda tdt, yds: (((yds != 4) and "+") or "") + (("%%0%dd" % (yds - 2)) % (tdt.years / 100)),
Пример #5
0
    '%M':
    lambda tdt, yds: '%02d' % tdt.minute,
    '%S':
    lambda tdt, yds: '%02d' % tdt.second,
    '%w':
    lambda tdt, yds: '%1d' % tdt.isoweekday(),
    '%W':
    lambda tdt, yds: '%02d' % tdt.isocalendar()[1],
    '%Y':
    lambda tdt, yds: (((yds != 4) and '+') or '') + (
        ('%%0%dd' % yds) % tdt.year),
    '%C':
    lambda tdt, yds: (((yds != 4) and '+') or '') + (('%%0%dd' % (yds - 2)) %
                                                     (tdt.year / 100)),
    '%Tests':
    lambda tdt, yds: tz_isoformat(tdt, '%Tests'),
    '%Z':
    lambda tdt, yds: tz_isoformat(tdt, '%Z'),
    '%z':
    lambda tdt, yds: tz_isoformat(tdt, '%z'),
    '%%':
    lambda tdt, yds: '%'
}

STRF_D_MAP = {
    '%d':
    lambda tdt, yds: '%02d' % tdt.days,
    '%f':
    lambda tdt, yds: '%06d' % tdt.microseconds,
    '%H':
    lambda tdt, yds: '%02d' % (tdt.seconds / 60 / 60),