Skip to content

Commit fb60a56

Browse files
committed
lint
1 parent c15b3d5 commit fb60a56

File tree

8 files changed

+51
-36
lines changed

8 files changed

+51
-36
lines changed

src/compas_fea2/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def from_name(cls, name, **kwargs):
135135
# ==========================================================================
136136
# Copy and Serialization
137137
# ==========================================================================
138+
138139
def copy(self, cls=None, copy_guid=False, copy_name=False):
139140
"""Make an independent copy of the data object.
140141

src/compas_fea2/job/input_file.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ def write_to_file(self, path=None):
7373

7474

7575
class ParametersFile(InputFile):
76-
"""Input file object for Optimizations.
77-
"""
76+
"""Input file object for Optimizations."""
7877

7978
def __init__(self, **kwargs):
8079
super(ParametersFile, self).__init__(**kwargs)

src/compas_fea2/model/elements.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ def plot_section(self):
347347
self.section.plot()
348348

349349
def plot_stress_distribution(self, step: "_Step", end: str = "end_1", nx: int = 100, ny: int = 100, *args, **kwargs): # noqa: F821
350-
""" Plot the stress distribution along the element.
351-
350+
"""Plot the stress distribution along the element.
351+
352352
Parameters
353353
----------
354354
step : :class:`compas_fea2.model.Step`
@@ -375,41 +375,41 @@ def section_forces_result(self, step: "Step") -> "Result": # noqa: F821
375375
----------
376376
step : :class:`compas_fea2.model.Step`
377377
The analysis step.
378-
378+
379379
Returns
380380
-------
381381
:class:`compas_fea2.results.Result`
382382
The section forces result for the element.
383383
"""
384-
384+
385385
if not hasattr(step, "section_forces_field"):
386386
raise ValueError("The step does not have a section_forces_field")
387387
return step.section_forces_field.get_result_at(self)
388388

389389
def forces(self, step: "Step") -> "Result": # noqa: F821
390390
"""Get the forces result for the element.
391-
391+
392392
Parameters
393393
----------
394394
step : :class:`compas_fea2.model.Step`
395395
The analysis step.
396-
396+
397397
Returns
398398
-------
399399
:class:`compas_fea2.results.Result`
400-
The forces result for the element.
400+
The forces result for the element.
401401
"""
402402
r = self.section_forces_result(step)
403403
return r.forces
404404

405405
def moments(self, step: "_Step") -> "Result": # noqa: F821
406-
""" Get the moments result for the element.
407-
406+
"""Get the moments result for the element.
407+
408408
Parameters
409409
----------
410410
step : :class:`compas_fea2.model.Step`
411411
The analysis step.
412-
412+
413413
Returns
414414
-------
415415
:class:`compas_fea2.results.Result`
@@ -638,12 +638,12 @@ def _construct_faces(self, face_indices: Dict[str, Tuple[int]]) -> List[Face]:
638638

639639
def stress_results(self, step: "_Step") -> "Result": # noqa: F821
640640
"""Get the stress results for the element.
641-
641+
642642
Parameters
643643
----------
644644
step : :class:`compas_fea2.model.Step`
645645
The analysis step.
646-
646+
647647
Returns
648648
-------
649649
:class:`compas_fea2.results.Result`

src/compas_fea2/model/nodes.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def connected_elements(self) -> List:
265265

266266
def transform(self, transformation):
267267
"""Transform the node using a transformation matrix.
268-
268+
269269
Parameters
270270
----------
271271
transformation : list
@@ -275,12 +275,12 @@ def transform(self, transformation):
275275

276276
def transformed(self, transformation):
277277
"""Return a copy of the node transformed by a transformation matrix.
278-
278+
279279
Parameters
280280
----------
281281
transformation : list
282282
A 4x4 transformation matrix.
283-
283+
284284
Returns
285285
-------
286286
:class:`compas_fea2.model.Node`
@@ -292,12 +292,12 @@ def transformed(self, transformation):
292292

293293
def displacement(self, step):
294294
"""Get the displacement of the node at a given step.
295-
295+
296296
Parameters
297297
----------
298298
step : :class:`compas_fea2.model.Step`
299299
The step for which to get the displacement.
300-
300+
301301
Returns
302302
-------
303303
:class:`compas_fea2.results.DisplacementResult`
@@ -308,18 +308,18 @@ def displacement(self, step):
308308

309309
def reaction(self, step):
310310
"""Get the reaction of the node at a given step.
311-
311+
312312
Parameters
313313
----------
314314
step : :class:`compas_fea2.model.Step`
315315
The step for which to get the reaction.
316-
316+
317317
Returns
318318
-------
319319
:class:`compas_fea2.results.ReactionResult`
320320
The reaction result at the node for the given step.
321321
"""
322-
322+
323323
if step.reaction_field:
324324
return step.reaction_field.get_result_at(location=self)
325325

