-
Notifications
You must be signed in to change notification settings - Fork 35
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
ci(mypy): add mypy check and adjust code for types #439
Open
d33bs
wants to merge
11
commits into
cytomining:main
Choose a base branch
from
d33bs:add-mypy-checks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−25
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8478dbd
ci(mypy): add mypy check and adjust code for types
d33bs 92b91a1
remove redefinitions config
d33bs f8e7b36
update stubs and ignores
d33bs 90ffa30
update output for compression typing
d33bs 3bf75fb
update expanduser types for cell_locations
d33bs 52e2a4b
add ignore for change in types
d33bs 37a5ec7
adjust for typing
d33bs 8a363e7
update celllocations typing
d33bs 45f1803
remove ignores
d33bs 436e9c4
add missing library ignore settings; fix aggregate
d33bs b057fb1
add test condition for aggregate
d33bs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,20 @@ def test_output_default(): | |
result, DATA_DF, check_names=False, check_exact=False, atol=1e-3 | ||
) | ||
|
||
# test with an output_type of None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
output_result = output( | ||
df=DATA_DF, | ||
output_filename=output_filename, | ||
compression_options=TEST_COMPRESSION_OPTIONS, | ||
float_format=None, | ||
output_type=None, | ||
) | ||
result = pd.read_csv(output_result) | ||
|
||
pd.testing.assert_frame_equal( | ||
result, DATA_DF, check_names=False, check_exact=False, atol=1e-3 | ||
) | ||
|
||
|
||
def test_output_tsv(): | ||
# Test input filename of writing a tab separated file | ||
|
Oops, something went wrong.
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.
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.
This feels dangerous - perhaps we could throw a warning that None is not supported?
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.
This is standard way of checking if a default none argument has been passed.
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.
ah, I should clarify what I mean by "dangerous" - if a user explicitly sets
output_type=None
and expects certain behavior (e.g., outputting to variable and not writing), they may be surprised that we overwrite it tooutput_type="csv"
. Perhaps the solution isn't to throw a warning (maybe add to docstring)? Or, we could elect to do nothing if this is standard expected behavior.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.
Thanks for these comments! I had to make this change in order to integrate
aggregate
withoutput
properly given its default parameter types. I recognize we could change the defaults one direction or the other (withaggregate
oroutput
) but I didn't want to move too much outside of the scope of the changes here in order to get a first pass withmypy
. I wasn't sure about rationalizing a default value foraggregate
'soutput_type
if it wasn't going to use output. At the same time, I didn't want to change too much ofoutput
's default capabilities due to how it integrates with many other functions (could get complex for the scope of this PR).My feeling here was that if
output
was used at all that we'd expect to be "outputting" something, and that if None were passed to it foroutput_type
(especially for nested function calls) that it should revert to the default string value for the parameter inoutput
.