Net change in brace depth this logical line contributes.
(line: LogicalLine)
| 447 | |
| 448 | |
| 449 | def _brace_delta(line: LogicalLine) -> int: |
| 450 | """Net change in brace depth this logical line contributes.""" |
| 451 | if line.kind in ("comment", "blank"): |
| 452 | return 0 |
| 453 | opens = 0 |
| 454 | closes = 0 |
| 455 | for raw in line.raws: |
| 456 | # Fast-and-loose — string literals inside prop values could fool us, |
| 457 | # but property values ending in `{` are already classified as "open" |
| 458 | # which is fine for our needs. |
| 459 | opens += raw.count("{") |
| 460 | closes += raw.count("}") |
| 461 | return opens - closes |
| 462 | |
| 463 | |
| 464 | # --------------------------------------------------------------------------- |
no test coverage detected