Exemple #1
0
def filter_since_date(pubs, since_date):
    """Filter the publications after the since_date."""
    for pub in pubs:
        if isinstance(pub.get("year"), str):
            pub["year"] = int(pub.get("year"))
        pub["day"] = int(pub.get('day', 28))
        if is_after(pub, since_date):
            if not pub.get("month"):
                print("WARNING: {} is missing month".format(pub["_id"]))
            if pub.get("month") == "tbd".casefold():
                print("WARNING: month in {} is tbd".format(pub["_id"]))
            yield pub
Exemple #2
0
def filter_since_date(pubs, rc):
    """Filter the publications after the since_date."""
    for pub in pubs:
        if isinstance(pub.get("year"), str):
            pub["year"] = int(pub.get("year"))
        pub["day"] = int(pub.get('day', 28))
        pub["month"] = pub.get("month", "dec")
        if pub.get("month").casefold().strip() == 'tbd' or pub.get(
                "month").strip() == '':
            print("WARNING: {} is missing month".format(pub["_id"]))
            pub["month"] = "dec"
        if is_after(pub, rc.pub_since_date):
            yield pub
Exemple #3
0
def test_is_after(thing, expected, now=TEST_DATE):
    assert is_after(thing, now=now) == expected