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

Consistently use Python 3.10 type annotations #263

Merged
merged 12 commits into from
Feb 5, 2025
Merged

Conversation

kklein
Copy link
Collaborator

@kklein kklein commented Feb 5, 2025

No description provided.

Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 93.75000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 92.54%. Comparing base (1429f9d) to head (c8a84f7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/datajudge/requirements.py 66.66% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #263      +/-   ##
==========================================
- Coverage   92.61%   92.54%   -0.07%     
==========================================
  Files          18       18              
  Lines        2044     2053       +9     
==========================================
+ Hits         1893     1900       +7     
- Misses        151      153       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kklein kklein added the ready label Feb 5, 2025
@kklein kklein marked this pull request as ready for review February 5, 2025 10:24
@kklein kklein requested a review from ivergara February 5, 2025 10:24
name: str | None = None,
output_processors: OutputProcessor
| list[OutputProcessor]
| None = output_processor_limit,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why a None did sneak in here?

Copy link
Collaborator Author

@kklein kklein Feb 5, 2025

Choose a reason for hiding this comment

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

Before this change, output_processors annotated with Optional[Union[OutputProcessor, List[OutputProcessor]].

If we convert the Optional, this gives us:
Union[OutputProcessor, List[OutputProcessor] | None.

If we now also covert the Union and (List to list), this gives us OutputProcessor | list[OutputProcessor] | None, which, afaict corresponds to the suggested change.

Does that make sense?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems I missed a step in the chain of transformations.

] = output_processor_limit,
output_processors: OutputProcessor
| list[OutputProcessor]
| None = output_processor_limit,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

Union[OutputProcessor, List[OutputProcessor]]
] = output_processor_limit,
ref2: DataReference | None = None,
ref_value: Any = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not critical, but the change from optional any to any feels wrong. But probably is an issue that Any is too vague to start with.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see your point. Do you suggestion yet?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have no suggestion. Well, one, but it's quite vague. To create a type that reflects what a ref_value can be. But it feels too much work for little gain.

@kklein kklein merged commit be00292 into main Feb 5, 2025
84 checks passed
@kklein kklein deleted the future_type_annotations branch February 5, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants