Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type-hints in function definitions #194

Merged
merged 10 commits into from
Dec 5, 2024
Merged

Conversation

neNasko1
Copy link
Contributor

@neNasko1 neNasko1 commented Dec 2, 2024

As there are current efforts to refactor spox and prepare it for a 1.0 release I have decided to look around the codebase for places where additional typing information can be provided. The changes are mainly around type-hinting in function declarations.

This PR centres around the following diff and fixing the type-errors discovered by it:

diff --git a/pyproject.toml b/pyproject.toml
index 8f5e249..ec2459f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -62,6 +62,7 @@ ignore_missing_imports = true
 no_implicit_optional = true
 check_untyped_defs = true
 warn_unused_ignores = true
+disallow_untyped_defs = true
 
 [tool.pytest.ini_options]
 # This will be pytest's future default.

type: ignore-s are only introduced in parts of the code that deals with the deprecated operator_overloading functionality.

Copy link
Collaborator

@cbourjau cbourjau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have just two minor comments.

src/spox/_function.py Outdated Show resolved Hide resolved
src/spox/_adapt.py Outdated Show resolved Hide resolved
@neNasko1 neNasko1 requested a review from cbourjau December 4, 2024 12:34
src/spox/_fields.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@cbourjau cbourjau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! I have but one minor comment.

src/spox/_schemas.py Outdated Show resolved Hide resolved
@neNasko1 neNasko1 requested a review from cbourjau December 4, 2024 18:27
@cbourjau cbourjau merged commit d3396ef into main Dec 5, 2024
18 checks passed
@cbourjau cbourjau deleted the add-type-annotations branch December 5, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants