Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
HDictus committed Nov 29, 2023
1 parent 42acc44 commit 1d96b29
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 31 deletions.
16 changes: 4 additions & 12 deletions bluepysnap/edges/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ def ids(self, group=None, sample=None, limit=None):
fun = lambda x: (x.ids(group), x.name)
return self._get_ids_from_pop(fun, CircuitEdgeIds, sample=sample, limit=limit)

def get(self,
edge_ids=None,
properties=None,
include_empty=False
): # pylint: disable=arguments-renamed
def get(
self, edge_ids=None, properties=None, include_empty=False
): # pylint: disable=arguments-renamed
"""Edge properties by iterating populations.
Args:
Expand Down Expand Up @@ -152,13 +150,7 @@ def efferent_nodes(self, source, unique=True):
result.unique(inplace=True)
return result

def pathway_edges(
self,
source=None,
target=None,
properties=None,
include_empty=False
):
def pathway_edges(self, source=None, target=None, properties=None, include_empty=False):
"""Get edges corresponding to ``source`` -> ``target`` connections.
Args:
Expand Down
6 changes: 4 additions & 2 deletions bluepysnap/nodes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def ids(self, group=None, sample=None, limit=None):
fun = lambda x: (x.ids(group, raise_missing_property=False), x.name)
return self._get_ids_from_pop(fun, CircuitNodeIds, sample=sample, limit=limit)

def get(self, group=None, properties=None, include_empty=False): # pylint: disable=arguments-differ
def get(
self, group=None, properties=None, include_empty=False
): # pylint: disable=arguments-differ
"""Node properties by iterating populations.
Args:
Expand All @@ -130,7 +132,7 @@ def get(self, group=None, properties=None, include_empty=False): # pylint: disa
properties (str/list): If specified, return only the properties in the list.
Otherwise return all properties.
include_empty: whether to include populations for which the query is empty
Returns:
Expand Down
5 changes: 1 addition & 4 deletions tests/test_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,7 @@ def test_pathway_edges(self):
)

# check that 'include_empty' kwarg works
tested = self.test_obj.pathway_edges(
source=[1],
properties=properties,
include_empty=True)
tested = self.test_obj.pathway_edges(source=[1], properties=properties, include_empty=True)

expected = pd.DataFrame(
{prop: [] for prop in properties},
Expand Down
20 changes: 7 additions & 13 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,25 +365,19 @@ def test_get(self):

with pytest.raises(BluepySnapError, match="Unknown properties required: {'unknown'}"):
next(self.test_obj.get(properties="unknown"))

tested = pd.concat([
df for _, df in self.test_obj.get({'layer': 10}, include_empty=True)
])

tested = pd.concat([df for _, df in self.test_obj.get({"layer": 10}, include_empty=True)])
expected = pd.DataFrame(
{p: [] for p in list(self.test_obj.property_names)},
index=pd.MultiIndex.from_tuples(
[],
names=["population", "node_ids"]
)
index=pd.MultiIndex.from_tuples([], names=["population", "node_ids"]),
)
pdt.assert_frame_equal(
tested.sort_index(axis=1),
expected.sort_index(axis=1),
check_dtype=False,
check_index_type=False
tested.sort_index(axis=1),
expected.sort_index(axis=1),
check_dtype=False,
check_index_type=False,
)


def test_functionality_with_separate_node_set(self):
with pytest.raises(BluepySnapError, match="Undefined node set"):
self.test_obj.ids("ExtraLayer2")
Expand Down

0 comments on commit 1d96b29

Please sign in to comment.