python39Packages.tomli: 1.2.1 -> 1.2.2, patch type error which occurs with mypy

This commit is contained in:
Sandro Jäckel 2021-11-15 00:36:21 +01:00
parent a5691cfc9a
commit ffb5403eb6
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5
2 changed files with 28 additions and 2 deletions

View file

@ -7,7 +7,7 @@
buildPythonPackage rec {
pname = "tomli";
version = "1.2.1";
version = "1.2.2";
format = "pyproject";
outputs = [
@ -19,9 +19,14 @@ buildPythonPackage rec {
owner = "hukkin";
repo = pname;
rev = version;
sha256 = "sha256-30AQ9MQmclcjl1d83mIoxFXzaJn1OFKQlVxayqC5NxY=";
sha256 = "sha256-oDjpNzWxTaCC1+WyBKrkR6kp90ZomcZQfyW+xKddDoM=";
};
patches = [
# required for mypy
./fix-backwards-compatibility-load.patch
];
nativeBuildInputs = [ flit-core ];
postInstall = ''

View file

@ -0,0 +1,21 @@
diff --git a/tomli/_parser.py b/tomli/_parser.py
index 89e81c3..6fb1bfd 100644
--- a/tomli/_parser.py
+++ b/tomli/_parser.py
@@ -1,6 +1,6 @@
import string
from types import MappingProxyType
-from typing import Any, BinaryIO, Dict, FrozenSet, Iterable, NamedTuple, Optional, Tuple
+from typing import IO, Union, Any, BinaryIO, Dict, FrozenSet, Iterable, NamedTuple, Optional, Tuple
import warnings
from tomli._re import (
@@ -48,7 +48,7 @@ class TOMLDecodeError(ValueError):
"""An error raised if a document is not valid TOML."""
-def load(fp: BinaryIO, *, parse_float: ParseFloat = float) -> Dict[str, Any]:
+def load(fp: Union[IO, BinaryIO], *, parse_float: ParseFloat = float) -> Dict[str, Any]:
"""Parse TOML from a binary file object."""
s_bytes = fp.read()
try: