jgdv.structs.locator._interface

Type Aliases

TimeDelta

Protocols

Location_p

Something which describes a file system location,

Locator_p

Base class for protocol classes.

Classes

LocationMeta_e

Available metadata attachable to a location

WildCard_e

Ways a path can have a wildcard.

Module Contents

jgdv.structs.locator._interface.TimeDelta: TypeAlias = datetime.timedelta
class jgdv.structs.locator._interface.Location_p[source]

Bases: jgdv.structs.strang._interface.Strang_p, Protocol

Something which describes a file system location, with a possible identifier, and metadata

check_wildcards(other) <Unknown>[source]
Parameters:

other (pathlib.Path | Location_p)

Return type:

bool

ext(*, last=False) <Unknown>[source]
Parameters:

last (bool)

Return type:

jgdv.Maybe[str | WordDesc | tuple[str | WordDesc, Ellipsis]]

is_concrete() <Unknown>[source]
Return type:

bool

Marks: ClassVar[jgdv.structs.strang._interface.StrangMarkAbstract_e]
Wild: ClassVar[jgdv.structs.strang._interface.StrangMarkAbstract_e]
property body_parent: list[WordDesc][source]
Return type:

list[WordDesc]

property key: jgdv.Maybe[str | jgdv.structs.dkey._interface.Key_p][source]
Return type:

jgdv.Maybe[str | jgdv.structs.dkey._interface.Key_p]

property keys: set[str][source]
Return type:

set[str]

property path: pathlib.Path[source]
Return type:

pathlib.Path

property stem: jgdv.Maybe[str | WordDesc][source]
Return type:

jgdv.Maybe[str | WordDesc]

class jgdv.structs.locator._interface.Locator_p[source]

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...
clear() <Unknown>[source]
Return type:

None

expand(
key,
*,
strict=True,
norm=True,
) <Unknown>[source]
Parameters:
Return type:

jgdv.Maybe[pathlib.Path]

metacheck(key, *meta) <Unknown>[source]
Parameters:
Return type:

bool

update(extra, *, strict=True) <Unknown>[source]
Parameters:
Return type:

Self

Current: Classvar[Locator_p]
class jgdv.structs.locator._interface.LocationMeta_e[source]

Bases: jgdv.structs.strang._interface.StrangMarkAbstract_e

Available metadata attachable to a location

classmethod default() <Unknown>[source]
Return type:

jgdv.Maybe

abstract = 'abstract'
artifact = 'artifact'
clean = 'clean'
dir
directory = 'directory'
earlycwd = 'earlycwd'
expand = 'expand'
file = 'file'
loc
location = 'location'
partial = 'partial'
protect = 'protect'
remote = 'remote'
class jgdv.structs.locator._interface.WildCard_e[source]

Bases: jgdv.structs.strang._interface.StrangMarkAbstract_e

Ways a path can have a wildcard.

glob = '*'
key = '{'
rec_glob = '**'
select = '?'