mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
move git commands to common/git.py (#31921)
move git into common/git.py old-commit-hash: 4fbc8a389662f82018eeabd03294cc761b87ce75
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user