pyleecan.Generator.read_fct module

read_all(path, is_internal=False, in_path='', soft_name='pyleecan')[source]

Read every csv files in a directory and subdirectory and create a structure for the code generation

Parameters:
  • path (str) – path to the root folder with the csv files

  • is_internal (bool) – True to overwrite the open source csv files by internal ones

  • soft_name (str) – Name of the generated software

Returns:

gen_dict – Dict with key = class name and value = class dict (name, package, properties, methods…)

Return type:

dict

read_file(file_path, soft_name='pyleecan')[source]

Read a csv file and create a dict for the class code generation

Parameters:

file_path (str) – path to the class csv file to read

Returns:

class_dict – Dict containing all the class informations (properties, package, methods…)

Return type:

dict

get_dict_from_side_by_side(class_csv, class_dict)[source]
get_dict_from_columns(class_csv, class_dict, header_index)[source]
update_all_daughters(gen_dict)[source]

This function update all the “daughters” key according to the “mother” key

Parameters:

gen_dict (dict) – gen_dict with no daughter set

get_value_str(value, type_val)[source]

Convert the value from the csv file to the correct str according to the type

Parameters:
  • value (str) – value to convert

  • type_val (str) – Type to convert to

Returns:

value – Value updated to match the type

Return type:

str

find_import_type(gen_dict, class_dict, pyleecan_type=[])[source]

Find all the Pyleecan type used by the class of class_dict

Parameters:
  • gen_dict (dict) – Dict with key = class name and value = class_dict

  • class_dict (dict) – Dict of the class to find the import

  • pyleecan_type (list) – Existing type to import (Default value = [])

Returns:

type_list – List of pyleecan type (as str) to import

Return type:

list

is_dict_list_pyleecan_type(type_name)[source]

Check if the type is a dict of list of Pyleecan type ({[name]})

Parameters:

type_name (str) – Type of the property

Returns:

is_dict_list – True if the type is a dict of list of pyleecan type

Return type:

bool

is_list_pyleecan_type(type_name)[source]

Check if the type is a list of Pyleecan type ([name])

Parameters:

type_name (str) – Type of the property

Returns:

is_list – True if the type is a list of pyleecan type

Return type:

bool

is_dict_pyleecan_type(type_name)[source]

Check if the type is a dict of Pyleecan type ({name})

Parameters:

type_name (str) – Type of the property

Returns:

is_list – True if the type is a dict of pyleecan type

Return type:

bool

is_list_unknow_type(type_name)[source]

Check if the type is a list of unknow type (Frozen or ndarray or python) “[]”

Parameters:

type_name (str) – Type of the property

Returns:

is_list – True if the type is a list of unknow type

Return type:

bool

exception NotAFile[source]

Bases: Exception

Raised when the code generator is call on a wrong path

exception InheritError[source]

Bases: Exception

Raised when a class has a wrong mother defined