Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Jan 28, 2025
1 parent a6efcaf commit 4c427b5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ See the docs overview at [https://cz-nic.github.io/mininterface/](https://cz-nic

# Gallery

Some of the projects that reduced the code base thanks to the mininterface.
These projects have the code base reduced thanks to the mininterface:

* **[deduplidog](https://github.com/CZ-NIC/deduplidog/)** – Find duplicates in a scattered directory structure
* **[touch-timestamp](https://github.com/CZ-NIC/touch-timestamp/)** – A powerful dialog to change the files' timestamp
Expand Down
7 changes: 3 additions & 4 deletions mininterface/auxiliary.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ def subclass_matches_annotation(cls, annotation) -> bool:

# simple types like scalars
try:
return issubclass(cls, annotation) # TODO tuple[int, str] is not a class
except Exception:
print("135: cls, annotation", cls, " ––– ", annotation) # TODO
raise
return issubclass(cls, annotation) # cls=tuple[int, str] raises an error since Python 3.13
except TypeError:
return False


def serialize_structure(obj):
Expand Down
3 changes: 1 addition & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,7 @@ def test_subclass_matches_annotation(self):
self.assertFalse(subclass_matches_annotation(int, annotation))

# The subclass_matches_annotation is not almighty. Tag behaves better:
self.assertTrue(Tag(annotation=annotation)._is_subclass(tuple[int, str])) # TODO
# TODO fails issubclass(tuple[int, str], ...) arg 1 must be a class
self.assertTrue(Tag(annotation=annotation)._is_subclass(tuple[int, str]))
# NOTE but this should work too
# self.assertTrue(Tag(annotation=annotation)._is_subclass(list[int]))

Expand Down

0 comments on commit 4c427b5

Please sign in to comment.