def __get_filename(self, key): ''' 从路径中提取file name ''' if self.isfile(key): s = key.split('/') return s[-1] else: raise upyun.UpYunClientException( str(key) + ' is dir or not found')
def __get_dir(self, key): ''' 从路径中提取dir ''' if self.isdir(key): return key elif self.isfile(key): s = key.split('/') s.pop() # pop the last element return '/'.join(s) else: raise upyun.UpYunClientException(str(key) + ' not found')