MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / _attr

Function _attr

scripts/developer-guide/run_languagetool.py:507–522  ·  view source on GitHub ↗

Read an attribute by the first matching name. language_tool_python renamed its Match accessors from camelCase (ruleId, errorLength) to snake_case (rule_id, error_length) between versions; CI pins 2.9.4 (camelCase) while local dev may have a newer release. Try both so the script work

(obj, *names, default=None)

Source from the content-addressed store, hash-verified

505
506
507def _attr(obj, *names, default=None):
508 """Read an attribute by the first matching name.
509
510 language_tool_python renamed its Match accessors from camelCase
511 (ruleId, errorLength) to snake_case (rule_id, error_length) between
512 versions; CI pins 2.9.4 (camelCase) while local dev may have a newer
513 release. Try both so the script works on either.
514 """
515 for name in names:
516 try:
517 val = getattr(obj, name)
518 except AttributeError:
519 continue
520 if val is not None:
521 return val
522 return default
523
524
525def matches_to_json(matches, text):

Callers 3

run_languagetoolFunction · 0.85
_flagged_textFunction · 0.85
matches_to_jsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected