class metricclass_flags¶
Flag class: characterizes a metric class ( procedure_metricclass , sfile_metricclass , compunit_metricclass , project_metricclass ).
- Use with metric class manager
create()methods or metric decorators to create metric classes: - Return type for metric class
flags()methods:
metricclass_flags Members¶
| Constructors | none |
| Static Method | from_integer() |
| Methods | __and__(), __cmp__(), __eq__(), __ge__(), __gt__(), __hash__(), __invert__(), __le__(), __lt__(), __ne__(), __or__(), __repr__(), __str__(), as_integer(), name() |
| Attributes | AUTO, NONE, POST_ANALYSIS |
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_flagsRaises: result.ERROR_INVALID_ARGUMENTif_inneris not a valid integer representation for ametricclass_flagsinstance.Invariant: For
metricclass_flagsx, 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_flagsReturns: A metricclass_flagsobject containing all flags that are in bothselfandb.>>> 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) – Themetricclass_flagsobject 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) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Trueifselfandbcompare equal,Falseotherwise.>>> metricclass_flags.AUTO == metricclass_flags.POST_ANALYSIS False
-
__ge__(b)¶ Greater-than-or-equal operator for
metricclass_flags.Parameters: b ( metricclass_flags) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Trueifself>=b,Falseotherwise.>>> metricclass_flags.AUTO >= metricclass_flags.POST_ANALYSIS False
-
__gt__(b)¶ Greater-than operator for
metricclass_flags.Parameters: b ( metricclass_flags) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Trueifself>b,Falseotherwise.>>> 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_flagsReturns: A metricclass_flagsobject containing the flags that are NOT contained inself.>>> ~metricclass_flags.POST_ANALYSIS <cs.metricclass_flags auto>
-
__le__(b)¶ Less-than-or-equal operator for
metricclass_flags.Parameters: b ( metricclass_flags) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Trueifself<=b,Falseotherwise.>>> metricclass_flags.AUTO <= metricclass_flags.AUTO True
-
__lt__(b)¶ Less-than operator for
metricclass_flags.Parameters: b ( metricclass_flags) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Trueifself<b,Falseotherwise.>>> metricclass_flags.POST_ANALYSIS < metricclass_flags.NONE False
-
__ne__(b)¶ Inequality operator for
metricclass_flags.Parameters: b ( metricclass_flags) – Themetricclass_flagsobject to compare against.Return type: bool Returns: Falseifselfandbcompare equal,Trueotherwise.>>> metricclass_flags.NONE != metricclass_flags.POST_ANALYSIS True
-
__or__(b)¶ OR operator for
metricclass_flags.Parameters: b ( metricclass_flags) – OR operand.Return type: metricclass_flagsReturns: A metricclass_flagsobject containing all flags that are in at least one ofself,b.>>> metricclass_flags.AUTO | metricclass_flags.NONE <cs.metricclass_flags auto>
-
__repr__()¶ Get a representation of a
metricclass_flagsobject 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_flagsobject.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_flagsx, metricclass_flags.from_integer(x.as_integer()) == x>>> metricclass_flags.NONE.as_integer() 0
-
name()¶ Get the name of a
metricclass_flagsobject.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
*_metricclassreport()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_ANALYSISis 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. (seeproject_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_ANALYSISin combination withmetricclass_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 classreport()method from a suitable visitor.The
result.ERROR_INVALID_PHASE_FOR_OPERATIONdocumentation lists the visitor types associated with the different phases.>>> metricclass_flags.POST_ANALYSIS <cs.metricclass_flags post-analysis>
-
static