From 18de28e7c10b97181ddb56e19442c49e0556e955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 14:51:39 +0000 Subject: [PATCH 1/4] chore(deps): bump requests from 2.32.4 to 2.33.0 in /docs Bumps [requests](https://github.com/psf/requests) from 2.32.4 to 2.33.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.32.4...v2.33.0) --- updated-dependencies: - dependency-name: requests dependency-version: 2.33.0 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- docs/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index ae8adb6..f50f265 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -60,7 +60,7 @@ pygments==2.19.1 # accessible-pygments # furo # sphinx -requests==2.32.4 +requests==2.33.0 # via sphinx roman-numerals==4.1.0 # via sphinx From 98150745620e8e9026a96ea2ba52a48d9a3d33e2 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Thu, 26 Mar 2026 20:46:25 +0530 Subject: [PATCH 2/4] fix: add ty: ignore comments to suppress ty type checker diagnostics Add suppression comments for: - unresolved-import: optional json2xml_rs Rust extension (guarded by try/except) - invalid-argument-type: tests intentionally passing wrong types - invalid-assignment: tests monkey-patching module functions Amp-Thread-ID: https://ampcode.com/threads/T-019d2ab6-a3d1-70a9-b3f7-c65e5c9199ab Co-authored-by: Amp --- json2xml/dicttoxml_fast.py | 6 +++--- tests/test_dict2xml.py | 10 +++++----- tests/test_json2xml.py | 4 ++-- tests/test_rust_dicttoxml.py | 4 ++-- tests/test_utils.py | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/json2xml/dicttoxml_fast.py b/json2xml/dicttoxml_fast.py index d356676..a0e35cd 100644 --- a/json2xml/dicttoxml_fast.py +++ b/json2xml/dicttoxml_fast.py @@ -24,9 +24,9 @@ _rust_dicttoxml = None try: - from json2xml_rs import dicttoxml as _rust_dicttoxml # type: ignore[import-not-found] # pragma: no cover - from json2xml_rs import escape_xml_py as rust_escape_xml # type: ignore[import-not-found] # pragma: no cover - from json2xml_rs import wrap_cdata_py as rust_wrap_cdata # type: ignore[import-not-found] # pragma: no cover + from json2xml_rs import dicttoxml as _rust_dicttoxml # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + from json2xml_rs import escape_xml_py as rust_escape_xml # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + from json2xml_rs import wrap_cdata_py as rust_wrap_cdata # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover _USE_RUST = True # pragma: no cover LOG.debug("Using Rust backend for dicttoxml") # pragma: no cover except ImportError: # pragma: no cover diff --git a/tests/test_dict2xml.py b/tests/test_dict2xml.py index 1d279f8..b50b54a 100644 --- a/tests/test_dict2xml.py +++ b/tests/test_dict2xml.py @@ -578,7 +578,7 @@ class CustomClass: # Should return the class name for unsupported types # Using type: ignore for intentional test of unsupported type - result = dicttoxml.get_xml_type(CustomClass()) # type: ignore[arg-type] + result = dicttoxml.get_xml_type(CustomClass()) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] assert result == "CustomClass" def test_make_valid_xml_name_invalid_chars(self) -> None: @@ -807,8 +807,8 @@ def patched_get_unique_id(element: str) -> str: this_id = module.make_id(element) # This exercises line 52 return ids[-1] - module.make_id = mock_make_id # type: ignore[assignment] - module.get_unique_id = patched_get_unique_id # type: ignore[assignment] + module.make_id = mock_make_id # type: ignore[assignment] # ty: ignore[invalid-assignment] + module.get_unique_id = patched_get_unique_id # type: ignore[assignment] # ty: ignore[invalid-assignment] try: result = dicttoxml.get_unique_id("test") @@ -874,7 +874,7 @@ class CustomClass: with pytest.raises(TypeError, match="Unsupported data type:"): dicttoxml.convert( - obj=CustomClass(), # type: ignore[arg-type] + obj=CustomClass(), # type: ignore[arg-type] # ty: ignore[invalid-argument-type] ids=None, attr_type=False, item_func=lambda x: "item", @@ -1024,7 +1024,7 @@ def mock_is_primitive(val: Any) -> bool: return True return original_is_primitive(val) - module.is_primitive_type = mock_is_primitive # type: ignore[assignment] + module.is_primitive_type = mock_is_primitive # type: ignore[assignment] # ty: ignore[invalid-assignment] try: item = {"@val": {"test": "data"}} result = dicttoxml.dict2xml_str( diff --git a/tests/test_json2xml.py b/tests/test_json2xml.py index 84c06d3..b08e580 100644 --- a/tests/test_json2xml.py +++ b/tests/test_json2xml.py @@ -56,12 +56,12 @@ def test_read_from_jsonstring(self) -> None: def test_read_from_invalid_string1(self) -> None: with pytest.raises(StringReadError) as pytest_wrapped_e: - readfromstring(1) # type: ignore[arg-type] + readfromstring(1) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] assert pytest_wrapped_e.type == StringReadError def test_read_from_invalid_string2(self) -> None: with pytest.raises(StringReadError) as pytest_wrapped_e: - readfromstring(jsondata=None) # type: ignore[arg-type] + readfromstring(jsondata=None) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] assert pytest_wrapped_e.type == StringReadError def test_read_from_invalid_jsonstring(self) -> None: diff --git a/tests/test_rust_dicttoxml.py b/tests/test_rust_dicttoxml.py index 6efbcef..aec21d0 100644 --- a/tests/test_rust_dicttoxml.py +++ b/tests/test_rust_dicttoxml.py @@ -12,8 +12,8 @@ # Check if Rust extension is available try: - from json2xml_rs import dicttoxml as rust_dicttoxml # type: ignore[import-not-found] - from json2xml_rs import escape_xml_py, wrap_cdata_py # type: ignore[import-not-found] + from json2xml_rs import dicttoxml as rust_dicttoxml # type: ignore[import-not-found] # ty: ignore[unresolved-import] + from json2xml_rs import escape_xml_py, wrap_cdata_py # type: ignore[import-not-found] # ty: ignore[unresolved-import] RUST_AVAILABLE = True except ImportError: RUST_AVAILABLE = False diff --git a/tests/test_utils.py b/tests/test_utils.py index f9346f2..4c985e6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -225,22 +225,22 @@ def test_readfromstring_complex_object(self) -> None: def test_readfromstring_invalid_type_int(self) -> None: """Test reading with integer input.""" with pytest.raises(StringReadError, match="Input is not a proper JSON string"): - readfromstring(123) # type: ignore[arg-type] + readfromstring(123) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] def test_readfromstring_invalid_type_list(self) -> None: """Test reading with list input.""" with pytest.raises(StringReadError, match="Input is not a proper JSON string"): - readfromstring(["not", "a", "string"]) # type: ignore[arg-type] + readfromstring(["not", "a", "string"]) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] def test_readfromstring_invalid_type_dict(self) -> None: """Test reading with dict input.""" with pytest.raises(StringReadError, match="Input is not a proper JSON string"): - readfromstring({"not": "a string"}) # type: ignore[arg-type] + readfromstring({"not": "a string"}) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] def test_readfromstring_invalid_type_none(self) -> None: """Test reading with None input.""" with pytest.raises(StringReadError, match="Input is not a proper JSON string"): - readfromstring(None) # type: ignore[arg-type] + readfromstring(None) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] def test_readfromstring_invalid_json_syntax(self) -> None: """Test reading string with invalid JSON syntax.""" From 1644b3b302fe987f4d9a8e99963106fb278e695e Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Thu, 26 Mar 2026 21:07:51 +0530 Subject: [PATCH 3/4] fix: lint --- json2xml/dicttoxml_fast.py | 12 +++++++++--- tests/test_rust_dicttoxml.py | 9 +++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/json2xml/dicttoxml_fast.py b/json2xml/dicttoxml_fast.py index a0e35cd..99ebbc4 100644 --- a/json2xml/dicttoxml_fast.py +++ b/json2xml/dicttoxml_fast.py @@ -24,9 +24,15 @@ _rust_dicttoxml = None try: - from json2xml_rs import dicttoxml as _rust_dicttoxml # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover - from json2xml_rs import escape_xml_py as rust_escape_xml # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover - from json2xml_rs import wrap_cdata_py as rust_wrap_cdata # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + from json2xml_rs import ( + dicttoxml as _rust_dicttoxml, # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + ) + from json2xml_rs import ( + escape_xml_py as rust_escape_xml, # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + ) + from json2xml_rs import ( + wrap_cdata_py as rust_wrap_cdata, # type: ignore[import-not-found] # ty: ignore[unresolved-import] # pragma: no cover + ) _USE_RUST = True # pragma: no cover LOG.debug("Using Rust backend for dicttoxml") # pragma: no cover except ImportError: # pragma: no cover diff --git a/tests/test_rust_dicttoxml.py b/tests/test_rust_dicttoxml.py index aec21d0..abc6155 100644 --- a/tests/test_rust_dicttoxml.py +++ b/tests/test_rust_dicttoxml.py @@ -12,8 +12,13 @@ # Check if Rust extension is available try: - from json2xml_rs import dicttoxml as rust_dicttoxml # type: ignore[import-not-found] # ty: ignore[unresolved-import] - from json2xml_rs import escape_xml_py, wrap_cdata_py # type: ignore[import-not-found] # ty: ignore[unresolved-import] + from json2xml_rs import ( + dicttoxml as rust_dicttoxml, # type: ignore[import-not-found] # ty: ignore[unresolved-import] + ) + from json2xml_rs import ( # type: ignore[import-not-found] # ty: ignore[unresolved-import] + escape_xml_py, + wrap_cdata_py, + ) RUST_AVAILABLE = True except ImportError: RUST_AVAILABLE = False From 411e1d722a89042dfbb64b28125003667e6e7666 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Thu, 26 Mar 2026 21:12:59 +0530 Subject: [PATCH 4/4] fix: move ty: ignore comments to individual import members in test_rust_dicttoxml Amp-Thread-ID: https://ampcode.com/threads/T-019d2ab6-a3d1-70a9-b3f7-c65e5c9199ab Co-authored-by: Amp --- tests/test_rust_dicttoxml.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_rust_dicttoxml.py b/tests/test_rust_dicttoxml.py index abc6155..36e3707 100644 --- a/tests/test_rust_dicttoxml.py +++ b/tests/test_rust_dicttoxml.py @@ -15,9 +15,9 @@ from json2xml_rs import ( dicttoxml as rust_dicttoxml, # type: ignore[import-not-found] # ty: ignore[unresolved-import] ) - from json2xml_rs import ( # type: ignore[import-not-found] # ty: ignore[unresolved-import] - escape_xml_py, - wrap_cdata_py, + from json2xml_rs import ( # type: ignore[import-not-found] + escape_xml_py, # ty: ignore[unresolved-import] + wrap_cdata_py, # ty: ignore[unresolved-import] ) RUST_AVAILABLE = True except ImportError: