コード例 #1
0
ファイル: rm.py プロジェクト: Brijen/trash-cli
class ListTrashinfos:
    def __init__(self, out):
        self.out = out
    def list_from_home_trashdir(self, trashdir_path):
        self.list_from_volume_trashdir(trashdir_path, '/')
    def list_from_volume_trashdir(self, trashdir_path, volume):
        self.volume = volume
        self.trashdir = TrashDir(FileSystemReader())
        self.trashdir.open(trashdir_path, volume)
        self.trashdir.each_trashinfo(self._report_original_location)
    def _report_original_location(self, trashinfo_path):
        file_reader = FileSystemReader()
        trashinfo = file_reader.contents_of(trashinfo_path)
        path = parse_path(trashinfo)
        complete_path = os.path.join(self.volume, path)
        self.out(complete_path, trashinfo_path)
コード例 #2
0
ファイル: rm.py プロジェクト: nestukh/trash-cli
class ListTrashinfos:
    def __init__(self, out):
        self.out = out

    def list_from_home_trashdir(self, trashdir_path):
        self.list_from_volume_trashdir(trashdir_path, '/')

    def list_from_volume_trashdir(self, trashdir_path, volume):
        self.volume = volume
        self.trashdir = TrashDir(FileSystemReader())
        self.trashdir.open(trashdir_path, volume)
        self.trashdir.each_trashinfo(self._report_original_location)

    def _report_original_location(self, trashinfo_path):
        file_reader = FileSystemReader()
        trashinfo = file_reader.contents_of(trashinfo_path)
        path = parse_path(trashinfo)
        complete_path = os.path.join(self.volume, path)
        self.out(complete_path, trashinfo_path)
コード例 #3
0
ファイル: test_trashdir.py プロジェクト: ahua/python
class TestTrashDir_finding_orphans:
    def test(self):
        self.fs.create_fake_file('/info/foo.trashinfo')

        self.find_orphan()

        assert_equals([], self.orphan_found)

    def test2(self):
        self.fs.create_fake_file('/files/foo')

        self.find_orphan()

        assert_equals(['/files/foo'], self.orphan_found)

    def setUp(self):
        self.orphan_found=[]
        self.fs = FakeFileSystem()
        self.trashdir=TrashDir(self.fs, '/', None)

    def find_orphan(self):
        self.trashdir.each_orphan(self.orphan_found.append)
コード例 #4
0
ファイル: test_trashdir.py プロジェクト: timgates42/trash-cli
class TestTrashDir_finding_orphans(unittest.TestCase):
    def test(self):
        self.fs.create_fake_file('/info/foo.trashinfo')

        self.find_orphan()

        assert [] == self.orphan_found

    def test2(self):
        self.fs.create_fake_file('/files/foo')

        self.find_orphan()

        assert ['/files/foo'] == self.orphan_found

    def setUp(self):
        self.orphan_found = []
        self.fs = FakeFileSystem()
        self.trashdir = TrashDir(self.fs)
        self.trashdir.open('/', None)

    def find_orphan(self):
        self.trashdir.each_orphan(self.orphan_found.append)
コード例 #5
0
ファイル: rm.py プロジェクト: timgates42/trash-cli
 def list_from_volume_trashdir(self, trashdir_path, volume):
     self.volume = volume
     trashdir = TrashDir(self.file_reader)
     trashdir.open(trashdir_path, volume)
     trashdir.each_trashinfo(self._report_original_location)
コード例 #6
0
ファイル: test_trashdir.py プロジェクト: timgates42/trash-cli
 def setUp(self):
     self.orphan_found = []
     self.fs = FakeFileSystem()
     self.trashdir = TrashDir(self.fs)
     self.trashdir.open('/', None)
コード例 #7
0
ファイル: rm.py プロジェクト: nestukh/trash-cli
 def list_from_volume_trashdir(self, trashdir_path, volume):
     self.volume = volume
     self.trashdir = TrashDir(FileSystemReader())
     self.trashdir.open(trashdir_path, volume)
     self.trashdir.each_trashinfo(self._report_original_location)
コード例 #8
0
ファイル: test_trashdir.py プロジェクト: Brijen/trash-cli
 def setUp(self):
     self.orphan_found=[]
     self.fs = FakeFileSystem()
     self.trashdir=TrashDir(self.fs)
     self.trashdir.open('/', None)
コード例 #9
0
ファイル: rm.py プロジェクト: Brijen/trash-cli
 def list_from_volume_trashdir(self, trashdir_path, volume):
     self.volume = volume
     self.trashdir = TrashDir(FileSystemReader())
     self.trashdir.open(trashdir_path, volume)
     self.trashdir.each_trashinfo(self._report_original_location)
コード例 #10
0
ファイル: rm.py プロジェクト: andreafrancia/trash-cli
 def list_from_volume_trashdir(self, trashdir_path, volume):
     self.volume = volume
     trashdir = TrashDir(self.file_reader)
     trashdir.open(trashdir_path, volume)
     trashdir.each_trashinfo(self._report_original_location)