/usr/lib64/python3.9/site-packages/setools
NameSizeModeActions
checker/-0755rm
diff/-0755rm
__pycache__/-0755rm
boolquery.py17420644editdlrm
boundsquery.py18450644editdlrm
categoryquery.py13750644editdlrm
commonquery.py16130644editdlrm
constraintquery.py51100644editdlrm
defaultquery.py23400644editdlrm
descriptors.py99320644editdlrm
devicetreeconquery.py22760644editdlrm
dta.py232110644editdlrm
exception.py61040644editdlrm
fsusequery.py28680644editdlrm
genfsconquery.py32600644editdlrm
ibendportconquery.py31260644editdlrm
ibpkeyconquery.py50060644editdlrm
infoflow.py159130644editdlrm
initsidquery.py23090644editdlrm
iomemconquery.py40950644editdlrm
ioportconquery.py41200644editdlrm
mixins.py69800644editdlrm
mlsrulequery.py41860644editdlrm
netifconquery.py24560644editdlrm
nodeconquery.py39970644editdlrm
objclassquery.py33480644editdlrm
pcideviceconquery.py26420644editdlrm
permmap.py165850644editdlrm
perm_map861140644editdlrm
pirqconquery.py25380644editdlrm
polcapquery.py11440644editdlrm
policyrep.cpython-39-x86_64-linux-gnu.so15228080755editdlrm
policyrep.pyi522530644editdlrm
portconquery.py48890644editdlrm
py.typed00644editdlrm
query.py12680644editdlrm
rbacrulequery.py54630644editdlrm
rolequery.py19970644editdlrm
sensitivityquery.py22700644editdlrm
terulequery.py89390644editdlrm
typeattrquery.py21570644editdlrm
typequery.py30210644editdlrm
userquery.py42900644editdlrm
util.py77730644editdlrm
__init__.py33160644editdlrm
Edit: /usr/lib64/python3.9/site-packages/setools/ibendportconquery.py (3126B)
# Copyright 2018, Chris PeBenito # # SPDX-License-Identifier: LGPL-2.1-only # import logging from typing import Iterable, Optional from .mixins import MatchContext, MatchName from .policyrep import Ibendportcon from .query import PolicyQuery from .util import match_regex class IbendportconQuery(MatchContext, MatchName, PolicyQuery): """ Infiniband endport context query. Parameter: policy The policy to query. Keyword Parameters/Class attributes: name The name of the network interface to match. name_regex If true, regular expression matching will be used for matching the name. port The port number to match. user The criteria to match the context's user. user_regex If true, regular expression matching will be used on the user. role The criteria to match the context's role. role_regex If true, regular expression matching will be used on the role. type_ The criteria to match the context's type. type_regex If true, regular expression matching will be used on the type. range_ The criteria to match the context's range. range_subset If true, the criteria will match if it is a subset of the context's range. range_overlap If true, the criteria will match if it overlaps any of the context's range. range_superset If true, the criteria will match if it is a superset of the context's range. range_proper If true, use proper superset/subset operations. No effect if not using set operations. """ _port: Optional[int] = None @property def port(self) -> Optional[int]: return self._port @port.setter def port(self, value: Optional[int]) -> None: if value: pending_value = int(value) if not 0 < pending_value < 256: raise ValueError("Endport value must be 1-255.") self._port = pending_value else: self._port = None def __init__(self, policy, **kwargs): super(IbendportconQuery, self).__init__(policy, **kwargs) self.log = logging.getLogger(__name__) def results(self) -> Iterable[Ibendportcon]: """Generator which yields all matching ibendportcons.""" self.log.info("Generating ibendportcon results from {0.policy}".format(self)) self._match_name_debug(self.log) self.log.debug("Port: {0.port!r}".format(self)) self._match_context_debug(self.log) for endport in self.policy.ibendportcons(): if self.name and not match_regex( endport.name, self.name, self.name_regex): continue if self.port is not None and self.port != endport.port: continue if not self._match_context(endport.context): continue yield endport