Skip to content

Commit

Permalink
ignore site-packages pt3
Browse files Browse the repository at this point in the history
  • Loading branch information
bagel897 committed Nov 2, 2023
1 parent 8e09274 commit 20170be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 5 additions & 1 deletion rope/contrib/autoimport/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,11 @@ def _del_if_exist(self, module_name, commit: bool = True):

def _get_python_folders(self) -> List[Path]:
def filter_folders(folder: Path) -> bool:
return folder.is_dir() and folder.as_posix() != "/usr/bin"
return (
folder.is_dir()
and folder.as_posix() != "/usr/bin"
and str(folder) != self.project.address
)

folders = self.project.get_python_path_folders()
folder_paths = map(lambda folder: Path(folder.real_path), folders)
Expand Down
4 changes: 1 addition & 3 deletions rope/contrib/autoimport/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ def get_package_tuple(
package_type: PackageType
if package_name.startswith(".") or package_name == "__pycache__":
return None
if "site-packages" in package_name:
return None
if package_name.endswith((".egg-info", ".dist-info")):
return None
if package_path.is_file():
Expand Down Expand Up @@ -120,7 +118,7 @@ def get_files(
yield ModuleFile(package.path, package.path.stem, underlined, False)
else:
assert package.path
for file in package.path.glob("**/*.py"):
for file in package.path.rglob("*.py"):
if file.name == "__init__.py":
yield ModuleFile(
file,
Expand Down

0 comments on commit 20170be

Please sign in to comment.