introduce fully_qualified_path_str() method

Reduce all the copy+pasted '/'.join(path_list) constructs with
a method returning the formatted path string.

Change-Id: I5e9bfb425c3a3fade13ca4ccd2b891a0c21ed56d
This commit is contained in:
Harald Welte
2022-07-19 23:48:45 +02:00
parent 3c98d5e91d
commit b2e4b4a300
2 changed files with 24 additions and 20 deletions

View File

@@ -112,6 +112,14 @@ class CardFile:
else:
return self.fid
def fully_qualified_path_str(self, prefer_name: bool = True) -> str:
"""Return fully qualified path to file as string.
Args:
prefer_name : Preferably build path of names; fall-back to FIDs as required
"""
return '/'.join(self.fully_qualified_path(prefer_name))
def fully_qualified_path(self, prefer_name: bool = True) -> List[str]:
"""Return fully qualified path to file as list of FID or name strings.