utils
Utility functions for IRDL.
-
irdl.utils._fits_in_memory(ingest_path: Path) → bool
Check if a file can be loaded into available RAM.
Needed when an entire dataset is loaded into memory.
- Parameters:
- ingest_path
Path Path to the ingestable file.
- Returns:
- fitsbool
True if the file fits into available RAM with headroom.
-
irdl.utils._link_or_copy(source_path: Path, target_path: Path) → Path
Hard-link a file, falling back to copy.
-
irdl.utils._preserve_permissions(source_path: Path, target_path: Path) → None
Copy permission bits from one file to another.
- Parameters:
- source_path
Path Existing file whose permission bits should be reused.
- target_path
Path Existing file that should receive the same permission bits.
-
irdl.utils._validate_hash_registry(provider_name: str, registry: object) → None
Validate the common flat hash-registry schema.
- Parameters:
- provider_name
str Provider identifier used in error messages.
- registry
object Parsed JSON payload to validate.
- Raises:
ValueErrorIf the registry does not match the required flat dict[str, str] schema.
-
irdl.utils.load_hash_registry(provider_name: str) → dict[str, str]
Load and validate a packaged provider hash registry.
- Parameters:
- provider_name
str Provider identifier used to resolve <provider_name>_hashes.json from
irdl/registry/ package data.
- Returns:
dictFlat mapping of provider-relative paths to sha256:... digests.