mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.FileContext.root: Add property
Add a .root property, returning the path part of the instantiating URI. Nothing meaningful beyond returning it is done with it so far. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
6a3cf7a283
commit
b52264dfad
1 changed files with 9 additions and 5 deletions
|
|
@ -16,6 +16,7 @@ class FileContext(abc.ABC):
|
|||
|
||||
def __init__(self, uri: str, interactive: bool|None=None, verbose_default=False):
|
||||
self.__uri = uri
|
||||
self.__id, self.__root = self.split_uri(uri)
|
||||
self.__interactive = interactive
|
||||
self.__verbose_default = verbose_default
|
||||
self.__log_name: str|None = None
|
||||
|
|
@ -40,15 +41,18 @@ class FileContext(abc.ABC):
|
|||
netloc = p.netloc if p.netloc else ''
|
||||
return f'{cls.schema_from_uri(uri)}://{netloc}', p.path
|
||||
|
||||
@cached_property
|
||||
def id(self) -> str:
|
||||
id, path = self.split_uri(self.__uri)
|
||||
return id
|
||||
|
||||
@property
|
||||
def uri(self) -> str:
|
||||
return self.__uri
|
||||
|
||||
@property
|
||||
def id(self) -> str:
|
||||
return self.__id
|
||||
|
||||
@property
|
||||
def root(self) -> str:
|
||||
return self.__root
|
||||
|
||||
@property
|
||||
def log_name(self) -> str:
|
||||
if self.__log_name is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue