MCPcopy Create free account
hub / github.com/ElementsProject/lightning / RecklessResult

Class RecklessResult

tests/test_reckless.py:95–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95class RecklessResult:
96 def __init__(self, process, returncode, stdout, stderr):
97 self.process = process
98 self.returncode = returncode
99 self.stdout = stdout
100 self.stderr = stderr
101
102 def __repr__(self):
103 return f'self.returncode, self.stdout, self.stderr'
104
105 def search_stdout(self, regex):
106 """return the matching regex line from reckless output."""
107 ex = re.compile(regex)
108 matching = []
109 for line in self.stdout:
110 if ex.search(line):
111 matching.append(line)
112 return matching
113
114 def check_stderr(self):
115 def output_okay(out):
116 for warning in ['[notice]', 'WARNING:', 'npm WARN',
117 'npm notice', 'DEPRECATION:', 'Creating virtualenv',
118 'config file not found:', 'press [Y]']:
119 if out.startswith(warning):
120 return True
121 return False
122 for e in self.stderr:
123 if len(e) < 1:
124 continue
125 # Don't err on verbosity from pip, npm
126 if not output_okay(e):
127 raise Exception(f'reckless stderr contains `{e}`')
128
129
130def reckless(cmds: list, dir: PosixPath = None,

Callers 1

recklessFunction · 0.85

Calls

no outgoing calls

Tested by 1

recklessFunction · 0.68