Module dump
source code
# DESCRIPTION: # load/save a data to file by dumping its structure
Copyright (C) 2007-2009 Fabio Erculiani
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
dumpobj(name,
my_object,
complete_path=False,
ignore_exceptions=True)
Dump object to file |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
D_EXT = '.dmp'
|
|
|
D_DIR = '/var/lib/entropy/caches/'
|
|
|
E_GID = 1000
|
dumpobj(name,
my_object,
complete_path=False,
ignore_exceptions=True)
| source code
|
Dump object to file
@param name -- name of the object @param my_object -- object to dump
@param complete_path -- name is a complete path @param ignore_exceptions
-- ignore exceptions
@return None
|
|
Serialize object to ser_f (file)
@param myobj -- object to serialize @type myobj -- any picklable
object @param ser_f -- file handle to write to @type ser_f -- file object
@param do_seek -- move the file cursor to the beginning @type do_seek --
bool @return file object where data is stored to
|
|
Unserialize file to object (file)
@param serial_f -- file object to read the stream to @type serial_f --
file object @return object reconstructed
|
|
Unserialize pickle string to object
@param mystring -- data stream in string form to reconstruct @type
mystring -- basestring @return reconstructed object
|
|
Serialize object to string
@param myobj -- object to serialize @type myobj -- any picklable
object @return serialized string
|
Load object from a file
@param name -- name of the object to load
@type name -- basestring
@param complete_path -- name is a complete serialized
object file path to load
@type complete_path -- basestring
@return object or None
|
|
Get dumped object mtime
@param name -- object name @type name -- basestring @return mtime --
integer
|
|
Remove cached object through its object name
@param name -- object name @type name -- basestring @return bool --
removed or not
|