-
Notifications
You must be signed in to change notification settings - Fork 3k
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
refactor(ingestion): improve Source.create type hints #8620
refactor(ingestion): improve Source.create type hints #8620
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.
LGTM
Looks like there's a lint issue - it needs double quotes instead of single quotes
Use a Generic variable for the `cls` and return value of the `Source.create` method. This allows type hinters, such as Pyright/VSCode, to correctly predict the return value of Source implementations. Previously, it would only return `Source`, preventing implementations from correctly referencing itself. Closes datahub-project#8358 Signed-off-by: Lucas Roesler <lucas@contiamo.com>
b9c2af0
to
a626a96
Compare
Sorry, I thought VSCode had already formatted it. I ran |
Looks like we may need to tighten our type annotations in a couple other places in the codebase:
|
Closing in favor of #12325 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Continue to review full report in Codecov by Sentry.
|
Use a Generic variable for the
cls
and return value of theSource.create
method. This allows type hinters, such as Pyright/VSCode, to correctly predict the return value of Source implementations. Previously, it would only returnSource
, preventing implementations from correctly referencing itself.Closes #8358
Checklist