Skip to content

Commit

Permalink
chore: add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Nov 26, 2024
1 parent b30c739 commit c7e810a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/py/mat3ra/made/tools/build/slab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ def create_slab(configuration: SlabConfiguration, termination: Optional[Terminat
return builder.get_material(configuration, selector_parameters=SlabSelectorParameters(termination=termination))


def create_slab_if_not(material: Material, default_slab_configuration: SlabConfiguration):
def create_slab_if_not(material: Material, default_slab_configuration: SlabConfiguration) -> Material:
"""
Create a slab from the material if it is not a slab already. Otherwise, return the material.
Args:
material (Material): The material to be checked.
default_slab_configuration (SlabConfiguration): The default configuration to be used for creating a new slab.
Returns:
Material: The slab.
"""
slab = material
if not slab.metadata or slab.metadata["build"]["configuration"]["type"] != SlabConfiguration.__name__:
print("The material is not a slab. Creating a new slab...")
Expand Down

0 comments on commit c7e810a

Please sign in to comment.