Ronny Pfannschmidt avatar Ronny Pfannschmidt committed 3fb9f4f

kill the simpledoctest package

Comments (0)

Files changed (2)

Add a comment to this file

simpledoctest/__init__.py

Empty file removed.

simpledoctest/blockread.py

-
-
-def dedent(line, last_indent):
-    if last_indent is not None:
-        if line[:last_indent].isspace():
-            return last_indent, line[last_indent:]
-    stripped = line.lstrip(' ')
-    return len(line) - len(stripped), stripped
-
-def blocks(lines):
-    result = []
-    firstline = None
-    last_indent = None
-    items = []
-    for lineno, line in enumerate(lines):
-
-        indent, rest = dedent(line, last_indent)
-
-        if last_indent is None:
-            last_indent = indent
-
-        if firstline is None:
-            firstline = lineno
-
-        if indent != last_indent:
-            if items[0] == '\n':
-                del items[0]
-                firstline+=1
-            if items and items[-1] == '\n':
-                del items[-1]
-            result.append((last_indent, firstline, items))
-            items = [rest]
-            last_indent = indent
-            firstline = lineno
-
-        else:
-            last_indent = indent
-            items.append(rest or '\n')
-
-    else:
-        result.append((indent, firstline, items))
-
-
-    return result
-
-
-def correct_content(content, updates):
-
-    lines = content.splitlines(True)
-    for update in reversed(updates):
-        line = update['line']
-        old_lines = len(update['content'].splitlines())
-        indent = ' '*update['indent']
-        new_lines = [ indent + _line for _line in update['new_content'].splitlines(1)]
-        import pprint
-        pprint.pprint(locals())
-
-        lines[line+1: line+old_lines+1] = new_lines
-
-
-    return ''.join(lines)
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.