-
Notifications
You must be signed in to change notification settings - Fork 670
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
Fix apply_configs decorator causing function signature to be lost #1858
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Looks good - minor nitpick but plese feel free to merge after fixing it
@@ -643,7 +649,7 @@ def describe_table( | |||
@apply_configs | |||
def create_ctas_table( # pylint: disable=too-many-locals | |||
sql: str, | |||
database: str, | |||
database: Optional[str] = None, |
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.
Nitpick - could you fix it in the docs below too?
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Feature or Bugfix
Detail
The definition for
apply_configs
so far has beenCallable[..., Any] -> Callable[..., Any]
. This means that IntelliSense as well as MyPy were not able to do check the types whenever a function decorated withapply_configs
was called. Functions such aswr.s3.to_parquet
were therefore treated as having a signature ofCallable[..., Any] -> Callable[..., Any]
.By changing the definition of
apply_configs
to make use of generic types, MyPy was able to find errors related to inconsistent type usages (e.g.Optional[str]
being passed asstr
). As such, I've had to fix all these type errors as part of this PR.Furthermore, since making this change, the auto-complete in Visual Studio Code is now able to pick up types for functions such as
wr.s3.to_parquet
again.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.