Conditions | 4 |
Total Lines | 16 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from pathlib import Path |
||
7 | def call(path: Path, signature: str, *, show_error: bool = True) -> bool: |
||
8 | functions = path.read_text("utf-8") |
||
9 | |||
10 | log.debug(f"Calling AppleScript: {signature}") |
||
11 | result = applescript.run(functions + "\n\n" + signature) |
||
12 | |||
13 | log.debug(f"AppleScript code: {result.code}") |
||
14 | if result.out: |
||
15 | log.debug(f"AppleScript output: {result.out}") |
||
16 | if result.err: |
||
17 | log.debug(f"AppleScript error: {result.err}") |
||
18 | if show_error: |
||
19 | message = result.err.split("error:")[-1].strip() |
||
20 | log.error(message) |
||
21 | |||
22 | return result.code == 0 and "missing value" not in result.out |
||
23 |