@classmethod
    def translate_dir(cls, dirname, skip=()):
        dirname = os.path.normpath(dirname)
        skip = [os.path.normpath(p) for p in skip]
        for root, dirs, files in os.walk(dirname):
            for fname in files:
                if fname.endswith('.py'):
                    filename = os.path.join(root, fname)
                    relpath = os.path.relpath(filename, dirname)
                    if fname in skip or relpath in skip or filename in skip:
                        print('%s skipped: %r' % (cls.__name__, relpath))
                        continue
                    code = open(filename, 'rb').read().decode('utf-8')
                    try:
                        new_code = cls(code).translate()
                    except CancelTranslation:
                        print('%s cancelled: %r' % (cls.__name__, relpath))
                    else:
                        with open(filename, 'wb') as f:
                            f.write(new_code.encode('utf-8'))
                        print('%s translated: %r' % (cls.__name__, relpath))
Classmethod to translate all .py files in the given
dataset/ETHPy150Open zoofIO/flexx/translate_to_legacy.py/BaseTranslator.translate_dir