chore(packages): remove type errors#339
Conversation
| new._constraint = constraint | ||
| new._pretty_constraint = str(constraint) | ||
|
|
||
| new.set_constraint(constraint) |
There was a problem hiding this comment.
before, this allowed constraint to be a str, although it seems the intention was for set_constraint to handle normalizing to VersionConstraint (as well as setting _pretty_constraint)
|
Kudos, SonarCloud Quality Gate passed!
|
| if isinstance(marker, (MultiMarker, MarkerUnion)): | ||
| groups[-1].append( | ||
| group_markers(marker.markers, isinstance(marker, MarkerUnion)) | ||
| group_markers(marker.markers, isinstance(marker, MarkerUnion)) # type: ignore[arg-type] |
There was a problem hiding this comment.
I got stuck here (in combination with the changed return type), but maybe not worth thinking about it since group_markers is not required anymore with #347. (The output of it seems to be in a weird form for representing or anyway.)
|
@branchvincent Can you rebase, please? (Sorry for the merge conflict.) 🙏 |
| link = Link(path_to_url(p)) | ||
|
|
||
| # it's a local file, dir, or url | ||
| dep: Dependency | None |
There was a problem hiding this comment.
suggestion: initialize the value to None here, rather than later.
| version = m.group("ver") | ||
|
|
||
| name = req.name or link.egg_fragment | ||
| name = cast(str, req.name or link.egg_fragment) |
There was a problem hiding this comment.
it's not clear what the intention of the (original) code is here: the name extracted only three lines previously is discarded here. So something has gone wrong and it would be good to take the opportunity to fix it.
My guess is that this whole fragment can be discarded (anyway that doesn't break any tests).
There was a problem hiding this comment.
(and if that's right then there are no users of egg_fragment left so maybe that can be discarded too)
|
|
||
| self.extras = {} | ||
| self.requires_extras = [] | ||
| self.extras: dict[str, list[str | Dependency]] = {} |
There was a problem hiding this comment.
pretty sure this should be dict[str, list[Dependency]]
| groups = group_markers([marker]) | ||
|
|
||
| requirements = {} | ||
| requirements: dict[str, list[list[tuple[str, str]]]] = {} |
There was a problem hiding this comment.
this is ConvertedMarkers isn't it?
| op = ">" | ||
|
|
||
| version = constraint.min.text | ||
| version: Version | str = constraint.min.text |
There was a problem hiding this comment.
or I think this can always be a string (without needing annotation) if you set version = constraint.max.text a few lines later
|
Closing this in favor of #354. |








Removes
poetry.core.packages.*from the ignored listRelates-to: python-poetry/poetry#5017