Skip to content

Commit

Permalink
Add type annotations to Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Jan 3, 2024
1 parent d464afe commit 104ef35
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rope/base/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def parent(self):
return self.project.get_folder(parent)

@property
def path(self):
def path(self) -> str:
"""Return the path of this resource relative to the project root
The path is the list of parent directories separated by '/' followed
Expand All @@ -84,17 +84,17 @@ def path(self):
return self._path

@property
def name(self):
def name(self) -> str:
"""Return the name of this resource"""
return self.path.split("/")[-1]

@property
def real_path(self):
def real_path(self) -> str:
"""Return the file system path of this resource"""
return self.project._get_resource_path(self.path)

@property
def pathlib(self):
def pathlib(self) -> Path:
"""Return the file as a pathlib path."""
return Path(self.real_path)

Expand Down

0 comments on commit 104ef35

Please sign in to comment.