brn: fix parsing offsets when coming from string
This commit is contained in:
parent
58028e3629
commit
16c1d26e3b
1 changed files with 4 additions and 4 deletions
|
@ -28,10 +28,10 @@ class BRN:
|
|||
def from_str(cls, s: str) -> BRN:
|
||||
parts = s.split(":")
|
||||
if len(parts) != 6 or parts[0].lower() != "brn" or not is_integer(parts[2]):
|
||||
raise TypeError(f"Expected a valid BRN but got {repr(s)}.")
|
||||
resource_parts = parts[4].split("/")
|
||||
if len(resource_parts) != 5:
|
||||
raise TypeError(f"Expected a valid BRN but got {repr(s)}.")
|
||||
raise TypeError(f"Expected a valid BRN but got {repr(s)} (invalid parts).")
|
||||
resource_parts = parts[5].split("/")
|
||||
if len(resource_parts) != 2:
|
||||
raise TypeError(f"Expected a valid BRN but got {repr(s)} (invalid resource parts).")
|
||||
return cls(
|
||||
global_namespace=parts[1],
|
||||
group_id=int(parts[2]),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue