move git commands to common/git.py (#31921)

move git into common/git.py
old-commit-hash: 4fbc8a389662f82018eeabd03294cc761b87ce75
This commit is contained in:
Justin Newberry
2024-03-19 15:39:09 -04:00
committed by GitHub
parent eba689d638
commit a5bc36ea9d
14 changed files with 86 additions and 69 deletions
+12
View File
@@ -1,3 +1,11 @@
from collections.abc import Callable
from functools import lru_cache
from typing import TypeVar
_RT = TypeVar("_RT")
class Freezable:
_frozen: bool = False
@@ -9,3 +17,7 @@ class Freezable:
if self._frozen:
raise Exception("cannot modify frozen object")
super().__setattr__(*args, **kwargs)
def cache(user_function: Callable[..., _RT], /) -> Callable[..., _RT]:
return lru_cache(maxsize=None)(user_function)