Conversation
PR Check ResultsEcosystemℹ️ ecosystem check detected changes. (+6, -6, 0 error(s)) airflow (+4, -4)
- [*] 16066 fixable with the `--fix` option (6343 hidden fixes can be enabled with the `--unsafe-fixes` option). + [*] 16069 fixable with the `--fix` option (6343 hidden fixes can be enabled with the `--unsafe-fixes` option). - airflow/providers/google/cloud/hooks/bigquery.py:1580:35: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`. + airflow/providers/google/cloud/hooks/bigquery.py:1580:35: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`. - airflow/providers/google/cloud/hooks/bigquery.py:1587:14: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`. + airflow/providers/google/cloud/hooks/bigquery.py:1587:14: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`. - airflow/providers/smtp/hooks/smtp.py:103:15: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[smtplib.SMTP_SSL | smtplib.SMTP]`. + airflow/providers/smtp/hooks/smtp.py:103:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[smtplib.SMTP_SSL | smtplib.SMTP]`. bokeh (+2, -2)
- [*] 17800 fixable with the `--fix` option (4727 hidden fixes can be enabled with the `--unsafe-fixes` option). + [*] 17801 fixable with the `--fix` option (4727 hidden fixes can be enabled with the `--unsafe-fixes` option). - src/bokeh/core/validation/decorators.py:67:13: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[Error | Warning]`. + src/bokeh/core/validation/decorators.py:67:13: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Error | Warning]`.
|
| checker | ||
| .generator() | ||
| .expr(&Expr::Subscript(ast::ExprSubscript { | ||
| value: Box::new(Expr::Name(ast::ExprName { | ||
| id: "type".into(), | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| })), | ||
| slice: Box::new(Expr::Subscript(ast::ExprSubscript { | ||
| value: Box::new(Expr::Name(ast::ExprName { | ||
| id: "Union".into(), | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| })), | ||
| slice: Box::new(Expr::Tuple(ast::ExprTuple { | ||
| elts: type_members | ||
| .into_iter() | ||
| .map(|type_member| { | ||
| Expr::Name(ast::ExprName { | ||
| id: type_member, | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| }) | ||
| }) | ||
| .collect(), | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| })), | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| })), | ||
| ctx: ExprContext::Load, | ||
| range: TextRange::default(), | ||
| })) |
There was a problem hiding this comment.
is there a shorthand for any of this?
There was a problem hiding this comment.
That is NOT what I wanted to hear! 🤣 Thanks anyways.
There was a problem hiding this comment.
Hopefully clear that I mean the abstractions are bad, and not your code :)
There was a problem hiding this comment.
🤣 of course.
...but why not both?
|
I think Is your first question still relevant? It looks like stuff outside of the |
mmm, that answers my question! I'll dig into that. Thanks! |
|
On second thought, it's probably not worth the complexity. But we should ensure that |
checker
.semantic()
.resolve_call_path(subscript.value.as_ref())
.is_some_and(|call_path| matches!(call_path.as_slice(), ["" | "builtins", "type"]))is this code starting on line 83 not doing that? or is it not explicit enough? |
|
It's not quite sufficient, because that would also match |
Summary
Adds autofix for
PYI055Questions:
def func():gets fixed? 🤔 I feel like some of the top-level variables would also be affected.w: builtins.type[int] | builtins.type[str] | builtins.type[complex]turn intow: builtins.type[int | str | complex]?w: type[int | str | complex]?Test Plan
cargo test, and manually.