• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

haiiliin / abqpy / 5910646359

19 Aug 2023 09:25AM UTC coverage: 83.152% (-0.1%) from 83.3%
5910646359

push

github

web-flow
[typing] Fix wrong mypy typing annotations (backport #4879) (#4880)

* [typing] Fix wrong mypy typing annotations (#4879)

* Fix mypy abqpy issues

* Mypy typings

* Update typing annotations for SymbolicConstants

* Fixing typings

* Add future annotations

* Use list/dict/tuple instead of List/Dict/Tuple

* Fix Optional typings

* Add future annotations

* Update xyPlot.py

* Update .pre-commit-config.yaml

* Fix list typings for Python 3.7/3.8

* Fixing more typings

* Fix more typings

* Update conf.py

* Update .pre-commit-config.yaml

* Revert "Update conf.py"

This reverts commit e8449ae0c.

* Update conf.py

* Revert "Update conf.py"

This reverts commit 3be44d0a5.

* Docs Not -W

(cherry picked from commit d7be4b472)

# Conflicts:
#	src/abaqus/BasicGeometry/Cell.py
#	src/abaqus/BasicGeometry/CellArray.py
#	src/abaqus/BasicGeometry/Face.py
#	src/abaqus/BasicGeometry/FaceArray.py
#	src/abaqus/BoundaryCondition/BoundaryConditionModel.py
#	src/abaqus/BoundaryCondition/SubmodelBC.py
#	src/abaqus/Datum/DatumCsys.py
#	src/abaqus/DisplayGroup/LeafFromConstraintNames.py
#	src/abaqus/EngineeringFeature/DataImperfection.py
#	src/abaqus/EngineeringFeature/EngineeringFeature.py
#	src/abaqus/EngineeringFeature/EngineeringFeatureBase.py
#	src/abaqus/EngineeringFeature/FileImperfection.py
#	src/abaqus/EngineeringFeature/InputImperfection.py
#	src/abaqus/FieldReport/FieldReportSession.py
#	src/abaqus/FieldReport/writeFieldReport.py
#	src/abaqus/Interaction/ContactExp.py
#	src/abaqus/Interaction/ContactStd.py
#	src/abaqus/Interaction/ExpInitialization.py
#	src/abaqus/Interaction/FluidInflatorProperty.py
#	src/abaqus/Interaction/FluidInflatorState.py
#	src/abaqus/Interaction/InteractionContactInitializationModel.py
#	src/abaqus/Interaction/InteractionModel.py
#	src/abaqus/Interaction/InteractionPropertyModel.py
#	src/abaqus/Interaction/SurfaceCrushTriggerAssignment.py
#... (continued)

3258 of 3258 new or added lines in 713 files covered. (100.0%)

24089 of 28970 relevant lines covered (83.15%)

0.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/abaqus/Mesh/MeshNodeArray.py
1
from __future__ import annotations
1✔
2

3
from typing import List, Sequence, Union
1✔
4

5
from abqpy.decorators import abaqus_class_doc, abaqus_method_doc
1✔
6

7
from .MeshNode import MeshNode
1✔
8

9

10
@abaqus_class_doc
1✔
11
class MeshNodeArray(List[MeshNode]):
1✔
12
    """The MeshNodeArray is a sequence of MeshNode objects.
13

14
    .. note::
15
        This object can be accessed by::
16

17
            import part
18
            mdb.models[name].parts[name].allInternalSets[name].nodes
19
            mdb.models[name].parts[name].allInternalSurfaces[name].nodes
20
            mdb.models[name].parts[name].allSets[name].nodes
21
            mdb.models[name].parts[name].allSurfaces[name].nodes
22
            mdb.models[name].parts[name].nodes
23
            mdb.models[name].parts[name].retainedNodes
24
            mdb.models[name].parts[name].sets[name].nodes
25
            mdb.models[name].parts[name].surfaces[name].nodes
26
            import assembly
27
            mdb.models[name].rootAssembly.allInstances[name].nodes
28
            mdb.models[name].rootAssembly.allInstances[name].sets[name].nodes
29
            mdb.models[name].rootAssembly.allInstances[name].surfaces[name].nodes
30
            mdb.models[name].rootAssembly.allInternalSets[name].nodes
31
            mdb.models[name].rootAssembly.allInternalSurfaces[name].nodes
32
            mdb.models[name].rootAssembly.allSets[name].nodes
33
            mdb.models[name].rootAssembly.allSurfaces[name].nodes
34
            mdb.models[name].rootAssembly.instances[name].nodes
35
            mdb.models[name].rootAssembly.instances[name].sets[name].nodes
36
            mdb.models[name].rootAssembly.instances[name].surfaces[name].nodes
37
            mdb.models[name].rootAssembly.modelInstances[i].nodes
38
            mdb.models[name].rootAssembly.modelInstances[i].sets[name].nodes
39
            mdb.models[name].rootAssembly.modelInstances[i].surfaces[name].nodes
40
            mdb.models[name].rootAssembly.nodes
41
            mdb.models[name].rootAssembly.sets[name].nodes
42
            mdb.models[name].rootAssembly.surfaces[name].nodes
43
    """
44

45
    @abaqus_method_doc
1✔
46
    def __init__(self, nodes: list[MeshNode]) -> None:
1✔
47
        """This method creates a MeshNodeArray object.
48

49
        .. note::
50
            This function can be accessed by::
51

52
                mesh.MeshNodeArray
53

54
        Parameters
55
        ----------
56
        nodes
57
            A list of MeshNode objects.
58

59
        Returns
60
        -------
61
        MeshNodeArray
62
            A MeshNodeArray object.
63
        """
64
        super().__init__()
1✔
65

66
    @abaqus_method_doc
1✔
67
    def getFromLabel(self, label: int) -> MeshNode:
1✔
68
        """This method returns the object in the MeshNodeArray with the given label.
69

70
        Parameters
71
        ----------
72
        label
73
            An Int specifying the label of the object.
74

75
        Returns
76
        -------
77
        MeshNode
78
            A MeshNode object.
79
        """
80
        return MeshNode((0.0, 0.0, 0.0))
×
81

82
    @abaqus_method_doc
1✔
83
    def getSequenceFromMask(self, mask: Union[str, Sequence[str]]) -> MeshNodeArray:
1✔
84
        """This method returns the objects in the MeshNodeArray identified using the specified
85
        **mask**. This command is generated when the JournalOptions are set to COMPRESSEDINDEX.
86
        When a large number of objects are involved, this method is highly efficient.
87

88
        Parameters
89
        ----------
90
        mask
91
            A String specifying the object or objects.
92

93
        Returns
94
        -------
95
        MeshNodeArray
96
            A MeshNodeArray object.
97
        """
98
        return MeshNodeArray([MeshNode((0.0, 0.0, 0.0))])
×
99

100
    @abaqus_method_doc
1✔
101
    def getMask(self) -> str:
1✔
102
        """This method returns a string specifying the object or objects.
103

104
        Returns
105
        -------
106
        str
107
            A String specifying the object or objects.
108
        """
109
        return ""
×
110

111
    @abaqus_method_doc
1✔
112
    def getByBoundingBox(
1✔
113
        self,
114
        xMin: float = 0,
115
        yMin: float = 0,
116
        zMin: float = 0,
117
        xMax: float = 0,
118
        yMax: float = 0,
119
        zMax: float = 0,
120
    ) -> MeshNodeArray:
121
        """This method returns an array of nodes that lie within the specified bounding box.
122

123
        Parameters
124
        ----------
125
        xMin
126
            A float specifying the minimum X boundary of the bounding box.
127
        yMin
128
            A float specifying the minimum Y boundary of the bounding box.
129
        zMin
130
            A float specifying the minimum Z boundary of the bounding box.
131
        xMax
132
            A float specifying the maximum X boundary of the bounding box.
133
        yMax
134
            A float specifying the maximum Y boundary of the bounding box.
135
        zMax
136
            A float specifying the maximum Z boundary of the bounding box.
137

138
        Returns
139
        -------
140
        MeshNodeArray
141
            A MeshNodeArray object, which is a sequence of MeshNode objects.
142
        """
143
        return MeshNodeArray([MeshNode((0.0, 0.0, 0.0))])
×
144

145
    @abaqus_method_doc
1✔
146
    def getByBoundingCylinder(
1✔
147
        self,
148
        center1: tuple[float, float, float],
149
        center2: tuple[float, float, float],
150
        radius: float,
151
    ) -> MeshNodeArray:
152
        """This method returns an array of node objects that lie within the specified bounding cylinder.
153

154
        Parameters
155
        ----------
156
        center1
157
            A tuple of the X-, Y-, and Z-coordinates of the center of the first end of the cylinder.
158
        center2
159
            A tuple of the X-, Y-, and Z-coordinates of the center of the second end of the
160
            cylinder.
161
        radius
162
            A float specifying the radius of the cylinder.
163

164
        Returns
165
        -------
166
        MeshNodeArray
167
            A MeshNodeArray object, which is a sequence of MeshNode objects.
168
        """
169
        return MeshNodeArray([MeshNode((0.0, 0.0, 0.0))])
×
170

171
    @abaqus_method_doc
1✔
172
    def getByBoundingSphere(self, center: tuple, radius: str) -> MeshNodeArray:
1✔
173
        """This method returns an array of node objects that lie within the specified bounding sphere.
174

175
        Parameters
176
        ----------
177
        center
178
            A tuple of the X-, Y-, and Z-coordinates of the center of the sphere.
179
        radius
180
            A float specifying the radius of the sphere.
181

182
        Returns
183
        -------
184
        MeshNodeArray
185
            A MeshNodeArray object, which is a sequence of MeshNode objects.
186
        """
187
        return MeshNodeArray([MeshNode((0.0, 0.0, 0.0))])
×
188

189
    @abaqus_method_doc
1✔
190
    def getBoundingBox(self) -> dict[str, tuple[float, float, float]]:
1✔
191
        """This method returns a dictionary of two tuples representing minimum and maximum boundary values of
192
        the bounding box of the minimum size containing the node sequence.
193

194
        Returns
195
        -------
196
        dict[str, tuple[float, float, float]]
197
            A Dictionary object with the following items:
198

199
            - **low**: a tuple of three floats representing the minimum x, y and z boundary values of
200
              the bounding box.
201
            - **high**: a tuple of three floats representing the maximum x, y and z boundary values of
202
              the bounding box.
203

204
        Raises
205
        ------
206
        """
207
        return {"low": (0.0, 0.0, 0.0), "high": (0.0, 0.0, 0.0)}
×
208

209
    @abaqus_method_doc
1✔
210
    def getClosest(
1✔
211
        self, coordinates: tuple, numToFind: int = 1, searchTolerance: float = 0.0
212
    ) -> Union[MeshNode, list[MeshNode]]:
213
        """This method returns the node or nodes closest to the given point or set of points.
214

215
        Parameters
216
        ----------
217
        coordinates
218
            A point defined by x, y, and z values or a list of such points.
219
        numToFind
220
            The number of nodes to find for each given point. For example, if **numToFind** is 2, then
221
            the 2 closest points, if available and within **searchTolerance**, will be returned in
222
            order of proximity for each input point. The default is 1.
223
        searchTolerance
224
            A float specifying a search radius for each point. By default, no search radius is
225
            defined, and all nodes in the sequence will be searched.
226

227
        Returns
228
        -------
229
        MeshNode | list[MeshNode]
230
            A MeshNode, or a list of MeshNode objects, or a list of lists of MeshNode objects,
231
            depending on the number of points given and the number of nodes requested.
232
        """
233
        return MeshNode((0.0, 0.0, 0.0))
×
234

235
    @abaqus_method_doc
1✔
236
    def sequenceFromLabels(self, labels: Sequence[int]) -> MeshNodeArray:
1✔
237
        """This method returns the objects in the MeshNodeArray identified using the specified labels.
238

239
        Parameters
240
        ----------
241
        labels
242
            A sequence of Ints specifying the labels.
243

244
        Returns
245
        -------
246
        MeshNodeArray
247
            A MeshNodeArray object.
248

249
        Raises
250
        ------
251
        Error
252
            The mask results in an empty sequence, An exception occurs if the resulting sequence is empty.
253
        """
254
        return MeshNodeArray([MeshNode((0.0, 0.0, 0.0))])
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc