Skip to content

Commit fd0f076

Browse files
committed
ruff
1 parent 4043c77 commit fd0f076

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+320
-303
lines changed

src/compas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def get(filename):
172172
import compas
173173
from compas.datastructures import Mesh
174174
175-
mesh = Mesh.from_obj(compas.get('faces.obj'))
175+
mesh = Mesh.from_obj(compas.get("faces.obj"))
176176
177177
"""
178178
filename = filename.strip("/")

src/compas/_os.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
These are internal functions of the framework.
44
Not intended to be used outside compas* packages.
55
"""
6+
67
import os
78
import platform
89
import re

src/compas/colors/colormap.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ class ColorMap(object):
4242
Examples
4343
--------
4444
>>> import random
45-
>>> cmap = ColorMap.from_palette('bamako')
45+
>>> cmap = ColorMap.from_palette("bamako")
4646
>>> for i in range(100):
4747
... color = cmap(random.random())
48-
...
4948
50-
>>> cmap = ColorMap.from_mpl('viridis')
49+
>>> cmap = ColorMap.from_mpl("viridis")
5150
>>> n = 100
5251
>>> for i in range(n):
5352
... color = cmap(i, minval=0, maxval=n - 1)
54-
...
5553
5654
See Also
5755
--------

src/compas/data/coercion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def coerce_sequence_of_tuple(sequence):
2222
2323
Examples
2424
--------
25-
>>> items = coerce_sequence_of_tuple(['a', 1, (None, ), [2.0, 3.0]])
25+
>>> items = coerce_sequence_of_tuple(["a", 1, (None,), [2.0, 3.0]])
2626
>>> is_sequence_of_tuple(items)
2727
True
2828
@@ -55,7 +55,7 @@ def coerce_sequence_of_list(sequence):
5555
5656
Examples
5757
--------
58-
>>> items = coerce_sequence_of_list(['a', 1, (None, ), [2.0, 3.0]])
58+
>>> items = coerce_sequence_of_list(["a", 1, (None,), [2.0, 3.0]])
5959
>>> is_sequence_of_list(items)
6060
True
6161

src/compas/data/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ def sha256(self, as_string=False):
302302
Examples
303303
--------
304304
>>> from compas.datastructures import Mesh
305-
>>> mesh = Mesh.from_obj(compas.get('faces.obj'))
305+
>>> mesh = Mesh.from_obj(compas.get("faces.obj"))
306306
>>> v1 = mesh.sha256()
307307
>>> v2 = mesh.sha256()
308-
>>> mesh.vertex_attribute(mesh.vertex_sample(1)[0], 'z', 1)
308+
>>> mesh.vertex_attribute(mesh.vertex_sample(1)[0], "z", 1)
309309
>>> v3 = mesh.sha256()
310310
>>> v1 == v2
311311
True

src/compas/data/encoders.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,15 @@ class DataEncoder(json.JSONEncoder):
8787
>>> from compas.data import DataEncoder
8888
>>> from compas.geometry import Point
8989
>>> point = Point(0, 0, 0)
90-
>>> with open('point.json', 'w') as f:
90+
>>> with open("point.json", "w") as f:
9191
... json.dump(point, f, cls=DataEncoder)
92-
...
9392
9493
Implicit use case.
9594
9695
>>> from compas.data import json_dump
9796
>>> from compas.geometry import Point
9897
>>> point = Point(0, 0, 0)
99-
>>> json_dump(point, 'point.json')
98+
>>> json_dump(point, "point.json")
10099
101100
"""
102101

@@ -182,14 +181,13 @@ class DataDecoder(json.JSONDecoder):
182181
183182
>>> import json
184183
>>> from compas.data import DataDecoder
185-
>>> with open('point.json', 'r') as f:
184+
>>> with open("point.json", "r") as f:
186185
... point = json.load(f, cls=DataDecoder)
187-
...
188186
189187
Implicit use case.
190188
191189
>>> from compas.data import json_load
192-
>>> point = json_load('point.json')
190+
>>> point = json_load("point.json")
193191
194192
"""
195193

