• 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

74.55
/src/abaqus/BasicGeometry/EdgeArray.py
1
from __future__ import annotations
1✔
2

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

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

7
from ..UtilityAndView.abaqusConstants import Boolean
1✔
8
from .Edge import Edge
1✔
9

10

11
@abaqus_class_doc
1✔
12
class EdgeArray(List[Edge]):
1✔
13
    """The EdgeArray is a sequence of Edge objects. If the part is modified, then EdgeArray must be updated for
14
    that part.
15

16
    .. note::
17
        This object can be accessed by::
18

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

46
    @abaqus_method_doc
1✔
47
    def __init__(self, edges: list[Edge]) -> None:
1✔
48
        """This method creates an EdgeArray object.
49

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

53
                part.EdgeArray
54

55
        Parameters
56
        ----------
57
        edges
58
            A list of Edge objects.
59

60
        Returns
61
        -------
62
        EdgeArray
63
            A EdgeArray object.
64
        """
65
        ...
1✔
66

67
    @overload
1✔
68
    @abaqus_method_doc
1✔
69
    def findAt(
1✔
70
        self,
71
        coordinates: tuple[float, float, float],
72
        printWarning: Boolean = True,
73
    ) -> Edge:
74
        ...
×
75

76
    @overload
1✔
77
    @abaqus_method_doc
1✔
78
    def findAt(
1✔
79
        self,
80
        coordinates: tuple[tuple[float, float, float],],
81
        printWarning: Boolean = True,
82
    ) -> list[Edge]:
83
        ...
×
84

85
    @overload
1✔
86
    @abaqus_method_doc
1✔
87
    def findAt(
1✔
88
        self,
89
        *coordinates: tuple[tuple[float, float, float],],
90
        printWarning: Boolean = True,
91
    ) -> list[Edge]:
92
        ...
×
93

94
    @abaqus_method_doc
1✔
95
    def findAt(self, *args, **kwargs) -> Union[Edge, list[Edge]]:
1✔
96
        """This method returns the object or objects in the EdgeArray located at the given coordinates. findAt
97
        initially uses the ACIS tolerance of 1E-6. As a result, findAt returns any edge that is at the arbitrary
98
        point specified or at a distance of less than 1E-6 from the arbitrary point. If nothing is found, findAt
99
        uses the tolerance for imprecise geometry (applicable only for imprecise geometric entities). The
100
        arbitrary point must not be shared by a second edge. If two edges intersect or coincide at the arbitrary
101
        point, findAt chooses the first edge that it encounters, and you should not rely on the return value
102
        being consistent. findAt will always try to find objects among all the edges in the part or assembly
103
        instance and will not restrict itself to a subset even if the EdgeArray represents such subset.
104

105
        Parameters
106
        ----------
107
        coordinates
108
            A sequence of Floats specifying the **X**, **Y**, and **Z** coordinates of the object to
109
            find. findAt returns either an Edge object or a sequence of Edge objects based on the
110
            type of input.
111

112
            * If **coordinates** is a sequence of Floats, findAt returns the Edge object at that point.
113

114
            * If you omit the **coordinates** keyword argument, findAt accepts as arguments a sequence
115
              of sequence of floats in the following format::
116

117
                edges = e.findAt(((20.19686, -169.513997, 27.798593), ),
118
                                 ((19.657627, -167.295749, 27.056402), ),
119
                                 ((18.274129, -157.144741, 25.15218), ))
120
        printWarning
121
            A Boolean specifying whether a message is to be printed to the CLI if no entity is found
122
            at the specified location. The default value is True.
123

124
        Returns
125
        -------
126
        Edge
127
            An Edge object or a sequence of Edge objects.
128
        """
129
        first_arg = kwargs.get("coordinates", args[0] if args else ((),))
×
130
        return Edge() if isinstance(first_arg[0], float) else [Edge()]
×
131

132
    @abaqus_method_doc
1✔
133
    def getClosest(
1✔
134
        self, coordinates: tuple, searchTolerance: str = ""
135
    ) -> dict[int, tuple[Edge, tuple[float, float, float]]]:
136
        """This method returns an object or objects in the EdgeArray closest to the given set of points, where
137
        the given points need not lie on the edges in the EdgeArray.
138

139
        Parameters
140
        ----------
141
        coordinates
142
            A sequence of a sequence of floats, where each sequence of floats describes the **X**,
143
            **Y**, and **Z**  coordinates of a point::
144

145
                >>> r=e.getClosest(coordinates=((20.0, 20.0, 10.0), (-1.0, -15.0, 15), ))
146
                >>> r.keys()
147
                [0, 1]
148
                >>> r[0]
149
                (mdb.models['Model-1'].parts['Part-1'].edges[3], (15.7090625762939, 20.0, 10.0))
150
        searchTolerance
151
            A double specifying the distance within which the closest object must lie. The default
152
            value is half of the parent part/instance size.
153

154
        Returns
155
        -------
156
        dict
157
            This method returns a dictionary object. The key to the dictionary object is the
158
            position of the input point in the tuple specified in the **coordinates** starting at
159
            index 0. If a closest edge could be found then the value is a sequence consisting of two
160
            objects. The first object in the sequence is an Edge that is close to the input point
