pathresolver.py : rtype and function doc (part)

This commit is contained in:
Maximilien Rigaut 2022-06-09 15:22:09 +02:00
parent 0130cbf740
commit 69822173d4
No known key found for this signature in database
GPG Key ID: 4F14B23709ADA5B1
1 changed files with 7 additions and 1 deletions

View File

@ -12,16 +12,21 @@ import os
class PathResolver:
"""
Initialised with a relative path and returns the translated absolute path
:param base_path: Relative path to be resolved
"""
def __init__(self, base_path):
"""
Initialises the PathResolver with the base path
:param base_path: Base path
:type base_path: str
"""
self.base_path = os.path.normpath(os.path.join(os.getcwd(), os.path.dirname(base_path)))
def __call__(self, relative_path='.'):
"""
Returns the absolute path of the relative path
:param relative_path: Relative path to be resolved
:type relative_path: str
:return: Absolute path
"""
return self.give_absolute(relative_path)
@ -30,6 +35,7 @@ class PathResolver:
"""
Returns the absolute path of the relative path
:param relative_path: Relative path to be resolved
:type relative_path: str
:return: Absolute path
"""
return os.path.normpath(os.path.join(self.base_path, relative_path))