fix appharness regex for functions with return type (#2512)

This commit is contained in:
benedikt-bartscher 2024-02-02 18:35:44 +01:00 committed by GitHub
parent 6d33156d15
commit 9ce4e85050
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -189,7 +189,9 @@ class AppHarness:
if isinstance(app_source, str):
return app_source
source = inspect.getsource(app_source)
source = re.sub(r"^\s*def\s+\w+\s*\(.*?\):", "", source, flags=re.DOTALL)
source = re.sub(
r"^\s*def\s+\w+\s*\(.*?\)(\s+->\s+\w+)?:", "", source, flags=re.DOTALL
)
return textwrap.dedent(source)
def _initialize_app(self):