Advertisement
Nenogzar

stamp_catalog

Feb 25th, 2024
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | None | 0 0
  1. class Stamps:
  2.     all_stamps = []
  3.  
  4.     def __init__(self, validation_date: str, BG, MI, SC, Ivert, SG):
  5.         self.stamp_id = None
  6.         self.validation_date = validation_date
  7.         self.validation_year = None
  8.         self.BG = BG
  9.         self.MI = MI
  10.         self.SC = SC
  11.         self.Ivert = Ivert
  12.         self.SG = SG
  13.         self.Period = None
  14.         self.period_id = None
  15.  
  16.  
  17.         self.year_id()
  18.  
  19.         self.period_info()
  20.  
  21.         self.ID_generator()
  22.  
  23.         Stamps.all_stamps.append(self)
  24.  
  25.     def year_id(self):
  26.         day, month, year = map(str, self.validation_date.split('.'))
  27.         self.validation_year = year
  28.  
  29.     def period_info(self):
  30.         self.period_id = ""
  31.         if int(self.validation_year) <= 1908:
  32.             self.Period = "Principality of Bulgaria"
  33.             self.period_id = 1
  34.         elif int(self.validation_year) <= 1946:
  35.             self.Period = "Kingdom of Bulgaria"
  36.             self.period_id = 2
  37.         elif int(self.validation_year) <= 1999:
  38.             self.Period = "People's Republic of Bulgaria"
  39.             self.period_id = 3
  40.         else:
  41.             self.Period = "Republic of Bulgaria"
  42.             self.period_id = 4
  43.  
  44.     def ID_generator(self):
  45.         self.stamp_id = f"{self.period_id}_{self.validation_year}_{self.BG}"
  46.  
  47. # tests
  48. stamp1 = Stamps("01.05.1879", 1, 1, 1, 1, 1)
  49. stamp2 = Stamps("01.05.1879", 2, 2, 2, 2, 2)
  50. stamp348 = Stamps("25.02.1938", 348, 338, 324, 348, 326)
  51. stamp878 = Stamps("11.11.1952", 878, 836, 779, 836, 856)
  52.  
  53. for stamp in Stamps.all_stamps:
  54.     print(
  55.         f"Postmark number according to BG catalog {stamp.BG} is an edition in {stamp.validation_year} and gets an ID: {stamp.stamp_id}. \n"
  56.         f"It was issued during the period of {stamp.Period}\n"
  57.         f"__________")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement