in mapillary_tools/upload.py [0:0]
def read_image_descriptions(desc_path: str) -> T.List[types.ImageDescriptionFile]:
if not os.path.isfile(desc_path):
raise exceptions.MapillaryFileNotFoundError(
f"Image description file {desc_path} not found. Please process the image directory first"
)
descs: T.List[types.ImageDescriptionFile] = []
if desc_path == "-":
try:
descs = json.load(sys.stdin)
except json.JSONDecodeError as ex:
raise exceptions.MapillaryInvalidDescriptionFile(
f"Invalid JSON stream from stdin: {ex}"
)
else:
with open(desc_path) as fp:
try:
descs = json.load(fp)
except json.JSONDecodeError as ex:
raise exceptions.MapillaryInvalidDescriptionFile(
f"Invalid JSON file {desc_path}: {ex}"
)
return types.filter_out_errors(
T.cast(T.List[types.ImageDescriptionFileOrError], descs)
)