-
Notifications
You must be signed in to change notification settings - Fork 146
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
Type hinting improvements - mypy conformance #2051
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ADBond
force-pushed
the
type-hinting-improvements
branch
from
March 12, 2024 15:11
d3d9638
to
538721f
Compare
github-actions
bot
force-pushed
the
type-hinting-improvements
branch
from
March 12, 2024 15:11
538721f
to
cb6277e
Compare
ADBond
force-pushed
the
type-hinting-improvements
branch
from
March 14, 2024 08:28
1fdce96
to
946af97
Compare
final is not properly supported by mypy for property/setters. This form (on setter only, after setter decorator) means mypy is happy, but it won't complain if you overwrite this in a subclass, so only indicitive
ADBond
force-pushed
the
type-hinting-improvements
branch
from
March 14, 2024 10:04
1cea524
to
e146b48
Compare
ADBond
changed the title
[WIP] Type hinting improvements
Type hinting improvements - mypy conformance
Mar 14, 2024
RobinL
approved these changes
Mar 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Decreasing the number ofGetting the code to passmypy
errorsmypy
, mainly through adjusting type hints and renaming variables.I have added a github workflow for type-hinting
- under the assumption that I probably won't fix all the issues in this PR, I will switch it off before requesting review, and then switch on when doing further work, leaving it on eventually when it's all sortedwhich is now passing. If it is too prohibitive for the moment, we can always disable it while we get things tightened up.Have also cut out some of mypy checking, for now, to make it easier to build up to full conformance in pieces (slowly adding in all modules + rules).
More substantial changes:
Settings
is now always dialectedSettingsCreator.from_path_or_dict
cluster_studio
if not suppliedSplinkDataFrame
now an abstract base classmisc.read_resource
has guard for missing filetf_adjustment_chart
Note on
@final
and property/setters - these doesn't really work with mypy, so there is no way (afaict) to properly guard these against being overridden by subclasses. What you can do is@final
after@some_att.setter
, and mypy will be happy, but it will not complain if subclasses overwrite this. Have left it there as at least a hint to devs that they shouldn't implement these, even if it won't be enforced by mypy.From 148 errors down to 0.