From e3744516b9033fc1092324339914a6d83c3193a6 Mon Sep 17 00:00:00 2001 From: Marko Ristin Date: Thu, 20 Jun 2024 16:05:59 +0200 Subject: [PATCH] Rename `parse.retree.BaseVisitor` to pass-through (#500) We rename `parse.retree.BaseVisitor` to `PassThroughVisitor` in alignment with the naming used for the generated SDKs. The name "base visitor" is also a bit of a misnomer as it insinuates some kind of an abstract class, while the pass-through visitor is explicitly a concrete class. --- aas_core_codegen/parse/retree/__init__.py | 2 +- aas_core_codegen/parse/retree/_fix.py | 2 +- aas_core_codegen/parse/retree/_visitor.py | 2 +- aas_core_codegen/xsd/main.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aas_core_codegen/parse/retree/__init__.py b/aas_core_codegen/parse/retree/__init__.py index 078439b29..95ffb46d7 100644 --- a/aas_core_codegen/parse/retree/__init__.py +++ b/aas_core_codegen/parse/retree/__init__.py @@ -35,7 +35,7 @@ Visitor = _types.Visitor Transformer = _types.Transformer -BaseVisitor = _visitor.BaseVisitor +PassThroughVisitor = _visitor.PassThroughVisitor dump = _stringify.dump diff --git a/aas_core_codegen/parse/retree/_fix.py b/aas_core_codegen/parse/retree/_fix.py index 545dda9f9..eed361d21 100644 --- a/aas_core_codegen/parse/retree/_fix.py +++ b/aas_core_codegen/parse/retree/_fix.py @@ -9,7 +9,7 @@ ) -class _FixForUTF16Regex(retree_visitor.BaseVisitor): +class _FixForUTF16Regex(retree_visitor.PassThroughVisitor): """ Modify the pattern in-place so that UTF-32 can be dealt by UTF-16-only regex engine. diff --git a/aas_core_codegen/parse/retree/_visitor.py b/aas_core_codegen/parse/retree/_visitor.py index 3157145b5..6f6560a43 100644 --- a/aas_core_codegen/parse/retree/_visitor.py +++ b/aas_core_codegen/parse/retree/_visitor.py @@ -15,7 +15,7 @@ from aas_core_codegen.parse.tree import FormattedValue -class BaseVisitor(Visitor): +class PassThroughVisitor(Visitor): """Visit all the nodes recursively without any action.""" def visit_regex(self, node: Regex) -> None: diff --git a/aas_core_codegen/xsd/main.py b/aas_core_codegen/xsd/main.py index 7f8da7e7b..67a49f09c 100644 --- a/aas_core_codegen/xsd/main.py +++ b/aas_core_codegen/xsd/main.py @@ -124,7 +124,7 @@ def _undo_escaping_backslash_x_u_and_U_in_pattern(pattern: str) -> str: return "".join(parts) -class _AnchorRemover(parse_retree.BaseVisitor): +class _AnchorRemover(parse_retree.PassThroughVisitor): """ Remove anchors from a regex in-place.