class project_metricclass_iterator¶
Iterator over the project-granularity metric classes ( project_metricclass ) managed by a project_metricclass_manager .
Initialize with project_metricclass_manager.metricclasses().
Use a project_metricclass_iterator to iterate over the project-granularity metric classes associated with an analysis. For example:
for e in project_metricclass_manager.metricclasses():
print('project_metricclass: ', e)
project_metricclass_iterator Members¶
| Constructors | none |
| Methods | __eq__(), __iter__(), __ne__(), __next__(), __repr__(), __str__(), at_end() |
project_metricclass_iterator Details¶
-
class
cs.project_metricclass_iterator¶ Iterator over the project-granularity metric classes (
project_metricclass) managed by aproject_metricclass_manager.-
__eq__(other)¶ Iterator equality.
Parameters: other ( project_metricclass_iterator) –Return type: bool Returns: Trueif and only ifselfandotherare at the same position. Behavior is undefined ifselfandotherare not iterating over the same collection.>>> pmc_iterA = project_metricclass_manager.metricclasses() >>> pmc_iterB = project_metricclass_manager.metricclasses() >>> pmc_iterA == pmc_iterB True >>> for mc in pmc_iterA: ... if 'com' in mc.tag().lower(): ... break ... >>> pmc_iterA == pmc_iterB False
-
__iter__()¶ Get the iterator object.
Return type: project_metricclass_iteratorReturns: self.>>> for mc in project_metricclass_manager.metricclasses(): # iteration managed by project_metricclass_iterator.__iter__() ... # and project_metriclass_iterator.__next__() ... if 'com' in mc.tag().lower(): ... print(mc.tag()) ... LCom LComOnly
-
__ne__(other)¶ Iterator inequality.
Parameters: other ( project_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.>>> pmc_iterA = project_metricclass_manager.metricclasses() >>> pmc_iterB = project_metricclass_manager.metricclasses() >>> pmc_iterA != pmc_iterB False >>> for mc in pmc_iterA: ... if 'com' in mc.tag().lower(): ... break ... >>> pmc_iterA != pmc_iterB True
-
__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 project_metricclass_manager.metricclasses(): # iteration managed by project_metricclass_iterator.__iter__() ... # and project_metriclass_iterator.__next__() ... if 'com' in mc.tag().lower(): ... print(mc.tag()) ... LCom LComOnly
-
__repr__()¶ Get a representation of the iterator that includes information useful for debugging.
Return type: str Returns: The string representation. >>> v0 = project_metricclass_manager.metricclasses() >>> repr(v0) '<cs.project_metricclass_iterator begin>'
-
__str__()¶ Get a simple string representation of the iterator.
Return type: str Returns: The string representation. >>> v0 = project_metricclass_manager.metricclasses() >>> str(v0) '<cs.project_metricclass_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 = project_metricclass_manager.metricclasses() >>> v0.at_end() False
-