From 0a1849b2938582313de0d55cbcc0efca790343a4 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Mon, 22 Apr 2024 14:20:57 -0400 Subject: [PATCH] infoflow/dta: Correct typing for NetworkX. Quote the annotations so NetworkX is optional again. Signed-off-by: Chris PeBenito --- setools/dta.py | 4 ++-- setools/infoflow.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/setools/dta.py b/setools/dta.py index 6f789418..4f27e34c 100644 --- a/setools/dta.py +++ b/setools/dta.py @@ -278,7 +278,7 @@ def results(self) -> Iterable[DTAPath] | Iterable[DomainTransition]: case _: raise ValueError(f"Unknown analysis mode: {self.mode}") - def graphical_results(self) -> nx.DiGraph: + def graphical_results(self) -> "nx.DiGraph": """ Return the results of the analysis as a NetworkX directed graph. @@ -697,7 +697,7 @@ class Edge(mixins.NetworkXGraphEdge): The default is False. """ - G: nx.DiGraph + G: "nx.DiGraph" source: policyrep.Type target: policyrep.Type create: InitVar[bool] = False diff --git a/setools/infoflow.py b/setools/infoflow.py index b128bc46..1a5be2e5 100644 --- a/setools/infoflow.py +++ b/setools/infoflow.py @@ -202,7 +202,7 @@ def results(self) -> Iterable[InfoFlowPath] | Iterable["InfoFlowStep"]: case _: raise ValueError(f"Unknown analysis mode: {self.mode}") - def graphical_results(self) -> nx.DiGraph: + def graphical_results(self) -> "nx.DiGraph": """ Return the results of the analysis as a NetworkX directed graph. @@ -432,7 +432,7 @@ class InfoFlowStep(mixins.NetworkXGraphEdge): The default is False. """ - G: nx.DiGraph + G: "nx.DiGraph" source: policyrep.Type target: policyrep.Type create: InitVar[bool] = False