python3Packages.tomli: 1.2.2 -> 2.0.1

https://github.com/hukkin/tomli/blob/2.0.1/CHANGELOG.md#201
This commit is contained in:
Martin Weinelt
2022-03-14 00:29:05 +01:00
parent 98d4760be8
commit f432820813
3 changed files with 9 additions and 62 deletions
@@ -3,6 +3,7 @@
, callPackage
, fetchFromGitHub
, flit-core
, python
# important downstream dependencies
, flit
@@ -13,40 +14,28 @@
buildPythonPackage rec {
pname = "tomli";
version = "1.2.2";
version = "2.0.1";
format = "pyproject";
outputs = [
"out"
"testsout"
];
src = fetchFromGitHub {
owner = "hukkin";
repo = pname;
rev = version;
sha256 = "sha256-oDjpNzWxTaCC1+WyBKrkR6kp90ZomcZQfyW+xKddDoM=";
sha256 = "sha256-v0ZMrHIIaGeORwD4JiBeLthmnKZODK5odZVL0SY4etA=";
};
patches = [
# required for mypy
./fix-backwards-compatibility-load.patch
];
nativeBuildInputs = [ flit-core ];
postInstall = ''
mkdir $testsout
cp -R benchmark/ pyproject.toml tests/ $testsout/
'';
pythonImportsCheck = [ "tomli" ];
# check in passthru.tests.pytest to escape infinite recursion with setuptools-scm
doCheck = false;
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
passthru.tests = {
pytest = callPackage ./tests.nix { };
# test downstream dependencies
inherit flit black mypy setuptools-scm;
};
@@ -1,21 +0,0 @@
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:
@@ -1,21 +0,0 @@
{ buildPythonPackage
, tomli
, pytestCheckHook
, python-dateutil
}:
buildPythonPackage rec {
pname = "tomli-tests";
inherit (tomli) version;
src = tomli.testsout;
dontBuild = true;
dontInstall = true;
checkInputs = [
pytestCheckHook
python-dateutil
tomli
];
}