Skip to content

Commit feec173

Browse files
committed
docstring formatting
1 parent d7b0a3e commit feec173

File tree

11 files changed

+34
-39
lines changed

11 files changed

+34
-39
lines changed

src/compas/data/encoders.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,13 @@ class DataDecoder(json.JSONDecoder):
181181
182182
>>> import json
183183
>>> from compas.data import DataDecoder
184-
>>> with open('point.json', 'r') as f: # doctest: +SKIP
185-
... point = json.load(f, cls=DataDecoder) # doctest: +SKIP
186-
...
184+
>>> with open("point.json", "r") as f: # doctest: +SKIP
185+
... point = json.load(f, cls=DataDecoder) # doctest: +SKIP
187186
188187
Implicit use case.
189188
190189
>>> from compas.data import json_load
191-
>>> point = json_load('point.json') # doctest: +SKIP
190+
>>> point = json_load("point.json") # doctest: +SKIP
192191
193192
"""
194193

src/compas/datastructures/assembly/part.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,20 @@ class GeometricFeature(Feature):
3939
>>>
4040
>>> def trim_brep_plane(brep, plane):
4141
... pass
42-
...
4342
>>> def trim_mesh_plane(mesh, plane):
4443
... pass
45-
...
4644
>>> class TrimmingFeature(GeometricFeature):
4745
... OPERATIONS = {Brep: trim_brep_plane, Mesh: trim_mesh_plane}
46+
...
4847
... def __init__(self, trimming_plane):
4948
... super(TrimmingFeature, self).__init__()
5049
... self._geometry = trimming_plane
50+
...
5151
... def apply(self, part):
5252
... part_geometry = part.get_geometry(with_features=True)
5353
... type_ = Brep if isinstance(part_geometry, Brep) else Mesh
5454
... operation = OPERATIONS[type_]
5555
... return operation(part_geometry, self._geometry)
56-
...
5756
>>>
5857
5958
"""
@@ -87,13 +86,15 @@ class ParametricFeature(Feature):
8786
... def __init__(self, extend_by):
8887
... super(ExtensionFeature, self).__init__()
8988
... self.extend_by = extend_by
89+
...
9090
... def apply(self, part):
9191
... part.length += self._extend_by
92+
...
9293
... def restore(self, part):
9394
... part.length -= self._extend_by
95+
...
9496
... def accumulate(self, other):
9597
... return BeamExtensionFeature(max(self.extend_by, other.extend_by))
96-
...
9798
>>>
9899
99100
"""

src/compas/datastructures/cell_network/cell_network.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ class CellNetwork(Datastructure):
7676
>>> cells = [[0, 1, 2, 3, 4, 5]]
7777
>>> for x, y, z in vertices:
7878
... vertex = cell_network.add_vertex(x=x, y=y, z=z)
79-
...
8079
>>> for face_vertices in faces:
8180
... face = cell_network.add_face(face_vertices)
82-
...
8381
>>> for cell_faces in cells:
84-
... cell = cell_network.add_cell(cell_faces)
85-
...
82+
... cell = cell_network.add_cell(cell_faces)
8683
>>> print(cell_network)
8784
<CellNetwork with 8 vertices, 6 faces, 1 cells, 12 edges>
8885

src/compas/datastructures/mesh/mesh.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,6 @@ def remove_duplicate_vertices(self, precision=None):
28552855
36
28562856
>>> for x, y, z in mesh.vertices_attributes("xyz", keys=list(mesh.vertices())[:5]):
28572857
... mesh.add_vertex(x=x, y=y, z=z)
2858-
...
28592858
36
28602859
37
28612860
38

src/compas/datastructures/mesh/operations/merge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def mesh_merge_faces(mesh, faces):
2121
--------
2222
>>> from compas.datastructures import Mesh
2323
>>> mesh = Mesh.from_vertices_and_faces([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]], [[0, 1, 2, 3]])
24-
>>> mesh = mesh.subdivided(scheme='quad')
24+
>>> mesh = mesh.subdivided(scheme="quad")
2525
>>> mesh_merge_faces(mesh, [1, 2])
2626
5
2727
>>> mesh_merge_faces(mesh, [3, 5])

src/compas/geometry/curves/parabola.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ class Parabola(Conic):
7373
7474
Visualize the parabola with the COMPAS viewer.
7575
76-
>>> from compas_viewer import Viewer # doctest: +SKIP
77-
>>> viewer = Viewer() # doctest: +SKIP
78-
>>> viewer.scene.add(line) # doctest: +SKIP
79-
>>> viewer.scene.add(parabola) # doctest: +SKIP
80-
>>> viewer.scene.add(parabola.frame) # doctest: +SKIP
81-
>>> viewer.show() # doctest: +SKIP
76+
>>> from compas_viewer import Viewer # doctest: +SKIP
77+
>>> viewer = Viewer() # doctest: +SKIP
78+
>>> viewer.scene.add(line) # doctest: +SKIP
79+
>>> viewer.scene.add(parabola) # doctest: +SKIP
80+
>>> viewer.scene.add(parabola.frame) # doctest: +SKIP
81+
>>> viewer.show() # doctest: +SKIP
8282
8383
"""
8484

