File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535import os
3636import sys
3737import warnings
38+ import re
3839from six .moves import filter
3940
4041if py3 :
@@ -134,6 +135,10 @@ def complete(cursor_offset, line):
134135
135136def find_modules (path ):
136137 """Find all modules (and packages) for a given directory."""
138+
139+ global nameSubname
140+ nameSubname = []
141+
137142 if not os .path .isdir (path ):
138143 # Perhaps a zip file
139144 return
@@ -192,8 +197,21 @@ def find_modules(path):
192197 if is_package :
193198 for subname in find_modules (pathname ):
194199 if subname != "__init__" :
195- yield "%s.%s" % (name , subname )
200+ doNotAppend = False
201+ for obj in nameSubname :
202+ nam = obj [0 ]
203+ subnam = obj [1 ]
204+ if (name == nam and subname == subnam ) or \
205+ any (nam in sub for sub in re .split ("[.]" , subname )) or \
206+ any (subname in na for na in re .split ("[.]" , name )):
207+ doNotAppend = True
208+ break
209+ if not doNotAppend :
210+ nameSubname .append ((name , subname ))
211+ yield "%s.%s" % (name , subname )
196212 yield name
213+ for obj in nameSubname :
214+ print (obj [0 ] + " " + obj [1 ])
197215
198216
199217def find_all_modules (path = None ):
You can’t perform that action at this time.
0 commit comments