Skip to content

Commit 42302ed

Browse files
authored
Merge pull request #3627 from TheChymera/codespell
Adjusted variable names for clarity and codespell false positives
2 parents 5ef9fe4 + 71e8795 commit 42302ed

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

nipype/pipeline/engine/utils.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,15 @@ def _write_detailed_dot(graph, dotfilename):
510510
edges = []
511511
for n in nx.topological_sort(graph):
512512
nodename = n.itername
513-
inports = []
513+
in_ports = []
514514
for u, v, d in graph.in_edges(nbunch=n, data=True):
515515
for cd in d["connect"]:
516516
if isinstance(cd[0], (str, bytes)):
517517
outport = cd[0]
518518
else:
519519
outport = cd[0][0]
520-
inport = cd[1]
521-
ipstrip = "in%s" % _replacefunk(inport)
520+
in_port = cd[1]
521+
ipstrip = "in%s" % _replacefunk(in_port)
522522
opstrip = "out%s" % _replacefunk(outport)
523523
edges.append(
524524
"%s:%s:e -> %s:%s:w;"
@@ -529,11 +529,11 @@ def _write_detailed_dot(graph, dotfilename):
529529
ipstrip,
530530
)
531531
)
532-
if inport not in inports:
533-
inports.append(inport)
532+
if in_port not in in_ports:
533+
in_ports.append(in_port)
534534
inputstr = (
535535
["{IN"]
536-
+ [f"|<in{_replacefunk(ip)}> {ip}" for ip in sorted(inports)]
536+
+ [f"|<in{_replacefunk(ip)}> {ip}" for ip in sorted(in_ports)]
537537
+ ["}"]
538538
)
539539
outports = []
@@ -886,34 +886,34 @@ def _node_ports(graph, node):
886886
for _, v, d in graph.out_edges(node, data=True):
887887
for src, dest in d["connect"]:
888888
if isinstance(src, tuple):
889-
srcport = src[0]
889+
src_port = src[0]
890890
else:
891-
srcport = src
892-
if srcport not in portoutputs:
893-
portoutputs[srcport] = []
894-
portoutputs[srcport].append((v, dest, src))
891+
src_port = src
892+
if src_port not in portoutputs:
893+
portoutputs[src_port] = []
894+
portoutputs[src_port].append((v, dest, src))
895895
return (portinputs, portoutputs)
896896

897897

898898
def _propagate_root_output(graph, node, field, connections):
899899
"""Propagates the given graph root node output port
900900
field connections to the out-edge destination nodes."""
901-
for destnode, inport, src in connections:
901+
for destnode, in_port, src in connections:
902902
value = getattr(node.inputs, field)
903903
if isinstance(src, tuple):
904904
value = evaluate_connect_function(src[1], src[2], value)
905-
destnode.set_input(inport, value)
905+
destnode.set_input(in_port, value)
906906

907907

908908
def _propagate_internal_output(graph, node, field, connections, portinputs):
909909
"""Propagates the given graph internal node output port
910910
field connections to the out-edge source node and in-edge
911911
destination nodes."""
912-
for destnode, inport, src in connections:
912+
for destnode, in_port, src in connections:
913913
if field in portinputs:
914-
srcnode, srcport = portinputs[field]
915-
if isinstance(srcport, tuple) and isinstance(src, tuple):
916-
src_func = srcport[1].split("\\n")[0]
914+
srcnode, src_port = portinputs[field]
915+
if isinstance(src_port, tuple) and isinstance(src, tuple):
916+
src_func = src_port[1].split("\\n")[0]
917917
dst_func = src[1].split("\\n")[0]
918918
raise ValueError(
919919
"Does not support two inline functions "
@@ -924,9 +924,9 @@ def _propagate_internal_output(graph, node, field, connections, portinputs):
924924

925925
connect = graph.get_edge_data(srcnode, destnode, default={"connect": []})
926926
if isinstance(src, tuple):
927-
connect["connect"].append(((srcport, src[1], src[2]), inport))
927+
connect["connect"].append(((src_port, src[1], src[2]), in_port))
928928
else:
929-
connect = {"connect": [(srcport, inport)]}
929+
connect = {"connect": [(src_port, in_port)]}
930930
old_connect = graph.get_edge_data(
931931
srcnode, destnode, default={"connect": []}
932932
)
@@ -936,7 +936,7 @@ def _propagate_internal_output(graph, node, field, connections, portinputs):
936936
value = getattr(node.inputs, field)
937937
if isinstance(src, tuple):
938938
value = evaluate_connect_function(src[1], src[2], value)
939-
destnode.set_input(inport, value)
939+
destnode.set_input(in_port, value)
940940

941941

942942
def generate_expanded_graph(graph_in):

0 commit comments

Comments
 (0)