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

SyntaxWarning: "is" with a literal. Did you mean "=="? #728

Closed
IgnatovD opened this issue Mar 13, 2023 · 9 comments
Closed

SyntaxWarning: "is" with a literal. Did you mean "=="? #728

IgnatovD opened this issue Mar 13, 2023 · 9 comments
Labels

Comments

@IgnatovD
Copy link

IgnatovD commented Mar 13, 2023

Hi all!

If I install python>=3.8.1 and segmentation-models-pytorch==0.32.2, then an warning occurs on import import segmentation_models_pytorch as smp. The warning appears in library pretrainedmodels.

Python 3.9.15 (main, Mar 13 2023, 09:18:54) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import segmentation_models_pytorch as smp
/home/jovyan/.cache/pypoetry/virtualenvs/s-outer-seg-sem-facade-mvp280223smp-82NsP1dj-py3.9/lib/python3.9/site-packages/pretrainedmodels/models/dpn.py:255: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if block_type is 'proj':
/home/jovyan/.cache/pypoetry/virtualenvs/s-outer-seg-sem-facade-mvp280223smp-82NsP1dj-py3.9/lib/python3.9/site-packages/pretrainedmodels/models/dpn.py:258: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif block_type is 'down':
/home/jovyan/.cache/pypoetry/virtualenvs/s-outer-seg-sem-facade-mvp280223smp-82NsP1dj-py3.9/lib/python3.9/site-packages/pretrainedmodels/models/dpn.py:262: SyntaxWarning: "is" with a literal. Did you mean "=="?
  assert block_type is 'normal'

The warning disappears when I install python 3.7.5.

In segmentation version 0.3.1 updated Codebase refactoring and style checks (black, flake8). I think the problem is in the flake8. And in python 3.7.5. maybe flake8 is being ignored.

Is there a way to disable flake8? To turn off the warning python >= 3.8.

@qubvel
Copy link
Collaborator

qubvel commented Mar 17, 2023

Hi, flake8 is not integrated into the package itself, it is just check code for each commit in CI/CD GitHub actions

@qubvel
Copy link
Collaborator

qubvel commented Mar 17, 2023

I guess it might be a native python warning that has been introduced in 3.9

@TCherici
Copy link

This is an issue stemming from the dependency on the pretrainedmodels package, which seems to be effectively unmaintained since ~2018.
A fix for this issue was already presented in 2020, but is yet to be reviewed and merged.

I'm not too sure of how easy it would be to drop this dependency, as I'm not familiar with this repository's codebase, but I'd be willing to help out

@qubvel
Copy link
Collaborator

qubvel commented Mar 22, 2023

This would be not so easy to drop, but the warning could be just caught with warnings.filterwarnings. You could try it in your code and propose PR to smp. Thanks.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 22, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@rusmux
Copy link

rusmux commented Aug 12, 2023

@qubvel Any progress on this?

@TCherici
Copy link

@rusmux What version of segmentation_models_pytorch are you running? I can't seem to reproduce the issue with the latest version (0.3.3)

@rusmux
Copy link

rusmux commented Aug 16, 2023

Yeah, sorry, seems like I was using outdated version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants