diff --git a/aliyunpan/about.py b/aliyunpan/about.py index 9a8a1b1..51dce9e 100644 --- a/aliyunpan/about.py +++ b/aliyunpan/about.py @@ -1 +1 @@ -__version__ = '3.0.4' +__version__ = '3.0.5' diff --git a/aliyunpan/api/models.py b/aliyunpan/api/models.py index ba0709e..4c7b3e2 100644 --- a/aliyunpan/api/models.py +++ b/aliyunpan/api/models.py @@ -150,9 +150,9 @@ def get_fid_list(self, file_id, update=True): return [i.data for i in self._tree.children(file_id)] def get_path_fid(self, path, file_id='root', update=True): - path = AliyunpanPath(path) if str(path) in ('', '/', '\\', '.', 'root'): return 'root' + path = AliyunpanPath(path) flag = False path_list = list(filter(None, path.split())) if path_list[0] == 'root': @@ -248,6 +248,7 @@ def __sub__(self, other: Path): def __add__(self, other): return Path(self.__str__()) / Path(str(other)) - -if __name__ == '__main__': - print(AliyunpanPath('/a/b/c') + AliyunpanPath('1')) + @property + def parent(self): + p = self.__str__().rsplit('/', 1)[0] + return p if p else '/'