pudl.scripts.check_path_permissions#
Check read, write, and delete permissions for local or remote paths.
Attributes#
Exceptions#
Permission check failure annotated with the stage that failed. |
Classes#
Named permission-check stages used by the CLI and its reports. |
|
Structured result for a single permission check. |
|
Structured result for all permission checks against one path. |
|
Top-level report for a CLI invocation across one or more paths. |
Functions#
|
Return resolved FERC EQR deployment targets as fully configured UPath objects. |
|
Return a |
|
Temporarily silence noisy storage-backend exception logging. |
|
Raise if the provided path points at an existing file/object. |
|
Raise if the given path cannot be read as a directory-like location. |
|
Raise if a canary file cannot be written, read back, and deleted. |
|
Record a result message in the summary and optionally print it. |
|
Set the check outcome and record the message in one step. |
|
Run a single permission check and update the structured summary. |
|
Run the requested checks for one path and return a structured summary. |
|
Check path permissions using UPath for local filesystems and cloud buckets. |
Module Contents#
- pudl.scripts.check_path_permissions.NOISY_BACKEND_LOGGERS = ('fsspec', 'gcsfs', 'gcsfs.retry', 's3fs')[source]#
- class pudl.scripts.check_path_permissions.PermissionCheck[source]#
Bases:
enum.StrEnumNamed permission-check stages used by the CLI and its reports.
- exception pudl.scripts.check_path_permissions.PathPermissionError(message: str)[source]#
Bases:
click.ClickExceptionPermission check failure annotated with the stage that failed.
- check: PermissionCheck[source]#
- class pudl.scripts.check_path_permissions.CheckReport[source]#
Structured result for a single permission check.
- class pudl.scripts.check_path_permissions.PathReport[source]#
Structured result for all permission checks against one path.
- checks: dict[PermissionCheck, CheckReport][source]#
- class pudl.scripts.check_path_permissions.PathCheckReport[source]#
Top-level report for a CLI invocation across one or more paths.
- results: list[PathReport][source]#
- pudl.scripts.check_path_permissions._get_ferceqr_deployment_paths(anon: bool = False) list[upath.UPath][source]#
Return resolved FERC EQR deployment targets as fully configured UPath objects.
Each target is constructed with its YAML-defined
storage_options, then the global--anonflag is applied on top (so it can override per-target settings if needed).- Parameters:
anon – Whether to force anonymous access for
gs://ors3://targets.
- pudl.scripts.check_path_permissions._build_upath(path: str, anon: bool, storage_options: dict[str, Any] | None = None) upath.UPath[source]#
Return a
UPathwith anon and any per-target options baked in.
- pudl.scripts.check_path_permissions._suppress_backend_tracebacks() Any[source]#
Temporarily silence noisy storage-backend exception logging.
- pudl.scripts.check_path_permissions._ensure_directory_like_path(path: upath.UPath) None[source]#
Raise if the provided path points at an existing file/object.
- pudl.scripts.check_path_permissions.check_read_access(path: upath.UPath) None[source]#
Raise if the given path cannot be read as a directory-like location.
- pudl.scripts.check_path_permissions.check_write_access(path: upath.UPath) None[source]#
Raise if a canary file cannot be written, read back, and deleted.
- pudl.scripts.check_path_permissions._record_check_output(*, check_name: PermissionCheck, message: str, json_output: bool, summary: PathReport, is_error: bool = False) None[source]#
Record a result message in the summary and optionally print it.
- pudl.scripts.check_path_permissions._record_check_outcome(*, check_name: PermissionCheck, success: bool, message: str, json_output: bool, summary: PathReport) None[source]#
Set the check outcome and record the message in one step.
- pudl.scripts.check_path_permissions._run_check(*, action: PermissionCheck, resolved_path: upath.UPath, json_output: bool, summary: PathReport) None[source]#
Run a single permission check and update the structured summary.