def get_version(self, filename=None, version=-1, **kwargs):
        self.__ensure_index_filename()
        query = kwargs
        if filename is not None:
            query["filename"] = filename

        cursor = self.__files.find(query)
        if version < 0:
            skip = abs(version) - 1
            cursor.limit(-1).skip(skip).sort("uploadDate", DESCENDING)
        else:
            cursor.limit(-1).skip(version).sort("uploadDate", ASCENDING)
        try:
            grid_file = cursor.next()
            return GridOut(self.__collection, file_document=grid_file)
        except StopIteration:
            raise NoFile("no version %d for filename %r" % (version, filename))
Test generate missing command.
dataset/ETHPy150Open blynch/CloudMemeBackend/gridfs/__init__.py/GridFS.get_version--crossover with--dataset/ETHPy150Open pytest-dev/pytest-bdd/tests/generation/test_generate_missing.py/test_generate_missing