Skip to content

Commit

Permalink
Merge pull request #641 from Fortran-FOSS-Programmers/fix-show-proc-p…
Browse files Browse the repository at this point in the history
…arent

Restore `show_proc_parent` option functionality
  • Loading branch information
ZedThree committed Apr 2, 2024
2 parents c969a21 + 5edea98 commit 97a4621
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ford/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class ProcNode(BaseNode):
def colour(self):
return ProcNode.COLOURS.get(self.proctype, super().colour)

def __init__(self, obj, gd, hist=None):
def __init__(self, obj, gd: GraphData, hist=None):
# ToDo: Figure out appropriate way to handle interfaces to routines in submodules.
self.proctype = getattr(obj, "proctype", "").lower()
if self.proctype == "" and isinstance(obj, FortranBoundProcedure):
Expand All @@ -487,7 +487,7 @@ def __init__(self, obj, gd, hist=None):

parent_label = ""
binding_label = ""
if parent:
if parent and gd.show_proc_parent:
parent_label = f"{parent.name}::"
if binder:
binding_label = f"{binder.name}%"
Expand Down
41 changes: 22 additions & 19 deletions test/test_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def make_project_graphs(tmp_path_factory, request):
project = create_project(settings)

graphs = GraphManager(
graphdir="", parentdir="..", coloured_edges=True, show_proc_parent=True
graphdir="",
parentdir="..",
coloured_edges=True,
show_proc_parent=proc_internals,
)
for entity_list in [
project.types,
Expand Down Expand Up @@ -221,7 +224,7 @@ def make_project_graphs(tmp_path_factory, request):
"c_subsubmod",
"iso_fortran_env",
"external_mod",
"foo::three",
"three",
"foo",
],
[
Expand All @@ -240,22 +243,22 @@ def make_project_graphs(tmp_path_factory, request):
{"proc_internals": False},
["callgraph"],
[
"c::defined_elsewhere",
"c::submod_proc",
"c_subsubmod::submod_proc",
"c::one",
"foo::three",
"c::two",
"foo::four",
"defined_elsewhere",
"submod_proc",
"submod_proc",
"one",
"three",
"two",
"four",
"other_sub",
"foo",
"c::alpha%five",
"c::alpha%six",
"c::seven",
"c::alpha%eight",
"c::alpha%nine",
"c::alpha%eight_nine",
"c::alpha%ten",
"alpha%five",
"alpha%six",
"seven",
"alpha%eight",
"alpha%nine",
"alpha%eight_nine",
"alpha%ten",
],
[
"proc~three->proc~one",
Expand Down Expand Up @@ -369,7 +372,7 @@ def make_project_graphs(tmp_path_factory, request):
(
{"proc_internals": False},
["procedures", "two", "callsgraph"],
["c::one", "c::two"],
["one", "two"],
["proc~two->proc~one"],
PROC_GRAPH_KEY,
),
Expand All @@ -388,14 +391,14 @@ def make_project_graphs(tmp_path_factory, request):
(
{"proc_internals": False},
["procedures", "two", "calledbygraph"],
["foo::three", "c::two", "foo"],
["three", "two", "foo"],
["proc~three->proc~two", "program~foo->proc~three"],
PROC_GRAPH_KEY,
),
(
{"proc_internals": False},
["procedures", "three", "usesgraph"],
["external_mod", "foo::three"],
["external_mod", "three"],
["proc~three->external_mod"],
MOD_GRAPH_KEY,
),
Expand Down

0 comments on commit 97a4621

Please sign in to comment.