From 2a83f2b018faf9763694ecaed9612706d203252d Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 12 Feb 2024 15:16:34 +0100 Subject: [PATCH] always tsl --- papyri/ts.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/papyri/ts.py b/papyri/ts.py index de3fdf73..4b8296b9 100644 --- a/papyri/ts.py +++ b/papyri/ts.py @@ -1,6 +1,5 @@ import logging import itertools -from pathlib import Path from textwrap import dedent, indent from typing import List, Any, Dict @@ -42,28 +41,11 @@ # VisitSubstitutionDefinitionNotImplementedError, ) -allowed_adorn = "=-`:.'\"~^_*+#<>" -try: - from tree_sitter_languages import get_parser - - # language = get_language('python') - parser = get_parser("rst") -except ModuleNotFoundError: - # replace by tree-sitter-languages once it works - # See https://github.com/grantjenks/py-tree-sitter-languages/issues/15 - try: - from tree_sitter import Language, Parser - - pth = str(Path(__file__).parent / "rst.so") - RST = Language(pth, "rst") - except OSError as e: - raise OSError( - "tree-sitter-rst not found, rst parsing will not work. Please run `papyri build-parser`" - ) from e - - parser = Parser() - parser.set_language(RST) +from tree_sitter_languages import get_parser + +parser = get_parser("rst") +allowed_adorn = "=-`:.'\"~^_*+#<>" log = logging.getLogger("papyri")