src/compas_fea2/model/parts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ def elements_by_dimension(self, dimension: int = 1) -> Iterable[_Element]:
598598
Iterable[:class:`compas_fea2.model._Element`]
599599
The elements of the specified dimension.
600600
"""
601-
601+
602602
if dimension == 1:
603603
return filter(lambda x: isinstance(x, _Element1D), self.elements)
604604
elif dimension == 2:
@@ -942,7 +942,7 @@ def from_step_file(cls, step_file: str, name: Optional[str] = None, **kwargs) ->
942942
def from_brep(cls, brep, name: Optional[str] = None, **kwargs) -> "_Part":
943943
"""Create a Part object from a BREP file.
944944
Parameters
945-
----------
945+
----------
946946
brep : str
947947
Path to the BREP file.
948948
name : str, optional
@@ -1551,8 +1551,8 @@ def visualize_node_connectivity(self):
15511551

15521552
def visualize_pyvis(self, filename="model_graph.html"):
15531553
"""Visualizes the Model-Part and Element-Node graph using Pyvis.
1554-
The graph is saved as an HTML file, which can be opened in a web browser.
1555-
1554+
The graph is saved as an HTML file, which can be opened in a web browser.
1555+
15561556
Warnings
15571557
--------
15581558
The Pyvis library must be installed to use this function. This function

src/compas_fea2/model/releases.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
from typing import TYPE_CHECKING
2+
13
from compas_fea2.base import FEAData
24

5+
if TYPE_CHECKING:
6+
from .elements import BeamElement
7+
38

49
class _BeamEndRelease(FEAData):
510
"""Assign a general end release to a `compas_fea2.model.BeamElement`.
@@ -40,9 +45,18 @@ class _BeamEndRelease(FEAData):
4045
4146
"""
4247

43-
def __init__(self, n: bool = False, v1: bool = False, v2: bool = False, m1: bool = False, m2: bool = False, t: bool = False, **kwargs):
48+
def __init__(
49+
self,
50+
n: bool = False,
51+
v1: bool = False,
52+
v2: bool = False,
53+
m1: bool = False,
54+
m2: bool = False,
55+
t: bool = False,
56+
**kwargs,
57+
):
4458
super().__init__(**kwargs)
45-
self._element: "BeamElement | None" # type: ignore
59+
self._element: "BeamElement | None" = None
4660
self._location: str | None = None
4761
self.n: bool = n
4862
self.v1: bool = v1
@@ -52,12 +66,12 @@ def __init__(self, n: bool = False, v1: bool = False, v2: bool = False, m1: bool
5266
self.t: bool = t
5367

5468
@property
55-
def element(self) -> "BeamElement | None": # type: ignore
69+
def element(self) -> "BeamElement | None":
5670
return self._element
5771

5872
@element.setter
59-
def element(self, value: "BeamElement"): # type: ignore
60-
if not isinstance(value, "BeamElement"): # type: ignore
73+
def element(self, value: "BeamElement"):
74+
if not isinstance(value, "BeamElement"):
6175
raise TypeError(f"{value!r} is not a beam element.")
6276
self._element = value
6377

src/compas_fea2/problem/combinations.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from compas_fea2.base import FEAData
21
import compas_fea2
2+
from compas_fea2.base import FEAData
3+
34

45
class LoadCombination(FEAData):
56
"""Load combination used to combine load fields together at each step.
@@ -68,7 +69,7 @@ def node_load(self):
6869
for load_field in self.step.load_fields:
6970
if isinstance(load_field, compas_fea2.problem.LoadField):
7071
if load_field.load_case in self.factors:
71-
for node in load_field.distribution :
72+
for node in load_field.distribution:
7273
for load in load_field.loads:
7374
if node in nodes_loads:
7475
nodes_loads[node] += load * self.factors[load_field.load_case]

src/compas_fea2/problem/steps/step.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ def add_gravity_load(self, parts=None, g=9.81, x=0.0, y=0.0, z=-1.0, load_case=N
602602

603603
def add_temperature_field(self, field, node):
604604
"""Add a temperature field to the Step object.
605-
605+
606606
Parameters
607607
----------
608608
field : :class:`compas_fea2.problem.fields.PrescribedTemperatureField`
609609
The temperature field to add.
610610
node : :class:`compas_fea2.model.Node`
611611
The node to which the temperature field is applied.
612-
612+
613613
Returns
614614
-------
615615
:class:`compas_fea2.problem.fields.PrescribedTemperatureField`
@@ -621,7 +621,7 @@ def add_temperature_field(self, field, node):
621621

622622
# if not isinstance(node, Node):
623623
# raise TypeError("{!r} is not a Node.".format(node))
624-
624+
625625
# node._temperature = field
626626
# self._fields.setdefault(node.part, {}).setdefault(field, set()).add(node)
627627
# return field

0 commit comments

Comments
 (0)