I get this warning when checking the return value of pydoc.locate not to be None:
Remove this identity check; it will always be True.sonarlint(python:S5727)
But this is a false positive as the None is a subtype of object, and the pydoc.locate could return a None if the object not exits (see: pydoc.py:L1730)
To reproduce you can use this dummy function:
import pydoc
def f():
res = pydoc.locate("modul.Obj")
if res is not None: # <--- Remove this identity check; it will always be True.sonarlint(python:S5727)
return res
raise ModuleNotFoundError()
Name: SonarLint
Id: SonarSource.sonarlint-vscode
Description: SonarLint is an IDE extension that helps you detect and fix quality issues as you write code in C, C++, Java, JavaScript, PHP, Python, HTML and TypeScript.
Version: 3.15.1
Publisher: SonarSource
VS Marketplace Link: SonarLint - Visual Studio Marketplace