def _parse_line(self, line):
        """Getting a random line from the manifest file"""
        with open(self._manifest.path, "r") as manifest_file:
            if isinstance(line, str):
                assert (
                    line in self.BASE_INFORMATION.keys()
                ), "An attempt to get non-existent information from the manifest"
                for _ in range(self.BASE_INFORMATION[line]):
                    fline = manifest_file.readline()
                return json.loads(fline)[line]
            else:
                assert self._index, "No prepared index"
                offset = self._index[line]
                manifest_file.seek(offset)
                properties = manifest_file.readline()
                parsed_properties = ImageProperties(json.loads(properties))
                self._json_item_is_valid(**parsed_properties)
                return parsed_properties
Getting a random line from the manifest file
utils/dataset_manifest/core.py