Segments
Epoch
Bases: Representation
, String
Represents the epoch segment of the version (e!
).
Source code in versions/segments/epoch.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
create(value: int = DEFAULT_VALUE) -> Self
classmethod
Creates an Epoch
from value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value of the epoch. |
DEFAULT_VALUE
|
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/epoch.py
22 23 24 25 26 27 28 29 30 31 32 |
|
from_string(string: str) -> Self
classmethod
Parses an Epoch
from string
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to parse. |
required |
Returns:
Type | Description |
---|---|
Self
|
The parsed epoch. |
Source code in versions/segments/epoch.py
34 35 36 37 38 39 40 41 42 43 44 |
|
to_string() -> str
Converts an Epoch
to its string representation.
Returns:
Type | Description |
---|---|
str
|
The epoch string. |
Source code in versions/segments/epoch.py
46 47 48 49 50 51 52 |
|
set_value(value: int) -> Self
Sets the value of the epoch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated epoch. |
Source code in versions/segments/epoch.py
54 55 56 57 58 59 60 61 62 63 |
|
next_value() -> Self
Increments the value of the epoch.
Returns:
Type | Description |
---|---|
Self
|
The next epoch. |
Source code in versions/segments/epoch.py
65 66 67 68 69 70 71 |
|
Local
Bases: Representation
, String
Represents the local segment of the version (+local.n
)
Source code in versions/segments/local.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
parts: LocalParts = field(eq=False, order=False)
class-attribute
instance-attribute
The local segment parts.
create(parts: LocalParts) -> Local
classmethod
Creates a Local
segment from local parts
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parts |
LocalParts
|
The local parts. |
required |
Returns:
Type | Description |
---|---|
Local
|
The newly created |
Source code in versions/segments/local.py
48 49 50 51 52 53 54 55 56 57 58 |
|
from_iterable(iterable: Iterable[LocalPart]) -> Self
classmethod
Creates a Local
segment from iterable
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterable |
Iterable[LocalPart]
|
The local parts in an iterable. |
required |
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/local.py
60 61 62 63 64 65 66 67 68 69 70 |
|
from_parts(*parts: LocalPart) -> Self
classmethod
Creates a Local
segment from local parts
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*parts |
LocalPart
|
The local parts. |
()
|
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/local.py
72 73 74 75 76 77 78 79 80 81 82 |
|
into_parts() -> LocalParts
Converts a Local
segment to its parts.
Returns:
Type | Description |
---|---|
LocalParts
|
The parts of the local segment. |
Source code in versions/segments/local.py
84 85 86 87 88 89 90 |
|
set_parts(*parts: LocalPart) -> Self
Sets the parts of a Local
segment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*parts |
LocalPart
|
The new parts. |
()
|
Returns:
Type | Description |
---|---|
Self
|
The updated local segment. |
Source code in versions/segments/local.py
92 93 94 95 96 97 98 99 100 101 |
|
from_string(string: str) -> Self
classmethod
Parses a Local
segment from string
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to parse. |
required |
Returns:
Type | Description |
---|---|
Self
|
The parsed local segment. |
Source code in versions/segments/local.py
103 104 105 106 107 108 109 110 111 112 113 |
|
to_string() -> str
Converts a Local
segment to its string representation.
Returns:
Type | Description |
---|---|
str
|
The local segment string. |
Source code in versions/segments/local.py
115 116 117 118 119 120 121 |
|
Release
Bases: Representation
, String
Represents the release segment of the version (x.y.z
).
Source code in versions/segments/release.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
|
parts: Parts = field(default=DEFAULT_PARTS, eq=False, order=False)
class-attribute
instance-attribute
The parts of the release.
precision: int
property
The count of the release parts.
last_index: int
property
The index of the last release part.
major: int
property
The major part of the release.
minor: int
property
The minor part of the release.
micro: int
property
The micro part of the release.
patch: int
property
The patch part of the release.
This is equivalent to micro
.
extra: Extra
property
The extra parts of the release.
create(parts: Parts = DEFAULT_PARTS) -> Self
classmethod
Creates a Release
from parts
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parts |
Parts
|
The parts of the release. |
DEFAULT_PARTS
|
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/release.py
53 54 55 56 57 58 59 60 61 62 63 |
|
from_iterable(iterable: Iterable[int]) -> Self
classmethod
Creates a Release
from iterable
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterable |
Iterable[int]
|
The parts of the release in an iterable. |
required |
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/release.py
65 66 67 68 69 70 71 72 73 74 75 |
|
from_parts(*parts: int) -> Self
classmethod
Creates a Release
from parts
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*parts |
int
|
The parts of the release. |
()
|
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/release.py
77 78 79 80 81 82 83 84 85 86 87 |
|
into_parts() -> Parts
Converts a Release
to its parts.
Returns:
Type | Description |
---|---|
Parts
|
The parts of the release. |
Source code in versions/segments/release.py
89 90 91 92 93 94 95 |
|
set_parts(*parts: int) -> Self
Sets the parts of the release to parts
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*parts |
int
|
The parts of the release. |
()
|
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
97 98 99 100 101 102 103 104 105 106 |
|
get_at(index: int, default: int = DEFAULT_VALUE) -> int
Gets the release part at the index
, defaulting to default
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the part to get. |
required |
default |
int
|
The default value to use. |
DEFAULT_VALUE
|
Returns:
Type | Description |
---|---|
int
|
The release part at |
Source code in versions/segments/release.py
147 148 149 150 151 152 153 154 155 156 157 |
|
get_at_unchecked(index: int) -> int
Gets the release part at the index
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index of the part to get. |
required |
Raises:
Type | Description |
---|---|
IndexError
|
The index is out-of-bounds. |
Returns:
Type | Description |
---|---|
int
|
The release part at |
Source code in versions/segments/release.py
159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
is_semantic() -> bool
Checks if the release matches the semantic versioning schema.
Returns:
Type | Description |
---|---|
bool
|
Whether the release matches the |
Source code in versions/segments/release.py
173 174 175 176 177 178 179 |
|
to_semantic() -> Self
Converts the release to match the semver
schema.
Returns:
Type | Description |
---|---|
Self
|
The converted release. |
Source code in versions/segments/release.py
181 182 183 184 185 186 187 188 189 190 |
|
set_major(value: int) -> Self
Sets the major part of the release to the value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set the major part to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
192 193 194 195 196 197 198 199 200 201 |
|
set_minor(value: int) -> Self
Sets the minor part of the release to the value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set the minor part to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
203 204 205 206 207 208 209 210 211 212 |
|
set_micro(value: int) -> Self
Sets the micro part of the release to the value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set the micro part to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
214 215 216 217 218 219 220 221 222 223 |
|
set_patch(value: int) -> Self
Sets the patch part of the release to the value
.
This is equivalent to set_micro
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set the patch part to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
225 226 227 228 229 230 231 232 233 234 235 236 |
|
set_at(index: int, value: int) -> Self
Sets the release part at the index
to the value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index to set the |
required |
value |
int
|
The value to set the part to. |
required |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
238 239 240 241 242 243 244 245 246 247 248 |
|
set_at_unchecked(index: int, value: int) -> Self
Sets the release part at the index
to the value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index to set the |
required |
value |
int
|
The value to set the part to. |
required |
Raises:
Type | Description |
---|---|
IndexError
|
The index is out-of-bounds. |
Returns:
Type | Description |
---|---|
Self
|
The updated release. |
Source code in versions/segments/release.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
next_major() -> Self
Bumps the major part of the release.
Returns:
Type | Description |
---|---|
Self
|
The bumped release. |
Source code in versions/segments/release.py
268 269 270 271 272 273 274 |
|
next_minor() -> Self
Bumps the minor part of the release.
Returns:
Type | Description |
---|---|
Self
|
The bumped release. |
Source code in versions/segments/release.py
276 277 278 279 280 281 282 |
|
next_micro() -> Self
Bumps the micro part of the release.
Returns:
Type | Description |
---|---|
Self
|
The bumped release. |
Source code in versions/segments/release.py
284 285 286 287 288 289 290 |
|
next_patch() -> Self
Bumps the patch part of the release.
This is equivalent to next_micro
.
Returns:
Type | Description |
---|---|
Self
|
The bumped release. |
Source code in versions/segments/release.py
292 293 294 295 296 297 298 299 300 |
|
next_at(index: int, default: int = DEFAULT_VALUE, padding: int = DEFAULT_PADDING) -> Self
Bumps the part of the release at the index
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index to bump the part at. |
required |
default |
int
|
The default value to use. |
DEFAULT_VALUE
|
padding |
int
|
The padding to use. |
DEFAULT_PADDING
|
Returns:
Type | Description |
---|---|
Self
|
The bumped release. |
Source code in versions/segments/release.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
has_major() -> bool
Checks if the release has the major part.
Returns:
Type | Description |
---|---|
bool
|
Whether the major part is present. |
Source code in versions/segments/release.py
319 320 321 322 323 324 325 |
|
has_minor() -> bool
Checks if the release has the minor part.
Returns:
Type | Description |
---|---|
bool
|
Whether the minor part is present. |
Source code in versions/segments/release.py
327 328 329 330 331 332 333 |
|
has_micro() -> bool
Checks if the release has the micro part.
Returns:
Type | Description |
---|---|
bool
|
Whether the micro part is present. |
Source code in versions/segments/release.py
335 336 337 338 339 340 341 |
|
has_patch() -> bool
Checks if the release has the patch part.
This is equivalent to has_micro
.
Returns:
Type | Description |
---|---|
bool
|
Whether the patch part is present. |
Source code in versions/segments/release.py
343 344 345 346 347 348 349 350 351 |
|
has_extra() -> bool
Checks if the release has any extra parts.
Returns:
Type | Description |
---|---|
bool
|
Whether the extra parts are present. |
Source code in versions/segments/release.py
353 354 355 356 357 358 359 |
|
has_at(index: int) -> bool
Checks if the release has a part at the index
.
Returns:
Type | Description |
---|---|
bool
|
Whether the part at the |
Source code in versions/segments/release.py
361 362 363 364 365 366 367 |
|
pad_to(length: int, padding: int = DEFAULT_PADDING) -> Self
Pads a Release
to the length
with padding
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
length |
int
|
The length to pad the release to. |
required |
padding |
int
|
The padding to use. |
DEFAULT_PADDING
|
Returns:
Type | Description |
---|---|
Self
|
The padded release. |
Source code in versions/segments/release.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
|
pad_to_index(index: int, padding: int = DEFAULT_PADDING) -> Self
Pads a Release
to the index
with padding
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
The index to pad the release to. |
required |
padding |
int
|
The padding to use. |
DEFAULT_PADDING
|
Returns:
Type | Description |
---|---|
Self
|
The padded release. |
Source code in versions/segments/release.py
384 385 386 387 388 389 390 391 392 393 394 |
|
pad_to_next(padding: int = DEFAULT_PADDING) -> Self
Pads a Release
to the next index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
padding |
int
|
The padding to use. |
DEFAULT_PADDING
|
Returns:
Type | Description |
---|---|
Self
|
The padded release. |
Source code in versions/segments/release.py
396 397 398 399 400 401 402 403 404 405 |
|
from_string(string: str) -> Self
classmethod
Parses a Release
from string
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to parse. |
required |
Returns:
Type | Description |
---|---|
Self
|
The parsed release. |
Source code in versions/segments/release.py
413 414 415 416 417 418 419 420 421 422 423 |
|
to_string() -> str
Converts a Release
to its string representation.
Returns:
Type | Description |
---|---|
str
|
The release string. |
Source code in versions/segments/release.py
425 426 427 428 429 430 431 |
|
DevTag
Bases: Tag
Represents the dev-release tag of the version (dev.n
).
Source code in versions/segments/tags.py
199 200 201 202 203 204 205 |
|
PostTag
Bases: Tag
Represents the post-release tag of the version (post.n
).
Source code in versions/segments/tags.py
190 191 192 193 194 195 196 |
|
PreTag
Bases: Tag
Represents the pre-release tag of the version (pre.n
).
Source code in versions/segments/tags.py
181 182 183 184 185 186 187 |
|
Tag
Bases: Representation
, String
Represents various version tags (tag.n
).
Source code in versions/segments/tags.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
phase: str = field(converter=convert_phase)
class-attribute
instance-attribute
The phase of the release tag.
value: int = field(default=DEFAULT_VALUE)
class-attribute
instance-attribute
The value of the release tag.
short: str
property
The short phase of the tag.
normal: str
property
The normalized phase of the tag.
create(phase: Optional[str] = None, value: int = DEFAULT_VALUE) -> Self
classmethod
Creates a Tag
from phase
and value
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
phase |
Optional[str]
|
The phase of the tag. |
None
|
value |
int
|
The value of the tag. |
DEFAULT_VALUE
|
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/tags.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
default_phase_with_value(value: int) -> Self
classmethod
Creates a Tag
from value
with the default phase.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value of the tag. |
required |
Returns:
Type | Description |
---|---|
Self
|
The newly created |
Source code in versions/segments/tags.py
78 79 80 81 82 83 84 85 86 87 88 |
|
normalize() -> Self
Normalizes the version tag.
Returns:
Type | Description |
---|---|
Self
|
The normalized tag. |
Source code in versions/segments/tags.py
104 105 106 107 108 109 110 |
|
set_phase(phase: str) -> Self
Sets the phase of the version tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
phase |
str
|
The phase to set. |
required |
Returns:
Type | Description |
---|---|
Self
|
The version tag with the new phase. |
Source code in versions/segments/tags.py
112 113 114 115 116 117 118 119 120 121 |
|
set_value(value: int) -> Self
Sets the value of the version tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
int
|
The value to set. |
required |
Returns:
Type | Description |
---|---|
Self
|
The version tag with the new value. |
Source code in versions/segments/tags.py
123 124 125 126 127 128 129 130 131 132 |
|
next() -> Self
Bumps the version tag value.
Returns:
Type | Description |
---|---|
Self
|
The next version tag. |
Source code in versions/segments/tags.py
134 135 136 137 138 139 140 |
|
next_phase(value: int = DEFAULT_VALUE) -> Optional[Self]
Bumps the version tag phase, if possible.
Returns:
Type | Description |
---|---|
Optional[Self]
|
The next version tag, if present. |
Source code in versions/segments/tags.py
142 143 144 145 146 147 148 149 150 |
|
from_string(string: str) -> Self
classmethod
Parses a Tag
from string
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str
|
The string to parse. |
required |
Returns:
Type | Description |
---|---|
Self
|
The parsed tag. |
Source code in versions/segments/tags.py
152 153 154 155 156 157 158 159 160 161 162 |
|
to_string() -> str
Converts a Tag
to its string representation.
Returns:
Type | Description |
---|---|
str
|
The tag string. |
Source code in versions/segments/tags.py
164 165 166 167 168 169 170 |
|
to_short_string() -> str
Converts a Tag
to its short string representation.
Returns:
Type | Description |
---|---|
str
|
The short tag string. |
Source code in versions/segments/tags.py
172 173 174 175 176 177 178 |
|