CPEComponentSimple class

class cpe.comp.cpecomp_simple.CPEComponentSimple(comp_str, comp_att)

Represents a generic string component of CPE name, compatible with the components of all versions of CPE specification.

__init__(comp_str, comp_att)

Store the value of component.

Parameters:
  • comp_str (string) – value of component value
  • comp_att (string) – attribute associated with component value
Returns:

None

Exception:

ValueError - incorrect value of component

__str__()

Returns a human-readable representation of CPE component.

Returns:Representation of CPE component as string
Return type:string
as_fs()

Returns the value of component encoded as formatted string.

Inspect each character in value of component. Certain nonalpha characters pass thru without escaping into the result, but most retain escaping.

Returns:Formatted string associated with component
Return type:string
as_uri_2_3()

Returns the value of component encoded as URI string.

Scans an input string s and applies the following transformations:

  • Pass alphanumeric characters thru untouched
  • Percent-encode quoted non-alphanumerics as needed
  • Unquoted special characters are mapped to their special forms.
Returns:URI string associated with component
Return type:string
as_wfn()

Returns the value of component encoded as Well-Formed Name (WFN) string.

Returns:WFN string associated with component
Return type:string
get_value()

Returns the encoded value of component.

Returns:The encoded value of component
Return type:string
set_value(comp_str, comp_att)

Set the value of component. By default, the component has a simple value.

Parameters:
  • comp_str (string) – new value of component
  • comp_att (string) – attribute associated with value of component
Returns:

None

Exception:

ValueError - incorrect value of component