Skip to content

Commit

Permalink
style fixes by ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
wspr authored and github-actions[bot] committed Apr 2, 2024
1 parent d0bd1de commit 2feb694
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions ausankey/ausankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def subplot(self, ii):
self.data[weightind + lastind],
]

nodes_lr =[
nodes_lr = [
self.sort_nodes(labels_lr[0], self.node_sizes[ii]),
self.sort_nodes(labels_lr[1], self.node_sizes[ii + 1]),
]
Expand Down Expand Up @@ -751,30 +751,26 @@ def draw_title(self, x, y, label, va):
},
)

###########################################

###########################################


def sort_nodes(self,lbl, node_sizes):
def sort_nodes(self, lbl, node_sizes):
"""creates a sorted list of labels by their summed weights"""

arr = {}
for uniq in lbl.unique():
if uniq is not None:
arr[uniq] = True

sort_arr = sorted(
arr.items(),
key=lambda item: list(node_sizes).index(item[0]),
)

return list(dict(sort_arr).keys())


###########################################
return list(dict(sort_arr).keys())

###########################################

def sort_node_sizes(self,lbl, sorting):
def sort_node_sizes(self, lbl, sorting):
"""creates a sorted list of labels by their summed weights"""

if sorting == "top":
Expand All @@ -788,8 +784,7 @@ def sort_node_sizes(self,lbl, sorting):

sort_arr = sorted(
lbl.items(),
key=lambda item:
s * self.sort_dict.get(item[0], item[1]),
key=lambda item: s * self.sort_dict.get(item[0], item[1]),
# sorting = 0,1,-1 affects this
)

Expand Down

0 comments on commit 2feb694

Please sign in to comment.