Commits

Anonymous committed fe76cff

simplify: added docs

  • Participants
  • Parent commits 90e04d3

Comments (0)

Files changed (1)

rope/base/simplify.py

 
 @utils.cached(7)
 def real_code(source):
+    """Simplify `source` for analysis
+
+    It replaces:
+
+    * comments with spaces
+    * strs with a new str filled with spaces
+    * implicit and explicit continuations with spaces
+    * tabs and semicolons with spaces
+
+    The resulting code is a lot easier to analyze if we are interested
+    only in offsets.
+    """
     collector = codeanalyze.ChangeCollector(source)
     for start, end in ignored_regions(source):
         if source[start] == '#':
 
 @utils.cached(7)
 def ignored_regions(source):
+    """Return ignored regions like strings and comments in `source` """
     return [(match.start(), match.end()) for match in _str.finditer(source)]