Skip to content
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

syntax warning of literal #3783

Closed
wyli opened this issue Feb 9, 2022 · 2 comments
Closed

syntax warning of literal #3783

wyli opened this issue Feb 9, 2022 · 2 comments
Assignees

Comments

@wyli
Copy link
Contributor

wyli commented Feb 9, 2022

Describe the bug
command:

./runtests.sh --clean; python -W error -c "import monai"

outcome:

  File "/Users/Documents/MONAI/monai/transforms/spatial/array.py", line 176
    if spatial_size is not -1 and spatial_size is not None:
       ^
SyntaxError: "is not" with a literal. Did you mean "!="?
@wyli wyli self-assigned this Feb 9, 2022
wyli added a commit to wyli/MONAI that referenced this issue Feb 9, 2022
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli
Copy link
Contributor Author

wyli commented Feb 9, 2022

patch included in #3773

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Feb 10, 2022

Hi @wyli ,

Thanks for your issue report, I also saw this warning yesterday, it's a warning from python 3.8+.
There is also another warning: "is" with a literal. Did you mean "=="?
Could you please help also identify and update it in your PR?

Here is the raw warnings I saw yesterday when testing the save_state PR:

root@apt-sh-ai:/workspace/data/medical/MONAI# python tests/test_save_state.py
"is not" with a literal. Did you mean "!="?
"is" with a literal. Did you mean "=="?
..........
----------------------------------------------------------------------
Ran 10 tests in 0.010s

OK

Thanks.

wyli added a commit to wyli/MONAI that referenced this issue Feb 10, 2022
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
@wyli wyli closed this as completed in 127e823 Feb 10, 2022
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

No branches or pull requests

2 participants