o }h@s`ddlZddlmZddlmZddlZddZddZdd d Zd d Z d e de fddZ dS)N)BytesIO)name_mapcCs*|d}d|d}|dt||S)Nzfiles/r)splitrget)s3_pathZs3_paths file_pathr 8/home/cmiss/Jenkins/workspace/SPARC-API/app/utilities.pyget_path_from_mangled_lists  r cCs<t}|j|dd|d|}dt|}|S)zQ Take in a Pillow image and convert it to a base64 string in PNG format. PNG)formatrzdata:image/png;base64,)rsaveseekgetvaluebase64 b64encodedecode)imgbufferedZimg_byteZimg_strr r r img_to_base64_strs  rcCs|D]J}t||t||trt|||dqt||trNt|dt||rGt||dtrGt||d|dt|dqdS)Nz [r])keysprint isinstancedict print_dictlistlen)dindentkr r r rs rcCs"tdt|trt|dSdS)Nzhit:)rrrr)hitr r r print_hit_structure's  r%filenamereturncCstj|\}}|S)z Extracts and returns the extension of a filename, including the leading dot. If the filename has no extension, returns an empty string. )ospathsplitext)r&_extr r r get_extension,sr-)r) riorZ"app.manifest_name_to_discover_namerr(r rrr%strr-r r r r s