src/compas/data/json.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def json_dump(data, fp, pretty=False, compact=False, minimal=False):
4545
>>> import compas
4646
>>> from compas.geometry import Point, Vector
4747
>>> data1 = [Point(0, 0, 0), Vector(0, 0, 0)]
48-
>>> compas.json_dump(data1, 'data.json')
49-
>>> data2 = compas.json_load('data.json')
48+
>>> compas.json_dump(data1, "data.json")
49+
>>> data2 = compas.json_load("data.json")
5050
>>> data1 == data2
5151
True
5252
@@ -197,8 +197,8 @@ def json_load(fp): # type: (...) -> dict
197197
>>> import compas
198198
>>> from compas.geometry import Point, Vector
199199
>>> data1 = [Point(0, 0, 0), Vector(0, 0, 0)]
200-
>>> compas.json_dump(data1, 'data.json')
201-
>>> data2 = compas.json_load('data.json')
200+
>>> compas.json_dump(data1, "data.json")
201+
>>> data2 = compas.json_load("data.json")
202202
>>> data1 == data2
203203
True
204204

src/compas/data/validators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def is_sequence_of_tuple(items):
161161
162162
Examples
163163
--------
164-
>>> is_sequence_of_tuple([(1, ), (1, ), (1, )])
164+
>>> is_sequence_of_tuple([(1,), (1,), (1,)])
165165
True
166166
167167
"""
@@ -184,7 +184,7 @@ def is_sequence_of_dict(items):
184184
185185
Examples
186186
--------
187-
>>> is_sequence_of_dict([{'a': 1}, {'b': 2}, {'c': 3}])
187+
>>> is_sequence_of_dict([{"a": 1}, {"b": 2}, {"c": 3}])
188188
True
189189
190190
"""
@@ -209,7 +209,7 @@ def is_item_iterable(item):
209209
--------
210210
>>> is_item_iterable(1.0)
211211
False
212-
>>> is_item_iterable('abc')
212+
>>> is_item_iterable("abc")
213213
True
214214
215215
"""
@@ -236,7 +236,7 @@ def is_sequence_of_iterable(items):
236236
237237
Examples
238238
--------
239-
>>> is_sequence_of_iterable(['abc', [1.0], (2, 'a', None)])
239+
>>> is_sequence_of_iterable(["abc", [1.0], (2, "a", None)])
240240
True
241241
242242
"""

src/compas/datastructures/assembly/part.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class GeometricFeature(Feature):
3535
Examples
3636
--------
3737
>>> def trim_brep_plane(brep, plane):
38-
>>> # trim brep with plane, return trimmed brep
38+
>>> # trim brep with plane, return trimmed brep
3939
>>>
4040
>>> def trim_mesh_plane(mesh, plane):
41-
>>> # trim mesh with plane, return trimmed mesh
41+
>>> # trim mesh with plane, return trimmed mesh
4242
>>>
4343
>>> class TrimmingFeature(GeometricFeature):
4444
>>> OPERATIONS = {Brep: trim_brep_plane, Mesh: trim_mesh_plane}

src/compas/datastructures/cell_network/cell_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class CellNetwork(Datastructure):
6969
>>> from compas.datastructures import CellNetwork
7070
>>> cell_network = CellNetwork()
7171
>>> vertices = [(0, 0, 0), (0, 1, 0), (1, 1, 0), (1, 0, 0), (0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1)]
72-
>>> faces = [[0, 1, 2, 3], [0, 3, 5, 4],[3, 2, 6, 5], [2, 1, 7, 6],[1, 0, 4, 7],[4, 5, 6, 7]]
72+
>>> faces = [[0, 1, 2, 3], [0, 3, 5, 4], [3, 2, 6, 5], [2, 1, 7, 6], [1, 0, 4, 7], [4, 5, 6, 7]]
7373
>>> cells = [[0, 1, 2, 3, 4, 5]]
7474
>>> [network.add_vertex(x=x, y=y, z=z) for x, y, z in vertices]
7575
>>> [cell_network.add_face(fverts) for fverts in faces]

0 commit comments

Comments
 (0)