Skip to content

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

Closed
@IgnatovD

Description

@IgnatovD

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions