/usr/lib/python2.7/dist-packages/trashcli/fstab.py is in trash-cli 0.12.9.14-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | import os
def volume_of(path) :
return Fstab().volume_of(path)
class AbstractFstab(object):
def __init__(self, ismount):
self.ismount = ismount
def volume_of(self, path):
volume_of = VolumeOf(ismount=self.ismount)
return volume_of(path)
def mount_points(self):
return self.ismount.mount_points()
class Fstab(AbstractFstab):
def __init__(self):
AbstractFstab.__init__(self, OsIsMount())
class FakeFstab:
def __init__(self):
self.ismount = FakeIsMount()
self.volume_of = VolumeOf(ismount = self.ismount)
self.volume_of.abspath = os.path.normpath
def mount_points(self):
return self.ismount.mount_points()
def volume_of(self, path):
volume_of = VolumeOf(ismount=self.ismount)
return volume_of(path)
def add_mount(self, path):
self.ismount.add_mount(path)
from trashcli.list_mount_points import mount_points as os_mount_points
class OsIsMount:
def __call__(self, path):
return os.path.ismount(path)
def mount_points(self):
return os_mount_points()
class FakeIsMount:
def __init__(self):
self.fakes = set(['/'])
def add_mount(self, path):
self.fakes.add(path)
def __call__(self, path):
if path == '/':
return True
path = os.path.normpath(path)
if path in self.fakes:
return True
return False
def mount_points(self):
return self.fakes.copy()
class VolumeOf:
def __init__(self, ismount):
self._ismount = ismount
import os
self.abspath = os.path.abspath
def __call__(self, path):
path = self.abspath(path)
while path != os.path.dirname(path):
if self._ismount(path):
break
path = os.path.dirname(path)
return path
|