예제 #1
0
def quarter_from(text):
    estimated = text.endswith('(E)')
    text = text[:-3] if estimated else text
    comp = text.split('/')
    return Quarter(year=int(comp[0]),
                   number=int(int(comp[1]) / 3),
                   estimated=estimated)
예제 #2
0
def quarter_from(text: str) -> Quarter:
    if (not text) or ('/' not in text):
        return None
    estimated = text.endswith('(E)')
    text = text[:-3] if estimated else text
    comp = text.split('/')
    return Quarter(year=int(comp[0]), number=int(int(comp[1]) / 3), estimated=estimated)