MCPcopy Create free account
hub / github.com/PabloLec/RecoverPy / _open_source

Function _open_source

recoverpy/lib/storage/byte_range_reader.py:105–117  ·  view source on GitHub ↗
(source_path: str)

Source from the content-addressed store, hash-verified

103
104
105def _open_source(source_path: str) -> int:
106 try:
107 return os.open(source_path, os.O_RDONLY)
108 except PermissionError as error:
109 raise BlockExtractionError(
110 f"Cannot open source {source_path}: {error}",
111 f"Permission denied: cannot open {source_path} (run as root).",
112 ) from error
113 except OSError as error:
114 raise BlockExtractionError(
115 f"Cannot open source {source_path}: {error}",
116 _get_open_error_message(source_path, error),
117 ) from error
118
119
120def _safe_pread(source_fd: int, size: int, offset: int, source_path: str) -> bytes:

Callers 2

extract_rangeFunction · 0.85
read_rangeFunction · 0.85

Calls 2

_get_open_error_messageFunction · 0.85

Tested by

no test coverage detected