class YearMonth: # I really don't like how this class is named and used but # past me is my own worst enemy and used it to make sorting on Dynamo easier VALID_YEARS = [2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030] VALID_MONTHS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] def __init__(self, year: int, month: int): if year not in YearMonth.VALID_YEARS: raise ValueError(f'Invalid year: {year}') if month not in YearMonth.VALID_MONTHS: raise ValueError(f'Invalid month: {month}') self._year = year self._month = month @property def month(self) -> int: return self._month @property def year(self) -> int: return self._year def __str__(self): return f'{self._year}-{self._month}'