@@ -201,57 +201,14 @@ def find_modules(path):
201201 continue
202202 else :
203203 if is_package :
204- pathGood = False
205- if useNameSubname == 2 :
206- pathGood = True
207-
208- pathList = re .split ("[/]" , pathname )
209- #print("pathL length:", len(pathList))
210- #for pathL in pathList:
211- #print("pathL:", pathL)
212-
213- #I did path len - 2 because I am worried about folders like bpython/bpython
214- # but if it is a symbolic link it will stop at bpython/bpython/bpython
215- for folder in range (len (pathList ) - 2 ):
216- if pathList [folder ] == pathList [len (pathList ) - 1 ]:
217- pathGood = False
218- #print(pathGood)
219- #print()
220- elif useNameSubname == 4 :
221- pathGood = True
222- pathReal = os .path .realpath (pathname )
223- if len (pathReal ) < len (pathname ) and pathReal in pathname :
224- #print("PathReal:", pathReal, "Path:", pathname)
225- pathGood = False
226- if useNameSubname == 1 or pathGood :
204+ pathGood = True
205+ pathReal = os .path .realpath (pathname )
206+ if len (pathReal ) < len (pathname ) and pathReal in pathname :
207+ pathGood = False
208+ if pathGood :
227209 for subname in find_modules (pathname ):
228210 if subname != "__init__" :
229- #If trying the first method using name and subname
230- if useNameSubname == 1 :
231- doNotAppend = False
232- #print("name: ", name, " subname: ", subname)
233- for obj in nameSubname :
234- nam = obj [0 ]
235- subnam = obj [1 ]
236- #print("name: ", name, " nam: ", nam, " subname: ", subname, " subnam: ", subnam)
237- if (name == nam and subname == subnam ) or \
238- any (name in sub for sub in re .split ("[.]" , subnam )):
239- #print("Excluded: ", name, subname, "because ", nam, subnam)
240- doNotAppend = True
241- break
242- #print()
243- if not doNotAppend :
244- nameSubname .append ((name , subname ))
245- #print(name, subname)
246- yield "%s.%s" % (name , subname )
247- #If trying seconf methond using the pathname
248- else :
249- yield "%s.%s" % (name , subname )
250- elif useNameSubname == 3 :
251- for subname in find_modules (pathname ):
252- if subname != "__init__" :
253- yield "%s.%s" % (name , subname )
254- #print("Name: ", name)
211+ yield "%s.%s" % (name , subname )
255212 yield name
256213
257214def find_all_modules (path = None ):
0 commit comments