File indexing completed on 2024-04-28 15:53:57

0001 #!/usr/bin/env python2.7
0002 # -*- coding: utf-8 -*-
0003 """:synopsis: Convert Python objects to streams of bytes and back (with different
0004 constraints).
0005 
0006 
0007 This module contains functions that can read and write Python values in a binary
0008 format.  The format is specific to Python, but independent of machine
0009 architecture issues (e.g., you can write a Python value to a file on a PC,
0010 transport the file to a Sun, and read it back there).  Details of the format are
0011 undocumented on purpose; it may change between Python versions (although it
0012 rarely does). [#]_
0013 
0014 """
0015 """
0016 Indicates the format that the module uses. Version 0 is the historical format,
0017 version 1 (added in Python 2.4) shares interned strings and version 2 (added in
0018 Python 2.5) uses a binary format for floating point numbers. The current version
0019 is 2.
0020 
0021 """
0022 version = None
0023 def dump(value,file,version):
0024     """
0025     Write the value on the open file.  The value must be a supported type.  The
0026     file must be an open file object such as ``sys.stdout`` or returned by
0027     :func:`open` or :func:`os.popen`.  It must be opened in binary mode (``'wb'``
0028     or ``'w+b'``).
0029     
0030     If the value has (or contains an object that has) an unsupported type, a
0031     :exc:`ValueError` exception is raised --- but garbage data will also be written
0032     to the file.  The object will not be properly read back by :func:`load`.
0033     
0034     """
0035     pass
0036     
0037 def load(file):
0038     """
0039     Read one value from the open file and return it.  If no valid value is read
0040     (e.g. because the data has a different Python version's incompatible marshal
0041     format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`.  The
0042     file must be an open file object opened in binary mode (``'rb'`` or
0043     ``'r+b'``).
0044     
0045     """
0046     pass
0047     
0048 def dumps(value,version):
0049     """
0050     Return the string that would be written to a file by ``dump(value, file)``.  The
0051     value must be a supported type.  Raise a :exc:`ValueError` exception if value
0052     has (or contains an object that has) an unsupported type.
0053     
0054     """
0055     pass
0056     
0057 def loads(string):
0058     """
0059     Convert the string to a value.  If no valid value is found, raise
0060     :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`.  Extra characters in the
0061     string are ignored.
0062     
0063     
0064     In addition, the following constants are defined:
0065     
0066     """
0067     pass
0068