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.

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

Creates an empty set of CPE Names.


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)

Returns a human-readable representation of CPE set.

Returns:Representation of CPE set as string
Return type:string

list of weak references to the object (if defined)


Adds a CPE Name to the set if not already.

Parameters:cpe (CPE) – CPE Name to store in set
Exception:NotImplementedError - Method not implemented

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’.

  • self (CPESet) – A set of m known CPE Names K = {K1, K2, …, Km}.
  • cpe (CPE) – A candidate CPE Name X.

True if X matches K, otherwise False.

Return type: