Lock datum

wreck.lock_datum.DC_SLOTS: dict[str, bool]

Allows dataclasses.dataclass __slots__ support from py310

class wreck.lock_datum.DATUM
wreck.lock_datum.DATUM: TypeVar

Class Pins is a Generic container. Allow changing which items the container can hold

class wreck.lock_datum.DatumByPkg
wreck.lock_datum.DatumByPkg: dict[str, set[wreck.lock_datum.PinDatum]]

Store by pkg_name. Either all or notable (has specifiers or qualifiers)

wreck.lock_datum.__all__: tuple[str, str, str, str, str, str, str, str, str] = ("DATUM", "DatumByPkg", "InFileType", "OutLastSuffix", "PinDatum",    "in_generic", "is_pin", "has_qualifiers", "pprint_pins")

Module exports

class wreck.lock_datum.InFileType(*values)

Each .in files constraints and requirements have to be resolved. This occurs recursively. Once resolved, InFile is moved from FILES –> ZEROES set

FILES = "_files"

.in file that has unresolved -c (constraints) and -r (requirements)

ZEROES = "_zeroes"

.in file that have all -c (constraints) and -r (requirements) resolved

class wreck.lock_datum.OutLastSuffix(*values)

Output file last suffix. File name may have other encoded properties like .shared

LOCK = ".lock"

A lock file

UNLOCK = ".unlock"

An unlock file

class wreck.lock_datum.PinDatum(file_abspath: Path, pkg_name: str, line: str, specifiers: list[str], qualifiers: list[str])

Qualifiers aware Pin. Use FilePins to instantiate.

Hashable and Comparable

file_abspath: Path
line: str
pkg_name: str
qualifiers: list[str]
specifiers: list[str]
wreck.lock_datum.has_qualifiers(qualifiers)

From .in file, identify as a pin only if has qualifiers.

Parameters:

qualifiers (list[str]) – package qualifiers e.g. platform_system=="Windows". Stored without ; separator

Returns:

True if has qualifiers otherwise False

Return type:

bool

wreck.lock_datum.in_generic(inst, val, field_name='file_abspath', set_name=InFileType.FILES, is_abspath_ok=False)

A generic __contains__

Comparing instances attribute path was removed

Parameters:
  • inst (object) – A class instance

  • val (Any) – item to check if within zeroes

  • field_name (str) – class instances attribute name which holds the relative or absolute path

  • set_name (wreck.lock_datum.InFileType | None) – Default wreck.lock_datum.InFileType.FILES. Which set to search thru. zeroes or files

  • is_abspath_ok (bool) – Default False. True if class instance field is an absolute path. False if relative path

Returns:

True if InFile contained within zeroes otherwise False

Return type:

bool

wreck.lock_datum.is_pin(specifiers)

From .in file, identify as a pin only if has specifiers.

Parameters:

specifiers (list[str]) – package specifiers e.g. >=1.0.0

Returns:

True if has specifiers otherwise False

Return type:

bool

wreck.lock_datum.pprint_pins(pins)

Capture pprint and return it.

Parameters:

pins (collections.abc.Iterable[wreck.lock_datum.DATUM]) – set of Pins

Returns:

pretty printed representation of the pins

Return type:

str