/usr/lib64/python3.9/site-packages/setools/diff
NameSizeModeActions
__pycache__/-0755rm
bool.py24860644editdlrm
bounds.py37820644editdlrm
commons.py21990644editdlrm
conditional.py12560644editdlrm
constraints.py83960644editdlrm
context.py13940644editdlrm
default.py36240644editdlrm
descriptors.py10630644editdlrm
difference.py54880644editdlrm
fsuse.py25500644editdlrm
genfscon.py27190644editdlrm
ibendportcon.py26410644editdlrm
ibpkeycon.py26540644editdlrm
initsid.py20010644editdlrm
mls.py101470644editdlrm
mlsrules.py46560644editdlrm
netifcon.py31270644editdlrm
nodecon.py26530644editdlrm
objclass.py31560644editdlrm
polcap.py11210644editdlrm
portcon.py26320644editdlrm
properties.py18200644editdlrm
rbacrules.py65540644editdlrm
roles.py27260644editdlrm
terules.py246690644editdlrm
typeattr.py28630644editdlrm
types.py42710644editdlrm
typing.py4580644editdlrm
users.py54810644editdlrm
__init__.py25850644editdlrm
Edit: /usr/lib64/python3.9/site-packages/setools/diff/conditional.py (1256B)
# Copyright 2015-2016, Tresys Technology, LLC # Copyright 2018, Chris PeBenito # # SPDX-License-Identifier: LGPL-2.1-only # from collections import defaultdict from ..policyrep import Conditional from .difference import Wrapper from .typing import Cache _cond_cache: Cache[Conditional, "ConditionalWrapper"] = defaultdict(dict) def conditional_wrapper_factory(cond: Conditional) -> "ConditionalWrapper": """ Wrap type attributes from the specified policy. This caches results to prevent duplicate wrapper objects in memory. """ try: return _cond_cache[cond.policy][cond] except KeyError: a = ConditionalWrapper(cond) _cond_cache[cond.policy][cond] = a return a class ConditionalWrapper(Wrapper[Conditional]): """Wrap conditional policy expressions to allow comparisons by truth table.""" __slots__ = ("truth_table") def __init__(self, cond: Conditional) -> None: self.origin = cond self.truth_table = cond.truth_table() def __hash__(self): return hash(self.origin) def __eq__(self, other): return self.truth_table == other.truth_table def __lt__(self, other): return str(self.origin) < str(other)