From 76193066aa24f4a3fd619c10a28ac75503208b9f Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Tue, 5 Dec 2023 08:21:08 -0500 Subject: [PATCH] Remove permission map parameter from analysis tabs. This is not the common case. Signed-off-by: Chris PeBenito --- setoolsgui/apol.py | 4 ++-- setoolsgui/widgets/boolquery.py | 6 +++--- setoolsgui/widgets/commonquery.py | 6 +++--- setoolsgui/widgets/constraintquery.py | 7 +++---- setoolsgui/widgets/fsusequery.py | 6 +++--- setoolsgui/widgets/genfsconquery.py | 6 +++--- setoolsgui/widgets/ibendportconquery.py | 7 +++---- setoolsgui/widgets/ibpkeyconquery.py | 7 +++---- setoolsgui/widgets/infoflow.py | 9 ++++++--- setoolsgui/widgets/initsidquery.py | 6 +++--- setoolsgui/widgets/mlsrulequery.py | 6 +++--- setoolsgui/widgets/netifconquery.py | 6 +++--- setoolsgui/widgets/nodeconquery.py | 7 +++---- setoolsgui/widgets/portconquery.py | 6 +++--- setoolsgui/widgets/rbacrulequery.py | 6 +++--- setoolsgui/widgets/summary.py | 11 +++++------ setoolsgui/widgets/tab.py | 20 ++++++++++---------- setoolsgui/widgets/terulequery.py | 6 +++--- tests-gui/widgets/test_boolquery.py | 2 +- tests-gui/widgets/test_commonquery.py | 2 +- tests-gui/widgets/test_constraintquery.py | 2 +- tests-gui/widgets/test_fsusequery.py | 2 +- tests-gui/widgets/test_genfsconquery.py | 2 +- tests-gui/widgets/test_ibendportconquery.py | 2 +- tests-gui/widgets/test_ibpkeyconquery.py | 2 +- tests-gui/widgets/test_initialsidquery.py | 2 +- tests-gui/widgets/test_mlsrulequery.py | 2 +- tests-gui/widgets/test_netifconquery.py | 2 +- tests-gui/widgets/test_nodeconquery.py | 2 +- tests-gui/widgets/test_portconquery.py | 2 +- tests-gui/widgets/test_rbacrulequery.py | 2 +- tests-gui/widgets/test_tab.py | 4 ++-- tests-gui/widgets/test_terulequery.py | 2 +- 33 files changed, 81 insertions(+), 83 deletions(-) diff --git a/setoolsgui/apol.py b/setoolsgui/apol.py index 6d2b8676..8b38ed68 100644 --- a/setoolsgui/apol.py +++ b/setoolsgui/apol.py @@ -446,8 +446,8 @@ def create_new_analysis(self, tab_class: type[widgets.tab.BaseAnalysisTabWidget] assert self.policy assert self.permmap - new_tab = tab_class(self.policy, self.permmap, - parent=self) + new_tab = tab_class(self.policy, parent=self) + new_tab.handle_permmap_change(self.permmap) new_tab.setObjectName(counted_name) self.permmap_changed.connect(new_tab.handle_permmap_change) index = self.addTab(new_tab, counted_name) diff --git a/setoolsgui/widgets/boolquery.py b/setoolsgui/widgets/boolquery.py index a5d12a8c..21873f7c 100644 --- a/setoolsgui/widgets/boolquery.py +++ b/setoolsgui/widgets/boolquery.py @@ -16,10 +16,10 @@ class BoolQueryTab(tab.TableResultTabWidget): tab_title = "Booleans" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.BoolQuery(policy), None, enable_criteria=True, + super().__init__(setools.BoolQuery(policy), enable_criteria=True, enable_browser=True, parent=parent) self.setWhatsThis("Search Booleans in a SELinux policy.") @@ -69,7 +69,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = BoolQueryTab(setools.SELinuxPolicy(), mw) + widget = BoolQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/commonquery.py b/setoolsgui/widgets/commonquery.py index 70f36a17..a97060ce 100644 --- a/setoolsgui/widgets/commonquery.py +++ b/setoolsgui/widgets/commonquery.py @@ -16,10 +16,10 @@ class CommonQueryTab(tab.TableResultTabWidget): tab_title = "Common Permision Sets" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.CommonQuery(policy), None, enable_criteria=True, + super().__init__(setools.CommonQuery(policy), enable_criteria=True, enable_browser=True, parent=parent) self.setWhatsThis("Search common permission sets in an SELinux policy.") @@ -67,7 +67,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = CommonQueryTab(setools.SELinuxPolicy(), mw) + widget = CommonQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/constraintquery.py b/setoolsgui/widgets/constraintquery.py index 1709e345..f73b2e3d 100644 --- a/setoolsgui/widgets/constraintquery.py +++ b/setoolsgui/widgets/constraintquery.py @@ -16,11 +16,10 @@ class ConstraintQueryTab(tab.TableResultTabWidget): tab_title = "Constraints" mlsonly = False - def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.ConstraintQuery(policy), None, enable_criteria=True, - parent=parent) + super().__init__(setools.ConstraintQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search constraints in a SELinux policy.") @@ -130,7 +129,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = ConstraintQueryTab(setools.SELinuxPolicy(), mw) + widget = ConstraintQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/fsusequery.py b/setoolsgui/widgets/fsusequery.py index 1af51a8d..8ca1a422 100644 --- a/setoolsgui/widgets/fsusequery.py +++ b/setoolsgui/widgets/fsusequery.py @@ -16,10 +16,10 @@ class FSUseQueryTab(tab.TableResultTabWidget): tab_title = "Fs_use_*" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.FSUseQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.FSUseQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search fs_use_* statements in a SELinux policy.") @@ -68,7 +68,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = FSUseQueryTab(setools.SELinuxPolicy(), mw) + widget = FSUseQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/genfsconquery.py b/setoolsgui/widgets/genfsconquery.py index 0fb8c505..e1378324 100644 --- a/setoolsgui/widgets/genfsconquery.py +++ b/setoolsgui/widgets/genfsconquery.py @@ -16,10 +16,10 @@ class GenfsconQueryTab(tab.TableResultTabWidget): tab_title = "Genfscons" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.GenfsconQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.GenfsconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search genfscon statements in a SELinux policy.") @@ -67,7 +67,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = GenfsconQueryTab(setools.SELinuxPolicy(), mw) + widget = GenfsconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/ibendportconquery.py b/setoolsgui/widgets/ibendportconquery.py index 541ad79e..5f57670f 100644 --- a/setoolsgui/widgets/ibendportconquery.py +++ b/setoolsgui/widgets/ibendportconquery.py @@ -16,11 +16,10 @@ class IbendportconQueryTab(tab.TableResultTabWidget): tab_title = "Infiniband Endport Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.IbendportconQuery(policy), None, enable_criteria=True, - parent=parent) + super().__init__(setools.IbendportconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search ibendportcon statements in a SELinux policy.") @@ -67,7 +66,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = IbendportconQueryTab(setools.SELinuxPolicy(), None, parent=mw) + widget = IbendportconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/ibpkeyconquery.py b/setoolsgui/widgets/ibpkeyconquery.py index 39417f17..491c1a4a 100644 --- a/setoolsgui/widgets/ibpkeyconquery.py +++ b/setoolsgui/widgets/ibpkeyconquery.py @@ -16,11 +16,10 @@ class IbpkeyconQueryTab(tab.TableResultTabWidget): tab_title = "Infiniband Partition Key Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.IbpkeyconQuery(policy), None, enable_criteria=True, - parent=parent) + super().__init__(setools.IbpkeyconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search ibpkeycon statements in a SELinux policy.") @@ -66,7 +65,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = IbpkeyconQueryTab(setools.SELinuxPolicy(), None, parent=mw) + widget = IbpkeyconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/infoflow.py b/setoolsgui/widgets/infoflow.py index e1e1c5fb..d1057cf0 100644 --- a/setoolsgui/widgets/infoflow.py +++ b/setoolsgui/widgets/infoflow.py @@ -37,10 +37,13 @@ class InfoFlowAnalysisTab(tab.DirectedGraphResultTab[setools.InfoFlowAnalysis]): tab_title = "Information Flow Analysis" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, perm_map: setools.PermissionMap, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.InfoFlowAnalysis(policy, perm_map), perm_map, + permmap = setools.PermissionMap() + permmap.map_policy(policy) + + super().__init__(setools.InfoFlowAnalysis(policy, permmap), enable_criteria=True, parent=parent) self.setWhatsThis("Information flow analysis of an SELinux policy.") @@ -315,7 +318,7 @@ def load(self, settings: dict) -> None: app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = InfoFlowAnalysisTab(setools.SELinuxPolicy(), setools.PermissionMap(), parent=mw) + widget = InfoFlowAnalysisTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/initsidquery.py b/setoolsgui/widgets/initsidquery.py index e4cfbf19..bd52afd8 100644 --- a/setoolsgui/widgets/initsidquery.py +++ b/setoolsgui/widgets/initsidquery.py @@ -16,10 +16,10 @@ class InitialSIDQueryTab(tab.TableResultTabWidget): tab_title = "Initial Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.InitialSIDQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.InitialSIDQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search initial context statements in a SELinux policy.") @@ -61,7 +61,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = InitialSIDQueryTab(setools.SELinuxPolicy(), mw) + widget = InitialSIDQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/mlsrulequery.py b/setoolsgui/widgets/mlsrulequery.py index 790fc469..c715b0e4 100644 --- a/setoolsgui/widgets/mlsrulequery.py +++ b/setoolsgui/widgets/mlsrulequery.py @@ -14,10 +14,10 @@ class MLSRuleQueryTab(tab.TableResultTabWidget): tab_title = "Multi-Level Security (MLS) Rules" mlsonly = True - def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, + def __init__(self, policy: "setools.SELinuxPolicy", /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.MLSRuleQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.MLSRuleQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search Type Enforcement rules in a SELinux policy.") @@ -132,7 +132,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = MLSRuleQueryTab(setools.SELinuxPolicy(), mw) + widget = MLSRuleQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/netifconquery.py b/setoolsgui/widgets/netifconquery.py index 0280799a..5687fd95 100644 --- a/setoolsgui/widgets/netifconquery.py +++ b/setoolsgui/widgets/netifconquery.py @@ -16,10 +16,10 @@ class NetifconQueryTab(tab.TableResultTabWidget): tab_title = "Network Interface Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.NetifconQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.NetifconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search netifcon statements in a SELinux policy.") @@ -61,7 +61,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = NetifconQueryTab(setools.SELinuxPolicy(), mw) + widget = NetifconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/nodeconquery.py b/setoolsgui/widgets/nodeconquery.py index 274b864d..25ed2f3d 100644 --- a/setoolsgui/widgets/nodeconquery.py +++ b/setoolsgui/widgets/nodeconquery.py @@ -16,11 +16,10 @@ class NodeconQueryTab(tab.TableResultTabWidget): tab_title = "Network Node Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.NodeconQuery(policy), None, enable_criteria=True, - parent=parent) + super().__init__(setools.NodeconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search nodecon statements in a SELinux policy.") @@ -69,7 +68,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = NodeconQueryTab(setools.SELinuxPolicy(), None, parent=mw) + widget = NodeconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/portconquery.py b/setoolsgui/widgets/portconquery.py index d1f53ac1..93c6f7b5 100644 --- a/setoolsgui/widgets/portconquery.py +++ b/setoolsgui/widgets/portconquery.py @@ -16,10 +16,10 @@ class PortconQueryTab(tab.TableResultTabWidget): tab_title = "Network Port Contexts" mlsonly = False - def __init__(self, policy: setools.SELinuxPolicy, _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.PortconQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.PortconQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search portcon statements in a SELinux policy.") @@ -101,7 +101,7 @@ def __init__(self, policy: setools.SELinuxPolicy, _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = PortconQueryTab(setools.SELinuxPolicy(), mw) + widget = PortconQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(1280, 1024) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/rbacrulequery.py b/setoolsgui/widgets/rbacrulequery.py index 60f3b07b..88481175 100644 --- a/setoolsgui/widgets/rbacrulequery.py +++ b/setoolsgui/widgets/rbacrulequery.py @@ -14,10 +14,10 @@ class RBACRuleQueryTab(tab.TableResultTabWidget): tab_title = "Role-based Access Control (RBAC) Rules" mlsonly = False - def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.RBACRuleQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.RBACRuleQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search RBAC rules in a SELinux policy.") @@ -119,7 +119,7 @@ def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = RBACRuleQueryTab(setools.SELinuxPolicy(), mw) + widget = RBACRuleQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/summary.py b/setoolsgui/widgets/summary.py index 41891d84..0d99cd71 100644 --- a/setoolsgui/widgets/summary.py +++ b/setoolsgui/widgets/summary.py @@ -3,9 +3,8 @@ # # SPDX-License-Identifier: LGPL-2.1-only -import typing - from PyQt6 import QtCore, QtGui, QtWidgets +import setools from . import tab @@ -20,11 +19,11 @@ class SummaryTab(tab.BaseAnalysisTabWidget): tab_title = "SELinux Policy Summary" mlsonly = False - def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(policy, None, enable_criteria=False, parent=parent) - self.policy: typing.Final = policy + super().__init__(policy, enable_criteria=False, parent=parent) + self.policy = policy # font for labels font = QtGui.QFont() @@ -210,7 +209,7 @@ def query_failed(self, message: str) -> None: app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = SummaryTab(setools.SELinuxPolicy(), None, parent=mw) + widget = SummaryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/setoolsgui/widgets/tab.py b/setoolsgui/widgets/tab.py index c6ed54d7..8802202c 100644 --- a/setoolsgui/widgets/tab.py +++ b/setoolsgui/widgets/tab.py @@ -68,7 +68,7 @@ class TabProtocol(typing.Protocol): section: AnalysisSection mlsonly: bool - def __init__(self, policy: setools.SELinuxPolicy, perm_map: setools.PermissionMap, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: ... @@ -107,7 +107,7 @@ class BaseAnalysisTabWidget(QtWidgets.QScrollArea, metaclass=TabRegistry): criteria: tuple[criteria.criteria.CriteriaWidget, ...] perm_map: setools.PermissionMap - def __init__(self, _, __, /, *, + def __init__(self, _, /, *, enable_criteria: bool = True, enable_browser: bool = False, parent: QtWidgets.QWidget | None = None) -> None: @@ -375,11 +375,11 @@ class ResultTab(enum.IntEnum): Table = 0 Text = 1 - def __init__(self, query: setools.PolicyQuery, _, /, *, + def __init__(self, query: setools.PolicyQuery, /, *, enable_criteria: bool = True, enable_browser: bool = False, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(query, None, enable_criteria=enable_criteria, + super().__init__(query, enable_criteria=enable_criteria, enable_browser=enable_browser, parent=parent) self.query: typing.Final = query @@ -556,11 +556,11 @@ class ResultTab(enum.IntEnum): Tree = 1 Text = 2 - def __init__(self, query: DGA, _, /, *, + def __init__(self, query: DGA, /, *, enable_criteria: bool = True, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(query, None, enable_criteria=enable_criteria, enable_browser=False, + super().__init__(query, enable_criteria=enable_criteria, enable_browser=False, parent=parent) self.query: typing.Final = query @@ -723,13 +723,13 @@ def query_failed(self, message: str) -> None: tw = QtWidgets.QTabWidget(mw) mw.setCentralWidget(tw) - widget1 = BaseAnalysisTabWidget(None, None, parent=tw) + widget1 = BaseAnalysisTabWidget(None, parent=tw) tw.addTab(widget1, "BaseAnalysisTabWidget w/criteria") - widget2 = BaseAnalysisTabWidget(None, None, enable_criteria=False, parent=tw) + widget2 = BaseAnalysisTabWidget(None, enable_criteria=False, parent=tw) tw.addTab(widget2, "BaseAnalysisTabWidget w/o criteria") - widget3 = TableResultTabWidget(q, None, parent=tw) + widget3 = TableResultTabWidget(q, parent=tw) tw.addTab(widget3, "TableResultTabWidget") - widget4 = DirectedGraphResultTab(a, None, parent=tw) + widget4 = DirectedGraphResultTab(a, parent=tw) tw.addTab(widget4, "GraphResultTabWidget w/criteria") mw.resize(1024, 768) diff --git a/setoolsgui/widgets/terulequery.py b/setoolsgui/widgets/terulequery.py index 0fa62d2f..87657d9e 100644 --- a/setoolsgui/widgets/terulequery.py +++ b/setoolsgui/widgets/terulequery.py @@ -16,10 +16,10 @@ class TERuleQueryTab(tab.TableResultTabWidget): tab_title = "Type Enforcement Rule Query" mlsonly = False - def __init__(self, policy: "setools.SELinuxPolicy", _, /, *, + def __init__(self, policy: setools.SELinuxPolicy, /, *, parent: QtWidgets.QWidget | None = None) -> None: - super().__init__(setools.TERuleQuery(policy), None, enable_criteria=True, parent=parent) + super().__init__(setools.TERuleQuery(policy), enable_criteria=True, parent=parent) self.setWhatsThis("Search Type Enforcement rules in a SELinux policy.") @@ -190,7 +190,7 @@ def run(self) -> None: app = QtWidgets.QApplication(sys.argv) mw = QtWidgets.QMainWindow() - widget = TERuleQueryTab(setools.SELinuxPolicy(), mw) + widget = TERuleQueryTab(setools.SELinuxPolicy(), parent=mw) mw.setCentralWidget(widget) mw.resize(widget.size()) whatsthis = QtWidgets.QWhatsThis.createAction(mw) diff --git a/tests-gui/widgets/test_boolquery.py b/tests-gui/widgets/test_boolquery.py index 770bb986..1de0737b 100644 --- a/tests-gui/widgets/test_boolquery.py +++ b/tests-gui/widgets/test_boolquery.py @@ -14,7 +14,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> BoolQue """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = BoolQueryTab(mock_policy, None, **kwargs) + w = BoolQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_commonquery.py b/tests-gui/widgets/test_commonquery.py index 5995c747..756dd530 100644 --- a/tests-gui/widgets/test_commonquery.py +++ b/tests-gui/widgets/test_commonquery.py @@ -14,7 +14,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> CommonQ """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = CommonQueryTab(mock_policy, None, **kwargs) + w = CommonQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_constraintquery.py b/tests-gui/widgets/test_constraintquery.py index 7889a926..880b9655 100644 --- a/tests-gui/widgets/test_constraintquery.py +++ b/tests-gui/widgets/test_constraintquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Constra """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = ConstraintQueryTab(mock_policy, None, **kwargs) + w = ConstraintQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_fsusequery.py b/tests-gui/widgets/test_fsusequery.py index 1f42b30a..044e3a45 100644 --- a/tests-gui/widgets/test_fsusequery.py +++ b/tests-gui/widgets/test_fsusequery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> FSUseQu """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = FSUseQueryTab(mock_policy, None, **kwargs) + w = FSUseQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_genfsconquery.py b/tests-gui/widgets/test_genfsconquery.py index 846812c2..fe4ff3b9 100644 --- a/tests-gui/widgets/test_genfsconquery.py +++ b/tests-gui/widgets/test_genfsconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Genfsco """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = GenfsconQueryTab(mock_policy, None, **kwargs) + w = GenfsconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_ibendportconquery.py b/tests-gui/widgets/test_ibendportconquery.py index fcc6c176..1427c9df 100644 --- a/tests-gui/widgets/test_ibendportconquery.py +++ b/tests-gui/widgets/test_ibendportconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Ibendpo """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = IbendportconQueryTab(mock_policy, None, **kwargs) + w = IbendportconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_ibpkeyconquery.py b/tests-gui/widgets/test_ibpkeyconquery.py index ee31e253..ec94f067 100644 --- a/tests-gui/widgets/test_ibpkeyconquery.py +++ b/tests-gui/widgets/test_ibpkeyconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Ibpkeyc """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = IbpkeyconQueryTab(mock_policy, None, **kwargs) + w = IbpkeyconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_initialsidquery.py b/tests-gui/widgets/test_initialsidquery.py index 0bbb195b..b2691233 100644 --- a/tests-gui/widgets/test_initialsidquery.py +++ b/tests-gui/widgets/test_initialsidquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Initial """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = InitialSIDQueryTab(mock_policy, None, **kwargs) + w = InitialSIDQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_mlsrulequery.py b/tests-gui/widgets/test_mlsrulequery.py index 32d48222..1e81f442 100644 --- a/tests-gui/widgets/test_mlsrulequery.py +++ b/tests-gui/widgets/test_mlsrulequery.py @@ -13,7 +13,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> MLSRule """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = MLSRuleQueryTab(mock_policy, None, **kwargs) + w = MLSRuleQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_netifconquery.py b/tests-gui/widgets/test_netifconquery.py index 16f39d1d..29ff09d5 100644 --- a/tests-gui/widgets/test_netifconquery.py +++ b/tests-gui/widgets/test_netifconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Netifco """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = NetifconQueryTab(mock_policy, None, **kwargs) + w = NetifconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_nodeconquery.py b/tests-gui/widgets/test_nodeconquery.py index 85f392b7..cafac279 100644 --- a/tests-gui/widgets/test_nodeconquery.py +++ b/tests-gui/widgets/test_nodeconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Nodecon """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = NodeconQueryTab(mock_policy, None, **kwargs) + w = NodeconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_portconquery.py b/tests-gui/widgets/test_portconquery.py index b10cb1b6..f66b7d99 100644 --- a/tests-gui/widgets/test_portconquery.py +++ b/tests-gui/widgets/test_portconquery.py @@ -15,7 +15,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> Portcon """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = PortconQueryTab(mock_policy, None, **kwargs) + w = PortconQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_rbacrulequery.py b/tests-gui/widgets/test_rbacrulequery.py index 93f95fe9..e2f7ef9e 100644 --- a/tests-gui/widgets/test_rbacrulequery.py +++ b/tests-gui/widgets/test_rbacrulequery.py @@ -13,7 +13,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> RBACRul """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = RBACRuleQueryTab(mock_policy, None, **kwargs) + w = RBACRuleQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_tab.py b/tests-gui/widgets/test_tab.py index 777db965..27dffb6d 100644 --- a/tests-gui/widgets/test_tab.py +++ b/tests-gui/widgets/test_tab.py @@ -14,7 +14,7 @@ def base_widget(mock_policy, request: pytest.FixtureRequest, """Pytest fixture to set up the BaseAnalysisTabWidget widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = tab.BaseAnalysisTabWidget(mock_policy, None, **kwargs) + w = tab.BaseAnalysisTabWidget(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w @@ -26,7 +26,7 @@ def table_widget(mock_policy, request: pytest.FixtureRequest, """Pytest fixture to set up the TableResultTabWidget widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = tab.TableResultTabWidget(mock_policy, None, **kwargs) + w = tab.TableResultTabWidget(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w diff --git a/tests-gui/widgets/test_terulequery.py b/tests-gui/widgets/test_terulequery.py index 9689b22e..5159e36c 100644 --- a/tests-gui/widgets/test_terulequery.py +++ b/tests-gui/widgets/test_terulequery.py @@ -13,7 +13,7 @@ def widget(mock_policy, request: pytest.FixtureRequest, qtbot: QtBot) -> TERuleQ """Pytest fixture to set up the widget.""" marker = request.node.get_closest_marker("obj_args") kwargs = marker.kwargs if marker else {} - w = TERuleQueryTab(mock_policy, None, **kwargs) + w = TERuleQueryTab(mock_policy, **kwargs) qtbot.addWidget(w) w.show() return w