Comments (1)
Thanks for the feedback!
I agree that .coerce()
should not fail on that input; however, 000
does not match clause 9 of the spec: numeric identifiers in a pre-release version must not contain leading zeroes.
A good test value would be:
>>> Version.coerce("01.02.03-04.0a.000023.000bcd+05")
Version("1.2.3-4.0a.23.000bcd+05")
- The build metadata is untouched (leading zeroes are allowed);
- Numerical identifiers in the pre-release part have their leading zeroes stripped;
- Non-numerical identifiers in that pre-release part are untouched.
I guess the code should instead look like this:
if prerelease:
clean_prerelease = ".".join([
bit.lstrip("0") or "0" if bit.isdigit() else bit
for bit in prerelease.split(".")
])
version = "%s-%s" % (version, clean_prerelease)
from python-semanticversion.
Related Issues (20)
- Support NPM verison ">=" following by a whitespace HOT 9
- `SimpleSpec` with Caret and Prerelease Wrong Behavior HOT 5
- Incorrect compare version with `partial=True` in Python 2 HOT 2
- unstable sort in case where versions only differ in their build HOT 12
- Add topics (keywords) in the About section of the repository page HOT 2
- Comparison with suffixes is just alphabetical HOT 1
- Conda Package HOT 5
- Constraints not properly evaluated for prerelease versions HOT 2
- [Feature Request] Support type hints HOT 5
- Check if two specs overlap/intersect HOT 4
- Is there a regex for validating strings containing SimpleSpec? HOT 2
- Truncate doesn't always return new object HOT 1
- Official support for 3.11 please HOT 3
- semantic_version.match emits a PendingDeprecationWarning HOT 1
- Support For Checking Intersection of SimpleSpec HOT 1
- RFE: is it possible to start making github releases?🤔 HOT 2
- add mypy support (annotations) HOT 1
- Equivalent of coerce for SimpleSpec ?
- Django model fields do not raise the correct error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-semanticversion.