Skip to content

Add pytype testing options #499

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

Merged
merged 4 commits into from
Jun 10, 2020

Conversation

hjmjohnson
Copy link
Contributor

Related to #476

Description

Add additional pytype checks, and address the newly identified warnings.

Status

Ready

Types of changes

  • New tests added to cover the changes
  • Docstrings/Documentation updated

@hjmjohnson hjmjohnson mentioned this pull request Jun 6, 2020
11 tasks
@hjmjohnson hjmjohnson mentioned this pull request Jun 6, 2020
1 task
@hjmjohnson hjmjohnson force-pushed the add-pytype-testing-options branch 3 times, most recently from 1a91a35 to 80c9b0d Compare June 9, 2020 17:39
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@wyli
Copy link
Contributor

wyli commented Jun 9, 2020

/black
please leave comments if you request further changes @Nic-Ma @ericspod , otherwise I'll merge it tomorrow

@hjmjohnson hjmjohnson force-pushed the add-pytype-testing-options branch from 80c9b0d to 6dbbaf7 Compare June 9, 2020 20:22
@hjmjohnson hjmjohnson force-pushed the add-pytype-testing-options branch from 6dbbaf7 to 308cb58 Compare June 9, 2020 23:55
@hjmjohnson hjmjohnson mentioned this pull request Jun 10, 2020
1 task
- Add type concept for index selection types
- Enable precise return checking for invalid function calls
- Test solve unknown types to label with structural types

Add conceptual type for dictionary selection variables

Values used to select dictionary subsets must be
containers of hashable elements.

File "monai/monai/transforms/io/dictionary.py", line 55, in __init__:
Function LoadNiftid.__init__ was called with the wrong arguments [wrong-arg-types]
         Expected: (self, keys: Container[Hashable])
  Actually passed: (self, keys: Hashable)
  The following methods aren't implemented on Hashable:
  __iter__
File "monai/monai/transforms/croppad/dictionary.py", line 136, in randomize: Function monai.utils.misc.ensure_tuple was called with the wrong arguments [wrong-arg-types]
         Expected: (vals: Iterable)
  Actually passed: (vals: slice)
  The following methods aren't implemented on slice:
  __iter__
For backward compatibility, allow `keys` to accept either
a collection or a hashable item.  change self.keys to have
the required more strict value type than the
function parameter `keys`.
@hjmjohnson hjmjohnson force-pushed the add-pytype-testing-options branch from fa40d62 to 0acdefc Compare June 10, 2020 14:06
monai/transforms/intensity/dictionary.py:334: error: Incompatible types in assignment
  (expression has type "Union[Tuple[Any, ...], List[Any]]", variable has type "Tuple[float, Any]")
@hjmjohnson hjmjohnson force-pushed the add-pytype-testing-options branch from 0acdefc to 6359e43 Compare June 10, 2020 14:14
@hjmjohnson
Copy link
Contributor Author

@Nic-Ma I think all the requested changes have been made.

@hjmjohnson
Copy link
Contributor Author

@wyli @Nic-Ma This approved PR has now resolved all requested changes and is ready for merging.

Copy link
Contributor

@Nic-Ma Nic-Ma 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 to me now.
Thanks.

@Nic-Ma Nic-Ma merged commit 9b3d6e4 into Project-MONAI:master Jun 10, 2020
@hjmjohnson hjmjohnson deleted the add-pytype-testing-options branch June 15, 2020 15:40
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.

4 participants