mirror of
https://github.com/SELinuxProject/setools
synced 2025-04-01 14:48:07 +00:00
Bounds: Refactor to move all initialization to the factory method.
This commit is contained in:
parent
790140acdb
commit
f33da33190
@ -39,17 +39,15 @@ cdef class Bounds(PolicySymbol):
|
|||||||
readonly object child
|
readonly object child
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
cdef factory(SELinuxPolicy policy, parent, child):
|
cdef inline Bounds factory(SELinuxPolicy policy, parent, child):
|
||||||
"""Factory function for creating Bounds objects."""
|
"""Factory function for creating Bounds objects."""
|
||||||
b = Bounds(parent, child)
|
cdef Bounds b = Bounds.__new__(Bounds)
|
||||||
b.policy = policy
|
b.policy = policy
|
||||||
|
b.ruletype = BoundsRuletype.typebounds
|
||||||
|
b.parent = parent
|
||||||
|
b.child = child
|
||||||
return b
|
return b
|
||||||
|
|
||||||
def __cinit__(self, parent, child):
|
|
||||||
self.ruletype = BoundsRuletype.typebounds
|
|
||||||
self.parent = parent
|
|
||||||
self.child = child
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "{0.ruletype} {0.parent} {0.child};".format(self)
|
return "{0.ruletype} {0.parent} {0.child};".format(self)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user