Files
ecw-charge-validation/src/ecw_bot/core/text.py
T
ManikandanandClaude Opus 5.5 ba15a574ab Initial import: eCW Charge Validation bot and results Portal
Snapshot of the working project as of 2026-10-23 (local 2d4d4fc), one
commit with no earlier history: the tracked files were de-identified
first (synthetic claim ids and patient data only; see Context.md
section 7). Credentials, run logs, screenshots, claim reports and client
workbooks are gitignored and not included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:38:17 +05:30

24 lines
926 B
Python

"""
core/text.py — small text helpers shared by core/, conditions/ and flows/.
Lives in core/ because core/ must not import from conditions/, pages/ or
flows/, and all three need it (review of unit D, 2026-10-05: the condition
runner, the Charge Summary and the flow each had their own copy).
"""
def first_line(value) -> str:
"""
The first non-blank line of `value`'s text, stripped.
For an exception: Playwright's messages carry a whole call log after the
first line, which is all a log line or a summary cell wants. An exception
with an empty message gives its class name instead — a bare
`str(exc).splitlines()[0]` raises IndexError on one. Any other empty
value (an error string that came back blank) gives "".
"""
lines = str(value).strip().splitlines()
if lines:
return lines[0].strip()
return type(value).__name__ if isinstance(value, BaseException) else ""