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

Function _validate_range

recoverpy/lib/storage/byte_range_reader.py:136–151  ·  view source on GitHub ↗
(offset: int, length: int, chunk_size: int)

Source from the content-addressed store, hash-verified

134
135
136def _validate_range(offset: int, length: int, chunk_size: int) -> None:
137 if offset < 0:
138 raise BlockExtractionError(
139 f"Invalid offset: {offset}",
140 "Invalid offset: expected value >= 0.",
141 )
142 if length <= 0:
143 raise BlockExtractionError(
144 f"Invalid length: {length}",
145 "Invalid length: expected value > 0.",
146 )
147 if chunk_size <= 0:
148 raise BlockExtractionError(
149 f"Invalid chunk size: {chunk_size}",
150 "Invalid chunk size: expected value > 0.",
151 )
152
153
154def _get_open_error_message(source_path: str, error: OSError) -> str:

Callers 2

extract_rangeFunction · 0.85
read_rangeFunction · 0.85

Calls 1

Tested by

no test coverage detected