mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-11 21:54:16 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
72ad6dc953
commit
f4cd1ba0d6
813 changed files with 66015 additions and 58839 deletions
|
|
@ -1,3 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
from typing import cast
|
||||
from typing import Dict
|
||||
|
|
@ -6,11 +8,11 @@ from typing import TypeVar
|
|||
from typing import Union
|
||||
|
||||
|
||||
__all__ = ["Stash", "StashKey"]
|
||||
__all__ = ['Stash', 'StashKey']
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
D = TypeVar("D")
|
||||
T = TypeVar('T')
|
||||
D = TypeVar('D')
|
||||
|
||||
|
||||
class StashKey(Generic[T]):
|
||||
|
|
@ -63,10 +65,10 @@ class Stash:
|
|||
some_bool = stash[some_bool_key]
|
||||
"""
|
||||
|
||||
__slots__ = ("_storage",)
|
||||
__slots__ = ('_storage',)
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._storage: Dict[StashKey[Any], object] = {}
|
||||
self._storage: dict[StashKey[Any], object] = {}
|
||||
|
||||
def __setitem__(self, key: StashKey[T], value: T) -> None:
|
||||
"""Set a value for key."""
|
||||
|
|
@ -79,7 +81,7 @@ class Stash:
|
|||
"""
|
||||
return cast(T, self._storage[key])
|
||||
|
||||
def get(self, key: StashKey[T], default: D) -> Union[T, D]:
|
||||
def get(self, key: StashKey[T], default: D) -> T | D:
|
||||
"""Get the value for key, or return default if the key wasn't set
|
||||
before."""
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue