





# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


__lowercase  :   List[str]						      =re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""")

@total_ordering
@dataclass
class      A       :
      _snake_case							     =42
      _snake_case							     =None
      _snake_case							     =None
      _snake_case							     =None
      _snake_case							     =None



      def 	lowerCAmelCase__    (	self:						List[str]       )						->    str:
         '''simple docstring'''

         UpperCAmelCase_						,       UpperCAmelCase_						,       UpperCAmelCase_											=_str_to_version_tuple(self.version_str       )



      def __repr__(	self:						Dict       )						->    str:
         '''simple docstring'''

         return F'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'



      @property
      def 	lowerCAmelCase__    (	self:						Optional[Any]       )						->    Dict:
         '''simple docstring'''

         return self.major, self.minor, self.patch



      def 	lowerCAmelCase__    (	self:						str		,  _lowerCAmelCase:						int       )						->    List[Any]:
         '''simple docstring'''

         if isinstance(_lowerCAmelCase		,  _lowerCAmelCase       ):
            return Version(_lowerCAmelCase       )
         elif isinstance(_lowerCAmelCase		,  _lowerCAmelCase       ):
            return other
         raise TypeError(F'{other} (type {type(_lowerCAmelCase       )}) cannot be compared to version.'       )



      def __eq__(	self:						Union[str, Any]		,  _lowerCAmelCase:						Optional[Any]       )						->    str:
         '''simple docstring'''

         try:
            UpperCAmelCase_											=self._validate_operand(_lowerCAmelCase       )
         except (TypeError, ValueError):
            return False
         else:
            return self.tuple == other.tuple



      def __lt__(	self:						str		,  _lowerCAmelCase:						Union[str, Any]       )						->    Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_											=self._validate_operand(_lowerCAmelCase       )
         return self.tuple < other.tuple



      def __hash__(	self:						str       )						->    str:
         '''simple docstring'''

         return hash(_version_tuple_to_str(self.tuple       )       )



      @classmethod
      def 	lowerCAmelCase__    (	cls:						str		,  _lowerCAmelCase:						Any       )						->    List[Any]:
         '''simple docstring'''

         UpperCAmelCase_											={f.name for f in dataclasses.fields(cls       )}
         return cls(**{k: v for k, v in dic.items() if k in field_names}       )






      def 	lowerCAmelCase__    (	self:						List[str]       )						->    str:
         '''simple docstring'''

         return self.version_str




def     a__ (					lowercase__  ):






   '''simple docstring'''






   UpperCAmelCase_											=_VERSION_REG.match(lowercase__  )
   if not res:
      raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'  )
   return tuple(int(lowercase__  ) for v in [res.group("major"  ), res.group("minor"  ), res.group("patch"  )]  )





def     a__ (					lowercase__  ):






   '''simple docstring'''






   return ".".join(str(lowercase__  ) for v in version_tuple  )











__lowercase  :   Optional[Any]						      =[
    (1000, """M"""),
    (900, """CM"""),
    (500, """D"""),
    (400, """CD"""),
    (100, """C"""),
    (90, """XC"""),
    (50, """L"""),
    (40, """XL"""),
    (10, """X"""),
    (9, """IX"""),
    (5, """V"""),
    (4, """IV"""),
    (1, """I"""),
]




def     a__ (					lowercase__  ):






   '''simple docstring'''






   UpperCAmelCase_											={"I": 1, "V": 5, "X": 1_0, "L": 5_0, "C": 1_0_0, "D": 5_0_0, "M": 1_0_0_0}
   UpperCAmelCase_											=0
   UpperCAmelCase_											=0
   while place < len(lowercase__  ):
      if (place + 1 < len(lowercase__  )) and (vals[roman[place]] < vals[roman[place + 1]]):
         total += vals[roman[place + 1]] - vals[roman[place]]
         place += 2
      else:
         total += vals[roman[place]]
         place += 1
   return total




def     a__ (					lowercase__  ):






   '''simple docstring'''






   UpperCAmelCase_											=[]
   for arabic, roman in ROMAN:
      ((UpperCAmelCase_)						,       (UpperCAmelCase_))											=divmod(lowercase__  ,    lowercase__  )
      result.append(roman * factor  )
      if number == 0:
         break
   return "".join(lowercase__  )


if __name__ == "__main__":
     import doctest

     doctest.testmod()




