(flagged_text, accept_re, surrounding_after="")
| 429 | |
| 430 | |
| 431 | def is_accepted(flagged_text, accept_re, surrounding_after=""): |
| 432 | if not flagged_text: |
| 433 | return False |
| 434 | if accept_re and accept_re.match(flagged_text): |
| 435 | return True |
| 436 | # Treat the flagged token as part of a dotted or underscored |
| 437 | # identifier ("android.permission", "win.shortcutName", |
| 438 | # "android.cusom_layout1"). Such matches are almost always build-hint |
| 439 | # or config keys, and the sources legitimately use lowercase |
| 440 | # identifiers as table cells / list labels. |
| 441 | if surrounding_after and _CONTEXT_CODE_RE.match(surrounding_after): |
| 442 | return True |
| 443 | return False |
| 444 | |
| 445 | |
| 446 | def run_languagetool(text, language="en-US", accept_re=None): |
no test coverage detected