'A@SEP' : 'BA-SEP', 'A@OCT' : 'BA-OCT', 'A@NOV' : 'BA-NOV', 'A@DEC' : 'BA-DEC', # lite aliases 'Min': 'T', 'min': 'T', 'ms': 'L', 'us': 'U' } for i, weekday in enumerate(['MON', 'TUE', 'WED', 'THU', 'FRI']): for iweek in xrange(4): name = 'WOM-%d%s' % (iweek + 1, weekday) _offset_map[name] = offsets.WeekOfMonth(week=iweek, weekday=i) _rule_aliases[name.replace('-', '@')] = name _legacy_reverse_map = dict((v, k) for k, v in _rule_aliases.iteritems()) # for helping out with pretty-printing and name-lookups _offset_names = {} for name, offset in _offset_map.iteritems(): if offset is None: continue offset.name = name _offset_names[offset] = name def inferTimeRule(index):
'A@SEP': 'BA-SEP', 'A@OCT': 'BA-OCT', 'A@NOV': 'BA-NOV', 'A@DEC': 'BA-DEC', # lite aliases 'Min': 'T', 'min': 'T', 'ms': 'L', 'us': 'U' } for _i, _weekday in enumerate(['MON', 'TUE', 'WED', 'THU', 'FRI']): for _iweek in range(4): _name = 'WOM-%d%s' % (_iweek + 1, _weekday) _offset_map[_name] = offsets.WeekOfMonth(week=_iweek, weekday=_i) _rule_aliases[_name.replace('-', '@')] = _name # Note that _rule_aliases is not 1:1 (d[BA]==d[A@DEC]), and so traversal # order matters when constructing an inverse. we pick one. #2331 _legacy_reverse_map = dict((v, k) for k, v in reversed(sorted(_rule_aliases.items()))) # for helping out with pretty-printing and name-lookups _offset_names = {} for name, offset in _offset_map.items(): if offset is None: continue offset.name = name _offset_names[offset] = name