Anonymous avatar Anonymous committed 71052b6

using the restructuring args instead of checks

Comments (0)

Files changed (2)

 ``batchset`` command is useful when performing refactorings with long
 configs, like restructurings::
 
-  pattern ${?pycore}.create_module(${?project}.root, ${?name})
+  pattern ${pycore}.create_module(${project}.root, ${name})
 
-  goal generate.create_module(${?project}, ${?name})
+  goal generate.create_module(${project}, ${name})
 
   imports
    from rope.contrib import generate
 
-  checks
-   ?pycore.type == rope.base.pycore.PyCore
-   ?project.type == rope.base.project.Project
+  args
+   pycore: type=rope.base.pycore.PyCore
+   project: type=rope.base.project.Project
 
 .. ignore the two-space indents
 
 Just for the sake of completeness, the reverse of the above
 restructuring can be::
 
-  pattern ${?create_module}(${?project}, ${?name})
+  pattern ${create_module}(${project}, ${name})
 
-  goal ${?project}.pycore.create_module(${?project}.root, ${?name})
+  goal ${project}.pycore.create_module(${project}.root, ${name})
 
   checks
-   ?create_module == rope.contrib.generate.create_module
-   ?project.type == rope.base.project.Project
+   create_module: name=rope.contrib.generate.create_module
+   project: type=rope.base.project.Project
 
 
 Key-binding

ropemacs/refactor.py

     key = 'x'
     confs = {'pattern': dialog.Data('Restructuring pattern: '),
              'goal': dialog.Data('Restructuring goal: ')}
-    optionals = {'checks': dialog.Data('Checks: '),
+    optionals = {'args': dialog.Data('Arguments: '),
                  'imports': dialog.Data('Imports: ')}
 
     def _calculate_changes(self, values, task_handle):
-        restructuring = rope.refactor.restructure.Restructure(
-            self.project, values['pattern'], values['goal'])
-        check_dict = {}
-        for raw_check in values.get('checks', '').split('\n'):
+        args = {}
+        for raw_check in values.get('args', '').split('\n'):
             if raw_check:
-                key, value = raw_check.split('==')
-                check_dict[key.strip()] = value.strip()
-        checks = restructuring.make_checks(check_dict)
+                key, value = raw_check.split(':', 1)
+                args[key.strip()] = value.strip()
         imports = [line.strip()
                    for line in values.get('imports', '').split('\n')]
-        return restructuring.get_changes(checks=checks, imports=imports,
-                                         task_handle=task_handle)
+        restructuring = rope.refactor.restructure.Restructure(
+            self.project, values['pattern'], values['goal'],
+            args=args, imports=imports)
+        return restructuring.get_changes(task_handle=task_handle)
 
 
 class Move(Refactoring):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.