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

Fix apply_configs decorator causing function signature to be lost #1858

Merged
merged 3 commits into from
Dec 13, 2022

Conversation

LeonLuttenberger
Copy link
Contributor

@LeonLuttenberger LeonLuttenberger commented Dec 12, 2022

Feature or Bugfix

  • Bugfix
  • Refactoring

Detail

The definition for apply_configs so far has been Callable[..., Any] -> Callable[..., Any]. This means that IntelliSense as well as MyPy were not able to do check the types whenever a function decorated with apply_configs was called. Functions such as wr.s3.to_parquet were therefore treated as having a signature of Callable[..., 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 as str). 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.

@malachi-constant

This comment was marked as outdated.

@malachi-constant

This comment was marked as outdated.

@malachi-constant

This comment was marked as outdated.

@malachi-constant

This comment was marked as outdated.

@malachi-constant

This comment was marked as outdated.

Copy link
Contributor

@jaidisido jaidisido left a 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,
Copy link
Contributor

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?

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: f89c6e3
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-4rfo0GHQ0u9a
  • Commit ID: 63335b5
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@LeonLuttenberger LeonLuttenberger merged commit 58a2b2f into main Dec 13, 2022
@LeonLuttenberger LeonLuttenberger deleted the fix/decorator-function-signature branch December 13, 2022 15:38
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.

None yet

3 participants