aboutcode-org / aboutcode-org/univers

`VersionConstraint.version` is allowed to be `None`

Đang mở
#33 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
50
Fork
29
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Is is more of a design decision than an issue.

Let's consider that in a place far far away, someone writes a piece code to get versions from all the constraints:
```py
>>> vr = VersionRange.from_string("vers:npm/1.1|2.2")
>>> range_versions = [c.version for c in vr.constraints]
>>> range_versions
[SemverVersion(string='1.1'), SemverVersion(string='2.2')]
```
Everything is nice and good until we meet `vers:ANY/*`
```py
>>> vr = VersionRange.from_string("vers:npm/*")
>>> range_versions = [c.version for c in vr.constraints]
>>> range_versions
[None]
```
Suddenly, `range_versions` break all expectations and contains a value value of `NoneType` than `Version`
A possible fix would be to allow `None` versions, such as `Version(None)`

Introduced here:
https://github.com/nexB/univers/blob/83e4fa651da7868f5c6f7c05a006bfadaac8d1cd/src/univers/version_constraint.py#L70

Related:
https://github.com/nexB/univers/issues/10
https://github.com/nexB/univers/issues/19

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.