Skip to content

Commit

Permalink
fixed up comments removed dead code. Now Tagger does not have to fix …
Browse files Browse the repository at this point in the history
…up prepad after the fact

but is natively supported by Matter with xtra xs code table size field.
  • Loading branch information
SmithSamuelM committed Jul 27, 2024
1 parent de5c84a commit f5840bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 38 deletions.
41 changes: 4 additions & 37 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,26 +672,6 @@ def __iter__(self):
TagDex = TagCodex() # Make instance


@dataclass(frozen=True)
class PadTagCodex:
"""
TagCodex is codex of Base64 derivation codes for compactly representing
various small Base64 tag values as prepadded special code soft part values.
Prepad is 1 B64 char.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
Tag1: str = '0J' # 1 B64 char tag with 1 pre pad
Tag5: str = '0L' # 1 B64 char tag with 1 pre pad
Tag9: str = '0N' # 1 B64 char tag with 1 pre pad

def __iter__(self):
return iter(astuple(self))


PadTagDex = PadTagCodex() # Make instance


@dataclass(frozen=True)
class PreCodex:
Expand Down Expand Up @@ -2106,7 +2086,7 @@ class Tagger(Matter):
composable (bool): True when .qb64b and .qb2 are 24 bit aligned and round trip
Properties:
tag (str): B64 primitive without prepad (strips prepad from soft)
tag (str): B64 primitive without prepad (alias of .soft)
Inherited Hidden: (See Matter)
Expand All @@ -2127,8 +2107,6 @@ class Tagger(Matter):
Methods:
def __init__(self, raw=None, code=MtrDex.Ed25519N, soft='', rize=None,
qb64b=None, qb64=None, qb2=None, strip=False):
"""
Pad = '_' # B64 pad char for tag codes with pre-padded soft values
Expand All @@ -2150,7 +2128,7 @@ def __init__(self, tag='', soft='', code=None, **kwa):
bytearray after parsing qb64b or qb2. False means do not strip
Parameters:
tag (str | bytes): Base64 plain. Prepad is added as needed.
tag (str | bytes): Base64 automatic sets code given size of tag
"""
if tag:
Expand All @@ -2164,10 +2142,6 @@ def __init__(self, tag='', soft='', code=None, **kwa):
if l > len(codes):
raise InvalidSoftError("Oversized tag={soft}.")
code = codes[l-1] # get code for for tag of len where (index = len - 1)
#if code in PadTagDex:
#soft = self.Pad + tag # pre pad for those that need it
#else:
#soft = tag
soft = tag


Expand All @@ -2179,17 +2153,10 @@ def __init__(self, tag='', soft='', code=None, **kwa):
@property
def tag(self):
"""Returns:
tag (str): B64 primitive without prepad (strips prepad from soft)
tag (str): B64 primitive without prepad (alias of self.soft)
"""
tag = self.soft
#if self.code in PadTagDex:
#pad = self.soft[0]
#tag = self.soft[1:]
#if pad != self.Pad:
#raise InvalidSoftError("Invaid pre {pad=} for {tag=}.")

return tag
return self.soft


class Ilker(Tagger):
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from keri.core import coring
from keri.core.coring import (Saids, Sadder, Tholder, Seqner, NumDex, Number,
Dater, Bexter, Texter,
TagDex, PadTagDex, Tagger, Ilker, Traitor,
TagDex, Tagger, Ilker, Traitor,
Verser, Versage, )
from keri.core.coring import Kindage, Kinds
from keri.core.coring import (Sizage, MtrDex, Matter)
Expand Down

0 comments on commit f5840bc

Please sign in to comment.