simplify python_version markers#851
Conversation
Reviewer's Guide by SourceryThis pull request simplifies Sequence diagram for union simplification of python_version markerssequenceDiagram
participant MultiMarker
participant SingleMarker
participant VersionRange
MultiMarker->>SingleMarker: union(other: SingleMarker)
SingleMarker->>SingleMarker: get_python_constraint_from_marker()
SingleMarker->>VersionRange: allows_all(constraint)
alt other_constraint.allows_all(constraint)
SingleMarker-->>MultiMarker: return other
else
SingleMarker-->>MultiMarker: return None
end
Sequence diagram for intersect simplification of python_version markerssequenceDiagram
participant MarkerUnion
participant SingleMarker
participant VersionRange
MarkerUnion->>SingleMarker: intersect(other: SingleMarker)
SingleMarker->>SingleMarker: get_python_constraint_from_marker()
SingleMarker->>VersionRange: allows_all(other_constraint)
alt constraint.allows_all(other_constraint)
SingleMarker-->>MarkerUnion: return other
else
SingleMarker-->>MarkerUnion: return None
end
Updated class diagram for BaseMarker and related classesclassDiagram
class BaseMarker {
+complexity: Tuple[int, int]
+union(other: BaseMarker): BaseMarker | None
+intersect(other: BaseMarker): BaseMarker | None
}
class MultiMarker {
-markers: Set[BaseMarker]
+of(*markers: BaseMarker): BaseMarker
}
class MarkerUnion {
-markers: Set[BaseMarker]
+of(*markers: BaseMarker): BaseMarker
}
class SingleMarkerLike {
+name: str
+constraint: Constraint
}
class SingleMarker {
+name: str
+constraint: Constraint
}
class AnyMarker
class EmptyMarker
BaseMarker <|-- MultiMarker
BaseMarker <|-- MarkerUnion
BaseMarker <|-- SingleMarkerLike
SingleMarkerLike <|-- SingleMarker
BaseMarker <|-- AnyMarker
BaseMarker <|-- EmptyMarker
MultiMarker *-- BaseMarker : contains
MarkerUnion *-- BaseMarker : contains
note for BaseMarker "Added union and intersect methods for simplification"
note for MultiMarker "Added of method for simplification"
note for MarkerUnion "Added of method for simplification"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @radoering - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you're converting
python_version == "3.x" or python_version == "3.y"topython_version >= "3.x" and python_version < "3.(y+1)"- can you confirm this is the expected behavior? - It might be helpful to add a comment explaining the logic behind the changes in
_merge_single_markers.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
b10fdee to
faad967
Compare
More exactly,
Good point. I added a comment. |
faad967 to
a6d12a4
Compare
There was a problem hiding this comment.
Hey @radoering - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you're adding a lot of new tests, which is great, but some of them seem to have platform-specific conditions combined with python version, which might make them harder to read and maintain.
- Consider adding a helper function to simplify the creation of
MultiMarkerinstances in the tests, as there are several places where they are constructed manually.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Improve recognization and merging of adjacent ranges.
… building the cnf/dnf (python-poetry#851)
a6d12a4 to
b365852
Compare
… building the cnf/dnf (python-poetry#851)
b365852 to
f984002
Compare
There was a problem hiding this comment.
Hey @radoering - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like you're adding a lot of new tests, which is great, but some of them seem to be testing the same scenarios - can you reduce the redundancy?
- The change to
test_dependency_from_pep_508_with_python_versionintests/packages/test_main.pyseems related, but it's not immediately clear why it's needed - can you add a comment explaining the change?
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Which tests are redundant?
The change is necessary because otherwise the test will fail. |
Resolves: python-poetry/poetry#10249
Requires: python-poetry/poetry#10274
Summary by Sourcery
Tests:
python_versionmarkers.Summary by Sourcery
Tests:
python_versionmarkers.