Skip to content

Instantly share code, notes, and snippets.

@mlima-experian
mlima-experian / retries.py
Last active September 6, 2025 02:44
Retries
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:
@mlima-experian
mlima-experian / max_version.py
Created April 30, 2025 11:16
Get max software version of list artifacts
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