Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /nfraxlab_svc-infra /src /svc_infra /db /utils.py
| from collections.abc import Sequence | |
| from pathlib import Path | |
| KeySpec = str | Sequence[str] | |
| def as_tuple(spec: KeySpec) -> tuple[str, ...]: | |
| return (spec,) if isinstance(spec, str) else tuple(spec) | |
| def normalize_dir(p: Path | str) -> Path: | |
| p = Path(p) | |
| return p if p.is_absolute() else (Path.cwd() / p).resolve() | |
| def snake(name: str) -> str: | |
| import re | |
| s1 = re.sub(r"(.)([A-Z][a-z]+)", r"\1_\2", name) | |
| s2 = re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", s1) | |
| return re.sub(r"[^a-zA-Z0-9_]+", "_", s2).lower().strip("_") | |
| def pascal(name: str) -> str: | |
| return "".join(p.capitalize() for p in snake(name).split("_") if p) or "Item" | |
| def plural_snake(entity_pascal: str) -> str: | |
| base = snake(entity_pascal) | |
| return base if base.endswith("s") else base + "s" | |
Xet Storage Details
- Size:
- 791 Bytes
- Xet hash:
- 1fc4e14965b326f0879aa48d6af478a9cb113f0528014e6f58233e2bb60b23a2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.