MCPcopy Create free account
hub / github.com/Cantera/cantera / FailRate

Class FailRate

test/python/test_reactor.py:1645–1656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1643
1644@ct.extension(name="fail-rate", data=FailRateData)
1645class FailRate(ct.ExtensibleRate):
1646 def __init__(self, *args, recoverable, **kwargs):
1647 super().__init__(*args, **kwargs)
1648 self.recoverable = recoverable
1649 self.count = 0
1650
1651 def eval(self, data):
1652 if data.fail:
1653 self.count += 1
1654 if self.count < 3 or not self.recoverable:
1655 raise ValueError("spam")
1656 return 0.0
1657
1658
1659class TestFlowReactor:

Calls

no outgoing calls