mirror of
https://github.com/samba-team/samba.git
synced 2025-11-07 12:23:51 +03:00
214 lines
6.5 KiB
Python
214 lines
6.5 KiB
Python
# This file was automatically generated by SWIG (http://www.swig.org).
|
|
# Version 1.3.33
|
|
#
|
|
# Don't modify this file, modify the SWIG interface instead.
|
|
|
|
import _tdb
|
|
import new
|
|
new_instancemethod = new.instancemethod
|
|
try:
|
|
_swig_property = property
|
|
except NameError:
|
|
pass # Python < 2.2 doesn't have 'property'.
|
|
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
|
if (name == "thisown"): return self.this.own(value)
|
|
if (name == "this"):
|
|
if type(value).__name__ == 'PySwigObject':
|
|
self.__dict__[name] = value
|
|
return
|
|
method = class_type.__swig_setmethods__.get(name,None)
|
|
if method: return method(self,value)
|
|
if (not static) or hasattr(self,name):
|
|
self.__dict__[name] = value
|
|
else:
|
|
raise AttributeError("You cannot add attributes to %s" % self)
|
|
|
|
def _swig_setattr(self,class_type,name,value):
|
|
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
|
|
|
def _swig_getattr(self,class_type,name):
|
|
if (name == "thisown"): return self.this.own()
|
|
method = class_type.__swig_getmethods__.get(name,None)
|
|
if method: return method(self)
|
|
raise AttributeError,name
|
|
|
|
def _swig_repr(self):
|
|
try: strthis = "proxy of " + self.this.__repr__()
|
|
except: strthis = ""
|
|
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
|
|
|
|
import types
|
|
try:
|
|
_object = types.ObjectType
|
|
_newclass = 1
|
|
except AttributeError:
|
|
class _object : pass
|
|
_newclass = 0
|
|
del types
|
|
|
|
|
|
def _swig_setattr_nondynamic_method(set):
|
|
def set_attr(self,name,value):
|
|
if (name == "thisown"): return self.this.own(value)
|
|
if hasattr(self,name) or (name == "this"):
|
|
set(self,name,value)
|
|
else:
|
|
raise AttributeError("You cannot add attributes to %s" % self)
|
|
return set_attr
|
|
|
|
|
|
REPLACE = _tdb.REPLACE
|
|
INSERT = _tdb.INSERT
|
|
MODIFY = _tdb.MODIFY
|
|
DEFAULT = _tdb.DEFAULT
|
|
CLEAR_IF_FIRST = _tdb.CLEAR_IF_FIRST
|
|
INTERNAL = _tdb.INTERNAL
|
|
NOLOCK = _tdb.NOLOCK
|
|
NOMMAP = _tdb.NOMMAP
|
|
CONVERT = _tdb.CONVERT
|
|
BIGENDIAN = _tdb.BIGENDIAN
|
|
TDB_SUCCESS = _tdb.TDB_SUCCESS
|
|
TDB_ERR_CORRUPT = _tdb.TDB_ERR_CORRUPT
|
|
TDB_ERR_IO = _tdb.TDB_ERR_IO
|
|
TDB_ERR_LOCK = _tdb.TDB_ERR_LOCK
|
|
TDB_ERR_OOM = _tdb.TDB_ERR_OOM
|
|
TDB_ERR_EXISTS = _tdb.TDB_ERR_EXISTS
|
|
TDB_ERR_NOLOCK = _tdb.TDB_ERR_NOLOCK
|
|
TDB_ERR_LOCK_TIMEOUT = _tdb.TDB_ERR_LOCK_TIMEOUT
|
|
TDB_ERR_NOEXIST = _tdb.TDB_ERR_NOEXIST
|
|
TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL
|
|
TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY
|
|
class tdb(object):
|
|
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
|
|
def __init__(self): raise AttributeError, "No constructor defined"
|
|
__repr__ = _swig_repr
|
|
__swig_destroy__ = _tdb.delete_tdb
|
|
def __str__(self):
|
|
return self.name()
|
|
|
|
|
|
def __getitem__(self, key):
|
|
result = self.get(key)
|
|
if result is None:
|
|
raise KeyError, '%s: %s' % (key, self.errorstr())
|
|
return result
|
|
|
|
def __setitem__(self, key, item):
|
|
if self.store(key, item) == -1:
|
|
raise IOError, self.errorstr()
|
|
|
|
def __delitem__(self, key):
|
|
if not self.exists(key):
|
|
raise KeyError, '%s: %s' % (key, self.errorstr())
|
|
self.delete(key)
|
|
|
|
def __contains__(self, key):
|
|
return self.exists(key) != 0
|
|
|
|
def has_key(self, key):
|
|
return self.exists(key) != 0
|
|
|
|
def fetch_uint32(self, key):
|
|
data = self.get(key)
|
|
if data is None:
|
|
return None
|
|
import struct
|
|
return struct.unpack("<L", data)[0]
|
|
|
|
def fetch_int32(self, key):
|
|
data = self.get(key)
|
|
if data is None:
|
|
return None
|
|
import struct
|
|
return struct.unpack("<l", data)[0]
|
|
|
|
|
|
class TdbIterator:
|
|
def __init__(self, tdb):
|
|
self.tdb = tdb
|
|
self.key = None
|
|
|
|
def __iter__(self):
|
|
return self
|
|
|
|
def next(self):
|
|
if self.key is None:
|
|
self.key = self.tdb.firstkey()
|
|
if self.key is None:
|
|
raise StopIteration
|
|
return self.key
|
|
else:
|
|
self.key = self.tdb.nextkey(self.key)
|
|
if self.key is None:
|
|
raise StopIteration
|
|
return self.key
|
|
|
|
def __iter__(self):
|
|
return self.TdbIterator(self)
|
|
|
|
|
|
|
|
def keys(self):
|
|
return [k for k in iter(self)]
|
|
|
|
def values(self):
|
|
return [self[k] for k in iter(self)]
|
|
|
|
def items(self):
|
|
return [(k, self[k]) for k in iter(self)]
|
|
|
|
def __len__(self):
|
|
return len(self.keys())
|
|
|
|
def clear(self):
|
|
for k in iter(self):
|
|
del(self[k])
|
|
|
|
def iterkeys(self):
|
|
for k in iter(self):
|
|
yield k
|
|
|
|
def itervalues(self):
|
|
for k in iter(self):
|
|
yield self[k]
|
|
|
|
def iteritems(self):
|
|
for k in iter(self):
|
|
yield (k, self[k])
|
|
|
|
|
|
|
|
tdb.error = new_instancemethod(_tdb.tdb_error,None,tdb)
|
|
tdb.close = new_instancemethod(_tdb.tdb_close,None,tdb)
|
|
tdb.append = new_instancemethod(_tdb.tdb_append,None,tdb)
|
|
tdb.errorstr = new_instancemethod(_tdb.tdb_errorstr,None,tdb)
|
|
tdb.get = new_instancemethod(_tdb.tdb_get,None,tdb)
|
|
tdb.delete = new_instancemethod(_tdb.tdb_delete,None,tdb)
|
|
tdb.store = new_instancemethod(_tdb.tdb_store,None,tdb)
|
|
tdb.exists = new_instancemethod(_tdb.tdb_exists,None,tdb)
|
|
tdb.firstkey = new_instancemethod(_tdb.tdb_firstkey,None,tdb)
|
|
tdb.nextkey = new_instancemethod(_tdb.tdb_nextkey,None,tdb)
|
|
tdb.lock_all = new_instancemethod(_tdb.tdb_lock_all,None,tdb)
|
|
tdb.unlock_all = new_instancemethod(_tdb.tdb_unlock_all,None,tdb)
|
|
tdb.read_lock_all = new_instancemethod(_tdb.tdb_read_lock_all,None,tdb)
|
|
tdb.read_unlock_all = new_instancemethod(_tdb.tdb_read_unlock_all,None,tdb)
|
|
tdb.reopen = new_instancemethod(_tdb.tdb_reopen,None,tdb)
|
|
tdb.transaction_start = new_instancemethod(_tdb.tdb_transaction_start,None,tdb)
|
|
tdb.transaction_commit = new_instancemethod(_tdb.tdb_transaction_commit,None,tdb)
|
|
tdb.transaction_cancel = new_instancemethod(_tdb.tdb_transaction_cancel,None,tdb)
|
|
tdb.transaction_recover = new_instancemethod(_tdb.tdb_transaction_recover,None,tdb)
|
|
tdb.hash_size = new_instancemethod(_tdb.tdb_hash_size,None,tdb)
|
|
tdb.map_size = new_instancemethod(_tdb.tdb_map_size,None,tdb)
|
|
tdb.get_flags = new_instancemethod(_tdb.tdb_get_flags,None,tdb)
|
|
tdb.set_max_dead = new_instancemethod(_tdb.tdb_set_max_dead,None,tdb)
|
|
tdb.name = new_instancemethod(_tdb.tdb_name,None,tdb)
|
|
tdb_swigregister = _tdb.tdb_swigregister
|
|
tdb_swigregister(tdb)
|
|
|
|
def Tdb(*args, **kwargs):
|
|
val = _tdb.new_Tdb(*args, **kwargs)
|
|
return val
|
|
|
|
|
|
|