OpenQuizz
Une application de gestion des contenus pédagogiques
gitdb.util Namespace Reference

Data Structures

class  _RandomAccessBytesIO
 
class  LazyMixin
 
class  LockedFD
 

Functions

def unpack_from (fmt, data, offset=0)
 
def remove (*args, **kwargs)
 
def byte_ord (b)
 
def make_sha (source=''.encode("ascii"))
 
def allocate_memory (size)
 
def file_contents_ro (fd, stream=False, allow_mmap=True)
 
def file_contents_ro_filepath (filepath, stream=False, allow_mmap=True, flags=0)
 
def sliding_ro_buffer (filepath, flags=0)
 
def to_hex_sha (sha)
 
def to_bin_sha (sha)
 

Variables

 mman
 
 hex_to_bin
 
 bin_to_hex
 
 ENOENT
 
 exists
 
 mkdir
 
 chmod
 
 isdir
 
 isfile
 
 rename
 
 dirname
 
 basename
 
 join
 
 read
 
 write
 
 close
 
 fsync
 

Function Documentation

◆ allocate_memory()

def gitdb.util.allocate_memory (   size)
:return: a file-protocol accessible memory block of the given size

◆ byte_ord()

def gitdb.util.byte_ord (   b)
Return the integer representation of the byte string.  This supports Python
3 byte arrays as well as standard strings.

◆ file_contents_ro()

def gitdb.util.file_contents_ro (   fd,
  stream = False,
  allow_mmap = True 
)
:return: read-only contents of the file represented by the file descriptor fd

:param fd: file descriptor opened for reading
:param stream: if False, random access is provided, otherwise the stream interface
    is provided.
:param allow_mmap: if True, its allowed to map the contents into memory, which
    allows large files to be handled and accessed efficiently. The file-descriptor
    will change its position if this is False

◆ file_contents_ro_filepath()

def gitdb.util.file_contents_ro_filepath (   filepath,
  stream = False,
  allow_mmap = True,
  flags = 0 
)
Get the file contents at filepath as fast as possible

:return: random access compatible memory of the given filepath
:param stream: see ``file_contents_ro``
:param allow_mmap: see ``file_contents_ro``
:param flags: additional flags to pass to os.open
:raise OSError: If the file could not be opened

**Note** for now we don't try to use O_NOATIME directly as the right value needs to be
shared per database in fact. It only makes a real difference for loose object
databases anyway, and they use it with the help of the ``flags`` parameter

◆ make_sha()

def gitdb.util.make_sha (   source = ''.encode("ascii"))
A python2.4 workaround for the sha/hashlib module fiasco

**Note** From the dulwich project 

◆ remove()

def gitdb.util.remove ( args,
**  kwargs 
)

◆ sliding_ro_buffer()

def gitdb.util.sliding_ro_buffer (   filepath,
  flags = 0 
)
:return: a buffer compatible object which uses our mapped memory manager internally
    ready to read the whole given filepath

◆ to_bin_sha()

def gitdb.util.to_bin_sha (   sha)

◆ to_hex_sha()

def gitdb.util.to_hex_sha (   sha)
:return: hexified version  of sha

◆ unpack_from()

def gitdb.util.unpack_from (   fmt,
  data,
  offset = 0 
)

Variable Documentation

◆ basename

basename

◆ bin_to_hex

bin_to_hex

◆ chmod

chmod

◆ close

close

◆ dirname

dirname

◆ ENOENT

ENOENT

◆ exists

exists

◆ fsync

fsync

◆ hex_to_bin

hex_to_bin

◆ isdir

isdir

◆ isfile

isfile

◆ join

join

◆ mkdir

mkdir

◆ mman

mman

◆ read

read

◆ rename

rename

◆ write

write