CPESet2_3 class

class cpe.cpeset2_3.CPESet2_3[source]

Represents a set of CPEs.

This class allows:

  • create set of CPE elements.

  • match a CPE element against a set of CPE elements.

append(cpe)[source]

Adds a CPE element to the set if not already. Only WFN CPE Names are valid, so this function converts the input CPE object of version 2.3 to WFN style.

Parameters

cpe (CPE) – CPE Name to store in set

Returns

None

Exception

ValueError - invalid version of CPE Name

classmethod compare_wfns(source, target)[source]

Compares two WFNs and returns a generator of pairwise attribute-value comparison results. It provides full access to the individual comparison results to enable use-case specific implementations of novel name-comparison algorithms.

Compare each attribute of the Source WFN to the Target WFN:

Parameters
Returns

generator of pairwise attribute comparison results

Return type

generator

classmethod cpe_disjoint(source, target)[source]

Compares two WFNs and returns True if the set-theoretic relation between the names is DISJOINT.

Parameters
Returns

True if the set relation between source and target is DISJOINT, otherwise False.

Return type

boolean

classmethod cpe_equal(source, target)[source]

Compares two WFNs and returns True if the set-theoretic relation between the names is EQUAL.

Parameters
Returns

True if the set relation between source and target is EQUAL, otherwise False.

Return type

boolean

classmethod cpe_subset(source, target)[source]

Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUBSET.

Parameters
Returns

True if the set relation between source and target is SUBSET, otherwise False.

Return type

boolean

classmethod cpe_superset(source, target)[source]

Compares two WFNs and returns True if the set-theoretic relation between the names is (non-proper) SUPERSET.

Parameters
Returns

True if the set relation between source and target is SUPERSET, otherwise False.

Return type

boolean

name_match(wfn)[source]

Accepts a set of CPE Names K and a candidate CPE Name X. It returns ‘True’ if X matches any member of K, and ‘False’ otherwise.

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

  • cpe (CPE) – A candidate CPE Name X.

Returns

True if X matches K, otherwise False.

Return type

boolean