1. zjes
  2. rope_py3k

Commits

Ali Gholami Rudi  committed c42a5e6

Making library.txt to use Restructure.make_checks()

  • Participants
  • Parent commits 15d7481
  • Branches trunk

Comments (0)

Files changed (4)

File docs/dev/library.txt

View file
   >>> goal = '${?param1} ** ${?param2}'
 
   >>> restructuring = restructure.Restructure(project, pattern, goal)
-  >>> checks = {}
-  >>> pymod1 = project.get_pycore().get_module('mod1')
-  >>> pow_pyname = pymod1.get_attribute('pow')
-  >>> checks['?pow_func'] = pow_pyname
-
-  # We could have used `Restructuring.make_checks()` instead:
-  # checks = restructuring.make_checks({'?pow_func': 'mod1.pow'})
+  >>> checks = restructuring.make_checks({'?pow_func': 'mod1.pow'})
 
   >>> project.do(restructuring.get_changes(checks))
   >>> mod2.read()

File docs/dev/stories.txt

View file
 * Supporting templates in text modes
 
 
+* Next/prev sentence
+
+
 * Inlining a single occurrence
 
 
 * Split tuple assignment refactoring
 
 
-* Next/prev sentence
-
-
 > Public Release 0.6m5 : July 15, 2007

File docs/dev/workingon.txt

View file
 Small Stories
 =============
 
-- Not analyzing containing scopes in automatic SOI
+- Changing restructuring example in ``library.txt`` to use
+  `Restructure.make_checks()`
 
-* Sorting methods; Move method up/down
-* Better help in restructuring dialog
 * Refactor `rope.base.refactor.importutils`
 * Not holding current_folder in `FromImport`?
+* Move method up/down
+* Better help in restructuring dialog
 * What to do with files that cannot be compiled when refactoring?
 
 * Extracting subexpressions; look at `extracttest` for more info

File rope/refactor/patchedast.py

View file
 
 
 def get_patched_ast(source, sorted_children=False):
-    """Adds `region` and `sorted_children` fields to nodes"""
+    """Adds ``region`` and ``sorted_children`` fields to nodes
+
+    Adds ``sorted_children`` field only if `sorted_children` is True.
+
+    """
     return patch_ast(ast.parse(source), source, sorted_children)
 
 
 def patch_ast(node, source, sorted_children=False):
     """Patches the given node
-    
+
     After calling, each node in `node` will have a new field named
     `region` that is a tuple containing the start and end offsets
     of the code that generated it.
-    
+
     If `sorted_children` is true, a `sorted_children` field will
     be created for each node, too.  It is a list containing child
     nodes as well as whitespaces and comments that occur between
 
 def write_ast(patched_ast_node):
     """Extract source form a patched AST node with `sorted_children` field
-    
+
     If the node is patched with sorted_children turned off you can use
     `node_region` function for obtaining code using module source code.
     """