Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Stamps:
- all_stamps = []
- def __init__(self, validation_date: str, BG, MI, SC, Ivert, SG):
- self.stamp_id = None
- self.validation_date = validation_date
- self.validation_year = None
- self.BG = BG
- self.MI = MI
- self.SC = SC
- self.Ivert = Ivert
- self.SG = SG
- self.Period = None
- self.period_id = None
- self.year_id()
- self.period_info()
- self.ID_generator()
- Stamps.all_stamps.append(self)
- def year_id(self):
- day, month, year = map(str, self.validation_date.split('.'))
- self.validation_year = year
- def period_info(self):
- self.period_id = ""
- if int(self.validation_year) <= 1908:
- self.Period = "Principality of Bulgaria"
- self.period_id = 1
- elif int(self.validation_year) <= 1946:
- self.Period = "Kingdom of Bulgaria"
- self.period_id = 2
- elif int(self.validation_year) <= 1999:
- self.Period = "People's Republic of Bulgaria"
- self.period_id = 3
- else:
- self.Period = "Republic of Bulgaria"
- self.period_id = 4
- def ID_generator(self):
- self.stamp_id = f"{self.period_id}_{self.validation_year}_{self.BG}"
- # tests
- stamp1 = Stamps("01.05.1879", 1, 1, 1, 1, 1)
- stamp2 = Stamps("01.05.1879", 2, 2, 2, 2, 2)
- stamp348 = Stamps("25.02.1938", 348, 338, 324, 348, 326)
- stamp878 = Stamps("11.11.1952", 878, 836, 779, 836, 856)
- for stamp in Stamps.all_stamps:
- print(
- f"Postmark number according to BG catalog {stamp.BG} is an edition in {stamp.validation_year} and gets an ID: {stamp.stamp_id}. \n"
- f"It was issued during the period of {stamp.Period}\n"
- f"__________")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement