pyk.utils module

class BugReport(bug_report: Path)[source]

Bases: object

add_command(args: Iterable[str]) → None[source]
add_file(finput: Path, arcname: Path) → None[source]
add_file_contents(input: str, arcname: Path) → None[source]
class Chainable(f: Callable[[P], R])[source]

Bases: Generic[P, R]

class FrozenDict(*args: Any, **kwargs: Any)[source]

Bases: Mapping[K, V]

final class POSet(relation: 'Iterable[tuple[H, H]]')[source]

Bases: Generic[H]

image: FrozenDict[H, frozenset[H]]
abs_or_rel_to(path: Path, base: Path) → Path[source]
add_indent(indent: str, lines: Iterable[str]) → list[str][source]
case(cases: Iterable[tuple[Callable[[P], bool], Callable[[P], R]]], default: Callable[[P], R] | None = None) → Callable[[P], R][source]
check_absolute_path(path: Path) → None[source]
check_dir_path(path: Path) → None[source]
check_file_path(path: Path) → None[source]
check_relative_path(path: Path) → None[source]
check_type(x: Any, typ: type[T]) → T[source]
compare_short_hashes(lhs: str, rhs: str) → bool[source]
deconstruct_short_hash(h: str) → tuple[str, str][source]
ensure_dir_path(path: str | Path) → Path[source]
exit_with_process_error(err: CalledProcessError) → None[source]
filter_none(mapping: Mapping[K, V]) → dict[K, V][source]
find_common_items(l1: Iterable[T], l2: Iterable[T]) → tuple[list[T], list[T], list[T]][source]
gen_file_timestamp(comment: str = '//') → str[source]
hash_file(file: Path, chunk_num_blocks: int = 128) → str[source]
hash_str(x: Any) → str[source]
intersperse(iterable: Iterable[T], delimiter: T) → Iterator[T][source]
is_hash(x: Any) → bool[source]
is_hexstring(x: str) → bool[source]
is_relative_to(_self: Path, other: Path) → bool[source]
maybe(f: Callable[[P], R]) → Callable[[P | None], R | None][source]
merge_with(f: Callable[[V, V], V], d1: Mapping[K, V], d2: Mapping[K, V]) → dict[K, V][source]
none(x: Any) → None[source]
nonempty_str(x: Any) → str[source]
not_none(x: T | None) → T[source]
raised(f: Callable, *args: Any, **kwargs: Any) → BaseException | None[source]
repeat_last(iterable: Iterable[T]) → Iterator[T][source]
run_process(args: str | Iterable[str], *, check: bool = True, input: str | None = None, pipe_stdout: bool = True, pipe_stderr: bool = False, cwd: str | Path | None = None, env: Mapping[str, str] | None = None, logger: Logger | None = None, exec_process: bool = False) → CompletedProcess[source]
shorten_hash(h: str, left_chars: int = 6, right_chars: int = 6) → str[source]
shorten_hashes(value: Any, left_chars: int = 6, right_chars: int = 6) → Any[source]
single(iterable: Iterable[T]) → T[source]
some(iterable: Iterable[T]) → T | None[source]
tuple_of() → Callable[[tuple[()]], tuple[()]][source]
tuple_of(f1: Callable[[P1], R1], /) → Callable[[tuple[P1]], tuple[R1]]
tuple_of(f1: Callable[[P1], R1], f2: Callable[[P2], R2], /) → Callable[[tuple[P1, P2]], tuple[R1, R2]]
tuple_of(f1: Callable[[P1], R1], f2: Callable[[P2], R2], f3: Callable[[P3], R3], /) → Callable[[tuple[P1, P2, P3]], tuple[R1, R2, R3]]
tuple_of(f1: Callable[[P1], R1], f2: Callable[[P2], R2], f3: Callable[[P3], R3], f4: Callable[[P4], R4], /) → Callable[[tuple[P1, P2, P3, P4]], tuple[R1, R2, R3, R4]]
unique(iterable: Iterable[H]) → Iterator[H][source]