Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f4c0ed6
some changes to file reading
etiennerichart Jun 25, 2020
347707d
Some work on symbolic link files
etiennerichart Jun 26, 2020
3f13a28
Cleaned up symlink fix ideas
etiennerichart Jun 26, 2020
47ea5ee
More clean up
etiennerichart Jun 26, 2020
6eff3b2
Make it easier to test different methods
etiennerichart Jun 26, 2020
8e08f3a
Found an even better way. useNameSubname = 4
etiennerichart Jun 26, 2020
2b96e8d
"Used os.path.realpath to fix issue"
etiennerichart Jun 29, 2020
44f76f7
Removed code that I was using for testing
etiennerichart Jun 29, 2020
513f37d
Made variable to store paths for comparison.
etiennerichart Jun 30, 2020
01a6a4c
further finalize changes to importcompletion.py
etiennerichart Jul 3, 2020
2edc977
Working on test but am having issues with the try
etiennerichart Jul 6, 2020
62bed48
replaced import test file with them file directory
etiennerichart Jul 7, 2020
45ada74
fixed importtest.py
etiennerichart Jul 8, 2020
9fafb2e
moved and renamed importtest to test folder
etiennerichart Jul 8, 2020
52cef9f
cleaned up test file
etiennerichart Jul 9, 2020
6983428
improved test
etiennerichart Jul 9, 2020
5928198
made it so test skips in python 2
etiennerichart Jul 9, 2020
dbc1d4f
made skipping work
etiennerichart Jul 9, 2020
5f15d7d
removed chdir and made better test skip
etiennerichart Jul 13, 2020
8bd85e9
fix symbolic links for the test
etiennerichart Jul 16, 2020
0a29731
used black auto format
etiennerichart Jul 16, 2020
cec627a
improved test to work on other computers
etiennerichart Jul 16, 2020
629bf1e
made testing strickter
etiennerichart Jul 16, 2020
11369fc
further testing
etiennerichart Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
"Used os.path.realpath to fix issue"
  • Loading branch information
etiennerichart committed Jun 29, 2020
commit 2b96e8d69ace845794102d398e361e6f2da5b6f1
55 changes: 6 additions & 49 deletions bpython/importcompletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,57 +201,14 @@ def find_modules(path):
continue
else:
if is_package:
pathGood = False
if useNameSubname == 2:
pathGood = True

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

#I did path len - 2 because I am worried about folders like bpython/bpython
# but if it is a symbolic link it will stop at bpython/bpython/bpython
for folder in range(len(pathList) - 2):
if pathList[folder] == pathList[len(pathList) - 1]:
pathGood = False
#print(pathGood)
#print()
elif useNameSubname == 4:
pathGood = True
pathReal = os.path.realpath(pathname)
if len(pathReal) < len(pathname) and pathReal in pathname:
#print("PathReal:", pathReal, "Path:", pathname)
pathGood = False
if useNameSubname == 1 or pathGood:
pathGood = True
pathReal = os.path.realpath(pathname)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit, but in this project (and most Python projects) we use snake_case instead of camelCase

if len(pathReal) < len(pathname) and pathReal in pathname:
pathGood = False
if pathGood:
for subname in find_modules(pathname):
if subname != "__init__":
#If trying the first method using name and subname
if useNameSubname == 1:
doNotAppend = False
#print("name: ", name, " subname: ", subname)
for obj in nameSubname:
nam = obj[0]
subnam = obj[1]
#print("name: ", name, " nam: ", nam, " subname: ", subname, " subnam: ", subnam)
if (name == nam and subname == subnam) or \
any(name in sub for sub in re.split("[.]", subnam)):
#print("Excluded: ", name, subname, "because ", nam, subnam)
doNotAppend = True
break
#print()
if not doNotAppend:
nameSubname.append((name, subname))
#print(name, subname)
yield "%s.%s" % (name, subname)
#If trying seconf methond using the pathname
else:
yield "%s.%s" % (name, subname)
elif useNameSubname == 3:
for subname in find_modules(pathname):
if subname != "__init__":
yield "%s.%s" % (name, subname)
#print("Name: ", name)
yield "%s.%s" % (name, subname)
yield name

def find_all_modules(path=None):
Expand Down
Empty file.
1 change: 1 addition & 0 deletions importtestfolder/Left/toRight
Empty file.
1 change: 1 addition & 0 deletions importtestfolder/Right/toLeft