Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/tree-sitter-omega/blob/main/bindings/python/tree_sitter_omega/__init__.py # tree-sitter-omega aien-dev/tree-sitter-omega Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `tree-sitter-omega / bindings / python / tree_sitter_omega / __init__.py` 45 lines ยท 1257 bytes Raw Blame History 1 """Omega (.om, Omegese) grammar for tree-sitter""" 2 3 from ._binding import language 4 5 6 def _get_query(name, file): 7 files = globals().get("_files") 8 if files is None: 9 from importlib.resources import files 10 globals()["_files"] = files 11 try: 12 query = files(f"{__package__}") / file 13 globals()[name] = query.read_text() 14 except FileNotFoundError: 15 globals()[name] = None 16 return globals()[name] 17 18 19 def __getattr__(name): 20 if name == "HIGHLIGHTS_QUERY": 21 return _get_query("HIGHLIGHTS_QUERY", "queries/highlights.scm") 22 if name == "INJECTIONS_QUERY": 23 return _get_query("INJECTIONS_QUERY", "queries/injections.scm") 24 if name == "LOCALS_QUERY": 25 return _get_query("LOCALS_QUERY", "queries/locals.scm") 26 if name == "TAGS_QUERY": 27 return _get_query("TAGS_QUERY", "queries/tags.scm") 28 29 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") 30 31 32 __all__ = [ 33 "language", 34 "HIGHLIGHTS_QUERY", 35 "INJECTIONS_QUERY", 36 "LOCALS_QUERY", 37 "TAGS_QUERY", 38 ] 39 40 41 def __dir__(): 42 return sorted(__all__ + [ 43 "__all__", "__builtins__", "__cached__", "__doc__", "__file__", 44 "__loader__", "__name__", "__package__", "__path__", "__spec__", 45 ])