def generate_code(root_path, gen_dict=None):
    'Generate pyleecan Classes code according to doc in root_path\n\n    Parameters\n    ----------\n    root_path : str\n        Path to the main folder of Pyleecan\n    gen_dict : dict\n        Generation dictionnary (contains all the csv data)\n    Returns\n    -------\n    None\n    '
    CLASS_DIR = join(root_path, 'Classes')
    FUNC_DIR = join(root_path, 'Functions')
    DOC_DIR = join(root_path, 'Generator', 'ClassesRef')
    print(('Reading classes csv in: ' + DOC_DIR))
    print(('Saving generated files in: ' + CLASS_DIR))
    path = __file__[__file__.index(package_name):]
    path = path.replace('\\', '/')
    print('Deleting old class files...')
    for file_name in listdir(CLASS_DIR):
        if (file_name[0] != '_'):
            remove(join(CLASS_DIR, file_name))
    import_file = open(join(CLASS_DIR, 'import_all.py'), 'w')
    import_file.write('# -*- coding: utf-8 -*-\n\n')
    import_file.write('"""File generated by generate_code() - \n')
    import_file.write('WARNING! All changes made in this file will be lost!\n"""\n\n')
    load_file = open(join(FUNC_DIR, 'load_switch.py'), 'w')
    load_file.write('# -*- coding: utf-8 -*-\n')
    load_file.write('"""File generated by generate_code() - \n')
    load_file.write('WARNING! All changes made in this file will be lost!\n"""\n\n')
    load_file.write('from ..Classes.import_all import *\n\n')
    load_file.write('load_switch = {\n')
    if (gen_dict is None):
        gen_dict = read_all(DOC_DIR)
    for (class_name, _) in iter(sorted(list(gen_dict.items()))):
        import_file.write((((('from ..Classes.' + class_name) + ' import ') + class_name) + '\n'))
        load_file.write((((('    "' + class_name) + '": ') + class_name) + ',\n'))
        print((('Generation of ' + class_name) + ' class'))
        generate_class(gen_dict, class_name, CLASS_DIR)
    import_file.close()
    load_file.write('}\n')
    load_file.close()
    print('Generation of load_switch.py')
    print('Generation of import_all.py')
    class_dict_file = join(CLASS_DIR, 'Class_Dict.json')
    with open(class_dict_file, 'w') as json_file:
        json.dump(gen_dict, json_file, sort_keys=True, indent=4, separators=(',', ': '))
Generate pyleecan Classes code according to doc in root_path

Parameters
----------
root_path : str
    Path to the main folder of Pyleecan
gen_dict : dict
    Generation dictionnary (contains all the csv data)
Returns
-------
None
def generate_code(root_path, gen_dict=None):
    'Generate pyleecan Classes code according to doc in root_path\n\n    Parameters\n    ----------\n    root_path : str\n        Path to the main folder of Pyleecan\n    gen_dict : dict\n        Generation dictionnary (contains all the csv data)\n    Returns\n    -------\n    None\n    '
    CLASS_DIR = join(root_path, 'Classes')
    FUNC_DIR = join(root_path, 'Functions')
    DOC_DIR = join(root_path, 'Generator', 'ClassesRef')
    print(('Reading classes csv in: ' + DOC_DIR))
    print(('Saving generated files in: ' + CLASS_DIR))
    path = __file__[__file__.index(package_name):]
    path = path.replace('\\', '/')
    print('Deleting old class files...')
    for file_name in listdir(CLASS_DIR):
        if (file_name[0] != '_'):
            remove(join(CLASS_DIR, file_name))
    import_file = open(join(CLASS_DIR, 'import_all.py'), 'w')
    import_file.write('# -*- coding: utf-8 -*-\n\n')
    import_file.write('"File generated by generate_code() - \n')
    import_file.write('WARNING! All changes made in this file will be lost!\n"\n\n')
    load_file = open(join(FUNC_DIR, 'load_switch.py'), 'w')
    load_file.write('# -*- coding: utf-8 -*-\n')
    load_file.write('"File generated by generate_code() - \n')
    load_file.write('WARNING! All changes made in this file will be lost!\n"\n\n')
    load_file.write('from ..Classes.import_all import *\n\n')
    load_file.write('load_switch = {\n')
    if (gen_dict is None):
        gen_dict = read_all(DOC_DIR)
    for (class_name, _) in iter(sorted(list(gen_dict.items()))):
        import_file.write((((('from ..Classes.' + class_name) + ' import ') + class_name) + '\n'))
        load_file.write((((('    "' + class_name) + '": ') + class_name) + ',\n'))
        print((('Generation of ' + class_name) + ' class'))
        generate_class(gen_dict, class_name, CLASS_DIR)
    import_file.close()
    load_file.write('}\n')
    load_file.close()
    print('Generation of load_switch.py')
    print('Generation of import_all.py')
    class_dict_file = join(CLASS_DIR, 'Class_Dict.json')
    with open(class_dict_file, 'w') as json_file:
        json.dump(gen_dict, json_file, sort_keys=True, indent=4, separators=(',', ': '))