class sfile_metricclass_iterator

Iterator over the sfile-granularity metric classes ( sfile_metricclass ) managed by a sfile_metricclass_manager .

Initialize with sfile_metricclass_manager.metricclasses().

Use a sfile_metricclass_iterator to iterate over the sfile-granularity metric classes associated with an analysis. For example:

for e in sfile_metricclass_manager.metricclasses():
    print('sfile_metricclass: ', e)

sfile_metricclass_iterator Details

class cs.sfile_metricclass_iterator

Iterator over the sfile-granularity metric classes ( sfile_metricclass ) managed by a sfile_metricclass_manager .

__eq__(other)

Iterator equality.

Parameters:other (sfile_metricclass_iterator) –
Return type:bool
Returns:True if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> fmc_iterA = sfile_metricclass_manager.metricclasses()
>>> fmc_iterB = sfile_metricclass_manager.metricclasses()
>>> fmc_iterA == fmc_iterB
True
>>> next(fmc_iterA)
<cs.metricclass L>
>>> fmc_iterA == fmc_iterB
False
__iter__()

Get the iterator object.

Return type:sfile_metricclass_iterator
Returns:self.
>>> for mc in sfile_metricclass_manager.metricclasses():  # iteration managed by sfile_metricclass_iterator.__iter__()
...                                                       # and sfile_metricclass_iterator.__next__()
...     if 'taint' in mc.tag().lower():
...         print(mc.tag())
...
TaintSource
TaintSink
TaintProp
__ne__(other)

Iterator inequality.

Parameters:other (sfile_metricclass_iterator) – The iterator to compare against.
Return type:bool
Returns:False if and only if self and other are at the same position. Behavior is undefined if self and other are not iterating over the same collection.
>>> fmc_iterA = sfile_metricclass_manager.metricclasses()
>>> fmc_iterB = sfile_metricclass_manager.metricclasses()
>>> fmc_iterA != fmc_iterB
False
>>> next(fmc_iterA)
<cs.metricclass L>
>>> fmc_iterA != fmc_iterB
True
__next__()

Iterator dereference operator.

Return type:

sfile_metricclass

Returns:

The element at the current iterator position.

Raises:
  • result.REPLACED if 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 sfile_metricclass_manager.metricclasses():  # iteration managed by sfile_metricclass_iterator.__iter__()
...                                                       # and sfile_metricclass_iterator.__next__()
...     if 'taint' in mc.tag().lower():
...         print(mc.tag())
...
TaintSource
TaintSink
TaintProp
__repr__()

Get a representation of the iterator that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> fmc_iterA = sfile_metricclass_manager.metricclasses()
>>> repr(fmc_iterA)
'<cs.sfile_metricclass_iterator begin>'
__str__()

Get a simple string representation of the iterator.

Return type:str
Returns:The string representation.
>>> fmc_iterA = sfile_metricclass_manager.metricclasses()
>>> str(fmc_iterA)
'<cs.sfile_metricclass_iterator begin>'
at_end()

Check: is the iterator at the end of the structure?

Return type:bool
Returns:True if the iterator is at the end of the structure (there are no more elements to iterate over), False otherwise.
>>> fmc_iterA = sfile_metricclass_manager.metricclasses()
>>> fmc_iterA.at_end()
False