From fd0f076240fcc9d1d38d38ad8fd3f816e1357744 Mon Sep 17 00:00:00 2001 From: tomvanmele Date: Tue, 14 May 2024 01:37:20 +0200 Subject: [PATCH] ruff --- src/compas/__init__.py | 2 +- src/compas/_os.py | 1 + src/compas/colors/colormap.py | 6 +- src/compas/data/coercion.py | 4 +- src/compas/data/data.py | 4 +- src/compas/data/encoders.py | 10 +- src/compas/data/json.py | 8 +- src/compas/data/validators.py | 8 +- src/compas/datastructures/assembly/part.py | 4 +- .../cell_network/cell_network.py | 2 +- src/compas/datastructures/graph/graph.py | 4 +- .../datastructures/graph/operations/join.py | 12 +- src/compas/datastructures/mesh/duality.py | 4 +- src/compas/datastructures/mesh/mesh.py | 5 +- .../datastructures/mesh/operations/merge.py | 2 +- src/compas/datastructures/mesh/subdivision.py | 8 +- src/compas/datastructures/tree/tree.py | 10 +- src/compas/files/obj.py | 12 +- src/compas/geometry/_core/_algebra.py | 16 +- src/compas/geometry/_core/predicates_2.py | 8 +- src/compas/geometry/_core/transformations.py | 2 +- .../geometry/_core/transformations_numpy.py | 4 +- src/compas/geometry/bbox_numpy.py | 2 +- src/compas/geometry/booleans.py | 10 +- src/compas/geometry/curves/arc.py | 16 +- src/compas/geometry/curves/circle.py | 10 +- src/compas/geometry/curves/ellipse.py | 10 +- src/compas/geometry/curves/line.py | 2 +- src/compas/geometry/curves/parabola.py | 10 +- src/compas/geometry/curves/polyline.py | 2 +- src/compas/geometry/frame.py | 22 +-- src/compas/geometry/intersections.py | 6 +- src/compas/geometry/point.py | 2 +- src/compas/geometry/quaternion.py | 6 +- src/compas/geometry/rotation.py | 6 +- src/compas/geometry/scale.py | 4 +- .../geometry/trimesh_samplepoints_numpy.py | 6 +- src/compas/itertools.py | 4 +- src/compas/linalg.py | 30 ++- src/compas/matrices.py | 6 +- src/compas/plugins.py | 4 +- src/compas/rpc/proxy.py | 14 +- src/compas/rpc/server.py | 3 +- src/compas/topology/combinatorics.py | 2 +- src/compas/utilities/azync.py | 8 +- src/compas/utilities/datetime.py | 4 +- src/compas/utilities/remote.py | 4 +- src/compas_blender/install.py | 11 +- src/compas_ghpython/utilities/drawing.py | 30 +-- src/compas_rhino/conduits/lines.py | 2 +- src/compas_rhino/conversions/surfaces.py | 1 - src/compas_rhino/install.py | 11 +- src/compas_rhino/install_plugin.py | 1 - src/compas_rhino/layers.py | 39 ++-- src/compas_rhino/objects.py | 2 +- src/compas_rhino/uninstall.py | 7 +- src/compas_rhino/utilities/drawing.py | 186 ++++++++++-------- .../compas/geometry/test_core_predicates_3.py | 1 - tests/compas/rpc/test_rpc.py | 1 - .../compas/scene/test_scene_serialisation.py | 2 - 60 files changed, 320 insertions(+), 303 deletions(-) diff --git a/src/compas/__init__.py b/src/compas/__init__.py index d5e2de51abe..15eb970dbde 100644 --- a/src/compas/__init__.py +++ b/src/compas/__init__.py @@ -172,7 +172,7 @@ def get(filename): import compas from compas.datastructures import Mesh - mesh = Mesh.from_obj(compas.get('faces.obj')) + mesh = Mesh.from_obj(compas.get("faces.obj")) """ filename = filename.strip("/") diff --git a/src/compas/_os.py b/src/compas/_os.py index 003df5fd975..d09b801c6e9 100644 --- a/src/compas/_os.py +++ b/src/compas/_os.py @@ -3,6 +3,7 @@ These are internal functions of the framework. Not intended to be used outside compas* packages. """ + import os import platform import re diff --git a/src/compas/colors/colormap.py b/src/compas/colors/colormap.py index fcdb9d3504d..0b0ac1bba27 100644 --- a/src/compas/colors/colormap.py +++ b/src/compas/colors/colormap.py @@ -42,16 +42,14 @@ class ColorMap(object): Examples -------- >>> import random - >>> cmap = ColorMap.from_palette('bamako') + >>> cmap = ColorMap.from_palette("bamako") >>> for i in range(100): ... color = cmap(random.random()) - ... - >>> cmap = ColorMap.from_mpl('viridis') + >>> cmap = ColorMap.from_mpl("viridis") >>> n = 100 >>> for i in range(n): ... color = cmap(i, minval=0, maxval=n - 1) - ... See Also -------- diff --git a/src/compas/data/coercion.py b/src/compas/data/coercion.py index 25bba723d9a..90dc8a93448 100644 --- a/src/compas/data/coercion.py +++ b/src/compas/data/coercion.py @@ -22,7 +22,7 @@ def coerce_sequence_of_tuple(sequence): Examples -------- - >>> items = coerce_sequence_of_tuple(['a', 1, (None, ), [2.0, 3.0]]) + >>> items = coerce_sequence_of_tuple(["a", 1, (None,), [2.0, 3.0]]) >>> is_sequence_of_tuple(items) True @@ -55,7 +55,7 @@ def coerce_sequence_of_list(sequence): Examples -------- - >>> items = coerce_sequence_of_list(['a', 1, (None, ), [2.0, 3.0]]) + >>> items = coerce_sequence_of_list(["a", 1, (None,), [2.0, 3.0]]) >>> is_sequence_of_list(items) True diff --git a/src/compas/data/data.py b/src/compas/data/data.py index d258287718e..f72355fdd5d 100644 --- a/src/compas/data/data.py +++ b/src/compas/data/data.py @@ -302,10 +302,10 @@ def sha256(self, as_string=False): Examples -------- >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_obj(compas.get('faces.obj')) + >>> mesh = Mesh.from_obj(compas.get("faces.obj")) >>> v1 = mesh.sha256() >>> v2 = mesh.sha256() - >>> mesh.vertex_attribute(mesh.vertex_sample(1)[0], 'z', 1) + >>> mesh.vertex_attribute(mesh.vertex_sample(1)[0], "z", 1) >>> v3 = mesh.sha256() >>> v1 == v2 True diff --git a/src/compas/data/encoders.py b/src/compas/data/encoders.py index 04c93a8913b..7b1a1c64ebf 100644 --- a/src/compas/data/encoders.py +++ b/src/compas/data/encoders.py @@ -87,16 +87,15 @@ class DataEncoder(json.JSONEncoder): >>> from compas.data import DataEncoder >>> from compas.geometry import Point >>> point = Point(0, 0, 0) - >>> with open('point.json', 'w') as f: + >>> with open("point.json", "w") as f: ... json.dump(point, f, cls=DataEncoder) - ... Implicit use case. >>> from compas.data import json_dump >>> from compas.geometry import Point >>> point = Point(0, 0, 0) - >>> json_dump(point, 'point.json') + >>> json_dump(point, "point.json") """ @@ -182,14 +181,13 @@ class DataDecoder(json.JSONDecoder): >>> import json >>> from compas.data import DataDecoder - >>> with open('point.json', 'r') as f: + >>> with open("point.json", "r") as f: ... point = json.load(f, cls=DataDecoder) - ... Implicit use case. >>> from compas.data import json_load - >>> point = json_load('point.json') + >>> point = json_load("point.json") """ diff --git a/src/compas/data/json.py b/src/compas/data/json.py index 30e61beca6f..73bda1e2484 100644 --- a/src/compas/data/json.py +++ b/src/compas/data/json.py @@ -45,8 +45,8 @@ def json_dump(data, fp, pretty=False, compact=False, minimal=False): >>> import compas >>> from compas.geometry import Point, Vector >>> data1 = [Point(0, 0, 0), Vector(0, 0, 0)] - >>> compas.json_dump(data1, 'data.json') - >>> data2 = compas.json_load('data.json') + >>> compas.json_dump(data1, "data.json") + >>> data2 = compas.json_load("data.json") >>> data1 == data2 True @@ -197,8 +197,8 @@ def json_load(fp): # type: (...) -> dict >>> import compas >>> from compas.geometry import Point, Vector >>> data1 = [Point(0, 0, 0), Vector(0, 0, 0)] - >>> compas.json_dump(data1, 'data.json') - >>> data2 = compas.json_load('data.json') + >>> compas.json_dump(data1, "data.json") + >>> data2 = compas.json_load("data.json") >>> data1 == data2 True diff --git a/src/compas/data/validators.py b/src/compas/data/validators.py index 716786acf30..acc6f47bf16 100644 --- a/src/compas/data/validators.py +++ b/src/compas/data/validators.py @@ -161,7 +161,7 @@ def is_sequence_of_tuple(items): Examples -------- - >>> is_sequence_of_tuple([(1, ), (1, ), (1, )]) + >>> is_sequence_of_tuple([(1,), (1,), (1,)]) True """ @@ -184,7 +184,7 @@ def is_sequence_of_dict(items): Examples -------- - >>> is_sequence_of_dict([{'a': 1}, {'b': 2}, {'c': 3}]) + >>> is_sequence_of_dict([{"a": 1}, {"b": 2}, {"c": 3}]) True """ @@ -209,7 +209,7 @@ def is_item_iterable(item): -------- >>> is_item_iterable(1.0) False - >>> is_item_iterable('abc') + >>> is_item_iterable("abc") True """ @@ -236,7 +236,7 @@ def is_sequence_of_iterable(items): Examples -------- - >>> is_sequence_of_iterable(['abc', [1.0], (2, 'a', None)]) + >>> is_sequence_of_iterable(["abc", [1.0], (2, "a", None)]) True """ diff --git a/src/compas/datastructures/assembly/part.py b/src/compas/datastructures/assembly/part.py index d16cf250dfb..d47fa6eed85 100644 --- a/src/compas/datastructures/assembly/part.py +++ b/src/compas/datastructures/assembly/part.py @@ -35,10 +35,10 @@ class GeometricFeature(Feature): Examples -------- >>> def trim_brep_plane(brep, plane): - >>> # trim brep with plane, return trimmed brep + >>> # trim brep with plane, return trimmed brep >>> >>> def trim_mesh_plane(mesh, plane): - >>> # trim mesh with plane, return trimmed mesh + >>> # trim mesh with plane, return trimmed mesh >>> >>> class TrimmingFeature(GeometricFeature): >>> OPERATIONS = {Brep: trim_brep_plane, Mesh: trim_mesh_plane} diff --git a/src/compas/datastructures/cell_network/cell_network.py b/src/compas/datastructures/cell_network/cell_network.py index dd0cf8e2a5c..59f7332f76d 100644 --- a/src/compas/datastructures/cell_network/cell_network.py +++ b/src/compas/datastructures/cell_network/cell_network.py @@ -69,7 +69,7 @@ class CellNetwork(Datastructure): >>> from compas.datastructures import CellNetwork >>> cell_network = CellNetwork() >>> 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)] - >>> 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]] + >>> 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]] >>> cells = [[0, 1, 2, 3, 4, 5]] >>> [network.add_vertex(x=x, y=y, z=z) for x, y, z in vertices] >>> [cell_network.add_face(fverts) for fverts in faces] diff --git a/src/compas/datastructures/graph/graph.py b/src/compas/datastructures/graph/graph.py index 469ff508e56..5fb7fc62763 100644 --- a/src/compas/datastructures/graph/graph.py +++ b/src/compas/datastructures/graph/graph.py @@ -905,7 +905,7 @@ def is_connected(self): -------- >>> import compas >>> from compas.datastructures import Graph - >>> graph = Graph.from_obj(compas.get('lines.obj')) + >>> graph = Graph.from_obj(compas.get("lines.obj")) >>> graph.is_connected() True @@ -2364,7 +2364,7 @@ def complement(self): -------- >>> import compas >>> from compas.datastructures import Graph - >>> graph = Graph.from_obj(compas.get('lines.obj')) + >>> graph = Graph.from_obj(compas.get("lines.obj")) >>> complement = graph.complement() >>> any(complement.has_edge(u, v, directed=False) for u, v in graph.edges()) False diff --git a/src/compas/datastructures/graph/operations/join.py b/src/compas/datastructures/graph/operations/join.py index 3c9d4517218..9fcceb2d473 100644 --- a/src/compas/datastructures/graph/operations/join.py +++ b/src/compas/datastructures/graph/operations/join.py @@ -77,12 +77,12 @@ def graph_polylines(graph, splits=None): This will result in the following polylines (a, b, c), (c, d) and (c, e, f). >>> from compas.datastructures import Graph - >>> a = [0., 0., 0.] - >>> b = [1., 0., 0.] - >>> c = [2., 0., 0.] - >>> d = [2., 1., 0.] - >>> e = [3., 0., 0.] - >>> f = [4., 0., 0.] + >>> a = [0.0, 0.0, 0.0] + >>> b = [1.0, 0.0, 0.0] + >>> c = [2.0, 0.0, 0.0] + >>> d = [2.0, 1.0, 0.0] + >>> e = [3.0, 0.0, 0.0] + >>> f = [4.0, 0.0, 0.0] >>> lines = [(a, b), (b, c), (c, d), (c, e), (e, f)] >>> graph = Graph.from_lines(lines) >>> len(graph_polylines(graph)) == 3 diff --git a/src/compas/datastructures/mesh/duality.py b/src/compas/datastructures/mesh/duality.py index 985aebda0bc..16bf43c67d7 100644 --- a/src/compas/datastructures/mesh/duality.py +++ b/src/compas/datastructures/mesh/duality.py @@ -32,12 +32,12 @@ def mesh_dual(mesh, cls=None, include_boundary=False): -------- >>> import compas >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_obj(compas.get('faces.obj')) + >>> mesh = Mesh.from_obj(compas.get("faces.obj")) >>> mesh.delete_face(11) >>> mesh.delete_face(6) >>> mesh.delete_face(7) >>> mesh.quads_to_triangles() - >>> mesh = mesh.subdivide('corner') + >>> mesh = mesh.subdivide("corner") >>> dual = mesh.dual(include_boundary=True) """ diff --git a/src/compas/datastructures/mesh/mesh.py b/src/compas/datastructures/mesh/mesh.py index aa2641c817c..89e008ca77f 100644 --- a/src/compas/datastructures/mesh/mesh.py +++ b/src/compas/datastructures/mesh/mesh.py @@ -2849,12 +2849,11 @@ def remove_duplicate_vertices(self, precision=None): -------- >>> import compas >>> from compas.datastructures import Mesh - >>> mesh = Mesh.from_obj(compas.get('faces.obj')) + >>> mesh = Mesh.from_obj(compas.get("faces.obj")) >>> mesh.number_of_vertices() 36 - >>> for x, y, z in mesh.vertices_attributes('xyz', keys=list(mesh.vertices())[:5]): + >>> for x, y, z in mesh.vertices_attributes("xyz", keys=list(mesh.vertices())[:5]): ... mesh.add_vertex(x=x, y=y, z=z) - ... 38 39 40 diff --git a/src/compas/datastructures/mesh/operations/merge.py b/src/compas/datastructures/mesh/operations/merge.py index dc873c7d2bd..3a0f91cf55a 100644 --- a/src/compas/datastructures/mesh/operations/merge.py +++ b/src/compas/datastructures/mesh/operations/merge.py @@ -21,7 +21,7 @@ def mesh_merge_faces(mesh, faces): -------- >>> from compas.datastructures import Mesh >>> mesh = Mesh.from_vertices_and_faces([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]], [[0, 1, 2, 3]]) - >>> mesh = mesh.subdivide(scheme='quad') + >>> mesh = mesh.subdivide(scheme="quad") >>> mesh_merge_faces(mesh, [1, 2]) 5 >>> mesh_merge_faces(mesh, [3, 5]) diff --git a/src/compas/datastructures/mesh/subdivision.py b/src/compas/datastructures/mesh/subdivision.py index 190545a2a00..144052a1924 100644 --- a/src/compas/datastructures/mesh/subdivision.py +++ b/src/compas/datastructures/mesh/subdivision.py @@ -179,7 +179,7 @@ def mesh_subdivide_quad(mesh, k=1): False >>> type(mesh) is type(subd) True - >>> subd.number_of_faces() == mesh.number_of_faces() * 4 ** k + >>> subd.number_of_faces() == mesh.number_of_faces() * 4**k True """ @@ -293,7 +293,7 @@ def mesh_subdivide_catmullclark(mesh, k=1, fixed=None): False >>> type(mesh) is type(subd) True - >>> subd.number_of_faces() == mesh.number_of_faces() * 4 ** k + >>> subd.number_of_faces() == mesh.number_of_faces() * 4**k True The algorithm supports "integer creasing" as described in @@ -309,9 +309,9 @@ def mesh_subdivide_catmullclark(mesh, k=1, fixed=None): >>> from compas.datastructures import Mesh >>> cage = Mesh.from_shape(Box.from_width_height_depth(1, 1, 1)) - >>> cage.update_default_edge_attributes({'crease': 0}) + >>> cage.update_default_edge_attributes({"crease": 0}) >>> top = sorted(cage.faces(), key=lambda face: dot_vectors(cage.face_normal(face), [0, 0, 1]))[-1] - >>> cage.edges_attribute('crease', 5, keys=list(cage.face_halfedges(top))) + >>> cage.edges_attribute("crease", 5, keys=list(cage.face_halfedges(top))) >>> subd = cage.subdivide(k=4) diff --git a/src/compas/datastructures/tree/tree.py b/src/compas/datastructures/tree/tree.py index 30727413ad3..524c35d28d0 100644 --- a/src/compas/datastructures/tree/tree.py +++ b/src/compas/datastructures/tree/tree.py @@ -60,7 +60,6 @@ def __data__(self): @classmethod def __from_data__(cls, data): - name = data.get("name", None) attributes = data.get("attributes", {}) children = data.get("children", []) @@ -235,10 +234,10 @@ class Tree(Datastructure): -------- >>> from compas.datastructures import Tree, TreeNode >>> tree = Tree() - >>> root = TreeNode('root') - >>> branch = TreeNode('branch') - >>> leaf1 = TreeNode('leaf1') - >>> leaf2 = TreeNode('leaf2') + >>> root = TreeNode("root") + >>> branch = TreeNode("branch") + >>> leaf1 = TreeNode("leaf1") + >>> leaf2 = TreeNode("leaf2") >>> tree.add(root) >>> root.add(branch) >>> branch.add(leaf1) @@ -457,7 +456,6 @@ def get_hierarchy_string(self, max_depth=None): hierarchy = [] def traverse(node, hierarchy, prefix="", last=True, depth=0): - if max_depth is not None and depth > max_depth: return diff --git a/src/compas/files/obj.py b/src/compas/files/obj.py index 02b539e7a7e..b6abd36cdac 100644 --- a/src/compas/files/obj.py +++ b/src/compas/files/obj.py @@ -52,12 +52,12 @@ class OBJ(object): Write mesh data to a file. >>> mesh = Mesh.from_polyhedron(12) - >>> obj = OBJ('mesh.obj') + >>> obj = OBJ("mesh.obj") >>> obj.write(mesh) Read mesh data from a file. - >>> obj = OBJ('mesh.obj') + >>> obj = OBJ("mesh.obj") >>> obj.read() >>> mesh = Mesh.from_vertices_and_faces(obj.vertices, obj.faces) @@ -74,20 +74,18 @@ class OBJ(object): ... mesh = Mesh.from_polyhedron(12) ... mesh.transform(Translation.from_vector(point)) ... meshes.append(mesh) - ... - >>> obj = OBJ('meshes.obj') + >>> obj = OBJ("meshes.obj") >>> obj.write(meshes) Read mesh data from a file. - >>> obj = OBJ('meshes.obj') + >>> obj = OBJ("meshes.obj") >>> obj.read() >>> meshes = [] >>> for name in obj.objects: - ... mesh = Mesh.from_vertices_and_faces(* obj.objects[name]) + ... mesh = Mesh.from_vertices_and_faces(*obj.objects[name]) ... mesh.name = name ... meshes.append(mesh) - ... """ diff --git a/src/compas/geometry/_core/_algebra.py b/src/compas/geometry/_core/_algebra.py index 51bbeb87b38..09bb398b275 100644 --- a/src/compas/geometry/_core/_algebra.py +++ b/src/compas/geometry/_core/_algebra.py @@ -2681,10 +2681,10 @@ def quaternion_from_axis_angle(axis, angle): Examples -------- - >>> axis = [1.0, 0.0, 0.0] - >>> angle = math.pi/2 + >>> axis = [1.0, 0.0, 0.0] + >>> angle = math.pi / 2 >>> q = quaternion_from_axis_angle(axis, angle) - >>> allclose(q, [math.sqrt(2)/2, math.sqrt(2)/2, 0, 0]) + >>> allclose(q, [math.sqrt(2) / 2, math.sqrt(2) / 2, 0, 0]) True """ @@ -2710,11 +2710,11 @@ def axis_angle_from_quaternion(q): Examples -------- - >>> q = [1., 1., 0., 0.] + >>> q = [1.0, 1.0, 0.0, 0.0] >>> axis, angle = axis_angle_from_quaternion(q) - >>> allclose(axis, [1., 0., 0.]) + >>> allclose(axis, [1.0, 0.0, 0.0]) True - >>> allclose([angle], [math.pi/2], 1e-6) + >>> allclose([angle], [math.pi / 2], 1e-6) True """ @@ -2769,9 +2769,9 @@ def close(value1, value2, tol=1e-05): Examples -------- - >>> close(1., 1.001) + >>> close(1.0, 1.001) False - >>> close(1., 1.001, tol=1e-2) + >>> close(1.0, 1.001, tol=1e-2) True """ return TOL.is_close(value1, value2, rtol=0.0, atol=tol) diff --git a/src/compas/geometry/_core/predicates_2.py b/src/compas/geometry/_core/predicates_2.py index da834efc1b8..339851d7c75 100644 --- a/src/compas/geometry/_core/predicates_2.py +++ b/src/compas/geometry/_core/predicates_2.py @@ -58,16 +58,16 @@ def is_ccw_xy(a, b, c, colinear=False): Examples -------- - >>> print(is_ccw_xy([0,0,0], [0,1,0], [-1, 0, 0])) + >>> print(is_ccw_xy([0, 0, 0], [0, 1, 0], [-1, 0, 0])) True - >>> print(is_ccw_xy([0,0,0], [0,1,0], [+1, 0, 0])) + >>> print(is_ccw_xy([0, 0, 0], [0, 1, 0], [+1, 0, 0])) False - >>> print(is_ccw_xy([0,0,0], [1,0,0], [2,0,0])) + >>> print(is_ccw_xy([0, 0, 0], [1, 0, 0], [2, 0, 0])) False - >>> print(is_ccw_xy([0,0,0], [1,0,0], [2,0,0], True)) + >>> print(is_ccw_xy([0, 0, 0], [1, 0, 0], [2, 0, 0], True)) True """ diff --git a/src/compas/geometry/_core/transformations.py b/src/compas/geometry/_core/transformations.py index dc84673631a..e55cabc9fb3 100644 --- a/src/compas/geometry/_core/transformations.py +++ b/src/compas/geometry/_core/transformations.py @@ -176,7 +176,7 @@ def dehomogenize_and_unflatten_frames(points_and_vectors): Examples -------- - >>> points_and_vectors = [(1., 1., 1., 1.), (0., 1., 0., 0.), (1., 0., 0., 0.)] + >>> points_and_vectors = [(1.0, 1.0, 1.0, 1.0), (0.0, 1.0, 0.0, 0.0), (1.0, 0.0, 0.0, 0.0)] >>> dehomogenize_and_unflatten_frames(points_and_vectors) [[[1.0, 1.0, 1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0]]] diff --git a/src/compas/geometry/_core/transformations_numpy.py b/src/compas/geometry/_core/transformations_numpy.py index 6d0813b5445..7fc1802754e 100644 --- a/src/compas/geometry/_core/transformations_numpy.py +++ b/src/compas/geometry/_core/transformations_numpy.py @@ -83,7 +83,7 @@ def transform_frames_numpy(frames, T): -------- >>> from compas.geometry import Frame, matrix_from_axis_and_angle >>> frames = [Frame([1, 0, 0], [1, 2, 4], [4, 7, 1]), Frame([0, 2, 0], [5, 2, 1], [0, 2, 1])] - >>> T = matrix_from_axis_and_angle([0, 2, 0], math.radians(45), point=[4, 5, 6]) + >>> T = matrix_from_axis_and_angle([0, 2, 0], math.radians(45), point=[4, 5, 6]) >>> transformed_frames = transform_frames_numpy(frames, T) """ @@ -269,7 +269,7 @@ def dehomogenize_and_unflatten_frames_numpy(points_and_vectors): Examples -------- - >>> points_and_vectors = [(1., 1., 1., 1.), (0., 1., 0., 0.), (1., 0., 0., 0.)] + >>> points_and_vectors = [(1.0, 1.0, 1.0, 1.0), (0.0, 1.0, 0.0, 0.0), (1.0, 0.0, 0.0, 0.0)] >>> res = dehomogenize_and_unflatten_frames_numpy(points_and_vectors) >>> np.allclose(res, [[1.0, 1.0, 1.0], [0.0, 1.0, 0.0], [1.0, 0.0, 0.0]]) True diff --git a/src/compas/geometry/bbox_numpy.py b/src/compas/geometry/bbox_numpy.py index 30b79c43353..7d35279a5df 100644 --- a/src/compas/geometry/bbox_numpy.py +++ b/src/compas/geometry/bbox_numpy.py @@ -10,11 +10,11 @@ from numpy import zeros from scipy.spatial import ConvexHull +from compas.geometry import length_vector from compas.geometry import local_axes from compas.geometry import local_to_world_coordinates_numpy from compas.geometry import pca_numpy from compas.geometry import world_to_local_coordinates_numpy -from compas.geometry import length_vector from compas.tolerance import TOL from .bbox import bounding_box diff --git a/src/compas/geometry/booleans.py b/src/compas/geometry/booleans.py index 0a220ddd7ec..0e3d51aef59 100644 --- a/src/compas/geometry/booleans.py +++ b/src/compas/geometry/booleans.py @@ -37,8 +37,8 @@ def boolean_union_mesh_mesh(A, B): Examples -------- >>> from compas.geometry import Box, Sphere - >>> from compas.geometry import boolean_union_mesh_mesh # doctest: +SKIP - >>> from compas.geometry import trimesh_remesh # doctest: +SKIP + >>> from compas.geometry import boolean_union_mesh_mesh # doctest: +SKIP + >>> from compas.geometry import trimesh_remesh # doctest: +SKIP >>> from compas.datastructures import Mesh >>> box = Box.from_width_height_depth(2, 2, 2) @@ -51,10 +51,10 @@ def boolean_union_mesh_mesh(A, B): >>> A = box.to_vertices_and_faces() >>> B = sphere.to_vertices_and_faces() - >>> B = trimesh_remesh(B, 0.3, 10) # doctest: +SKIP + >>> B = trimesh_remesh(B, 0.3, 10) # doctest: +SKIP - >>> V, F = boolean_union_mesh_mesh(A, B) # doctest: +SKIP - >>> union = Mesh.from_vertices_and_faces(V, F) # doctest: +SKIP + >>> V, F = boolean_union_mesh_mesh(A, B) # doctest: +SKIP + >>> union = Mesh.from_vertices_and_faces(V, F) # doctest: +SKIP """ raise PluginNotInstalledError("No plugin was found for the boolean_union_mesh_mesh pluggable. A plugin is available in compas_cgal...") diff --git a/src/compas/geometry/curves/arc.py b/src/compas/geometry/curves/arc.py index 9e61536bb8d..ef6659a0aba 100644 --- a/src/compas/geometry/curves/arc.py +++ b/src/compas/geometry/curves/arc.py @@ -100,19 +100,19 @@ class Arc(Curve): Visualize the arc using the viewer. - >>> from compas_viewer import Viewer # doctest: +SKIP - >>> viewer = Viewer() # doctest: +SKIP + >>> from compas_viewer import Viewer # doctest: +SKIP + >>> viewer = Viewer() # doctest: +SKIP >>> viewer.scene.add(arc.to_polyline(n=20)) # doctest: +SKIP - >>> viewer.scene.add(arc.frame) # doctest: +SKIP - >>> viewer.show() # doctest: +SKIP + >>> viewer.scene.add(arc.frame) # doctest: +SKIP + >>> viewer.show() # doctest: +SKIP Visualize only part of the arc. - >>> from compas_viewer import Viewer # doctest: +SKIP - >>> viewer = Viewer() # doctest: +SKIP + >>> from compas_viewer import Viewer # doctest: +SKIP + >>> viewer = Viewer() # doctest: +SKIP >>> viewer.scene.add(arc.to_polyline(n=20, domain=(0.25, 0.75))) # doctest: +SKIP - >>> viewer.scene.add(arc.frame) # doctest: +SKIP - >>> viewer.show() # doctest: +SKIP + >>> viewer.scene.add(arc.frame) # doctest: +SKIP + >>> viewer.show() # doctest: +SKIP """ diff --git a/src/compas/geometry/curves/circle.py b/src/compas/geometry/curves/circle.py index 6e24392386b..60e8e60b941 100644 --- a/src/compas/geometry/curves/circle.py +++ b/src/compas/geometry/curves/circle.py @@ -82,11 +82,11 @@ class Circle(Conic): Visualise the line, circle, and frame of the circle with the COMPAS viewer. >>> from compas_viewer import Viewer # doctest: +SKIP - >>> viewer = Viewer() # doctest: +SKIP - >>> viewer.scene.add(line) # doctest: +SKIP - >>> viewer.scene.add(circle) # doctest: +SKIP - >>> viewer.scene.add(circle.frame) # doctest: +SKIP - >>> viewer.show() # doctest: +SKIP + >>> viewer = Viewer() # doctest: +SKIP + >>> viewer.scene.add(line) # doctest: +SKIP + >>> viewer.scene.add(circle) # doctest: +SKIP + >>> viewer.scene.add(circle.frame) # doctest: +SKIP + >>> viewer.show() # doctest: +SKIP """ diff --git a/src/compas/geometry/curves/ellipse.py b/src/compas/geometry/curves/ellipse.py index 554321940b0..2f9fa9ed43b 100644 --- a/src/compas/geometry/curves/ellipse.py +++ b/src/compas/geometry/curves/ellipse.py @@ -104,11 +104,11 @@ class Ellipse(Conic): Visualise the line, ellipse, and frame of the ellipse with the COMPAS viewer. >>> from compas_viewer import Viewer # doctest: +SKIP - >>> viewer = Viewer() # doctest: +SKIP - >>> viewer.scene.add(line) # doctest: +SKIP - >>> viewer.scene.add(ellipse) # doctest: +SKIP - >>> viewer.scene.add(ellipse.frame) # doctest: +SKIP - >>> viewer.show() # doctest: +SKIP + >>> viewer = Viewer() # doctest: +SKIP + >>> viewer.scene.add(line) # doctest: +SKIP + >>> viewer.scene.add(ellipse) # doctest: +SKIP + >>> viewer.scene.add(ellipse.frame) # doctest: +SKIP + >>> viewer.show() # doctest: +SKIP """ diff --git a/src/compas/geometry/curves/line.py b/src/compas/geometry/curves/line.py index 427d82511a3..ebbcf5c7b42 100644 --- a/src/compas/geometry/curves/line.py +++ b/src/compas/geometry/curves/line.py @@ -61,7 +61,7 @@ class Line(Curve): Point(0.000, 0.000, 0.000) >>> line.midpoint Point(0.500, 0.500, 0.500) - >>> line.length == math.sqrt(line.dx **2 + line.dy **2 + line.dz **2) + >>> line.length == math.sqrt(line.dx**2 + line.dy**2 + line.dz**2) True >>> line.direction Vector(0.577, 0.577, 0.577) diff --git a/src/compas/geometry/curves/parabola.py b/src/compas/geometry/curves/parabola.py index d032e71dfed..2935c7cda0e 100644 --- a/src/compas/geometry/curves/parabola.py +++ b/src/compas/geometry/curves/parabola.py @@ -74,11 +74,11 @@ class Parabola(Conic): Visualize the parabola with the COMPAS viewer. >>> from compas_viewer import Viewer # doctest: +SKIP - >>> viewer = Viewer() # doctest: +SKIP - >>> viewer.scene.add(line) # doctest: +SKIP - >>> viewer.scene.add(parabola) # doctest: +SKIP - >>> viewer.scene.add(parabola.frame) # doctest: +SKIP - >>> viewer.show() # doctest: +SKIP + >>> viewer = Viewer() # doctest: +SKIP + >>> viewer.scene.add(line) # doctest: +SKIP + >>> viewer.scene.add(parabola) # doctest: +SKIP + >>> viewer.scene.add(parabola.frame) # doctest: +SKIP + >>> viewer.show() # doctest: +SKIP """ diff --git a/src/compas/geometry/curves/polyline.py b/src/compas/geometry/curves/polyline.py index 00e65cea049..366db032a8f 100644 --- a/src/compas/geometry/curves/polyline.py +++ b/src/compas/geometry/curves/polyline.py @@ -55,7 +55,7 @@ class Polyline(Curve): Examples -------- - >>> polyline = Polyline([[0,0,0], [1,0,0], [2,0,0], [3,0,0]]) + >>> polyline = Polyline([[0, 0, 0], [1, 0, 0], [2, 0, 0], [3, 0, 0]]) >>> polyline.length 3.0 diff --git a/src/compas/geometry/frame.py b/src/compas/geometry/frame.py index bc0b4034313..fb93ea4a30c 100644 --- a/src/compas/geometry/frame.py +++ b/src/compas/geometry/frame.py @@ -422,7 +422,7 @@ def from_list(cls, values): # type: (...) -> Frame Examples -------- - >>> l = [-1.0, 0.0, 0.0, 8110, 0.0, 0.0, -1.0, 7020, 0.0, -1.0, 0.0, 1810] + >>> l = [-1.0, 0.0, 0.0, 8110, 0.0, 0.0, -1.0, 7020, 0.0, -1.0, 0.0, 1810] >>> f = Frame.from_list(l) """ @@ -457,7 +457,7 @@ def from_quaternion(cls, quaternion, point=[0, 0, 0]): # type: (...) -> Frame Examples -------- >>> q1 = [0.945, -0.021, -0.125, 0.303] - >>> f = Frame.from_quaternion(q1, point=[1., 1., 1.]) + >>> f = Frame.from_quaternion(q1, point=[1.0, 1.0, 1.0]) >>> q2 = f.quaternion >>> allclose(q1, q2) True @@ -521,8 +521,8 @@ def from_euler_angles(cls, euler_angles, static=True, axes="xyz", point=[0, 0, 0 Examples -------- >>> ea1 = 1.4, 0.5, 2.3 - >>> f = Frame.from_euler_angles(ea1, static=True, axes='xyz') - >>> ea2 = f.euler_angles(static=True, axes='xyz') + >>> f = Frame.from_euler_angles(ea1, static=True, axes="xyz") + >>> ea2 = f.euler_angles(static=True, axes="xyz") >>> allclose(ea1, ea2) True @@ -550,7 +550,7 @@ def from_plane(cls, plane): # type: (...) -> Frame Examples -------- >>> from compas.geometry import Plane - >>> plane = Plane([0,0,0], [0,0,1]) + >>> plane = Plane([0, 0, 0], [0, 0, 1]) >>> frame = Frame.from_plane(plane) >>> allclose(frame.normal, plane.normal) True @@ -669,8 +669,8 @@ def euler_angles(self, static=True, axes="xyz"): Examples -------- >>> ea1 = 1.4, 0.5, 2.3 - >>> f = Frame.from_euler_angles(ea1, static=True, axes='xyz') - >>> ea2 = f.euler_angles(static=True, axes='xyz') + >>> f = Frame.from_euler_angles(ea1, static=True, axes="xyz") + >>> ea2 = f.euler_angles(static=True, axes="xyz") >>> allclose(ea1, ea2) True @@ -699,8 +699,8 @@ def to_local_coordinates(self, obj_in_wcf): -------- >>> from compas.geometry import Point >>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15]) - >>> pw = Point(2, 2, 2) # point in wcf - >>> pl = frame.to_local_coordinates(pw) # point in frame + >>> pw = Point(2, 2, 2) # point in wcf + >>> pl = frame.to_local_coordinates(pw) # point in frame >>> frame.to_world_coordinates(pl) Point(2.000, 2.000, 2.000) @@ -731,8 +731,8 @@ def to_world_coordinates(self, obj_in_lcf): -------- >>> from compas.geometry import Point >>> frame = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15]) - >>> pl = Point(1.632, -0.090, 0.573) # point in frame - >>> pw = frame.to_world_coordinates(pl) # point in wcf + >>> pl = Point(1.632, -0.090, 0.573) # point in frame + >>> pw = frame.to_world_coordinates(pl) # point in wcf >>> frame.to_local_coordinates(pw) Point(1.632, -0.090, 0.573) diff --git a/src/compas/geometry/intersections.py b/src/compas/geometry/intersections.py index 7ddd03e805c..25af7d3c794 100644 --- a/src/compas/geometry/intersections.py +++ b/src/compas/geometry/intersections.py @@ -1055,9 +1055,9 @@ def intersection_ellipse_line_xy(ellipse, line): Examples -------- - >>> ellipse = 6., 2.5 - >>> p1 = (4.1, 2.8, 0.) - >>> p2 = (3.4, -3.1, 0.) + >>> ellipse = 6.0, 2.5 + >>> p1 = (4.1, 2.8, 0.0) + >>> p2 = (3.4, -3.1, 0.0) >>> i1, i2 = intersection_ellipse_line_xy(ellipse, [p1, p2]) """ diff --git a/src/compas/geometry/point.py b/src/compas/geometry/point.py index 258383b09e3..c84d306223f 100644 --- a/src/compas/geometry/point.py +++ b/src/compas/geometry/point.py @@ -82,7 +82,7 @@ class Point(Geometry): Point(5.000, 7.000, 9.000) >>> p1 * 2 Point(2.000, 4.000, 6.000) - >>> p1 ** 2 + >>> p1**2 Point(1.000, 4.000, 9.000) >>> p1 Point(1.000, 2.000, 3.000) diff --git a/src/compas/geometry/quaternion.py b/src/compas/geometry/quaternion.py index 824ef80e238..18ed9b410f7 100644 --- a/src/compas/geometry/quaternion.py +++ b/src/compas/geometry/quaternion.py @@ -264,8 +264,8 @@ def __mul__(self, other): Examples -------- >>> Q = Quaternion(1.0, 1.0, 1.0, 1.0).unitized() - >>> R = Quaternion(0.0,-0.1, 0.2,-0.3).unitized() - >>> P = R*Q + >>> R = Quaternion(0.0, -0.1, 0.2, -0.3).unitized() + >>> P = R * Q >>> P.is_unit True @@ -294,7 +294,7 @@ def from_frame(cls, frame): -------- >>> from compas.tolerance import TOL >>> from compas.geometry import Frame - >>> q = [1., -2., 3., -4.] + >>> q = [1.0, -2.0, 3.0, -4.0] >>> F = Frame.from_quaternion(q) >>> Q = Quaternion.from_frame(F) >>> TOL.is_allclose(Q.canonized(), quaternion_canonize(quaternion_unitize(q))) diff --git a/src/compas/geometry/rotation.py b/src/compas/geometry/rotation.py index f9ecec4914a..e0f6526403c 100644 --- a/src/compas/geometry/rotation.py +++ b/src/compas/geometry/rotation.py @@ -63,7 +63,7 @@ class Rotation(Transformation): >>> from compas.geometry import Frame >>> f1 = Frame([0, 0, 0], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15]) >>> R = Rotation.from_frame(f1) - >>> args = False, 'xyz' + >>> args = False, "xyz" >>> alpha, beta, gamma = R.euler_angles(*args) >>> xaxis, yaxis, zaxis = [1, 0, 0], [0, 1, 0], [0, 0, 1] >>> Rx = Rotation.from_axis_and_angle(xaxis, alpha) @@ -299,7 +299,7 @@ def from_euler_angles(cls, euler_angles, static=True, axes="xyz", **kwargs): -------- >>> from compas.tolerance import TOL >>> ea1 = 1.4, 0.5, 2.3 - >>> args = False, 'xyz' + >>> args = False, "xyz" >>> R1 = Rotation.from_euler_angles(ea1, *args) >>> ea2 = R1.euler_angles(*args) >>> TOL.is_allclose(ea1, ea2) @@ -344,7 +344,7 @@ def euler_angles(self, static=True, axes="xyz"): -------- >>> from compas.tolerance import TOL >>> ea1 = 1.4, 0.5, 2.3 - >>> args = False, 'xyz' + >>> args = False, "xyz" >>> R1 = Rotation.from_euler_angles(ea1, *args) >>> ea2 = R1.euler_angles(*args) >>> TOL.is_allclose(ea1, ea2) diff --git a/src/compas/geometry/scale.py b/src/compas/geometry/scale.py index 2ed8d7fdf8c..815a8a3b0da 100644 --- a/src/compas/geometry/scale.py +++ b/src/compas/geometry/scale.py @@ -52,7 +52,7 @@ class Scale(Transformation): >>> point = Point(2, 5, 0) >>> frame = Frame(point, (1, 0, 0), (0, 1, 0)) >>> points = [point, Point(2, 10, 0)] - >>> S = Scale.from_factors([2.] * 3, frame) + >>> S = Scale.from_factors([2.0] * 3, frame) >>> [p.transformed(S) for p in points] [Point(2.000, 5.000, 0.000), Point(2.000, 15.000, 0.000)] @@ -87,7 +87,7 @@ def from_factors(cls, factors, frame=None): >>> point = Point(2, 5, 0) >>> frame = Frame(point, (1, 0, 0), (0, 1, 0)) >>> points = [point, Point(2, 10, 0)] - >>> S = Scale.from_factors([2.] * 3, frame) + >>> S = Scale.from_factors([2.0] * 3, frame) >>> [p.transformed(S) for p in points] [Point(2.000, 5.000, 0.000), Point(2.000, 15.000, 0.000)] diff --git a/src/compas/geometry/trimesh_samplepoints_numpy.py b/src/compas/geometry/trimesh_samplepoints_numpy.py index cfb92c8c6e0..0d1a659be17 100644 --- a/src/compas/geometry/trimesh_samplepoints_numpy.py +++ b/src/compas/geometry/trimesh_samplepoints_numpy.py @@ -37,7 +37,7 @@ def trimesh_samplepoints_numpy(M, num_points=1000, return_normals=False): Make a triangle mesh. >>> from compas.datastructures import Mesh - >>> hypar = Mesh.from_obj(compas.get('hypar.obj')) + >>> hypar = Mesh.from_obj(compas.get("hypar.obj")) >>> hypar.is_trimesh() False >>> hypar.quads_to_triangles() @@ -46,9 +46,9 @@ def trimesh_samplepoints_numpy(M, num_points=1000, return_normals=False): >>> samples_pts, pts_normals = trimesh_samplepoints_numpy(hypar.to_vertices_and_faces(), 1000, True) >>> # the x,y,z of sample points would be the following - >>> x, y, z = samples_pts[:,0], samples_pts[:,1], samples_pts[:,2] + >>> x, y, z = samples_pts[:, 0], samples_pts[:, 1], samples_pts[:, 2] >>> # the sample points added normal vector would be the following - >>> X, Y, Z = x + pts_normals[:,0] , y + pts_normals[:,1] , z + pts_normals[:,2] + >>> X, Y, Z = x + pts_normals[:, 0], y + pts_normals[:, 1], z + pts_normals[:, 2] """ # if mesh.is_empty(): diff --git a/src/compas/itertools.py b/src/compas/itertools.py index 756764679b7..97bddf5ca67 100644 --- a/src/compas/itertools.py +++ b/src/compas/itertools.py @@ -133,7 +133,7 @@ def meshgrid(x, y, indexing="xy"): >>> Y [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]] - >>> X, Y = meshgrid(x, y, 'ij') + >>> X, Y = meshgrid(x, y, "ij") >>> X [[0.0, 0.0], [0.5, 0.5], [1.0, 1.0]] >>> Y @@ -276,7 +276,6 @@ def pairwise(iterable): -------- >>> for a, b in pairwise(range(5)): ... print(a, b) - ... 0 1 1 2 2 3 @@ -308,7 +307,6 @@ def window(seq, n=2): -------- >>> for view in window(range(10), 3): ... print(view) - ... (0, 1, 2) (1, 2, 3) (2, 3, 4) diff --git a/src/compas/linalg.py b/src/compas/linalg.py index 0b9f8967617..299dc6c7ac8 100644 --- a/src/compas/linalg.py +++ b/src/compas/linalg.py @@ -405,7 +405,7 @@ def uvw_lengths(C, X): Examples -------- >>> from compas.matrices import connectivity_matrix - >>> C = connectivity_matrix([[0, 1], [1, 2]], 'csr') + >>> C = connectivity_matrix([[0, 1], [1, 2]], "csr") >>> X = array([[0, 0, 0], [1, 1, 0], [0, 0, 1]]) >>> uvw_lengths(C, X) (array([[ 1., 1., 0.], @@ -438,7 +438,19 @@ def normrow(A): Examples -------- - >>> normrow(array([[2, -1, 3,], [1, 0, 1], [0, 2, -1]])) + >>> normrow( + ... array( + ... [ + ... [ + ... 2, + ... -1, + ... 3, + ... ], + ... [1, 0, 1], + ... [0, 2, -1], + ... ] + ... ) + ... ) array([[3.74165739], [1.41421356], [2.23606798]]) @@ -472,7 +484,19 @@ def normalizerow(A, do_nan_to_num=True): Examples -------- - >>> normalizerow(array([[2, -1, 3,], [1, 0, 1], [0, 2, -1]])) + >>> normalizerow( + ... array( + ... [ + ... [ + ... 2, + ... -1, + ... 3, + ... ], + ... [1, 0, 1], + ... [0, 2, -1], + ... ] + ... ) + ... ) array([[ 0.53452248, -0.26726124, 0.80178373], [ 0.70710678, 0. , 0.70710678], [ 0. , 0.89442719, -0.4472136 ]]) diff --git a/src/compas/matrices.py b/src/compas/matrices.py index 1fe48bd6abd..603e0f4c1fc 100644 --- a/src/compas/matrices.py +++ b/src/compas/matrices.py @@ -140,7 +140,7 @@ def connectivity_matrix(edges, rtype="array"): Examples -------- - >>> connectivity_matrix([[0, 1], [0, 2], [0, 3]], rtype='array') + >>> connectivity_matrix([[0, 1], [0, 2], [0, 3]], rtype="array") array([[-1., 1., 0., 0.], [-1., 0., 1., 0.], [-1., 0., 0., 1.]]) @@ -188,7 +188,7 @@ def laplacian_matrix(edges, normalize=False, rtype="array"): Examples -------- - >>> laplacian_matrix([[0, 1], [0, 2], [0, 3]], rtype='array') + >>> laplacian_matrix([[0, 1], [0, 2], [0, 3]], rtype="array") array([[ 3., -1., -1., -1.], [-1., 1., 0., 0.], [-1., 0., 1., 0.], @@ -252,7 +252,7 @@ def equilibrium_matrix(C, xyz, free, rtype="array"): -------- >>> C = connectivity_matrix([[0, 1], [0, 2], [0, 3]]) >>> xyz = [[0, 0, 1], [0, 1, 0], [-1, -1, 0], [1, -1, 0]] - >>> equilibrium_matrix(C, xyz, [0], rtype='array') + >>> equilibrium_matrix(C, xyz, [0], rtype="array") array([[ 0., 1., -1.], [-1., 1., 1.]]) diff --git a/src/compas/plugins.py b/src/compas/plugins.py index c33b7bd45d8..131fc9a3bc4 100644 --- a/src/compas/plugins.py +++ b/src/compas/plugins.py @@ -260,9 +260,9 @@ def pluggable( Examples -------- - >>> @pluggable(category='triangulation') + >>> @pluggable(category="triangulation") ... def triangulate_mesh(mesh): - ... pass + ... pass """ diff --git a/src/compas/rpc/proxy.py b/src/compas/rpc/proxy.py index 650c9f9efbf..474bc40d000 100644 --- a/src/compas/rpc/proxy.py +++ b/src/compas/rpc/proxy.py @@ -95,10 +95,10 @@ class Proxy(object): Minimal example showing connection to the proxy server, and ensuring the server is disposed after using it: - >>> from compas.rpc import Proxy # doctest: +SKIP - >>> with Proxy('compas.numerical') as numerical: # doctest: +SKIP - ... pass # doctest: +SKIP - ... # doctest: +SKIP + >>> from compas.rpc import Proxy # doctest: +SKIP + >>> with Proxy("compas.numerical") as numerical: # doctest: +SKIP + ... pass # doctest: +SKIP + ... # doctest: +SKIP Starting a new proxy server... # doctest: +SKIP New proxy server started. # doctest: +SKIP Stopping the server proxy. # doctest: +SKIP @@ -396,9 +396,9 @@ def _proxy(self, *args, **kwargs): The result dict has the following structure :: { - 'error' : ..., # A traceback of the error raised on the server, if any. - 'profile' : ..., # A profile of the code executed on the server, if there was no error. - 'data' : ..., # The result returned by the target function, if there was no error. + "error": ..., # A traceback of the error raised on the server, if any. + "profile": ..., # A profile of the code executed on the server, if there was no error. + "data": ..., # The result returned by the target function, if there was no error. } Warnings diff --git a/src/compas/rpc/server.py b/src/compas/rpc/server.py index c33a4665bcb..e570f0f437a 100644 --- a/src/compas/rpc/server.py +++ b/src/compas/rpc/server.py @@ -32,8 +32,7 @@ class DefaultService(Dispatcher): pass - if __name__ == '__main__': - + if __name__ == "__main__": server = Server(("localhost", 8888)) server.register_function(server.ping) diff --git a/src/compas/topology/combinatorics.py b/src/compas/topology/combinatorics.py index 30923d9a696..d010cb23d2b 100644 --- a/src/compas/topology/combinatorics.py +++ b/src/compas/topology/combinatorics.py @@ -45,7 +45,7 @@ def vertex_coloring(adjacency): -------- >>> import compas >>> from compas.datastructures import Graph - >>> graph = Graph.from_obj(compas.get('lines.obj')) + >>> graph = Graph.from_obj(compas.get("lines.obj")) >>> key_color = vertex_coloring(graph.adjacency) >>> key = graph.get_any_node() >>> color = key_color[key] diff --git a/src/compas/utilities/azync.py b/src/compas/utilities/azync.py index 8845e7f1e8b..147cd50cb24 100644 --- a/src/compas/utilities/azync.py +++ b/src/compas/utilities/azync.py @@ -77,15 +77,17 @@ def await_callback(async_func, callback_name="callback", errback_name=None, *arg from compas.utilities import await_callback + def do_async_stuff(callback): from threading import Thread def runner(cb): - print('doing async stuff') + print("doing async stuff") # .. - cb('done') + cb("done") + + Thread(target=runner, args=(callback,)).start() - Thread(target=runner, args=(callback, )).start() result = await_callback(do_async_stuff) diff --git a/src/compas/utilities/datetime.py b/src/compas/utilities/datetime.py index b5d5611f670..372236cdedf 100644 --- a/src/compas/utilities/datetime.py +++ b/src/compas/utilities/datetime.py @@ -16,7 +16,7 @@ def timestamp(): Examples -------- - >>> type(timestamp()) == type('') + >>> type(timestamp()) == type("") True """ @@ -33,7 +33,7 @@ def now(): Examples -------- - >>> type(now()) == type('') + >>> type(now()) == type("") True """ diff --git a/src/compas/utilities/remote.py b/src/compas/utilities/remote.py index 6da13c40bd4..c8ec7eddbd2 100644 --- a/src/compas/utilities/remote.py +++ b/src/compas/utilities/remote.py @@ -30,8 +30,8 @@ def download_file_from_remote(source, target, overwrite=True): import compas from compas.utilities.remote import download_file_from_remote - source = 'https://raw.githubusercontent.com/compas-dev/compas/main/data/faces.obj' - target = os.path.join(compas.APPDATA, 'data', 'faces.obj') + source = "https://raw.githubusercontent.com/compas-dev/compas/main/data/faces.obj" + target = os.path.join(compas.APPDATA, "data", "faces.obj") download_file_from_remote(source, target) diff --git a/src/compas_blender/install.py b/src/compas_blender/install.py index 2a198c5e272..359abc6206c 100644 --- a/src/compas_blender/install.py +++ b/src/compas_blender/install.py @@ -31,6 +31,7 @@ def install(version=None, packages=None, clean=False): .. code-block:: python import compas_blender.install + compas_blender.install.install() .. code-block:: bash @@ -243,9 +244,9 @@ def installable_blender_packages(): Examples -------- >>> import compas.plugins - >>> @compas.plugins.plugin(category='install') + >>> @compas.plugins.plugin(category="install") ... def installable_blender_packages(): - ... return ['compas_fab'] + ... return ["compas_fab"] Returns ------- @@ -272,10 +273,10 @@ def after_blender_install(installed_packages): Examples -------- >>> import compas.plugins - >>> @compas.plugins.plugin(category='install') + >>> @compas.plugins.plugin(category="install") ... def after_blender_install(installed_packages): - ... # Do something after package is installed to Blender, e.g. install the COMPAS UI, etc - ... return [('compas_blender', 'COMPAS Blender UI installed', True)] + ... # Do something after package is installed to Blender, e.g. install the COMPAS UI, etc + ... return [("compas_blender", "COMPAS Blender UI installed", True)] Returns ------- diff --git a/src/compas_ghpython/utilities/drawing.py b/src/compas_ghpython/utilities/drawing.py index a367d1573f6..ddd993040a8 100644 --- a/src/compas_ghpython/utilities/drawing.py +++ b/src/compas_ghpython/utilities/drawing.py @@ -149,9 +149,7 @@ def draw_polylines(polylines): ----- .. code-block:: python - Schema({ - 'points': lambda x: all(len(y) == 3 for y in x) - }) + Schema({"points": lambda x: all(len(y) == 3 for y in x)}) """ rg_polylines = [] @@ -180,10 +178,7 @@ def draw_faces(faces): ----- .. code-block:: python - Schema({ - 'points': lambda x: all(len(y) == 3 for y in x), - Optional('vertexcolors', default=None): lambda x: all(len(y) == 3 for y in x) - }) + Schema({"points": lambda x: all(len(y) == 3 for y in x), Optional("vertexcolors", default=None): lambda x: all(len(y) == 3 for y in x)}) """ meshes = [] @@ -234,11 +229,7 @@ def draw_cylinders(cylinders, cap=False): ----- .. code-block:: python - Schema({ - 'start': lambda x: len(x) == 3, - 'end': lambda x: len(x) == 3, - 'radius': And(Or(int, float), lambda x: x > 0) - }) + Schema({"start": lambda x: len(x) == 3, "end": lambda x: len(x) == 3, "radius": And(Or(int, float), lambda x: x > 0)}) """ rg_cylinders = [] @@ -284,10 +275,7 @@ def draw_pipes(pipes, cap=2, fit=1.0): ----- .. code-block:: python - Schema({ - 'points': lambda x: all(len(y) == 3 for y in x), - 'radius': And(Or(int, float), lambda x: x > 0) - }) + Schema({"points": lambda x: all(len(y) == 3 for y in x), "radius": And(Or(int, float), lambda x: x > 0)}) """ abs_tol = TOL @@ -323,10 +311,7 @@ def draw_spheres(spheres): ----- .. code-block:: python - Schema({ - 'pos': lambda x: len(x) == 3, - 'radius': And(Or(int, float), lambda x: x > 0) - }) + Schema({"pos": lambda x: len(x) == 3, "radius": And(Or(int, float), lambda x: x > 0)}) """ rg_sheres = [] @@ -445,10 +430,7 @@ def draw_circles(circles): ----- .. code-block:: python - Schema({ - 'plane': lambda x: len(x[0]) == 3 and len(x[1]) == 3, - 'radius': And(Or(int, float), lambda x: x > 0) - }) + Schema({"plane": lambda x: len(x[0]) == 3 and len(x[1]) == 3, "radius": And(Or(int, float), lambda x: x > 0)}) """ rg_circles = [] diff --git a/src/compas_rhino/conduits/lines.py b/src/compas_rhino/conduits/lines.py index 57aca6f366b..f8878968cc4 100644 --- a/src/compas_rhino/conduits/lines.py +++ b/src/compas_rhino/conduits/lines.py @@ -46,7 +46,7 @@ class LinesConduit(BaseConduit): from random import randint points = [(1.0 * randint(0, 30), 1.0 * randint(0, 30), 0.0) for _ in range(100)] - lines = [(points[i], points[i + 1]) for i in range(99)] + lines = [(points[i], points[i + 1]) for i in range(99)] conduit = LinesConduit(lines) with conduit.enabled(): diff --git a/src/compas_rhino/conversions/surfaces.py b/src/compas_rhino/conversions/surfaces.py index 5843e3ab27f..fbb84010aed 100644 --- a/src/compas_rhino/conversions/surfaces.py +++ b/src/compas_rhino/conversions/surfaces.py @@ -203,7 +203,6 @@ def surface_to_compas_mesh(surface, facefilter=None, cleanup=False, cls=None): ... if w > 10 and h > 10: ... return True ... return False - ... >>> guid = compas_rhino.select_surface() >>> surf = Rhino.Geometry.Surface.from_guid(guid) diff --git a/src/compas_rhino/install.py b/src/compas_rhino/install.py index 2c768ccbcdb..911a7341bf4 100644 --- a/src/compas_rhino/install.py +++ b/src/compas_rhino/install.py @@ -33,6 +33,7 @@ def install(version=None, packages=None, clean=False): .. code-block:: python import compas_rhino.install + compas_rhino.install.install() .. code-block:: bash @@ -273,9 +274,9 @@ def installable_rhino_packages(): Examples -------- >>> import compas.plugins - >>> @compas.plugins.plugin(category='install') + >>> @compas.plugins.plugin(category="install") ... def installable_rhino_packages(): - ... return ['compas_fab'] + ... return ["compas_fab"] Returns ------- @@ -302,10 +303,10 @@ def after_rhino_install(installed_packages): Examples -------- >>> import compas.plugins - >>> @compas.plugins.plugin(category='install') + >>> @compas.plugins.plugin(category="install") ... def after_rhino_install(installed_packages): - ... # Do something after package is installed to Rhino, eg, copy components, etc - ... return [('compas_ghpython', 'GH Components installed', True)] + ... # Do something after package is installed to Rhino, eg, copy components, etc + ... return [("compas_ghpython", "GH Components installed", True)] Returns ------- diff --git a/src/compas_rhino/install_plugin.py b/src/compas_rhino/install_plugin.py index 344269e948c..42fefe6a051 100644 --- a/src/compas_rhino/install_plugin.py +++ b/src/compas_rhino/install_plugin.py @@ -151,7 +151,6 @@ def install_plugin(plugin, version=None): # ============================================================================== if __name__ == "__main__": - import argparse parser = argparse.ArgumentParser(description="COMPAS Rhino Plugin Installation command-line utility.") diff --git a/src/compas_rhino/layers.py b/src/compas_rhino/layers.py index 759a3ba8360..a449fcc6af9 100644 --- a/src/compas_rhino/layers.py +++ b/src/compas_rhino/layers.py @@ -125,12 +125,14 @@ def create_layers_from_paths(names, separator="::"): .. code-block:: python - create_layers_from_paths([ - "COMPAS::Datastructures::Mesh", - "COMPAS::Datastructures::Graph", - "COMPAS::Geometry::Point", - "COMPAS::Geometry::Vector", - ]) + create_layers_from_paths( + [ + "COMPAS::Datastructures::Mesh", + "COMPAS::Datastructures::Graph", + "COMPAS::Geometry::Point", + "COMPAS::Geometry::Vector", + ] + ) """ for name in names: @@ -155,16 +157,15 @@ def create_layers_from_dict(layers): -------- .. code-block:: python - layers = {'COMPAS', {'layers': { - 'Datastructures': {'color': (255, 0, 0), 'layers': { - 'Mesh': {}, - 'Graph': {} - }}, - 'Geometry': {'color': (0, 0, 255),'layers': { - 'Point': {}, - 'Vector': {} - }}, - }}} + layers = { + "COMPAS", + { + "layers": { + "Datastructures": {"color": (255, 0, 0), "layers": {"Mesh": {}, "Graph": {}}}, + "Geometry": {"color": (0, 0, 255), "layers": {"Point": {}, "Vector": {}}}, + } + }, + } create_layers_from_dict(layers) @@ -307,12 +308,12 @@ def delete_layers(layers): -------- .. code-block:: python - layers = {'COMPAS': {'layers': {'Datastructures': {'layers': {'Mesh': {}, 'Graph': {}}}}}} + layers = {"COMPAS": {"layers": {"Datastructures": {"layers": {"Mesh": {}, "Graph": {}}}}}} create_layers(layers) - delete_layers(['COMPAS::Datastructures::Graph']) - delete_layers({'COMPAS': {'layers': {'Datastructures': {'layers': {'Mesh': {}}}}}}) + delete_layers(["COMPAS::Datastructures::Graph"]) + delete_layers({"COMPAS": {"layers": {"Datastructures": {"layers": {"Mesh": {}}}}}}) """ to_delete = [] diff --git a/src/compas_rhino/objects.py b/src/compas_rhino/objects.py index 4bde93f6717..2601f3836a2 100644 --- a/src/compas_rhino/objects.py +++ b/src/compas_rhino/objects.py @@ -50,7 +50,7 @@ def get_objects(name=None, color=None, layer=None, type=None): import compas_rhino guids_all = compas_rhino.get_objects() - guids_compas = compas_rhino.get_objects(name='COMPAS.*') + guids_compas = compas_rhino.get_objects(name="COMPAS.*") guids_red = compas_rhino.get_objects(color=(255, 0, 0)) guids_points = compas_rhino.get_objects(type=compas_rhino.rs.filter.point) guids_redpoints = compas_rhino.get_objects(color=(255, 0, 0), type=compas_rhino.rs.filter.point) diff --git a/src/compas_rhino/uninstall.py b/src/compas_rhino/uninstall.py index 10b040a91ba..cb4e4a656ef 100644 --- a/src/compas_rhino/uninstall.py +++ b/src/compas_rhino/uninstall.py @@ -30,6 +30,7 @@ def uninstall(version=None, packages=None): .. code-block:: python import compas_rhino + compas_rhino.uninstall() .. code-block:: bash @@ -205,10 +206,10 @@ def after_rhino_uninstall(uninstalled_packages): Examples -------- >>> import compas.plugins - >>> @compas.plugins.plugin(category='install') + >>> @compas.plugins.plugin(category="install") ... def after_rhino_uninstall(uninstalled_packages): - ... # Do something cleanup, eg remove copied files. - ... return [('compas_ghpython', 'GH Components uninstalled', True)] + ... # Do something cleanup, eg remove copied files. + ... return [("compas_ghpython", "GH Components uninstalled", True)] Returns ------- diff --git a/src/compas_rhino/utilities/drawing.py b/src/compas_rhino/utilities/drawing.py index 4df1f5bd687..e5245353821 100644 --- a/src/compas_rhino/utilities/drawing.py +++ b/src/compas_rhino/utilities/drawing.py @@ -84,15 +84,17 @@ def draw_labels(labels, **kwargs): .. code-block:: python - Schema({ - 'pos': And(list, lambda x: len(x) == 3), - 'text': And(str, len), - Optional('name', default=''): str, - Optional('color', default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - Optional('fontsize', default=10): Or(int, float), - Optional('font', default="Arial Regular"): str - }) + Schema( + { + "pos": And(list, lambda x: len(x) == 3), + "text": And(str, len), + Optional("name", default=""): str, + Optional("color", default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + Optional("fontsize", default=10): Or(int, float), + Optional("font", default="Arial Regular"): str, + } + ) """ guids = [] @@ -149,12 +151,14 @@ def draw_points(points, **kwargs): .. code-block:: python - Schema({ - 'pos': And(list, lambda x: len(x) == 3), - Optional('name', default=''): str, - Optional('color', default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str - }) + Schema( + { + "pos": And(list, lambda x: len(x) == 3), + Optional("name", default=""): str, + Optional("color", default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -206,15 +210,17 @@ def draw_lines(lines, **kwargs): .. code-block:: python - Schema({ - 'start': And(list, lambda x: len(x) == 3), - 'end': And(list, lambda x: len(x) == 3), - Optional('name', default=''): str, - Optional('color', default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - Optional('arrow', default=None): str, - Optional('width', default=None): Or(int, float), - }) + Schema( + { + "start": And(list, lambda x: len(x) == 3), + "end": And(list, lambda x: len(x) == 3), + Optional("name", default=""): str, + Optional("color", default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + Optional("arrow", default=None): str, + Optional("width", default=None): Or(int, float), + } + ) """ guids = [] @@ -276,15 +282,17 @@ def draw_geodesics(geodesics, **kwargs): .. code-block:: python - Schema({ - 'start': And(list, lambda x: len(x) == 3), - 'end': And(list, lambda x: len(x) == 3), - 'srf': Or(str, System.Guid), - Optional('name', default=''): str, - Optional('color', default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - Optional('arrow', default=None): str, - }) + Schema( + { + "start": And(list, lambda x: len(x) == 3), + "end": And(list, lambda x: len(x) == 3), + "srf": Or(str, System.Guid), + Optional("name", default=""): str, + Optional("color", default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + Optional("arrow", default=None): str, + } + ) """ guids = [] @@ -434,8 +442,8 @@ def draw_breps(faces, u=10, v=10, join=False, **kwargs): Draw convert each mesh face to brep dict schema: - >>> vertices = mesh.vertices_attributes('xyz') - >>> breps = [{'points': mesh.face_coordinates(face)} for face in mesh.faces()] + >>> vertices = mesh.vertices_attributes("xyz") + >>> breps = [{"points": mesh.face_coordinates(face)} for face in mesh.faces()] Draw brep faces as one joined brep. @@ -523,14 +531,16 @@ def draw_cylinders(cylinders, cap=False, **kwargs): .. code-block:: python - Schema({ - 'start': And(list, lambda x: len(x) == 3), - 'end': And(list, lambda x: len(x) == 3), - 'radius': And(Or(int, float), lambda x: x > 0.0), - Optional('name', default=''): str, - Optional('color', default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - }) + Schema( + { + "start": And(list, lambda x: len(x) == 3), + "end": And(list, lambda x: len(x) == 3), + "radius": And(Or(int, float), lambda x: x > 0.0), + Optional("name", default=""): str, + Optional("color", default=None): (lambda x: len(x) == 3 and all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -602,13 +612,15 @@ def draw_pipes(pipes, cap=2, fit=1.0, **kwargs): .. code-block:: python - Schema({ - 'points': And(list, lambda x: all(len(y) == 3 for y in x)), - 'radius': And(Or(int, float), lambda x: x > 0.0), - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - }) + Schema( + { + "points": And(list, lambda x: all(len(y) == 3 for y in x)), + "radius": And(Or(int, float), lambda x: x > 0.0), + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -671,13 +683,15 @@ def draw_spheres(spheres, **kwargs): .. code-block:: python - Schema({ - 'pos': And(list, lambda x: len(x) == 3), - 'radius': And(Or(int, float), lambda x: x > 0.0), - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str, - }) + Schema( + { + "pos": And(list, lambda x: len(x) == 3), + "radius": And(Or(int, float), lambda x: x > 0.0), + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -805,12 +819,14 @@ def draw_faces(faces, **kwargs): .. code-block:: python - Schema({ - 'points': And(len, lambda x: all(len(y) == 3 for y in x)), - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('vertexcolors', default=None): And(len, lambda x: all(0 <= y <= 255 for y in x)), - }) + Schema( + { + "points": And(len, lambda x: all(len(y) == 3 for y in x)), + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("vertexcolors", default=None): And(len, lambda x: all(0 <= y <= 255 for y in x)), + } + ) """ guids = [] @@ -883,13 +899,15 @@ def draw_circles(circles, **kwargs): .. code-block:: python - Schema({ - 'plane': lambda x: len(x[0]) == 3 and len(x[1]) == 3, - 'radius': And(Or(int, float), lambda x: x > 0), - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str - }) + Schema( + { + "plane": lambda x: len(x[0]) == 3 and len(x[1]) == 3, + "radius": And(Or(int, float), lambda x: x > 0), + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -943,12 +961,14 @@ def draw_curves(curves, **kwargs): .. code-block:: python - Schema({ - 'curve': compas.geometry.Rhino.Geometry.Curve, - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str - }) + Schema( + { + "curve": compas.geometry.Rhino.Geometry.Curve, + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] @@ -999,12 +1019,14 @@ def draw_surfaces(surfaces, **kwargs): .. code-block:: python - Schema({ - 'surface': compas.geometry.Surface, - Optional('name', default=''): str, - Optional('color', default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), - Optional('layer', default=None): str - }) + Schema( + { + "surface": compas.geometry.Surface, + Optional("name", default=""): str, + Optional("color", default=None): And(lambda x: len(x) == 3, all(0 <= y <= 255 for y in x)), + Optional("layer", default=None): str, + } + ) """ guids = [] diff --git a/tests/compas/geometry/test_core_predicates_3.py b/tests/compas/geometry/test_core_predicates_3.py index 61a1267e91e..d3a015d4af6 100644 --- a/tests/compas/geometry/test_core_predicates_3.py +++ b/tests/compas/geometry/test_core_predicates_3.py @@ -3,7 +3,6 @@ def test_is_coplanar(): - # 4 points that are colinear: points = [[0, 0, 0], [0, 1, 0], [0, 2, 0], [0, 4, 0]] diff --git a/tests/compas/rpc/test_rpc.py b/tests/compas/rpc/test_rpc.py index 26e424f8d35..87e48017ce5 100644 --- a/tests/compas/rpc/test_rpc.py +++ b/tests/compas/rpc/test_rpc.py @@ -11,7 +11,6 @@ def test_basic_rpc_call(): def test_switch_package(): with Proxy("numpy", python="python") as proxy: - A = proxy.array([[1, 2], [3, 4]]) proxy.package = "scipy.linalg" diff --git a/tests/compas/scene/test_scene_serialisation.py b/tests/compas/scene/test_scene_serialisation.py index 2cd33077afb..2fd12c3bca1 100644 --- a/tests/compas/scene/test_scene_serialisation.py +++ b/tests/compas/scene/test_scene_serialisation.py @@ -70,7 +70,6 @@ def items(): def assert_is_data_equal(obj1, obj2, path=""): - if type(obj1) is not type(obj2): print("Type mismatch: {} != {} for {}:{} and {}:{}".format(type(obj1), type(obj2), path, obj1, path, obj2)) return False @@ -109,7 +108,6 @@ def assert_is_data_equal(obj1, obj2, path=""): def test_scene_serialisation(items, mocker): - if compas.IPY: mocker.patch("compas.is_rhino", return_value=False)