src/compas/geometry/frame.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,8 @@ def from_euler_angles(cls, euler_angles, static=True, axes="xyz", point=[0, 0, 0
525525
--------
526526
>>> from compas.tolerance import TOL
527527
>>> ea1 = 1.4, 0.5, 2.3
528-
>>> f = Frame.from_euler_angles(ea1, static=True, axes='xyz')
529-
>>> ea2 = f.euler_angles(static=True, axes='xyz')
528+
>>> f = Frame.from_euler_angles(ea1, static=True, axes="xyz")
529+
>>> ea2 = f.euler_angles(static=True, axes="xyz")
530530
>>> TOL.is_allclose(ea1, ea2)
531531
True
532532
@@ -555,7 +555,7 @@ def from_plane(cls, plane): # type: (...) -> Frame
555555
--------
556556
>>> from compas.geometry import Plane
557557
>>> from compas.tolerance import TOL
558-
>>> plane = Plane([0,0,0], [0,0,1])
558+
>>> plane = Plane([0, 0, 0], [0, 0, 1])
559559
>>> frame = Frame.from_plane(plane)
560560
>>> TOL.is_allclose(frame.normal, plane.normal)
561561
True
@@ -676,8 +676,8 @@ def euler_angles(self, static=True, axes="xyz"):
676676
--------
677677
>>> from compas.tolerance import TOL
678678
>>> ea1 = 1.4, 0.5, 2.3
679-
>>> f = Frame.from_euler_angles(ea1, static=True, axes='xyz')
680-
>>> ea2 = f.euler_angles(static=True, axes='xyz')
679+
>>> f = Frame.from_euler_angles(ea1, static=True, axes="xyz")
680+
>>> ea2 = f.euler_angles(static=True, axes="xyz")
681681
>>> TOL.is_allclose(ea1, ea2)
682682
True
683683
@@ -706,7 +706,7 @@ def to_local_coordinates(self, obj_in_wcf):
706706
--------
707707
>>> from compas.geometry import Point
708708
>>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
709-
>>> pw = Point(2, 2, 2) # point in wcf
709+
>>> pw = Point(2, 2, 2) # point in wcf
710710
>>> pl = frame.to_local_coordinates(pw) # point in frame
711711
>>> print(frame.to_world_coordinates(pl))
712712
Point(x=2.000, y=2.000, z=2.000)
@@ -738,8 +738,8 @@ def to_world_coordinates(self, obj_in_lcf):
738738
--------
739739
>>> from compas.geometry import Point
740740
>>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15])
741-
>>> pl = Point(1.632, -0.090, 0.573) # point in frame
742-
>>> pw = frame.to_world_coordinates(pl) # point in wcf
741+
>>> pl = Point(1.632, -0.090, 0.573) # point in frame
742+
>>> pw = frame.to_world_coordinates(pl) # point in wcf
743743
>>> print(frame.to_local_coordinates(pw))
744744
Point(x=1.632, y=-0.090, z=0.573)
745745

src/compas/geometry/intersection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class Intersection(object):
1818
1919
Examples
2020
--------
21-
>>> from compas.geometry import Line # doctest: +SKIP
21+
>>> from compas.geometry import Line # doctest: +SKIP
2222
>>> from compas.geometry import Intersection # doctest: +SKIP
23-
>>> a = Line([0, 0, 0], [2, 0, 0]) # doctest: +SKIP
24-
>>> b = Line([1, 0, 0], [1, 1, 0]) # doctest: +SKIP
25-
>>> intersection = Intersection() # doctest: +SKIP
26-
>>> intersection.line_line(a, b) # doctest: +SKIP
27-
>>> intersection.number_of_intersections # doctest: +SKIP
23+
>>> a = Line([0, 0, 0], [2, 0, 0]) # doctest: +SKIP
24+
>>> b = Line([1, 0, 0], [1, 1, 0]) # doctest: +SKIP
25+
>>> intersection = Intersection() # doctest: +SKIP
26+
>>> intersection.line_line(a, b) # doctest: +SKIP
27+
>>> intersection.number_of_intersections # doctest: +SKIP
2828
1
29-
>>> intersection.points[0] # doctest: +SKIP
29+
>>> intersection.points[0] # doctest: +SKIP
3030
Point(1.0, 0.0, z=0.0)
3131
3232
"""

src/compas/geometry/point.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Point(Geometry):
8686
>>> print(result)
8787
Point(x=2.000, y=4.000, z=6.000)
8888
89-
>>> result = p1 ** 2
89+
>>> result = p1**2
9090
>>> print(result)
9191
Point(x=1.000, y=4.000, z=9.000)
9292

src/compas/geometry/scale.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Scale(Transformation):
5252
>>> point = Point(2, 5, 0)
5353
>>> frame = Frame(point, (1, 0, 0), (0, 1, 0))
5454
>>> points = [point, Point(2, 10, 0)]
55-
>>> S = Scale.from_factors([2.] * 3, frame)
55+
>>> S = Scale.from_factors([2.0] * 3, frame)
5656
>>> points = [p.transformed(S) for p in points]
5757
>>> print(points)
5858
[Point(x=2.000, y=5.000, z=0.000), Point(x=2.000, y=15.000, z=0.000)]
@@ -88,7 +88,7 @@ def from_factors(cls, factors, frame=None):
8888
>>> point = Point(2, 5, 0)
8989
>>> frame = Frame(point, (1, 0, 0), (0, 1, 0))
9090
>>> points = [point, Point(2, 10, 0)]
91-
>>> S = Scale.from_factors([2.] * 3, frame)
91+
>>> S = Scale.from_factors([2.0] * 3, frame)
9292
>>> points = [p.transformed(S) for p in points]
9393
>>> print(points)
9494
[Point(x=2.000, y=5.000, z=0.000), Point(x=2.000, y=15.000, z=0.000)]

0 commit comments

Comments
 (0)