CPESet class¶
-
class
cpe.cpeset.
CPESet
¶ Represents a set of CPE Names.
This class allows:
- create a set of CPE Names.
- match a CPE Name against a set of CPE Names.
-
__getitem__
(i)¶ Returns the i’th CPE Name of set.
Parameters: i (int) – CPE Name index to find Returns: CPE Name found Return type: CPE Exception: IndexError - list index out of range
-
__init__
()¶ Creates an empty set of CPE Names.
Returns: None
-
__len__
()¶ Returns the count of CPE Names of set.
Returns: count of components of CPE Name Return type: int TEST: empty set
>>> from .cpeset1_1 import CPESet1_1 >>> s = CPESet1_1() >>> len(s) 0
-
__str__
()¶ Returns a human-readable representation of CPE set.
Returns: Representation of CPE set as string Return type: string
-
__weakref__
¶ list of weak references to the object (if defined)
-
append
(cpe)¶ Adds a CPE Name to the set if not already.
Parameters: cpe (CPE) – CPE Name to store in set Returns: None Exception: NotImplementedError - Method not implemented
-
name_match
(cpe)¶ Accepts a set of known instances of CPE Names and a candidate CPE Name, and returns ‘True’ if the candidate can be shown to be an instance based on the content of the known instances. Otherwise, it returns ‘False’.
Parameters: Returns: True if X matches K, otherwise False.
Return type: boolean