Apply suggestions from code review
Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
parent
713e801e6f
commit
42fddd3b0c
|
@ -1 +1 @@
|
||||||
Fixed bug where monkeypatch setitem/delitem type annotations didn't support typing.TypedDict.
|
The `monkeypatch` `setitem`/`delitem` type annotations now allow `TypedDict` arguments.
|
||||||
|
|
|
@ -295,12 +295,7 @@ class MonkeyPatch:
|
||||||
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(
|
def delitem(self, dic: Mapping[K, V], name: K, raising: bool = True) -> None:
|
||||||
self,
|
|
||||||
dic: Mapping[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
|
||||||
|
@ -341,7 +336,7 @@ class MonkeyPatch:
|
||||||
Raises ``KeyError`` if it does not exist, unless ``raising`` is set to
|
Raises ``KeyError`` if it does not exist, unless ``raising`` is set to
|
||||||
False.
|
False.
|
||||||
"""
|
"""
|
||||||
environ: Mapping[str, str] = os.environ
|
environ: MutableMapping[str, str] = os.environ
|
||||||
self.delitem(environ, name, raising=raising)
|
self.delitem(environ, name, raising=raising)
|
||||||
|
|
||||||
def syspath_prepend(self, path) -> None:
|
def syspath_prepend(self, path) -> None:
|
||||||
|
|
Loading…
Reference in New Issue