The create_files.py module#

Summary#

clean

Remove src/ansys/mechanical/stubs directory.

get_version

Get the install directory and version of Ansys Mechanical installed on the system.

is_type_published

Get published type if it exists.

main

Generate the Mechanical stubs based on assembly files.

make

Generate the __init__.py files from assembly files.

resolve

Add assembly resolver for the Ansys Mechanical install.

write_docs

Output to the tinypages directory.

Description#

Create __init__.py files from the content of the assembly XML files.

Module detail#

create_files.clean(outdir)#

Remove src/ansys/mechanical/stubs directory.

Parameters:
outdir: pathlib.Path

Path to where the init files are generated.

create_files.get_version()#

Get the install directory and version of Ansys Mechanical installed on the system.

Returns:
str

Path of the Ansys install set in the AWP_ROOTDV_DEV environment variable.

int

The version of the Ansys install set in the AWP_ROOTDV_DEV environment variable.

create_files.is_type_published(mod_type: System.RuntimeType)#

Get published type if it exists.

Parameters:
mod_type: System.RuntimeType

A module type.

Returns:
bool

True if “Ansys.Utilities.Sdk.PublishedAttribute” is in map(str, attrs) False if “Ansys.Utilities.Sdk.PublishedAttribute” is not in map(str, attrs)

create_files.main()#

Generate the Mechanical stubs based on assembly files.

create_files.make(base_dir, outdir, assemblies, str_version)#

Generate the __init__.py files from assembly files.

Make __init__.py files in src/ansys/mechanical/stubs, generate classes, properties, and methods with their docstrings from assembly files from the Ansys Mechanical install, and add import statements to the __init__.py files.

Parameters:
outdir: pathlib.Path

Path to where the init files are generated.

assemblies: list

List of Mechanical assembly files to create classes, properties, and methods from.

create_files.resolve()#

Add assembly resolver for the Ansys Mechanical install.

create_files.write_docs(commands, tiny_pages_path)#

Output to the tinypages directory.

Parameters:
tiny_pages_pathstr

Path to the tiny pages directory.