[python] requirements.txt: check entries regardless of dash/underscore in the package name (PY-65403, PY-70173)

Since pip [normalizes](https://github.com/pypa/packaging-problems/issues/230) underscores to dashes, PyCharm should treat them equally for requirements.txt entries

GitOrigin-RevId: 62149b9c64c67936f1405c7bf282a288e8d52764
This commit is contained in:
lada.gagina
2024-05-03 19:08:31 +02:00
committed by intellij-monorepo-bot
parent 202b9dbc47
commit 625373b47a
3 changed files with 7 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ data class PyRequirementImpl(private val name: String,
override fun match(packages: Collection<PyPackage>): PyPackage? {
return packages.firstOrNull { `package` ->
name.equals(`package`.name, true)
name.replace('_', '-').equals(`package`.name.replace('_', '-'), true)
&& versionSpecs.all { it.matches(`package`.version) }
}
}