ShardId: a shard, numbered within its shard group (Effect's
ShardId). Its text form is "<group>:<id>".
Classes#
Functions#
make#
make(group, id) -> ShardId| Parameter | Type | Description |
|---|---|---|
group | str | |
id | int |
Returns ShardId
def make(group: str, id: int) -> ShardId:
return ShardId(group=group, id=id)from_string#
from_string(text) -> ShardIdParse "<group>:<id>" (the group may hold :, the id is ASCII
digits); raises ValueError for anything else.
| Parameter | Type | Description |
|---|---|---|
text | str |
Returns ShardId
def from_string(text: str) -> ShardId:
"""Parse ``"<group>:<id>"`` (the group may hold ``:``, the id is ASCII
digits); raises ``ValueError`` for anything else."""
group, colon, id = text.rpartition(":")
if not colon:
raise ValueError("Invalid ShardId format")
number = parse_signed_digits(id)
if number is None:
raise ValueError("ShardId id must be a number")
return ShardId(group=group, id=number)