(self, pattern: str, version: int)
return self.compare(comparator, left_value=version, right_value=version_)
Does the given version match the given pattern
Does the given version match the given pattern
Does the given version match the given pattern
def version_match(self, pattern: str, version: int) -> bool:
        """Does the given version match the given pattern"""
        match = re.match(r"(<|>|<=|>=|!=|=)(\d+)", pattern)
        if not match:
            sys.stderr.write("Invalid version\n")
            sys.exit(1)

        comparator, version_ = match.groups()

        try:
            version_ = int(version_)
        except TypeError:
            sys.stderr.write("Invalid version\n")
            sys.exit(1)

        return self.compare(comparator, left_value=version, right_value=version_)
def version_match ( self , pattern : str , version : int ) -> bool : match = re . match ( r"(<|>|<=|>=|!=|=)(\d+)" , pattern ) if not match : sys . stderr . write ( "Invalid version\n" ) sys . exit ( 1 ) comparator , version_ = match . groups ( ) try : version_ = int ( version_ ) except TypeError : sys . stderr . write ( "Invalid version\n" ) sys . exit ( 1 ) return self . compare ( comparator , left_value = version , right_value = version_ )