File: indentation_test.py

package info (click to toggle)
python-redbaron 0.9.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 772 kB
  • sloc: python: 6,650; makefile: 145; sh: 28
file content (21 lines) | stat: -rw-r--r-- 482 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
Recursivly traverse a python script to test if .indentation seems to be working everywhere
"""

from redbaron import RedBaron

red = RedBaron(open("../redbaron.py", "r").read())
# red = RedBaron(open(__file__, "r").read())

def walk(node):
    if node is None:
        return
    print([node.indentation, node])
    for i in node._dict_keys:
        walk(getattr(node, i))

    for i in node._list_keys:
        map(walk, getattr(node, i))

map(walk, red)
# print(walk(red[0]))