示例#1
0
        self.volume = volume
        self.page = page

    def __repr__(self):
        return 'Notice( volume=%s, page=%s )' % (repr(
            self.volume), repr(self.page))

    def __eq__(self, other):
        return isinstance(other, Notice) and repr(self) == repr(other)


class Delayed:
    pass


effective_date = (utils.Marker("effective") +
                  utils.Marker("date")).setParseAction(lambda: EffectiveDate())

notice_citation = (
    Word(string.digits) + utils.Marker('FR') +
    Word(string.digits)).setParseAction(lambda m: Notice(int(m[0]), int(m[1])))

delayed = utils.Marker("delayed").setParseAction(lambda: Delayed())


def int2Month(m):
    month = date(2000, m, 1)
    month = month.strftime('%B')
    token = utils.Marker(month)
    return token.setParseAction(lambda: m)
示例#2
0
def int2Month(m):
    month = date(2000, m, 1)
    month = month.strftime('%B')
    token = utils.Marker(month)
    return token.setParseAction(lambda: m)
def _month_parser(month_idx):
    """Separate function to account for lexical scoping on lambdas"""
    month_name = calendar.month_name[month_idx]
    return utils.Marker(month_name).setParseAction(lambda: month_idx)