-
-
Notifications
You must be signed in to change notification settings - Fork 431
refactor: improve import formatting and type hinting consistency across modules #4058
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, thank you!
@@ -80,7 +80,7 @@ def create_string_constrained_field_schema( | |||
schema.max_length = kwarg_definition.max_length | |||
if kwarg_definition.pattern: | |||
schema.pattern = ( | |||
kwarg_definition.pattern.pattern # type: ignore[attr-defined] | |||
kwarg_definition.pattern.pattern # type: ignore[attr-defined,unused-ignore] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kwarg_definition.pattern.pattern # type: ignore[attr-defined,unused-ignore] | |
kwarg_definition.pattern.pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this is raising linter errors locally but not in CI. I'm wondering if it's a difference between pylance/pyright?
@@ -22,5 +22,5 @@ def get_typed_init(self, type_: Any) -> tuple[Signature, dict[str, Any]]: | |||
inspect.Parameter(name=field_name, kind=inspect.Parameter.KEYWORD_ONLY, annotation=Any) | |||
for field_name in model_fields | |||
] | |||
type_hints = {field_name: Any for field_name in model_fields} | |||
type_hints = dict.fromkeys(model_fields, Any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally find the other method more readable as it's more explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a Ruff automated upgrade that's been recently added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we ignore it?
I'm not sure why the documentation tests are hanging. I'll have to take a deeper look at this. I haven't another PR that's doing the same thing. |
…ss modules This PR also updates the dependency and tests against the latest versions of ruff and pyright.
This PR also updates the dependency and tests against the latest versions of ruff and pyright.
There are also a few documentations related updates for Advanced Alchemy 1.0