예제 #1
0
 def __init__(
     self,
     contains_lidvids: bool,
     subcomponents: Set[S],
     fs: FS,
     filepaths: Set[str],
 ) -> None:
     """
     Create a 'VersionContents' object.  DO NOT USE this
     constructor.  Instead use the static methods
     VersionContents.create_from_lids() and
     VersionContents.create_from_lidvids().
     """
     if not _data_consistent(contains_lidvids, subcomponents):
         raise TypeError(
             "Subcomponents are not consistent, should be all "
             + "livids or all lids."
         )
     self.contains_lidvids = contains_lidvids
     self.subcomponents: Set[S] = subcomponents
     for filepath in filepaths:
         if not isabs(filepath):
             raise ValueError(f"{filepath} is not an absolute path.")
         if not fs.isfile(filepath):
             raise ValueError(f"{filepath} is not a file.")
     self.fs = fs
     self.filepaths = filepaths
예제 #2
0
 def abs(self):
     if fp.isabs(self.path):
         return self.path
     else:
         from fs.osfs import OSFS
         with OSFS('.') as fs:
             return fs.getsyspath(self.path)
예제 #3
0
파일: model.py 프로젝트: tech-pi/filesystem
 def abs(self) -> str:
     #return fp.abspath(self.route)
     if fp.isabs(self.route):
         return self.route
     else:
         from fs.osfs import OSFS
         with OSFS('.') as fs:
             return fs.getsyspath(self.route)
예제 #4
0
 def is_abs(self):
     return fp.isabs(self._path)
예제 #5
0
def deref_link(link_path, real_path):
    if isabs(real_path):
        return real_path
    else:
        basename, fname = pathsplit(link_path)
        return pathjoin(basename, real_path)
예제 #6
0
 def parts(self):
     result = fp.iteratepath(self.path)
     if fp.isabs(self.path) and not result[0] == '/':
         result = ['/'] + result
     return tuple(result)
예제 #7
0
 def isrel(self):
     return not fp.isabs(self.path)
예제 #8
0
 def isabs(self):
     return fp.isabs(self.path)
예제 #9
0
 def test_isabs(self):
     self.assertTrue(isabs("/"))
     self.assertTrue(isabs("/foo"))
     self.assertFalse(isabs("foo"))
예제 #10
0
파일: model.py 프로젝트: tech-pi/filesystem
 def isabs(self):
     return fp.isabs(self.route)
예제 #11
0
파일: path.py 프로젝트: Hong-Xiang/dxfs
 def is_absolute(self) -> bool:
     return fp.isabs(self.s)
예제 #12
0
def deref_link(link_path, real_path):
    if isabs(real_path):
        return real_path
    else:
        basename, fname = pathsplit(link_path)
        return pathjoin(basename, real_path)