class compunit_metricclass_iterator¶
Iterator over the compunit-granularity metric classes ( compunit_metricclass ) managed by a compunit_metricclass_manager .
Initialize with compunit_metricclass_manager.metricclasses().
Use a compunit_metricclass_iterator to iterate over the compunit-granularity metric classes associated with an analysis. For example:
for e in compunit_metricclass_manager.metricclasses():
print('compunit_metricclass: ', e)
compunit_metricclass_iterator Members¶
| Constructors | none |
| Methods | __eq__(), __iter__(), __ne__(), __next__(), __repr__(), __str__(), at_end() |
compunit_metricclass_iterator Details¶
-
class
cs.compunit_metricclass_iterator¶ Iterator over the compunit-granularity metric classes (
compunit_metricclass) managed by acompunit_metricclass_manager.-
__eq__(other)¶ Iterator equality.
Parameters: other ( compunit_metricclass_iterator) –Return type: bool Returns: Trueif and only ifselfandotherare at the same position. Behavior is undefined ifselfandotherare not iterating over the same collection.>>> cmc_iterA = compunit_metricclass_manager.metricclasses() >>> cmc_iterB = compunit_metricclass_manager.metricclasses() >>> cmc_iterA == cmc_iterB True >>> for mc in cmc_iterA: ... print(mc.tag()) # these classes will only be present if you have created them with compunit_metricclass_manager.create() ... NBW NBWflag NBWdesc num_bws >>> cmc_iterA == cmc_iterB # if there are no metric classes, result will be the same as for previous comparison False >>> # Note: if there are no compunit-granularity metrics, test will have same result as before the iteration
-
__iter__()¶ Get the iterator object.
Return type: compunit_metricclass_iteratorReturns: self.>>> for mc in compunit_metricclass_manager.metricclasses(): ... print(mc.tag()) # iteration managed by compunit_metricclass_iterator.__iter__() ... # and compunit_metricclass_iterator.__next__() ... NBW NBWflag NBWdesc num_bws
-
__ne__(other)¶ Iterator inequality.
Parameters: other ( compunit_metricclass_iterator) – The iterator to compare against.Return type: bool Returns: Falseif and only ifselfandotherare at the same position. Behavior is undefined ifselfandotherare not iterating over the same collection.>>> cmc_iterA = compunit_metricclass_manager.metricclasses() >>> cmc_iterB = compunit_metricclass_manager.metricclasses() >>> cmc_iterA != cmc_iterB False >>> for mc in cmc_iterA: ... print(mc.tag()) # these classes will only be present if you have created them with compunit_metricclass_manager.create() example ... NBW NBWflag NBWdesc num_bws >>> cmc_iterA != cmc_iterB # if there are no metric classes, result will be the same as for previous comparison True >>> # Note: if there are no compunit-granularity metrics, test will have same result as before the iteration
-
__next__()¶ Iterator dereference operator.
Return type: Returns: The element at the current iterator position.
Raises: result.REPLACEDif the set of metric classes changed during iteration.StopIteration
- Side effects: Modifies
self.
The typical use is implicit:
>>> for item in myiter: ... (do something to item)
>>> for mc in compunit_metricclass_manager.metricclasses(): ... print(mc.tag()) # iteration managed by compunit_metricclass_iterator.__iter__() ... # and compunit_metricclass_iterator.__next__() ... # iterator contents will depend on what classes you have created, if any ... NBW NBWflag NBWdesc num_bws
-
__repr__()¶ Get a representation of the iterator that includes information useful for debugging.
Return type: str Returns: The string representation. >>> v0 = compunit_metricclass_manager.metricclasses() >>> repr(v0) '<cs.compunitmetricclass_iterator begin>'
-
__str__()¶ Get a simple string representation of the iterator.
Return type: str Returns: The string representation. >>> v0 = compunit_metricclass_manager.metricclasses() >>> str(v0) '<cs.compunitmetricclass_iterator begin>'
-
at_end()¶ Check: is the iterator at the end of the structure?
Return type: bool Returns: Trueif the iterator is at the end of the structure (there are no more elements to iterate over),Falseotherwise.>>> v0 = compunit_metricclass_manager.metricclasses() >>> v0.at_end() False
-