Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pattonw committed May 11, 2023
1 parent 82f8b62 commit 6d17a72
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion funlib/persistence/__init__.py
Original file line number Diff line number Diff line change
@@ -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("."))
__version_info__ = tuple(int(i) for i in __version__.split("."))
2 changes: 1 addition & 1 deletion funlib/persistence/graphs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .file_graph_provider import FileGraphProvider # noqa
from .mongodb_graph_provider import MongoDbGraphProvider # noqa
from .mongodb_graph_provider import MongoDbGraphProvider # noqa
12 changes: 9 additions & 3 deletions funlib/persistence/graphs/file_graph_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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":
Expand Down
1 change: 0 additions & 1 deletion funlib/persistence/graphs/shared_graph_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,3 @@ def get_connected_components(self):

def name(self):
return type(self).__name__

1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

14 changes: 10 additions & 4 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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):
Expand Down Expand Up @@ -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,
Expand All @@ -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):
Expand Down

0 comments on commit 6d17a72

Please sign in to comment.