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

Support for optional as UnionType (Python >= 3.10) #739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkomet
Copy link

@mkomet mkomet commented Jan 27, 2024

This resolves the issue #533

@mkomet mkomet force-pushed the mkomet/add-optional-uniontype branch 4 times, most recently from 7bba6a7 to 92d1179 Compare January 27, 2024 01:07
Signed-off-by: Meir Komet <mskomet1@gmail.com>
@mkomet mkomet force-pushed the mkomet/add-optional-uniontype branch from 92d1179 to 311dfaa Compare January 27, 2024 09:27
@mkomet mkomet changed the title Support for optional as UnionType (Python > 3.10) Support for optional as UnionType (Python >> 3.10) Jan 27, 2024
@mkomet mkomet changed the title Support for optional as UnionType (Python >> 3.10) Support for optional as UnionType (Python >= 3.10) Jan 28, 2024
@svlandeg svlandeg added feature New feature, enhancement or request p3 types Type hints and type checking labels Feb 28, 2024
@johnthagen
Copy link

Also closes

Another PR that also address this issue

@@ -816,8 +822,9 @@ def get_click_param(
is_tuple = False
parameter_type: Any = None
is_flag = None
is_union_type = lenient_issubclass(type(main_type), UnionType)

Choose a reason for hiding this comment

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

Hi, I'm new to this kind of stuff, could you please clarify this for me please? From the variable name, it is a type already, why do we need to convert it to type() here? Is it just your preference or there are some edge cases being handled implicitly here?

@johnthagen johnthagen mentioned this pull request May 2, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request p3 types Type hints and type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants