class metricclass_flags

Flag class: characterizes a metric class ( procedure_metricclass , sfile_metricclass , compunit_metricclass , project_metricclass ).

metricclass_flags Details

class cs.metricclass_flags

Flag class: characterizes a metric class ( procedure_metricclass , sfile_metricclass , compunit_metricclass , project_metricclass ).

static from_integer(_inner)

Construct an instance from an integer representation.

Parameters:_inner (int) – The integer representation, as returned by metricclass_flags.as_integer().
Return type:metricclass_flags
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a metricclass_flags instance.

Invariant: For metricclass_flags x, metricclass_flags.from_integer(x.as_integer()) == x

>>> metricclass_flags.from_integer(1)
<cs.metricclass_flags auto>
__and__(b)

AND operator for metricclass_flags .

Parameters:b (metricclass_flags) – AND operand.
Return type:metricclass_flags
Returns:A metricclass_flags object containing all flags that are in both self and b.
>>> metricclass_flags.AUTO & metricclass_flags.NONE
<cs.metricclass_flags none>
__cmp__(other)

Comparison function for metricclass_flags , with respect to a stable overall ordering.

Parameters:other (metricclass_flags) – The metricclass_flags object to compare against.
Return type:int
Returns:An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if self < other
  • N>0 if self > other
>>> metricclass_flags.POST_ANALYSIS.__cmp__(metricclass_flags.NONE)
1
__eq__(b)

Equality operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:True if self and b compare equal, False otherwise.
>>> metricclass_flags.AUTO == metricclass_flags.POST_ANALYSIS
False
__ge__(b)

Greater-than-or-equal operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:True if self >= b , False otherwise.
>>> metricclass_flags.AUTO >= metricclass_flags.POST_ANALYSIS
False
__gt__(b)

Greater-than operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:True if self > b , False otherwise.
>>> metricclass_flags.NONE > metricclass_flags.POST_ANALYSIS
False
__hash__()

Hash function for metricclass_flags .

Return type:int
>>> hash(metricclass_flags.NONE)
0
__invert__()

Complementation operator.

Return type:metricclass_flags
Returns:A metricclass_flags object containing the flags that are NOT contained in self.
>>> ~metricclass_flags.POST_ANALYSIS
<cs.metricclass_flags auto>
__le__(b)

Less-than-or-equal operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:True if self <= b , False otherwise.
>>> metricclass_flags.AUTO <= metricclass_flags.AUTO
True
__lt__(b)

Less-than operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:True if self < b , False otherwise.
>>> metricclass_flags.POST_ANALYSIS < metricclass_flags.NONE
False
__ne__(b)

Inequality operator for metricclass_flags .

Parameters:b (metricclass_flags) – The metricclass_flags object to compare against.
Return type:bool
Returns:False if self and b compare equal, True otherwise.
>>> metricclass_flags.NONE != metricclass_flags.POST_ANALYSIS
True
__or__(b)

OR operator for metricclass_flags .

Parameters:b (metricclass_flags) – OR operand.
Return type:metricclass_flags
Returns:A metricclass_flags object containing all flags that are in at least one of self, b.
>>> metricclass_flags.AUTO | metricclass_flags.NONE
<cs.metricclass_flags auto>
__repr__()

Get a representation of a metricclass_flags object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> repr(metricclass_flags.AUTO)
'<cs.metricclass_flags auto>'
__str__()

Get a simple string representation of a metricclass_flags object.

Return type:str
Returns:The string representation.
>>> str(metricclass_flags.POST_ANALYSIS)
'post-analysis'
as_integer()

Get an integer representation of self.

Return type:int
Returns:An integer suitable for use with metricclass_flags.from_integer().

Invariant: For metricclass_flags x, metricclass_flags.from_integer(x.as_integer()) == x

>>> metricclass_flags.NONE.as_integer()
0
name()

Get the name of a metricclass_flags object.

Return type:str
>>> metricclass_flags.NONE.name()
'none'
AUTO

Singleton set containing the “auto” flag: automatically compute values for this metric.

If this flag is not set, values for the metric must be explicitly reported using the appropriate *_metricclass report() method.

>>> metricclass_flags.AUTO
<cs.metricclass_flags auto>
NONE

Empty set: contains no flags.

>>> metricclass_flags.NONE
<cs.metricclass_flags none>
POST_ANALYSIS

Singleton set containing the “post-analysis” flag: this metric relies on data from the analysis and should not be computed until after the analysis has completed; its value will therefore not be available until after the analysis has completed.

Analysis-phase metrics (those where metricclass_flags.POST_ANALYSIS is not set) can be reported at any point during the serial depth-first traversal, during the parallel depth-first traversal, or by a bottom-up program visitor. (see project_bottom_up_visitor()).

Post-analysis metrics can be reported at any point between the start of the bottom-up traversal and the transition to daemon mode.

If you specify metricclass_flags.POST_ANALYSIS in combination with metricclass_flags.AUTO, CodeSonar will automatically invoke the metric computation function at the appropriate stage of the analysis. Otherwise, you will need to explicitly report the metric value by invoking the appropriate metric class report() method from a suitable visitor.

The result.ERROR_INVALID_PHASE_FOR_OPERATION documentation lists the visitor types associated with the different phases.

>>> metricclass_flags.POST_ANALYSIS
<cs.metricclass_flags post-analysis>