in libs/libcommon/src/libcommon/url_preparator.py [0:0]
def prepare_urls_in_first_rows_in_place(self, first_rows: Mapping[str, Any], revision: str) -> None:
asset_url_paths = self._get_asset_url_paths_from_first_rows(first_rows=first_rows)
if not asset_url_paths:
return
# prepare the URLs (set revision + sign)
row_items = first_rows.get("rows")
if not isinstance(row_items, list):
raise InvalidFirstRowsError('Expected response["rows"] to be a list')
for row_item in row_items:
if not isinstance(row_item, dict):
raise InvalidFirstRowsError('Expected response["rows"][i] to be a dict')
truncated_cells = row_item.get("truncated_cells")
if not isinstance(truncated_cells, list) or not all(isinstance(cell, str) for cell in truncated_cells):
raise InvalidFirstRowsError('Expected response["rows"][i]["truncated_cells"] to be a list of strings')
row = row_item.get("row")
if not isinstance(row, dict):
raise InvalidFirstRowsError('Expected response["rows"][i]["row"] to be a dict')
for asset_url_path in asset_url_paths:
if isinstance(asset_url_path.path[0], str) and asset_url_path.path[0] in truncated_cells:
# the cell has been truncated, nothing to prepare in it
continue
self._prepare_asset_url_path_in_place(cell=row, asset_url_path=asset_url_path, revision=revision)