Beispiel #1
0
    def indexer(location):
        """Return a list of indexed files.

        :param location:
        :return:
        """

        _location = basic.real_full_path(location.encode("utf8"))
        if os.path.isdir(_location):
            r_walk = os.walk(_location)
            objects = list()
            for root_inx, inx in [(root, fls) for root, sfs, fls in r_walk]:
                for inode in inx:
                    object_path = basic.jpath(root=root_inx, inode=inode)
                    try:
                        objects.append(object_path.decode("utf-8"))
                    except UnicodeDecodeError:
                        objects.append(object_path)
            else:
                return objects

        elif os.path.isfile(_location):
            return [_location]
        else:
            raise turbo.NoFileProvided("No Path was Found for %s" % _location)
Beispiel #2
0
    def indexer(location):
        """Return a list of indexed files.

        :param location:
        :return:
        """

        _location = basic.real_full_path(location.encode("utf8"))
        if os.path.isdir(_location):
            r_walk = os.walk(_location)
            indexes = [(root, fls) for root, sfs, fls in r_walk]
            return [basic.jpath(root=inx[0], inode=inode) for inx in indexes for inode in inx[1]]
        elif os.path.isfile(_location):
            return [_location]
        else:
            raise turbo.NoFileProvided("No Path was Found for %s" % _location)
Beispiel #3
0
    def indexer(location):
        """Return a list of indexed files.

        :param location:
        :return:
        """

        _location = basic.real_full_path(location.encode('utf8'))
        if os.path.isdir(_location):
            r_walk = os.walk(_location)
            indexes = [(root, fls) for root, sfs, fls in r_walk]
            return [
                basic.jpath(root=inx[0], inode=inode) for inx in indexes
                for inode in inx[1]
            ]
        elif os.path.isfile(_location):
            return [_location]
        else:
            raise turbo.NoFileProvided('No Path was Found for %s' % _location)
Beispiel #4
0
    def indexer(location):
        """Return a list of indexed files.

        :param location:
        :return:
        """

        _location = basic.real_full_path(location.encode('utf8'))
        if os.path.isdir(_location):
            r_walk = os.walk(_location)
            objects = list()
            for root_inx, inx in [(root, fls) for root, sfs, fls in r_walk]:
                for inode in inx:
                    object_path = basic.jpath(root=root_inx, inode=inode)
                    objects.append(unicode(object_path.decode('utf-8')))
            else:
                return objects

        elif os.path.isfile(_location):
            return [_location]
        else:
            raise turbo.NoFileProvided('No Path was Found for %s' % _location)
 def test_real_full_path(self):
     obj = basic_utils.real_full_path(object='/test/dir')
     self.assertEqual(obj, '/test/dir')
 def test_real_full_path_relitive_path(self):
     os.environ['HOME'] = '/home/test'
     obj = basic_utils.real_full_path(object='~/test/dir')
     self.assertEqual(obj, '/home/test/test/dir')
Beispiel #7
0
 def test_real_full_path(self):
     obj = basic_utils.real_full_path(object='/test/dir')
     self.assertEqual(obj, '/test/dir')
Beispiel #8
0
 def test_real_full_path_relitive_path(self):
     os.environ['HOME'] = '/home/test'
     obj = basic_utils.real_full_path(object='~/test/dir')
     self.assertEqual(obj, '/home/test/test/dir')