-
Notifications
You must be signed in to change notification settings - Fork 0
/
searches.py
54 lines (49 loc) · 1.03 KB
/
searches.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from treesearcher import *
import regex
#[of]Regex cheatsheet:Regex cheatsheet
#[c]\m 'start of word'
#[c]\M 'end of word'
#[c](*PRUNE)
#[c](*SKIP) 'do not backtrack from this point on'
#[cf]
#[c]Inspect site-packages
set_root('C:/_/python37/Lib/site-packages')
set_fileexts('+.py')
#[c]~ cleanup(ask=False)
search({
#[of]classes:code examples
"code examples" : [
r'''
(?<!
^ {{ inline ws }} {{ do not backtrack }}
(?:
>>> {{ something }}
|
{{ three dots }} {{ maybe something }}
) \n
)
^ {{ inline ws }} >>> {{ inline ws }} {{ do not backtrack }} .
''',
regex.MULTILINE
],
#[cf]
#[of]classes:~ all files
#[c]~ "all files" : None,
#[cf]
#[of]classes:~ classes
#[c]~ "classes" : [
#[c] ~ r'{{ class keyword }}',
#[c] ~ regex.MULTILINE
#[c]~ ],
#[cf]
#[of]functions:~ functions
#[c]~ "functions" : [
#[c] ~ r'{{ function keyword }}',
#[c] ~ regex.MULTILINE
#[c]~ ],
#[cf]
})
#[l]:run.py:run.py
#[l]:results:_toc.txt
if __name__ == '__main__':
print('Nope, the run.py does the job')