Skip to content

Commit

Permalink
[typing] Fix typing errors for argument assignments in `appendInSte…
Browse files Browse the repository at this point in the history
…p` (backport #5734) (#5742)

Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent 9be3522 commit f94d78a
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 20 deletions.
8 changes: 7 additions & 1 deletion src/abaqus/Interaction/ContactPropertyAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Material.Material import Material
from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -43,7 +45,11 @@ def changeValuesInStep(self, stepName: str, index: int, value: str):
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.SELF, C.GLOBAL]):
def appendInStep(
self,
stepName: str,
assignments: tuple[tuple[Region | Material | Literal[C.GLOBAL], Region | Material | Literal[C.SELF], str], ...],
):
"""This method allows addition of contact property assignments to new domain pairs in a given step.
Parameters
Expand Down
8 changes: 7 additions & 1 deletion src/abaqus/Interaction/InitializationAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -44,7 +45,11 @@ def changeValuesInStep(self, stepName: str, index: int, value: str):
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.CLEARANCE, C.SELF, C.GLOBAL]):
def appendInStep(
self,
stepName: str,
assignments: tuple[tuple[Region | Literal[C.GLOBAL], Region | Literal[C.SELF], str, str], ...],
):
"""This method allows addition of contact initialization assignments to new domain pairs in a given
step.
Expand All @@ -56,6 +61,7 @@ def appendInStep(self, stepName: str, assignments: Literal[C.CLEARANCE, C.SELF,
assignments
A sequence of tuples specifying the initializations assigned to each surface pair. Each
tuple contains four entries (fourth entry is for Abaqus/Explicit and is optional):
- A region object or the SymbolicConstant GLOBAL (for Abaqus/Standard only).
- A region object or the SymbolicConstant SELF (for Abaqus/Standard only).
- A String specifying a StdInitialization or ExpInitializationobject associated with this pair of regions.
Expand Down
7 changes: 6 additions & 1 deletion src/abaqus/Interaction/MasterSlaveAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -44,7 +45,11 @@ def changeValuesInStep(self, stepName: str, index: int, value: Literal[C.BALANCE
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.BALANCED, C.SECONDARY, C.MAIN, C.GLOBAL]):
def appendInStep(
self,
stepName: str,
assignments: tuple[tuple[Region | Literal[C.GLOBAL], Literal[C.BALANCED, C.SECONDARY, C.MAIN, C.GLOBAL]], ...],
):
"""This method allows addition of master-slave assignments to new surface pairs in a given step.
Parameters
Expand Down
20 changes: 15 additions & 5 deletions src/abaqus/Interaction/SlidingTransitionAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -52,7 +53,13 @@ def changeValuesInStep(
def appendInStep(
self,
stepName: str,
assignments: Literal[C.QUADRATIC_SMOOTHING, C.LINEAR_SMOOTHING, C.ELEMENT_ORDER_SMOOTHING, C.GLOBAL],
assignments: tuple[
tuple[
Region | Literal[C.GLOBAL],
Literal[C.QUADRATIC_SMOOTHING, C.LINEAR_SMOOTHING, C.ELEMENT_ORDER_SMOOTHING, C.GLOBAL],
],
...,
],
):
"""This method allows you to add sliding transition assignments to new surface pairs in a given step.
Expand All @@ -63,10 +70,13 @@ def appendInStep(
to be defined.
assignments
A sequence of tuples specifying the sliding transition assignments. Each tuple contains
two entries:A region object or the SymbolicConstant GLOBAL specifying the surface to
which the sliding transition attribute is assigned.A SymbolicConstant specifying the
overriding the smoothness value to be used for the first surface. Possible values of the
SymbolicConstant are ELEMENT_ORDER_SMOOTHING, LINEAR_SMOOTHING, and QUADRATIC_SMOOTHING.
two entries:
- A region object or the SymbolicConstant GLOBAL specifying the surface to which the sliding
transition attribute is assigned.
- A SymbolicConstant specifying the overriding the smoothness value to be used for the first
surface. Possible values of the SymbolicConstant are ELEMENT_ORDER_SMOOTHING, LINEAR_SMOOTHING,
and QUADRATIC_SMOOTHING.
"""
...

Expand Down
9 changes: 8 additions & 1 deletion src/abaqus/Interaction/SmoothingAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -47,7 +48,13 @@ def changeValuesInStep(
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.TOROIDAL, C.SPHERICAL, C.REVOLUTION, C.NONE]):
def appendInStep(
self,
stepName: str,
assignments: tuple[
tuple[Region | Literal[C.GLOBAL], Literal[C.TOROIDAL, C.SPHERICAL, C.REVOLUTION, C.NONE]], ...
],
):
"""This method allows addition of surface smoothing assignments to new surfaces in a given step.
Parameters
Expand Down
6 changes: 5 additions & 1 deletion src/abaqus/Interaction/StabilizationAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -43,7 +44,9 @@ def changeValuesInStep(self, stepName: str, index: int, value: str):
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.SELF, C.GLOBAL]):
def appendInStep(
self, stepName: str, assignments: tuple[tuple[Region | Literal[C.GLOBAL], Region | Literal[C.SELF], str], ...]
):
"""This method allows addition of contact stabilization assignments to new domain pairs in a given step.
Parameters
Expand All @@ -54,6 +57,7 @@ def appendInStep(self, stepName: str, assignments: Literal[C.SELF, C.GLOBAL]):
assignments
A sequence of tuples specifying the stabilizations assigned to each surface pair. Each
tuple contains three entries:
- A region object or the SymbolicConstant GLOBAL.
- A region object or the SymbolicConstant SELF.
- A String specifying a StdStabilization object associated with this pair of regions.
Expand Down
12 changes: 11 additions & 1 deletion src/abaqus/Interaction/SurfaceFeatureAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Material.Material import Material
from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -65,7 +67,15 @@ def changeValuesInStep(
def appendInStep(
self,
stepName: str,
assignments: Union[Literal[C.GLOBAL, C.ALL, C.CURRENT, C.ORIGINAL, C.NONE, C.PICKED, C.PERIMETER], float],
assignments: tuple[
tuple[
Region | Material | Literal[C.GLOBAL],
float | Literal[C.ALL, C.NONE, C.PICKED, C.PERIMETER],
float | Literal[C.ALL, C.NONE, C.PICKED, C.PERIMETER],
Literal[C.CURRENT, C.ORIGINAL],
],
...,
],
):
"""This method allows addition of surface feature angle assignments to new surfaces in a given step.
Expand Down
6 changes: 4 additions & 2 deletions src/abaqus/Interaction/SurfaceOffsetAssignment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Sequence, Union
from typing import Union

from typing_extensions import Literal

Expand Down Expand Up @@ -53,7 +53,9 @@ def changeValuesInStep(self, stepName: str, index: int, value: Union[Literal[C.S
def appendInStep(
self,
stepName: str,
assignments: Sequence[tuple[Union[Region, Material, Literal[C.SPOS, C.ORIGINAL, C.SNEG, C.GLOBAL]], float]],
assignments: tuple[
tuple[Region | Material | Literal[C.GLOBAL], float | Literal[C.SPOS, C.ORIGINAL, C.SNEG, C.GLOBAL]], ...
],
):
"""This method allows addition of surface offset fraction assignments to new surfaces in a given step.
Expand Down
8 changes: 1 addition & 7 deletions src/abaqus/Interaction/SurfaceThicknessAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from ..Material.Material import Material
from ..Region.Region import Region
from ..UtilityAndView.abaqusConstants import SymbolicConstant
from ..UtilityAndView.abaqusConstants import abaqusConstants as C


Expand Down Expand Up @@ -59,12 +58,7 @@ def appendInStep(
self,
stepName: str,
assignments: tuple[
tuple[
Union[Region, Material, Literal[C.THINNING, C.ORIGINAL, C.GLOBAL]],
Union[SymbolicConstant, float],
float,
],
...,
tuple[Region | Material | Literal[C.GLOBAL], float | Literal[C.THINNING, C.ORIGINAL], float], ...
],
):
"""This method allows addition of surface thickness assignments to new surfaces in a given step.
Expand Down

0 comments on commit f94d78a

Please sign in to comment.