From 3188b32896ea2a2796bf7fcb7bde918a0e2b30ac Mon Sep 17 00:00:00 2001 From: Elifarley Date: Thu, 12 Dec 2024 03:12:44 -0300 Subject: [PATCH] cedarscript-ast-parser>=0.7.0 --- pyproject.toml | 2 +- tests/corpus/chat.make-top-level-from-method.1/chat.xml | 6 +++--- tests/corpus/move.decorated-method/chat.xml | 4 ++-- tests/corpus/move.double-decorated-method/chat.xml | 4 ++-- .../chat.xml | 8 ++++---- tests/corpus/update.identifier.case-filter/chat.xml | 4 ++-- .../update.identifier.ed-script-filter!nowindows/chat.xml | 6 +++--- tests/corpus/update.identifier.move.whole.1/chat.xml | 2 +- tests/corpus/update.identifier.move.whole.2/chat.xml | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8a2cace..da22f44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ keywords = ["cedarscript", "code-editing", "refactoring", "code-analysis", "sql-like", "ai-assisted-development"] dependencies = [ "orgecc-pylib>=0.1.3", - "cedarscript-ast-parser>=0.6.1", + "cedarscript-ast-parser>=0.7.0", "grep-ast==0.4.1", # https://github.com/tree-sitter/py-tree-sitter/issues/303 # https://github.com/grantjenks/py-tree-sitter-languages/issues/64 diff --git a/tests/corpus/chat.make-top-level-from-method.1/chat.xml b/tests/corpus/chat.make-top-level-from-method.1/chat.xml index 0e22884..9fd81e1 100644 --- a/tests/corpus/chat.make-top-level-from-method.1/chat.xml +++ b/tests/corpus/chat.make-top-level-from-method.1/chat.xml @@ -11,14 +11,14 @@ Here's my plan to implement the requested changes: Here's the CEDARScript script: ```CEDARScript --- 1. Move the `_candidate()` method from the `A` class, placing it at the top level, just before the line where its class starts +# 1. Move the `_candidate()` method from the `A` class, placing it at the top level, just before the line where its class starts UPDATE CLASS "A" FROM FILE "main.py" MOVE FUNCTION "_candidate" INSERT BEFORE CLASS "A" RELATIVE INDENTATION 0; --- 2. Update the copied function to remove references to `self` +# 2. Update the copied function to remove references to `self` UPDATE FUNCTION "_candidate" FROM FILE "main.py" REPLACE LINE "def _candidate(self, a, b, c):" @@ -26,7 +26,7 @@ WITH CONTENT ''' @0:def _candidate(a, b, c): '''; --- 3. Update ALL call sites of the method `_candidate()` to call the new top-level function with the same name +# 3. Update ALL call sites of the method `_candidate()` to call the new top-level function with the same name UPDATE FUNCTION "_check" FROM FILE "main.py" REPLACE LINE "self._candidate(" diff --git a/tests/corpus/move.decorated-method/chat.xml b/tests/corpus/move.decorated-method/chat.xml index 1ffa66e..e81bef5 100644 --- a/tests/corpus/move.decorated-method/chat.xml +++ b/tests/corpus/move.decorated-method/chat.xml @@ -1,13 +1,13 @@ ```CEDARScript --- 1. Move the `get_fault_text` method from the `SpyderKernel` class to be a top-level function +# 1. Move the `get_fault_text` method from the `SpyderKernel` class to be a top-level function UPDATE METHOD "SpyderKernel.get_fault_text" FROM FILE "1.py" MOVE WHOLE INSERT BEFORE CLASS "SpyderKernel" RELATIVE INDENTATION 0; --- 2. Update the copied function to remove references to `self` +# 2. Update the copied function to remove references to `self` UPDATE FUNCTION "get_fault_text" FROM FILE r"1.py" REPLACE WHOLE WITH CASE diff --git a/tests/corpus/move.double-decorated-method/chat.xml b/tests/corpus/move.double-decorated-method/chat.xml index 1ffa66e..e81bef5 100644 --- a/tests/corpus/move.double-decorated-method/chat.xml +++ b/tests/corpus/move.double-decorated-method/chat.xml @@ -1,13 +1,13 @@ ```CEDARScript --- 1. Move the `get_fault_text` method from the `SpyderKernel` class to be a top-level function +# 1. Move the `get_fault_text` method from the `SpyderKernel` class to be a top-level function UPDATE METHOD "SpyderKernel.get_fault_text" FROM FILE "1.py" MOVE WHOLE INSERT BEFORE CLASS "SpyderKernel" RELATIVE INDENTATION 0; --- 2. Update the copied function to remove references to `self` +# 2. Update the copied function to remove references to `self` UPDATE FUNCTION "get_fault_text" FROM FILE r"1.py" REPLACE WHOLE WITH CASE diff --git a/tests/corpus/refactor-benchmark.indentation-size-discovery/chat.xml b/tests/corpus/refactor-benchmark.indentation-size-discovery/chat.xml index 5a6bb51..10b3956 100644 --- a/tests/corpus/refactor-benchmark.indentation-size-discovery/chat.xml +++ b/tests/corpus/refactor-benchmark.indentation-size-discovery/chat.xml @@ -1,22 +1,22 @@ ```CEDARScript --- Try CST-based indentation discovery --- Move the `__get_brackets` method from the `CodeEditor` class, placing it at the top level, just before the line where its class starts +# Try CST-based indentation discovery +# Move the `__get_brackets` method from the `CodeEditor` class, placing it at the top level, just before the line where its class starts UPDATE CLASS "CodeEditor" FROM FILE "codeeditor.py" MOVE METHOD "__get_brackets" INSERT BEFORE CLASS "CodeEditor" RELATIVE INDENTATION 0; --- 1. Move the method to become a top-level function. +# 1. Move the method to become a top-level function. UPDATE CLASS "AutosaveForPlugin" FROM FILE "autosave.py" MOVE METHOD "get_files_to_recover" INSERT BEFORE CLASS "AutosaveForPlugin" RELATIVE INDENTATION 0; --- 1. Move the `adapt_method_mode` method from the `BaseHandler` class, placing it at the top level, just before the line where its class starts +# 1. Move the `adapt_method_mode` method from the `BaseHandler` class, placing it at the top level, just before the line where its class starts UPDATE CLASS "BaseHandler" FROM FILE "base.py" MOVE METHOD "adapt_method_mode" diff --git a/tests/corpus/update.identifier.case-filter/chat.xml b/tests/corpus/update.identifier.case-filter/chat.xml index 9d790ac..25ba5e6 100644 --- a/tests/corpus/update.identifier.case-filter/chat.xml +++ b/tests/corpus/update.identifier.case-filter/chat.xml @@ -20,7 +20,7 @@ REPLACE WHOLE WITH CASE r'\1' END; --- Update the copied function to remove references to `self` +# Update the copied function to remove references to `self` UPDATE FUNCTION "_make_source_table" FROM FILE "analyzer_cli.py" REPLACE WHOLE WITH CASE @@ -29,7 +29,7 @@ REPLACE WHOLE WITH CASE r'''\1''' END; --- Update ALL call sites of the method `_make_source_table` to call the new top-level function with the same name +# Update ALL call sites of the method `_make_source_table` to call the new top-level function with the same name UPDATE METHOD "DebugAnalyzer.list_source" FROM FILE "analyzer_cli.py" REPLACE BODY WITH CASE diff --git a/tests/corpus/update.identifier.ed-script-filter!nowindows/chat.xml b/tests/corpus/update.identifier.ed-script-filter!nowindows/chat.xml index 3625e6b..d46aeb8 100644 --- a/tests/corpus/update.identifier.ed-script-filter!nowindows/chat.xml +++ b/tests/corpus/update.identifier.ed-script-filter!nowindows/chat.xml @@ -8,7 +8,7 @@ g/^def convert/s/self, // '''; --- 1. Update the function signature of `calc1()` to add parameter `tax: float` as the first one and use the new parameter instead of `7` +# 1. Update the function signature of `calc1()` to add parameter `tax: float` as the first one and use the new parameter instead of `7` UPDATE FUNCTION "calc1" FROM FILE "1.py" REPLACE WHOLE WITH ED r''' @@ -18,8 +18,8 @@ g/return/s/7.*/tax/ '''; --- 2. Update the function signature of `calc2()` to add parameter `base_tax: float = 1.3` as the last one --- 3. Update ALL call sites of `calc1()` to pass `base_tax` as the first argument +# 2. Update the function signature of `calc2()` to add parameter `base_tax: float = 1.3` as the last one +# 3. Update ALL call sites of `calc1()` to pass `base_tax` as the first argument UPDATE FUNCTION "calc2" FROM FILE "1.py" REPLACE WHOLE WITH ED r''' diff --git a/tests/corpus/update.identifier.move.whole.1/chat.xml b/tests/corpus/update.identifier.move.whole.1/chat.xml index 5742c37..527b753 100644 --- a/tests/corpus/update.identifier.move.whole.1/chat.xml +++ b/tests/corpus/update.identifier.move.whole.1/chat.xml @@ -1,6 +1,6 @@ ```CEDARScript --- A02 becomes local to b +# A02 becomes local to b UPDATE FUNCTION "b" FROM FILE "main.py" MOVE WHOLE INSERT BEFORE CLASS "A02" diff --git a/tests/corpus/update.identifier.move.whole.2/chat.xml b/tests/corpus/update.identifier.move.whole.2/chat.xml index b2b9f2f..d612c4f 100644 --- a/tests/corpus/update.identifier.move.whole.2/chat.xml +++ b/tests/corpus/update.identifier.move.whole.2/chat.xml @@ -1,6 +1,6 @@ ```CEDARScript --- 2nd pst becomes inner of A3 +# 2nd pst becomes inner of A3 UPDATE FUNCTION "pst" OFFSET 1 FROM FILE "main.py" MOVE WHOLE INSERT AFTER CLASS "A3" RELATIVE INDENTATION 1;