MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / SemVer

Class SemVer

commitizen/version_schemes.py:296–329  ·  view source on GitHub ↗

Semantic Versioning (SemVer) scheme See: https://semver.org/spec/v1.0.0.html

Source from the content-addressed store, hash-verified

294
295
296class SemVer(BaseVersion):
297 """
298 Semantic Versioning (SemVer) scheme
299
300 See: https://semver.org/spec/v1.0.0.html
301 """
302
303 def __str__(self) -> str:
304 parts: list[str] = []
305
306 # Epoch
307 if self.epoch != 0:
308 parts.append(f"{self.epoch}!")
309
310 # Release segment
311 parts.append(".".join(str(x) for x in self.release))
312
313 # Pre-release
314 if self.prerelease:
315 parts.append(f"-{self.prerelease}")
316
317 # Post-release
318 if self.post is not None:
319 parts.append(f"-post{self.post}")
320
321 # Development release
322 if self.dev is not None:
323 parts.append(f"-dev{self.dev}")
324
325 # Local version segment
326 if self.local:
327 parts.append(f"+{self.local}")
328
329 return "".join(parts)
330
331
332class SemVer2(SemVer):

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…