# Baixa 
# https://download-directory.github.io/?url=https://github.com/tarngaina/LtMAO/tree/master/src/LtMAO/pyRitoFile?&filename=pyRitoFile
# e salva em _gui_notes/downloaded/pyRitoFile.zip

from os import path


if __name__ ==  '__main__':
    from zipfile import ZipFile
    from os import walk


    with ZipFile('downloaded/pyRitoFile.zip', 'r') as zip_ref:
        zip_ref.extractall('downloaded/pyRitoFile')
    
    print('Extracted pyRitoFile')

    for root, _, files in walk('downloaded/pyRitoFile'):
        for file in files:
            file_path = path.join(root, file)

            if file_path.endswith('.py'):
                with open(file_path, 'r') as f:
                    content = f.read()

                content = content.replace('from ..pyRitoFile.', 'from .')
                content = content.replace('from ...pyRitoFile.', 'from .')
                with open(file_path, 'w') as f:
                    f.write(content)
    
    print("Finished")