Skip to content

Commit

Permalink
Simplify code that uses pathlib.Path to use Resource.pathlib property
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Jan 3, 2024
1 parent 174f084 commit d464afe
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions rope/contrib/autoimport/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(
autoimport = AutoImport(..., memory=True)
"""
self.project = project
project_package = get_package_tuple(Path(project.root.real_path), project)
project_package = get_package_tuple(project.root.pathlib, project)
assert project_package is not None
assert project_package.path is not None
self.project_package = project_package
Expand Down Expand Up @@ -175,9 +175,7 @@ def calculate_project_hash(data: str) -> str:
f"file:rope-{project_hash}:?mode=memory&cache=shared", uri=True
)
else:
return sqlite3.connect(
str(Path(project.ropefolder.real_path) / "autoimport.db")
)
return sqlite3.connect(project.ropefolder.pathlib / "autoimport.db")

@property
def connection(self):
Expand Down Expand Up @@ -627,7 +625,7 @@ def _resource_to_module(
) -> ModuleFile:
assert self.project_package.path
underlined = underlined if underlined else self.underlined
resource_path: Path = Path(resource.real_path)
resource_path: Path = resource.pathlib
# The project doesn't need its name added to the path,
# since the standard python file layout accounts for that
# so we set add_package_name to False
Expand Down

0 comments on commit d464afe

Please sign in to comment.