Skip to content

Third-party stubs: enforce CamelCase for type alias names#8256

Merged
AlexWaygood merged 8 commits into
masterfrom
third-party-aliases
Jul 19, 2022
Merged

Third-party stubs: enforce CamelCase for type alias names#8256
AlexWaygood merged 8 commits into
masterfrom
third-party-aliases

Conversation

@AlexWaygood
Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood commented Jul 7, 2022

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi Outdated
Comment thread stubs/html5lib/html5lib/_tokenizer.pyi Outdated
Comment thread stubs/psutil/psutil/__init__.pyi
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@srittau
Copy link
Copy Markdown
Collaborator

srittau commented Jul 7, 2022

A lot of aliases are marked as type aliases that I wouldn't consider type aliases. In my opinion as soon as an alias is used at runtime, I wouldn't consider it a type aliases. Examples are ordered_column_set in SQLAlchemy or pmem in psutil.

@AlexWaygood
Copy link
Copy Markdown
Member Author

AlexWaygood commented Jul 7, 2022

A lot of aliases are marked as type aliases that I wouldn't consider type aliases. In my opinion as soon as an alias is used at runtime, I wouldn't consider it a type aliases. Examples are ordered_column_set in SQLAlchemy or pmem in psutil.

I agree that these don't need to be type aliases necessarily. @hauntsaninja raised some objections the last time I tried to remove those markers from some of them (#8248 (review)), but I also don't think he has a strong objection (#8248 (review))

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Copy Markdown
Member Author

@srittau, does 27308f3 address your concerns?

@github-actions

This comment has been minimized.

# Ignore Y026, this isn't a type alias.
# We have to do `ordered_column_set = OrderedSet[_T]
# instead of `ordered_column_set = OrderedSet`,
# or pyright complains
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why doesn't pyright complain about column_set?

Copy link
Copy Markdown
Member Author

@AlexWaygood AlexWaygood Jul 19, 2022

Choose a reason for hiding this comment

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

I have no idea :/

Copy link
Copy Markdown
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

One optional suggestion

Comment thread stubs/psycopg2/psycopg2/_psycopg.pyi Outdated
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood merged commit e3d4bdc into master Jul 19, 2022
@AlexWaygood AlexWaygood deleted the third-party-aliases branch July 19, 2022 07:23
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