Apply suggestions from code review

Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
Adam J. Stewart 2023-05-13 21:16:16 -05:00 committed by GitHub
parent 713e801e6f
commit 42fddd3b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -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.

View File

@ -295,12 +295,7 @@ class MonkeyPatch:
self._setitem.append((dic, name, dic.get(name, notset)))
dic[name] = value
def delitem(
self,
dic: Mapping[K, V],
name: K,
raising: bool = True,
) -> None:
def delitem(self, dic: Mapping[K, V], name: K, raising: bool = True) -> None:
"""Delete ``name`` from dict.
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
False.
"""
environ: Mapping[str, str] = os.environ
environ: MutableMapping[str, str] = os.environ
self.delitem(environ, name, raising=raising)
def syspath_prepend(self, path) -> None: