This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import TypeVar, Callable | |
import time | |
import requests | |
T = TypeVar('T') | |
def retry(n: int, z: int, fn: Callable[[], T]) -> T: | |
try: | |
return fn() | |
except Exception as e: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import fnmatch | |
def parse_version(version_str: str, replace_str: str = None) -> dict: | |
if replace_str: | |
version_str = version_str.replace(replace_str, "") | |
VERSION_REGEX = re.compile( | |
r'(?P<major>[0-9]+)' # major number | |
r'\.' # literal . character | |
r'(?P<minor>[0-9]+)' # minor number |