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
3938from six .moves import filter
4039
4140if py3 :
4948
5049# The cached list of all known modules
5150modules = set ()
52- #List of stored paths
51+ # List of stored paths to compare against so that real paths are not repeated
52+ # handles symlinks not mount points
5353paths = set ()
5454fully_loaded = False
5555
@@ -137,7 +137,6 @@ def complete(cursor_offset, line):
137137
138138def find_modules (path ):
139139 """Find all modules (and packages) for a given directory."""
140-
141140 if not os .path .isdir (path ):
142141 # Perhaps a zip file
143142 return
@@ -194,21 +193,22 @@ def find_modules(path):
194193 continue
195194 else :
196195 if is_package :
197- pathReal = os .path .realpath (pathname )
198- if not pathReal in paths :
199- paths .add (pathReal )
196+ path_real = os .path .realpath (pathname )
197+ if path_real not in paths :
198+ paths .add (path_real )
200199 for subname in find_modules (pathname ):
201200 if subname != "__init__" :
202201 yield "%s.%s" % (name , subname )
203202 yield name
204203
204+
205205def find_all_modules (path = None ):
206206 """Return a list with all modules in `path`, which should be a list of
207207 directory names. If path is not given, sys.path will be used."""
208208 if path is None :
209209 modules .update (try_decode (m , "ascii" ) for m in sys .builtin_module_names )
210210 path = sys .path
211-
211+
212212 for p in path :
213213 if not p :
214214 p = os .curdir
You can’t perform that action at this time.
0 commit comments