Structs

structs provides some of the key classes of JGDV. Especially:

  1. ChainGuard, a type guarded failable accessor to nested mappings.

  2. Strang, a Structured str subtype.

  3. DKey, extends Strang into a type guarded Key for getting values from dicts.

  4. Locator, extends DKey into a Location/Path central store.

  5. rxmatcher, a utility for using the match statement with regular expressions.

Chainguard

key = "value"

[table]
key = "other value"
sub = {key="blah"}

Strang

A Structured String class.

from jgdv.structs.strang import Strang

example : Strang = Strang("head.meta.data::tail.value")
# Regular string index access:
example[0] == "h"
example[0:4] == "he"
# Section access:
example[0,:] == "head.meta.data"
example[1,:] == "tail.value"
example[0,0] == "head"
example[1,0] == "tail"

DKey

Extends Strang to become a key.

from jgdv.structs.dkey import DKey

# TODO

Locator

A Locator and Location pair, to provide a central store of paths.

from jgdv.structs.locator import JGDVLocator

# TODO

RxMatcher

from jgdv.structs import RxMatcher

# TODO