-
Notifications
You must be signed in to change notification settings - Fork 235
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
Make pre commit code changes #345
Make pre commit code changes #345
Conversation
@@ -11,7 +11,7 @@ flaky | |||
freezegun==0.3.9 | |||
ipdb | |||
mock>=1.3.0 | |||
mypy==0.782 | |||
mypy==0.950 |
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.
MyPy would not pass the way the code was written. Why? MyPy has a delineation between Type Variables
and TypeAlias
s. To force dynamic classes such as Relation
to be read as TypeAlias
s , we need a newer version of MyPy for use of type_extensions
.
If anyone goes digging, they'll find that eventually typing
gets TypeAlias
as a native member in later versions of Python, but this doesn't include all dbt
s supported versions of Python. This solution was selected as the more surgical approach. I had begun to rewrite Spark-specific code but this felt really, really unsatisfactory and would have taken up needed development time. Hence, this.
Thankfully, changing the MyPy version doesn't result in any negative effects (I ran this over --all-files
to be sure).
… str's instead of Optional[str]'s
82935c8
to
27681c5
Compare
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 to me. thanks for picking this up and fantastic work!
if 'temporarily_unavailable' in message: | ||
return exc.message | ||
return None | ||
def _is_retryable_error(exc: Exception) -> str: |
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.
Nice refactor!
For places like this where it's a refactor and not just formatting, can you call those out in the comments to make reviewing easier? Then it's easy to see what needs a closer look vs some newlines or spacing
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!
* Make pre commit code changes (#345) * Refactor exception function using accurate type specs. * Upgrade the mypy version in order to use TypeAlias-es. * Upgrade the mypy version in the worfklow. Fix bug introduced by using str's instead of Optional[str]'s * Address code review comments: Remove integration test command since there are multiple ways we can run tests in spark.
* Add commit hook tooling. (#346) * Make pre commit code changes (#345) * Refactor exception function using accurate type specs. * Upgrade the mypy version in order to use TypeAlias-es. * Upgrade the mypy version in the worfklow. Fix bug introduced by using str's instead of Optional[str]'s * Address code review comments: Remove integration test command since there are multiple ways we can run tests in spark. * Add changelog entry * Altering names of dev_requirements references.
resolves #292
Description
This PR is a combination of:
pre-commit
Checklist
CHANGELOG.md
and added information about my change to the "dbt-spark next" section.