Skip to content

Commit 3f13a28

Browse files
Cleaned up symlink fix ideas
1 parent 347707d commit 3f13a28

2 files changed

Lines changed: 9 additions & 32 deletions

File tree

bpython/importcompletion.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,8 @@ def complete(cursor_offset, line):
136136
def find_modules(path):
137137
"""Find all modules (and packages) for a given directory."""
138138

139-
global nameSubname
140-
nameSubname = []
141-
142-
#global pathNameList
143-
#pathNameList = []
139+
#global nameSubname
140+
#nameSubname = []
144141

145142
if not os.path.isdir(path):
146143
# Perhaps a zip file
@@ -199,28 +196,15 @@ def find_modules(path):
199196
else:
200197
if is_package:
201198
pathGood = True
202-
#print("pathname:", pathname)
203-
#for paths in pathNameList:
204-
#print(paths)
205-
#print("Hi")
206-
207-
#if pathname == paths:
208-
#pathGood = False
209-
#break
210199

211200
pathList = re.split("[/]", pathname)
212201
#print("pathL length:", len(pathList))
213202
#for pathL in pathList:
214203
#print("pathL:", pathL)
215204

216-
for folder in range(len(pathList)):
217-
for folderT in range(len(pathList)):
218-
#print("folder:", folder, "folderT:", folderT)
219-
#print("Pathlist Folder:", pathList[folder], "Pathlist FolderT:", pathList[folderT])
220-
if folder == folderT:
221-
continue
222-
elif pathList[folder] == pathList[folderT]:
223-
pathGood = False
205+
for folder in range(len(pathList) - 2):
206+
if pathList[folder] == pathList[len(pathList) - 1]:
207+
pathGood = False
224208
#print(pathGood)
225209
#print()
226210
if pathGood:
@@ -242,14 +226,10 @@ def find_modules(path):
242226
#print()
243227
#if not doNotAppend:
244228
#nameSubname.append((name, subname))
245-
#print(name, subname)
246-
yield "%s.%s" % (name, subname)
229+
print(name, subname)
230+
yield "%s.%s" % (name, subname)
231+
print(name)
247232
yield name
248-
for obj in nameSubname:
249-
#print(obj[0] + " " + obj[1])
250-
pass
251-
#print("PathNameList len:", len(pathNameList))
252-
253233

254234
def find_all_modules(path=None):
255235
"""Return a list with all modules in `path`, which should be a list of

importtest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
foo = find_modules(os.path.abspath("./importtestfolder"))
55

66
for thing in foo:
7-
print(thing)
8-
9-
#for obj in foo.nameSubname:
10-
#print(obj[0] + " " + obj[1])
7+
pass
118

129
#bpython import_completion yield name | #bpython import yield name subname and yield name
1310
#bpdb | #bpdb

0 commit comments

Comments
 (0)