From 11f7cb731c4d78cec8d87672544e6d00109a8ab8 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Thu, 21 Mar 2024 05:43:05 -0500 Subject: [PATCH] Replace ufmt with simple usort and black chaining. --- .github/workflows/auto-sync.yml | 3 ++- suite/auto-sync/format_py.sh | 4 ++++ suite/auto-sync/pyproject.toml | 1 - .../src/autosync/cpptranslator/Patches/AddCSDetail.py | 4 ++-- .../src/autosync/cpptranslator/Patches/AddOperand.py | 3 ++- suite/auto-sync/src/autosync/cpptranslator/Patches/Assert.py | 3 ++- .../src/autosync/cpptranslator/Patches/BitCastStdArray.py | 3 ++- .../src/autosync/cpptranslator/Patches/CheckDecoderStatus.py | 3 ++- .../src/autosync/cpptranslator/Patches/ClassConstructorDef.py | 3 ++- .../src/autosync/cpptranslator/Patches/ClassesDef.py | 4 ++-- .../autosync/cpptranslator/Patches/ConstMCInstParameter.py | 3 ++- .../src/autosync/cpptranslator/Patches/ConstMCOperand.py | 3 ++- .../src/autosync/cpptranslator/Patches/CppInitCast.py | 3 ++- .../src/autosync/cpptranslator/Patches/CreateOperand0.py | 4 ++-- .../src/autosync/cpptranslator/Patches/CreateOperand1.py | 4 ++-- .../cpptranslator/Patches/DeclarationInConditionClause.py | 3 ++- .../src/autosync/cpptranslator/Patches/DecodeInstruction.py | 3 ++- .../src/autosync/cpptranslator/Patches/DecoderCast.py | 3 ++- .../src/autosync/cpptranslator/Patches/DecoderParameter.py | 3 ++- .../src/autosync/cpptranslator/Patches/FallThrough.py | 3 ++- .../src/autosync/cpptranslator/Patches/FeatureBits.py | 3 ++- .../src/autosync/cpptranslator/Patches/FeatureBitsDecl.py | 3 ++- .../src/autosync/cpptranslator/Patches/FieldFromInstr.py | 4 ++-- .../src/autosync/cpptranslator/Patches/GetNumOperands.py | 3 ++- .../auto-sync/src/autosync/cpptranslator/Patches/GetOpcode.py | 3 ++- .../src/autosync/cpptranslator/Patches/GetOperand.py | 3 ++- .../src/autosync/cpptranslator/Patches/GetOperandRegImm.py | 3 ++- .../src/autosync/cpptranslator/Patches/GetRegClass.py | 3 ++- .../src/autosync/cpptranslator/Patches/GetRegFromClass.py | 3 ++- .../auto-sync/src/autosync/cpptranslator/Patches/GetSubReg.py | 3 ++- .../src/autosync/cpptranslator/Patches/HelperMethods.py | 4 ++-- .../auto-sync/src/autosync/cpptranslator/Patches/Includes.py | 4 ++-- .../autosync/cpptranslator/Patches/InlineToStaticInline.py | 3 ++- .../src/autosync/cpptranslator/Patches/IsOptionalDef.py | 3 ++- .../src/autosync/cpptranslator/Patches/IsPredicate.py | 3 ++- .../auto-sync/src/autosync/cpptranslator/Patches/IsRegImm.py | 3 ++- .../src/autosync/cpptranslator/Patches/LLVMFallThrough.py | 3 ++- .../src/autosync/cpptranslator/Patches/LLVMunreachable.py | 3 ++- .../src/autosync/cpptranslator/Patches/MethodToFunctions.py | 3 ++- .../src/autosync/cpptranslator/Patches/MethodTypeQualifier.py | 3 ++- .../src/autosync/cpptranslator/Patches/NamespaceAnon.py | 3 ++- .../src/autosync/cpptranslator/Patches/NamespaceArch.py | 3 ++- .../src/autosync/cpptranslator/Patches/NamespaceLLVM.py | 3 ++- .../src/autosync/cpptranslator/Patches/OutStreamParam.py | 3 ++- .../autosync/cpptranslator/Patches/PredicateBlockFunctions.py | 3 ++- .../src/autosync/cpptranslator/Patches/PrintAnnotation.py | 3 ++- .../src/autosync/cpptranslator/Patches/PrintRegImmShift.py | 3 ++- .../src/autosync/cpptranslator/Patches/QualifiedIdentifier.py | 3 ++- .../src/autosync/cpptranslator/Patches/ReferencesDecl.py | 4 ++-- .../src/autosync/cpptranslator/Patches/RegClassContains.py | 3 ++- .../src/autosync/cpptranslator/Patches/STIArgument.py | 3 ++- .../src/autosync/cpptranslator/Patches/STIFeatureBits.py | 3 ++- .../src/autosync/cpptranslator/Patches/STParameter.py | 3 ++- .../auto-sync/src/autosync/cpptranslator/Patches/SetOpcode.py | 3 ++- .../src/autosync/cpptranslator/Patches/SignExtend.py | 3 ++- .../src/autosync/cpptranslator/Patches/SizeAssignments.py | 4 ++-- .../src/autosync/cpptranslator/Patches/StreamOperation.py | 3 ++- .../src/autosync/cpptranslator/Patches/TemplateDeclaration.py | 3 ++- .../src/autosync/cpptranslator/Patches/TemplateDefinition.py | 4 ++-- .../src/autosync/cpptranslator/Patches/TemplateParamDecl.py | 4 ++-- .../src/autosync/cpptranslator/Patches/TemplateRefs.py | 3 ++- .../auto-sync/src/autosync/cpptranslator/Patches/UseMarkup.py | 3 ++- .../src/autosync/cpptranslator/Patches/UsingDeclaration.py | 3 ++- .../src/autosync/cpptranslator/Tests/test_patches.py | 4 ++-- 64 files changed, 128 insertions(+), 75 deletions(-) create mode 100755 suite/auto-sync/format_py.sh diff --git a/.github/workflows/auto-sync.yml b/.github/workflows/auto-sync.yml index 69b368f7eea..26df7d264b0 100644 --- a/.github/workflows/auto-sync.yml +++ b/.github/workflows/auto-sync.yml @@ -23,7 +23,8 @@ jobs: pip install . - name: Check formatting run: | - ufmt check src/autosync + python3.11 -m usort check src/autosync + python3.11 -m black --check src/autosync - name: CppTranslator - Patch tests run: | python -m unittest discover src/autosync/cpptranslator/Tests/ \ No newline at end of file diff --git a/suite/auto-sync/format_py.sh b/suite/auto-sync/format_py.sh new file mode 100755 index 00000000000..5f0d5d9dc57 --- /dev/null +++ b/suite/auto-sync/format_py.sh @@ -0,0 +1,4 @@ +#!/usr/bin/bash + +python3.11 -m usort format src/autosync +python3.11 -m black src/autosync diff --git a/suite/auto-sync/pyproject.toml b/suite/auto-sync/pyproject.toml index 6cc1ced38d2..ec6d5b557ee 100644 --- a/suite/auto-sync/pyproject.toml +++ b/suite/auto-sync/pyproject.toml @@ -5,7 +5,6 @@ dependencies = [ "termcolor >= 2.3.0", "tree_sitter < 0.22.0", "black >= 24.3.0", - "ufmt >= 2.5.1", "usort >= 1.0.8", "setuptools >= 69.2.0", ] diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/AddCSDetail.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/AddCSDetail.py index 685674852db..d80cbf30d2b 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/AddCSDetail.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/AddCSDetail.py @@ -1,6 +1,8 @@ import logging as log import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import ( get_MCInst_var_name, get_text, @@ -8,8 +10,6 @@ ) from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class AddCSDetail(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/AddOperand.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/AddOperand.py index 88ea1a1c138..a9491399852 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/AddOperand.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/AddOperand.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class AddOperand(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/Assert.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/Assert.py index 555451026d1..ada0a786a78 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/Assert.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/Assert.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class Assert(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/BitCastStdArray.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/BitCastStdArray.py index 18ea3913990..0fd4f8272e6 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/BitCastStdArray.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/BitCastStdArray.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class BitCastStdArray(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/CheckDecoderStatus.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/CheckDecoderStatus.py index 410f220c3b4..395ee55cf6b 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/CheckDecoderStatus.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/CheckDecoderStatus.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class CheckDecoderStatus(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassConstructorDef.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassConstructorDef.py index 9e3b2164788..4b06a0bca69 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassConstructorDef.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassConstructorDef.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class ClassConstructorDef(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassesDef.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassesDef.py index d58e5f99733..7f806fa2be5 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassesDef.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/ClassesDef.py @@ -1,11 +1,11 @@ import logging as log import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class ClassesDef(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCInstParameter.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCInstParameter.py index 738c0286472..49e0db275d9 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCInstParameter.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCInstParameter.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class ConstMCInstParameter(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCOperand.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCOperand.py index 2d1317fee67..44ac0bf9ebf 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCOperand.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/ConstMCOperand.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class ConstMCOperand(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/CppInitCast.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/CppInitCast.py index db8ff025dd7..ca9de65810c 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/CppInitCast.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/CppInitCast.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class CppInitCast(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand0.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand0.py index c6d8be1d079..0503f249da3 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand0.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand0.py @@ -1,10 +1,10 @@ import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class CreateOperand0(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand1.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand1.py index 59676456e20..53e35624010 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand1.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/CreateOperand1.py @@ -1,10 +1,10 @@ import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_MCInst_var_name, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class CreateOperand1(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/DeclarationInConditionClause.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/DeclarationInConditionClause.py index cc9ecad0833..471ae31a47d 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/DeclarationInConditionClause.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/DeclarationInConditionClause.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_capture_node, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class DeclarationInConditionalClause(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecodeInstruction.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecodeInstruction.py index b16bac9b5f3..b6c0ee63e4c 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecodeInstruction.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecodeInstruction.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class DecodeInstruction(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderCast.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderCast.py index f4dd36167aa..3417b46e3d9 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderCast.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderCast.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class DecoderCast(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderParameter.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderParameter.py index 2927e267053..da2a05493d6 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderParameter.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/DecoderParameter.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class DecoderParameter(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/FallThrough.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/FallThrough.py index bced2a1a6b5..95285712e1a 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/FallThrough.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/FallThrough.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class FallThrough(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBits.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBits.py index 9fa4135bce6..09c34041151 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBits.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBits.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_MCInst_var_name, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class FeatureBits(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBitsDecl.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBitsDecl.py index cd78d97daf1..c0910735827 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBitsDecl.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/FeatureBitsDecl.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class FeatureBitsDecl(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/FieldFromInstr.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/FieldFromInstr.py index 2f3655324d2..d228063f6b4 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/FieldFromInstr.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/FieldFromInstr.py @@ -1,14 +1,14 @@ import logging as log import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import ( get_function_params_of_node, get_text, ) from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class FieldFromInstr(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetNumOperands.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetNumOperands.py index ae2b3e291de..0a3f7192a75 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetNumOperands.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetNumOperands.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetNumOperands(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOpcode.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOpcode.py index fc78f5270e0..2ba9f95fc6a 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOpcode.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOpcode.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetOpcode(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperand.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperand.py index 8f3c9983b05..27e0dce1963 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperand.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperand.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetOperand(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperandRegImm.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperandRegImm.py index 911baec0029..d76371868fe 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperandRegImm.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetOperandRegImm.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_capture_node, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetOperandRegImm(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegClass.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegClass.py index a5e3b364a98..831a1bbd25a 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegClass.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegClass.py @@ -1,10 +1,11 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import ( get_capture_node, get_MCInst_var_name, get_text, ) from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetRegClass(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegFromClass.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegFromClass.py index a85c4e90c3a..56d08fe2ef1 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegFromClass.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetRegFromClass.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_capture_node, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetRegFromClass(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetSubReg.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetSubReg.py index e4b3ef6c68e..8ce0002a19c 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/GetSubReg.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/GetSubReg.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_MCInst_var_name, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class GetSubReg(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/HelperMethods.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/HelperMethods.py index 23eeb5a59bc..cbd3faaf4b6 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/HelperMethods.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/HelperMethods.py @@ -1,10 +1,10 @@ import logging as log import re -from autosync.Helper import fail_exit - from tree_sitter import Node +from autosync.Helper import fail_exit + def get_function_params_of_node(n: Node) -> Node: """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/Includes.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/Includes.py index bf23cb270d8..ffae8a99c46 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/Includes.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/Includes.py @@ -1,10 +1,10 @@ import logging as log +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class Includes(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/InlineToStaticInline.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/InlineToStaticInline.py index d980b4b785e..0698d05c03f 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/InlineToStaticInline.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/InlineToStaticInline.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class InlineToStaticInline(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsOptionalDef.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsOptionalDef.py index ee1695cb44e..1793ae95a30 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsOptionalDef.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsOptionalDef.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class IsOptionalDef(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsPredicate.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsPredicate.py index 98fa7c3c5f4..8c71dbda103 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsPredicate.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsPredicate.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class IsPredicate(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsRegImm.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsRegImm.py index 3d286d2bc59..0376dd68499 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/IsRegImm.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/IsRegImm.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class IsOperandRegImm(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMFallThrough.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMFallThrough.py index e01284af5c9..ed2cdccc3b2 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMFallThrough.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMFallThrough.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class LLVMFallThrough(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMunreachable.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMunreachable.py index d84d640f1a9..4e07bd1c0c7 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMunreachable.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/LLVMunreachable.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class LLVMUnreachable(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodToFunctions.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodToFunctions.py index 90cebd35fbc..4377fd30e81 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodToFunctions.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodToFunctions.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class MethodToFunction(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodTypeQualifier.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodTypeQualifier.py index 38fa68d1e2c..056eb3de56d 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodTypeQualifier.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/MethodTypeQualifier.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class MethodTypeQualifier(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceAnon.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceAnon.py index dd17633d286..5c5f7a0be46 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceAnon.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceAnon.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class NamespaceAnon(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceArch.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceArch.py index adcb69d3e82..3862c361a86 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceArch.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceArch.py @@ -1,3 +1,5 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import ( get_text, namespace_enum, @@ -5,7 +7,6 @@ namespace_struct, ) from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class NamespaceArch(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceLLVM.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceLLVM.py index cd57cbd2efc..a8d5c4cb8d0 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceLLVM.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/NamespaceLLVM.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class NamespaceLLVM(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/OutStreamParam.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/OutStreamParam.py index a88a71f97a2..0ee9897451d 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/OutStreamParam.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/OutStreamParam.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class OutStreamParam(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/PredicateBlockFunctions.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/PredicateBlockFunctions.py index 3cb4332b8b2..e82b4ff03b8 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/PredicateBlockFunctions.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/PredicateBlockFunctions.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_MCInst_var_name, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class PredicateBlockFunctions(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintAnnotation.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintAnnotation.py index 85ac7886439..096a0d91d14 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintAnnotation.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintAnnotation.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class PrintAnnotation(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintRegImmShift.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintRegImmShift.py index d8ef5f01441..cdedcf4eed1 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintRegImmShift.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/PrintRegImmShift.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_MCInst_var_name, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class PrintRegImmShift(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/QualifiedIdentifier.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/QualifiedIdentifier.py index fa990b44747..7ca8dec07a8 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/QualifiedIdentifier.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/QualifiedIdentifier.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class QualifiedIdentifier(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/ReferencesDecl.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/ReferencesDecl.py index a46a5e78752..396c09e0b34 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/ReferencesDecl.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/ReferencesDecl.py @@ -1,10 +1,10 @@ import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class ReferencesDecl(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/RegClassContains.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/RegClassContains.py index 0e59e066828..955e41e06a7 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/RegClassContains.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/RegClassContains.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_capture_node, get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class RegClassContains(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/STIArgument.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/STIArgument.py index 7170e1ee4a7..f7565550196 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/STIArgument.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/STIArgument.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class STIArgument(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/STIFeatureBits.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/STIFeatureBits.py index ead593c67dc..0980919a08c 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/STIFeatureBits.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/STIFeatureBits.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class STIFeatureBits(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/STParameter.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/STParameter.py index 23f0fedd3e1..f53a4fc8e7b 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/STParameter.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/STParameter.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class SubtargetInfoParam(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/SetOpcode.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/SetOpcode.py index 2d33f0e8c64..887ebb95ddb 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/SetOpcode.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/SetOpcode.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class SetOpcode(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/SignExtend.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/SignExtend.py index bd50fb742ec..9d2df5b1599 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/SignExtend.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/SignExtend.py @@ -1,7 +1,8 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch from autosync.cpptranslator.TemplateCollector import TemplateCollector -from tree_sitter import Node class SignExtend(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/SizeAssignments.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/SizeAssignments.py index 433416bb83a..406e9b83fdb 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/SizeAssignments.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/SizeAssignments.py @@ -1,13 +1,13 @@ import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import ( get_function_params_of_node, get_text, ) from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class SizeAssignment(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/StreamOperation.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/StreamOperation.py index 582ee7a7954..b4d231ae6a6 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/StreamOperation.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/StreamOperation.py @@ -1,6 +1,7 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node class StreamOperations(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDeclaration.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDeclaration.py index 090c0b35838..d088aac0c54 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDeclaration.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDeclaration.py @@ -1,12 +1,13 @@ import logging as log +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import parse_function_capture from autosync.cpptranslator.Patches.Patch import Patch from autosync.cpptranslator.TemplateCollector import ( TemplateCollector, TemplateRefInstance, ) -from tree_sitter import Node class TemplateDeclaration(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDefinition.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDefinition.py index 9f2d9be953d..a13ff38165e 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDefinition.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateDefinition.py @@ -1,6 +1,8 @@ import logging as log import re +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import parse_function_capture from autosync.cpptranslator.Patches.Patch import Patch from autosync.cpptranslator.TemplateCollector import ( @@ -8,8 +10,6 @@ TemplateRefInstance, ) -from tree_sitter import Node - class TemplateDefinition(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateParamDecl.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateParamDecl.py index 356bc4858eb..6031175599c 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateParamDecl.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateParamDecl.py @@ -1,10 +1,10 @@ import logging as log +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch -from tree_sitter import Node - class TemplateParamDecl(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateRefs.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateRefs.py index 9d8e43724d7..caf6b8aa30d 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateRefs.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/TemplateRefs.py @@ -1,7 +1,8 @@ +from tree_sitter import Node + from autosync.cpptranslator.Patches.HelperMethods import get_text from autosync.cpptranslator.Patches.Patch import Patch from autosync.cpptranslator.TemplateCollector import TemplateCollector -from tree_sitter import Node class TemplateRefs(Patch): diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/UseMarkup.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/UseMarkup.py index cce0fb6579a..09b2c752aa2 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/UseMarkup.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/UseMarkup.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class UseMarkup(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Patches/UsingDeclaration.py b/suite/auto-sync/src/autosync/cpptranslator/Patches/UsingDeclaration.py index 347a7943695..c150df1f242 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Patches/UsingDeclaration.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Patches/UsingDeclaration.py @@ -1,6 +1,7 @@ -from autosync.cpptranslator.Patches.Patch import Patch from tree_sitter import Node +from autosync.cpptranslator.Patches.Patch import Patch + class UsingDeclaration(Patch): """ diff --git a/suite/auto-sync/src/autosync/cpptranslator/Tests/test_patches.py b/suite/auto-sync/src/autosync/cpptranslator/Tests/test_patches.py index 3eab7744597..272716ec009 100644 --- a/suite/auto-sync/src/autosync/cpptranslator/Tests/test_patches.py +++ b/suite/auto-sync/src/autosync/cpptranslator/Tests/test_patches.py @@ -4,14 +4,14 @@ import unittest from pathlib import Path +from tree_sitter import Node, Query + import autosync.cpptranslator.Patches as Patches from autosync.cpptranslator import CppTranslator from autosync.cpptranslator.Configurator import Configurator from autosync.Helper import get_path -from tree_sitter import Node, Query - class TestPatches(unittest.TestCase): @classmethod