[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
2e6e5f7288
commit
6092c2455f
|
@ -2,9 +2,9 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import typing
|
||||||
import warnings
|
import warnings
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
import typing
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
from typing import List
|
from typing import List
|
||||||
|
@ -130,7 +130,13 @@ class MonkeyPatch:
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._setattr: List[Tuple[object, str, object]] = []
|
self._setattr: List[Tuple[object, str, object]] = []
|
||||||
self._setitem: List[Tuple[Union[MutableMapping[Any, Any], "typing.TypedDict[Any, Any]"], object, object]] = []
|
self._setitem: List[
|
||||||
|
Tuple[
|
||||||
|
Union[MutableMapping[Any, Any], "typing.TypedDict[Any, Any]"],
|
||||||
|
object,
|
||||||
|
object,
|
||||||
|
]
|
||||||
|
] = []
|
||||||
self._cwd: Optional[str] = None
|
self._cwd: Optional[str] = None
|
||||||
self._savesyspath: Optional[List[str]] = None
|
self._savesyspath: Optional[List[str]] = None
|
||||||
|
|
||||||
|
@ -291,12 +297,22 @@ class MonkeyPatch:
|
||||||
self._setattr.append((target, name, oldval))
|
self._setattr.append((target, name, oldval))
|
||||||
delattr(target, name)
|
delattr(target, name)
|
||||||
|
|
||||||
def setitem(self, dic: Union[MutableMapping[K, V], "typing.TypedDict[K, V]"], name: K, value: V) -> None:
|
def setitem(
|
||||||
|
self,
|
||||||
|
dic: Union[MutableMapping[K, V], "typing.TypedDict[K, V]"],
|
||||||
|
name: K,
|
||||||
|
value: V,
|
||||||
|
) -> None:
|
||||||
"""Set dictionary entry ``name`` to value."""
|
"""Set dictionary entry ``name`` to value."""
|
||||||
self._setitem.append((dic, name, dic.get(name, notset)))
|
self._setitem.append((dic, name, dic.get(name, notset)))
|
||||||
dic[name] = value
|
dic[name] = value
|
||||||
|
|
||||||
def delitem(self, dic: Union[MutableMapping[K, V], "typing.TypedDict[K, V]"], name: K, raising: bool = True) -> None:
|
def delitem(
|
||||||
|
self,
|
||||||
|
dic: Union[MutableMapping[K, V], "typing.TypedDict[K, V]"],
|
||||||
|
name: K,
|
||||||
|
raising: bool = True,
|
||||||
|
) -> None:
|
||||||
"""Delete ``name`` from dict.
|
"""Delete ``name`` from dict.
|
||||||
|
|
||||||
Raises ``KeyError`` if it doesn't exist, unless ``raising`` is set to
|
Raises ``KeyError`` if it doesn't exist, unless ``raising`` is set to
|
||||||
|
|
Loading…
Reference in New Issue