From b52264dfadf7928d08e0442d2beb792d12998f17 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 22 Apr 2026 07:03:01 +0200 Subject: [PATCH] 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 --- src/python/jw/pkg/lib/FileContext.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/python/jw/pkg/lib/FileContext.py b/src/python/jw/pkg/lib/FileContext.py index f13cf107..5344f466 100644 --- a/src/python/jw/pkg/lib/FileContext.py +++ b/src/python/jw/pkg/lib/FileContext.py @@ -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: