Open rjplevin opened 2 weeks ago
A few updates to the PR:
Stream.contains()
to use re.fullmatch()
instead of re.match()
to avoid erroneous partial matches. Now, unless the string used in _required_inputs
or _required_outputs
in a Process
includes regex characters, it devolves to a simple string match.dict
option for the elements of the _required_*
lists. Keys are pattern
, min
, and max
. Default for both min
and max
is 1. There's a new method, Process.valdict()
to create these conveniently.I modified test_stream.py
to exercise the dict
option:
class Proc3(Process):
def __init__(self, name, **kwargs):
super().__init__(name, **kwargs)
self._required_inputs = [
self.valdict(r'.*gas.*', min=2, max=2),
]
self._required_outputs = [
"CO2",
]
All tests passed.
Added
regex=False
argument to the stack of methods in Process and Stream used to find streams. Settingregex=True
allows use of regular expressions. Modified tests to exercise this option.