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) (#5736)

Co-authored-by: Hailin Wang <hailin.wang@connect.polyu.hk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 28, 2024
1 parent 79dd5df commit 297655a
Show file tree
Hide file tree
Showing 15 changed files with 125 additions and 40 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/MainSecondaryAssignment.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,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 main-secondary assignments to new surface pairs in a given step.
Parameters
Expand Down
7 changes: 6 additions & 1 deletion src/abaqus/Interaction/PolarityAssignments.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 @@ -45,7 +46,11 @@ def changeValuesInStep(self, stepName: str, index: int, value: Literal[C.TWO_SID
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.TWO_SIDED, C.SPOS, C.SNEG, C.GLOBAL]):
def appendInStep(
self,
stepName: str,
assignments: tuple[tuple[Region | Literal[C.GLOBAL], Literal[C.TWO_SIDED, C.SPOS, C.SNEG, C.GLOBAL]], ...],
):
"""This method allows you to add polarity assignments to new surface pairs in a given step.
Parameters
Expand Down
17 changes: 12 additions & 5 deletions src/abaqus/Interaction/SlidingFormulationAssignment.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,11 @@ def changeValuesInStep(self, stepName: str, index: int, value: Literal[C.SMALL_S
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Literal[C.SMALL_SLIDING, C.NONE, C.GLOBAL]):
def appendInStep(
self,
stepName: str,
assignments: tuple[tuple[Region | Literal[C.GLOBAL], Literal[C.SMALL_SLIDING, C.NONE, C.GLOBAL]], ...],
):
"""This method allows you to add sliding formulation assignments to new surface pairs in a given step.
Parameters
Expand All @@ -57,10 +62,12 @@ def appendInStep(self, stepName: str, assignments: Literal[C.SMALL_SLIDING, C.NO
are to be defined.
assignments
A sequence of tuples specifying the sliding formulation assignments. Each tuple contains
two entries:A region object or the SymbolicConstant GLOBAL specifying the surface to
which the sliding formulation attribute is assigned.A SymbolicConstant specifying the
overriding the smoothness value to be used for the first surface. Possible values of the
SymbolicConstant are NONE and SMALL_SLIDING.
two entries:
- A region object or the SymbolicConstant GLOBAL specifying the surface to which the sliding
formulation attribute is assigned.
- A SymbolicConstant specifying the overriding the smoothness value to be used for the first
surface. Possible values of the SymbolicConstant are NONE and SMALL_SLIDING.
"""
...

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
10 changes: 7 additions & 3 deletions src/abaqus/Interaction/SurfaceBeamSmoothingAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

from ..Region.Region import Region


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

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: tuple):
def appendInStep(self, stepName: str, assignments: tuple[tuple[Region, float], ...]):
"""This method allows addition of surface beam smoothing assignments to new surfaces in a given step.
Parameters
Expand All @@ -53,8 +55,10 @@ def appendInStep(self, stepName: str, assignments: tuple):
are to be defined.
assignments
A sequence of tuples specifying the surface beam smoothing assignments. Each tuple
contains two entries:A region object specifying the surface to which the smoothing is
assigned.A Float specifying the surface smoothing value to be used for the surface.
contains two entries:
- A region object specifying the surface to which the smoothing is assigned.
- A Float specifying the surface smoothing value to be used for the surface.
"""
...

Expand Down
20 changes: 17 additions & 3 deletions src/abaqus/Interaction/SurfaceCrushTriggerAssignment.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 @@ -56,7 +58,18 @@ def changeValuesInStep(

@abaqus_method_doc
def appendInStep(
self, stepName: str, assignments: Union[Literal[C.NO_CRUSH, C.TRIGGER, C.NO_TRIGGER, C.GLOBAL], float]
self,
stepName: str,
assignments: tuple[
tuple[
Region | Material | Literal[C.GLOBAL],
Literal[C.NO_CRUSH, C.TRIGGER, C.NO_TRIGGER, C.GLOBAL],
float,
float,
float,
],
...,
],
):
"""This method allows addition of surface crush trigger assignments to new surfaces in a given step.
Expand All @@ -68,10 +81,11 @@ def appendInStep(
assignments
A sequence of tuples specifying the surface crush trigger assignments. Each tuple
contains four entries:
- A region or a material object or the SymbolicConstant GLOBAL specifying the surface to
which the feature angle is assigned.
which the feature angle is assigned.
- A SymbolicConstant specifying the trigger option to be used for the surface. Possible
values of the SymbolicConstant are TRIGGER, NO_TRIGGER, or NO_CRUSH.
values of the SymbolicConstant are TRIGGER, NO_TRIGGER, or NO_CRUSH.
- A Float specifying the crush stress value to be used for the surface.
- A Float specifying the crush initiation angle value to be used for the surface.
- A Float specifying the crush continuation angle value to be used for the surface.
Expand Down
13 changes: 12 additions & 1 deletion src/abaqus/Interaction/SurfaceFeatureAssignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

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 +68,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
11 changes: 6 additions & 5 deletions src/abaqus/Interaction/SurfaceFrictionAssignment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import annotations

from typing import Union

from typing_extensions import Literal

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 @@ -50,7 +50,7 @@ def changeValuesInStep(self, stepName: str, index: int, value: float):
...

@abaqus_method_doc
def appendInStep(self, stepName: str, assignments: Union[Literal[C.GLOBAL], float]):
def appendInStep(self, stepName: str, assignments: tuple[tuple[Region | Material | Literal[C.GLOBAL], float], ...]):
"""This method allows addition of surface friction assignments to new surfaces in a given step.
Parameters
Expand All @@ -61,10 +61,11 @@ def appendInStep(self, stepName: str, assignments: Union[Literal[C.GLOBAL], floa
assignments
A sequence of tuples specifying the surface friction assignments. Each tuple contains
two entries:
- A region or a material object or the SymbolicConstant GLOBAL specifying the surface to
which the friction coefficient is assigned.
which the friction coefficient is assigned.
- A Float specifying the overriding friction coefficient to be used in the contact
definition.
definition.
"""
...

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
Loading

0 comments on commit 297655a

Please sign in to comment.