161
            referred to by the key. The second object in the sequence is a sequence of floats that
162
            specifies the **X**, **Y**, and **Z**  location of the closest point on the Edge to the given
163
            point. See program listing above.
164
        """
165
        return {0: (Edge(), (0.0, 0.0, 0.0))}
×
166

167
    @overload
1✔
168
    @abaqus_method_doc
1✔
169
    def getSequenceFromMask(self, mask: str) -> Edge:  # type: ignore
1✔
170
        ...
×
171

172
    @overload
1✔
173
    @abaqus_method_doc
1✔
174
    def getSequenceFromMask(self, mask: Sequence[str]) -> list[Edge]:  # type: ignore
1✔
175
        ...
×
176

177
    @abaqus_method_doc
1✔
178
    def getSequenceFromMask(self, mask: Union[str, Sequence[str]]) -> Union[Edge, list[Edge]]:  # type: ignore
1✔
179
        """This method returns the object or objects in the EdgeArray identified using the specified **mask**.
180
        This command is generated when the JournalOptions are set to COMPRESSEDINDEX. When a large number of
181
        objects are involved, this method is highly efficient.
182

183
        Parameters
184
        ----------
185
        mask
186
            A String specifying the object or objects.
187

188
        Returns
189
        -------
190
        Edge
191
            An Edge object or a sequence of Edge objects.
192

193
        Raises
194
        ------
195
        Error
196
            The mask results in an empty sequence, An exception occurs if the resulting sequence is empty.
197
        """
198
        return Edge() if isinstance(mask, str) else [Edge()]
×
199

200
    @abaqus_method_doc
1✔
201
    def getMask(self):
1✔
202
        """This method returns a string specifying the object or objects.
203

204
        Returns
205
        -------
206
        str
207
            A String specifying the object or objects.
208
        """
209
        return ""
×
210

211
    @abaqus_method_doc
1✔
212
    def getByBoundingBox(
1✔
213
        self,
214
        xMin: float = 0,
215
        yMin: float = 0,
216
        zMin: float = 0,
217
        xMax: float = 0,
218
        yMax: float = 0,
219
        zMax: float = 0,
220
    ) -> EdgeArray:
221
        """This method returns an array of edge objects that lie within the specified bounding box.
222

223
        Parameters
224
        ----------
225
        xMin
226
            A float specifying the minimum **X** boundary of the bounding box.
227
        yMin
228
            A float specifying the minimum **Y** boundary of the bounding box.
229
        zMin
230
            A float specifying the minimum **Z** boundary of the bounding box.
231
        xMax
232
            A float specifying the maximum **X** boundary of the bounding box.
233
        yMax
234
            A float specifying the maximum **Y** boundary of the bounding box.
235
        zMax
236
            A float specifying the maximum **Z** boundary of the bounding box.
237

238
        Returns
239
        -------
240
        EdgeArray
241
            An EdgeArray object, which is a sequence of Edge objects.
242
        """
243
        return EdgeArray([Edge()])
×
244

245
    @abaqus_method_doc
1✔
246
    def getByBoundingCylinder(
1✔
247
        self,
248
        center1: tuple[float, float, float],
249
        center2: tuple[float, float, float],
250
        radius: float,
251
    ) -> EdgeArray:
252
        """This method returns an array of edge objects that lie within the specified bounding cylinder.
253

254
        Parameters
255
        ----------
256
        center1
257
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the first end of the
258
            cylinder.
259
        center2
260
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the second end of the
261
            cylinder.
262
        radius
263
            A float specifying the radius of the cylinder.
264

265
        Returns
266
        -------
267
        EdgeArray
268
            An EdgeArray object, which is a sequence of Edge objects.
269
        """
270
        return EdgeArray([Edge()])
×
271

272
    @abaqus_method_doc
1✔
273
    def getByBoundingSphere(
1✔
274
        self,
275
        center: tuple[float, float, float],
276
        radius: float,
277
    ) -> EdgeArray:
278
        """This method returns an array of edge objects that lie within the specified bounding sphere.
279

280
        Parameters
281
        ----------
282
        center
283
            A tuple of the **X**, **Y**, and **Z** coordinates of the center of the sphere.
284
        radius
285
            A float specifying the radius of the sphere.
286

287
        Returns
288
        -------
289
        EdgeArray
290
            An EdgeArray object, which is a sequence of Edge objects.
291
        """
292
        return EdgeArray([Edge()])
×
293

294
    @abaqus_method_doc
1✔
295
    def getBoundingBox(self) -> dict[str, tuple[float, float, float]]:
1✔
296
        """This method returns a dictionary of two tuples representing minimum and maximum boundary values of
297
        the bounding box of the minimum size containing the edge sequence.
298

299
        Returns
300
        -------
301
        dict[str, tuple[float, float, float]]
302
            A Dictionary object with the following items:
303

304
            - **low**: a tuple of three floats representing the minimum **X** -, **Y** -, and **Z** -boundary
305
              values of the bounding box.
306
            - **high**: a tuple of three floats representing the maximum **X** -, **Y** -, and **Z** -boundary
307
              values of the bounding box.
308
        """
309
        return {"low": (0.0, 0.0, 0.0), "high": (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