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

silx.gui.plot: Added Python typing #3957

Merged
merged 2 commits into from
Oct 27, 2023
Merged

silx.gui.plot: Added Python typing #3957

merged 2 commits into from
Oct 27, 2023

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Oct 26, 2023

Merge PR #3956 first!

This PR adds some Python typing on existing functions/methods done while working on PR #3956.
To make it easier to review I splitted it in 2 PRs.
This one only containing the typing once PR #3956 is merged

@t20100 t20100 added this to the 2.0.0 milestone Oct 26, 2023
@t20100 t20100 requested a review from vallsv October 26, 2023 15:13
@vallsv
Copy link
Contributor

vallsv commented Oct 27, 2023

You can replace

  • typing.Any by object
  • typing.Union[a, b] by a | b
  • typing.Optional[a] by a | None

That's less stuffs to import

But this enforce to import the future annotation.

@t20100
Copy link
Member Author

t20100 commented Oct 27, 2023

I didn't knew you can use | with types with Python3.7, that's great: https://peps.python.org/pep-0604/#change-only-pep-484-type-hints-to-accept-the-syntax-type1-type2

@t20100
Copy link
Member Author

t20100 commented Oct 27, 2023

Updated typing.Union[a, b] -> a | b and typing.Optional[a] -> a | None

@t20100 t20100 merged commit b3e2bfa into silx-kit:main Oct 27, 2023
7 checks passed
@t20100 t20100 deleted the typing branch October 27, 2023 16:11
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.

2 participants