Skip to content

Commit 01a6a4c

Browse files
further finalize changes to importcompletion.py
1 parent 513f37d commit 01a6a4c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

bpython/importcompletion.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import os
3636
import sys
3737
import warnings
38-
import re
3938
from six.moves import filter
4039

4140
if py3:
@@ -49,7 +48,8 @@
4948

5049
# The cached list of all known modules
5150
modules = 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
5353
paths = set()
5454
fully_loaded = False
5555

@@ -137,7 +137,6 @@ def complete(cursor_offset, line):
137137

138138
def 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+
205205
def 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

0 commit comments

Comments
 (0)