From 6d17a7237c4ee0547204b97118331bad873e4b72 Mon Sep 17 00:00:00 2001 From: pattonw Date: Wed, 10 May 2023 17:13:55 -0700 Subject: [PATCH] black formatting --- funlib/persistence/__init__.py | 2 +- funlib/persistence/graphs/__init__.py | 2 +- funlib/persistence/graphs/file_graph_provider.py | 12 +++++++++--- funlib/persistence/graphs/shared_graph_provider.py | 1 - tests/conftest.py | 1 - tests/test_graph.py | 14 ++++++++++---- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/funlib/persistence/__init__.py b/funlib/persistence/__init__.py index 5060c32..9c534da 100644 --- a/funlib/persistence/__init__.py +++ b/funlib/persistence/__init__.py @@ -1,4 +1,4 @@ from .arrays import Array, open_ds, prepare_ds # noqa __version__ = "0.1.0" -__version_info__ = tuple(int(i) for i in __version__.split(".")) \ No newline at end of file +__version_info__ = tuple(int(i) for i in __version__.split(".")) diff --git a/funlib/persistence/graphs/__init__.py b/funlib/persistence/graphs/__init__.py index cad8f5e..c30d7c0 100644 --- a/funlib/persistence/graphs/__init__.py +++ b/funlib/persistence/graphs/__init__.py @@ -1,2 +1,2 @@ from .file_graph_provider import FileGraphProvider # noqa -from .mongodb_graph_provider import MongoDbGraphProvider # noqa \ No newline at end of file +from .mongodb_graph_provider import MongoDbGraphProvider # noqa diff --git a/funlib/persistence/graphs/file_graph_provider.py b/funlib/persistence/graphs/file_graph_provider.py index 9087427..fcde59f 100644 --- a/funlib/persistence/graphs/file_graph_provider.py +++ b/funlib/persistence/graphs/file_graph_provider.py @@ -424,7 +424,9 @@ def write_edges( if fail_if_exists: raise NotImplementedError("Fail if exists not implemented for file backend") if fail_if_not_exists: - raise NotImplementedError("Fail if not exists not implemented for file backend") + raise NotImplementedError( + "Fail if not exists not implemented for file backend" + ) if attributes is not None: raise NotImplementedError("Attributes not implemented for file backend") if self.graph_provider.mode == "r": @@ -477,9 +479,13 @@ def write_nodes( if delete: raise NotImplementedError("Delete not implemented for file backend") if fail_if_exists: - raise NotImplementedError("Fail if exists not implemented for " "file backend") + raise NotImplementedError( + "Fail if exists not implemented for " "file backend" + ) if fail_if_not_exists: - raise NotImplementedError("Fail if not exists not implemented for " "file backend") + raise NotImplementedError( + "Fail if not exists not implemented for " "file backend" + ) if attributes is not None: raise NotImplementedError("Attributes not implemented for file backend") if self.graph_provider.mode == "r": diff --git a/funlib/persistence/graphs/shared_graph_provider.py b/funlib/persistence/graphs/shared_graph_provider.py index 83ed7ac..22e7d79 100644 --- a/funlib/persistence/graphs/shared_graph_provider.py +++ b/funlib/persistence/graphs/shared_graph_provider.py @@ -103,4 +103,3 @@ def get_connected_components(self): def name(self): return type(self).__name__ - diff --git a/tests/conftest.py b/tests/conftest.py index c4d1393..342b1d0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -50,4 +50,3 @@ def file_provider_factory(mode, directed=None, total_roi=None): mongo_client.drop_database("test_mongo_graph") else: yield file_provider_factory - diff --git a/tests/test_graph.py b/tests/test_graph.py index 1cff02e..136faf1 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -31,7 +31,7 @@ def test_graph_filtering(provider_factory): filtered_edge_endpoints = [(edge["u"], edge["v"]) for edge in filtered_edges] expected_edge_endpoints = [(57, 23), (2, 42)] for u, v in expected_edge_endpoints: - assert (u,v) in filtered_edge_endpoints or (v,u) in filtered_edge_endpoints + assert (u, v) in filtered_edge_endpoints or (v, u) in filtered_edge_endpoints filtered_subgraph = graph_reader.get_graph( roi, nodes_filter={"selected": True}, edges_filter={"selected": True} @@ -42,7 +42,10 @@ def test_graph_filtering(provider_factory): assert expected_node_ids == nodes_with_position assert len(filtered_subgraph.edges()) == len(expected_edge_endpoints) for u, v in expected_edge_endpoints: - assert (u,v) in filtered_subgraph.edges() or (v,u) in filtered_subgraph.edges() + assert (u, v) in filtered_subgraph.edges() or ( + v, + u, + ) in filtered_subgraph.edges() def test_graph_filtering_complex(provider_factory): @@ -77,7 +80,7 @@ def test_graph_filtering_complex(provider_factory): filtered_edge_endpoints = [(edge["u"], edge["v"]) for edge in filtered_edges] expected_edge_endpoints = [(57, 23)] for u, v in expected_edge_endpoints: - assert (u,v) in filtered_edge_endpoints or (v,u) in filtered_edge_endpoints + assert (u, v) in filtered_edge_endpoints or (v, u) in filtered_edge_endpoints filtered_subgraph = graph_provider.get_graph( roi, @@ -90,7 +93,10 @@ def test_graph_filtering_complex(provider_factory): assert expected_node_ids == nodes_with_position assert len(filtered_subgraph.edges()) == len(expected_edge_endpoints) for u, v in expected_edge_endpoints: - assert (u,v) in filtered_subgraph.edges() or (v,u) in filtered_subgraph.edges() + assert (u, v) in filtered_subgraph.edges() or ( + v, + u, + ) in filtered_subgraph.edges() def test_graph_read_and_update_specific_attrs(provider_factory):