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

bug fix for help from typing package, add test for optional and union #513

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jemeljanov
Copy link

@Jemeljanov Jemeljanov commented May 21, 2024

Closes #508

Fixed bug where objects from typing instance were not displayed correctly mentioned in #508 and also Union types.

Added tests for typing.Union and typing.Optional

Other notes

Removed comment as the edge case mentioned is handled by new code.

Used arg_type = repr(arg_type).replace('typing.', '') to output a shorter message for user

Copy link

google-cla bot commented May 21, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

fire/helptext_test.py Outdated Show resolved Hide resolved
@dbieber
Copy link
Member

dbieber commented May 22, 2024

Thanks for putting this together! At a quick glance, this LGTM. One comment inline above.

@Jemeljanov
Copy link
Author

Jemeljanov commented May 22, 2024

@dbieber it was a little bit different behaviour now it will be Optional[Union[int, str]], the Optional is because the default is None.

Now it is more in compliance with the typing in python code and a more robust version than with regular expression.

Additional check is to prevent the Optional repetition (one added from python-fire the other from typing package).

@Jemeljanov Jemeljanov requested a review from dbieber May 23, 2024 15:36
@dbieber
Copy link
Member

dbieber commented Sep 21, 2024

I only just enabled CI for pull requests so this didn't surface earlier -- it looks like there are some test failures.

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.

Optional type args are mistyped in help
2 participants