12A猫で学んだこと-Memoir-

...What are you learning now?

レポート提出期限1時間前

from datetime import datetime

class Uncertain(NotImplementedError):
    def __init__(self, message):
        self.message = message

    def __str__(self):
        return f"UncertainException:{self.message}"

class Apathy(RuntimeError):
    def __str__(self):
        return "Apathy struck the writer."

def is_submitted(year, month):
    if (year, month) == (2019, 1):
        """ In January, 2019, there is no entry now. 
        However, if this script is to be submitted,
        then I can claim that an entry is posted.
        Hence,  ``True`` is returned.
        This is nothing but a sophistory...
        """
        return True

    """ This script is intended to write some posts,   
    with no regard to the contents in January, 2019.
    Hence, other cases is not to be implemented.
    """
    raise Uncertain("The past is fixed, but the future is to be changed.")

def write_something():
    raise Apathy()

def act():
    current_time = datetime.now()
    year = int(current_time.strftime("%Y"))
    month = int(current_time.strftime("%m"))

    """ Assured that an entry is submitted.
    """
    if not is_submitted(year, month):
        write_something()

if __name__ == "__main__":
    act()