def __init__(self, casename=None, pretty=False, mountdir=None, allow_greedy=True, *args, **kwargs):
        """Instantiation of this class automatically indexes the mountpoints and loopbacks currently on the system.
        However, in the time between calling any ``find`` function and actually unmounting anything, the system may
        change. This can be especially painful when using :func:`preview_unmount`.

        :param str casename: The casename to be unmounted, see :class:`ImageParser`
        :param bool pretty: Whether the volumes were mounted using pretty mount, see :class:`Volume`
        :param str mountdir: The mountdir wheret he volumes were mounted, see :class:`Volume`
        :param bool allow_greedy: When none of the parameters are specified, by default, a greedy method will try to
                find as much possible mount points as possible.
        """

        self.mountpoints = {}
        self.loopbacks = {}

        # if any details provided, do not try to be greedy
        self.be_greedy = allow_greedy and not (casename or pretty or mountdir)

        mountdir = mountdir or tempfile.gettempdir()
        if casename:
            mountdir = os.path.join(mountdir, casename)

        if pretty:
            self.re_pattern = re.escape(mountdir) + r"/.*[0-9.]+-.+"
            self.glob_pattern = mountdir + "/*"
        else:
            self.re_pattern = re.escape(mountdir) + r"/im_[0-9.]+_.+"
            self.glob_pattern = mountdir + "/im_*"

        if casename:
            self.orig_re_pattern = re.escape(tempfile.gettempdir()) + r"/image_mounter_.*_" + re.escape(casename)
            self.orig_glob_pattern = tempfile.gettempdir() + "/image_mounter_*_" + casename
        else:
            self.orig_re_pattern = re.escape(tempfile.gettempdir()) + r"/image_mounter_.*"
            self.orig_glob_pattern = tempfile.gettempdir() + "/image_mounter_*"

        self._index_loopbacks()
        self._index_mountpoints()
def __init__ ( self , casename = None , pretty = False , mountdir = None , allow_greedy = True , * args , ** kwargs ) : self . mountpoints = { } self . loopbacks = { } self . be_greedy = allow_greedy and not ( casename or pretty or mountdir ) mountdir = mountdir or tempfile . gettempdir ( ) if casename : mountdir = os . path . join ( mountdir , casename ) if pretty : self . re_pattern = re . escape ( mountdir ) + r"/.*[0-9.]+-.+" self . glob_pattern = mountdir + "/*" else : self . re_pattern = re . escape ( mountdir ) + r"/im_[0-9.]+_.+" self . glob_pattern = mountdir + "/im_*" if casename : self . orig_re_pattern = re . escape ( tempfile . gettempdir ( ) ) + r"/image_mounter_.*_" + re . escape ( casename ) self . orig_glob_pattern = tempfile . gettempdir ( ) + "/image_mounter_*_" + casename else : self . orig_re_pattern = re . escape ( tempfile . gettempdir ( ) ) + r"/image_mounter_.*" self . orig_glob_pattern = tempfile . gettempdir ( ) + "/image_mounter_*" self . _index_loopbacks ( ) self . _index_mountpoints ( )
Instantiation of this class automatically indexes the mountpoints and loopbacks currently on the system.
        However, in the time between calling any ``find`` function and actually unmounting anything, the system may
        change. This can be especially painful when using :func:`preview_unmount`.

        :param str casename: The casename to be unmounted, see :class:`ImageParser`
        :param bool pretty: Whether the volumes were mounted using pretty mount, see :class:`Volume`
        :param str mountdir: The mountdir wheret he volumes were mounted, see :class:`Volume`
        :param bool allow_greedy: When none of the parameters are specified, by default, a greedy method will try to
                find as much possible mount points as possible.