forked from kekewind/Kaleidoscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
importlist.py
43 lines (42 loc) · 1.27 KB
/
importlist.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
import MyUtils
# 更新import list
if __name__ == '__main__':
ff=MyUtils.txt(MyUtils.projectpath('importlist.txt'))
ff.l=[]
ff.save()
res=[]
# for i in MyUtils.extend(MyUtils.listfile(MyUtils.projectpath('./')),MyUtils.listfile(MyUtils.projectpath('./TEST/'))):
for i in MyUtils.listfile(MyUtils.projectpath('./')):
if not '.py'in i:
continue
f=MyUtils.txt(i)
for i in f.l:
if not 'import 'in i:
continue
if '#'in i:
continue
if 'from'in i:
continue
if 'Util'in i:
continue
if ')'in i:
continue
if '\''in i:
continue
if ':'in i:
continue
if 'M'in i:
continue
i=(MyUtils.gettail(i,'import '))
while '.'in i:
i=MyUtils.removetail(i,'.')
while ' 'in i:
i=MyUtils.removetail(i,' ')
while ' as'in i:
i=MyUtils.removetail(i,' as')
res.append(i)
res=list(set(res))
for i in ['os','asyncio','sys','time','multiprocessing','json','queue','csv','re','shutil']:
res.remove(i)
ff.l=res
ff.save()