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

move git into common/git.py
This commit is contained in:
Justin Newberry
2024-03-19 15:39:09 -04:00
committed by GitHub
parent d647361fae
commit 4fbc8a3896
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)