Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/bindings/swig/python/core.py view on Meta::CPAN
self.__dict__["_parent_pool"] = \
parent_pool or libsvn.core.application_pool;
if self.__dict__["_parent_pool"]:
self.__dict__["_is_valid"] = weakref.ref(
self.__dict__["_parent_pool"]._is_valid)
def assert_valid(self):
"""Assert that this object is using valid pool memory"""
if "_is_valid" in self.__dict__:
assert self.__dict__["_is_valid"](), "Variable has already been deleted"
def __getattr__(self, name):
"""Get an attribute from this object"""
self.assert_valid()
value = _swig_getattr(self, self.__class__, name)
members = self.__dict__.get("_members")
if members is not None:
_copy_metadata_deep(value, members.get(name))
_assert_valid_deep(value)
return value
def __setattr__(self, name, value):
"""Set an attribute on this object"""
self.assert_valid()
self.__dict__.setdefault("_members",{})[name] = value
return _swig_setattr(self, self.__class__, name, value)
def __init__(self):
"""__init__(svn_log_entry_t self) -> svn_log_entry_t"""
this = _core.new_svn_log_entry_t()
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _core.delete_svn_log_entry_t
__del__ = lambda self : None;
svn_log_entry_t_swigregister = _core.svn_log_entry_t_swigregister
svn_log_entry_t_swigregister(svn_log_entry_t)
def svn_log_entry_create(*args):
"""svn_log_entry_create(apr_pool_t pool) -> svn_log_entry_t"""
return _core.svn_log_entry_create(*args)
def svn_log_entry_dup(*args):
"""svn_log_entry_dup(svn_log_entry_t log_entry, apr_pool_t pool) -> svn_log_entry_t"""
return _core.svn_log_entry_dup(*args)
SVN_STREAM_CHUNK_SIZE = _core.SVN_STREAM_CHUNK_SIZE
SVN__STREAM_CHUNK_SIZE = _core.SVN__STREAM_CHUNK_SIZE
def svn_mime_type_validate(*args):
"""svn_mime_type_validate(char const * mime_type, apr_pool_t pool) -> svn_error_t"""
return _core.svn_mime_type_validate(*args)
def svn_mime_type_is_binary(*args):
"""svn_mime_type_is_binary(char const * mime_type) -> svn_boolean_t"""
return _core.svn_mime_type_is_binary(*args)
class svn_lock_t:
"""Proxy of C svn_lock_t struct"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, svn_lock_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, svn_lock_t, name)
__repr__ = _swig_repr
__swig_setmethods__["path"] = _core.svn_lock_t_path_set
__swig_getmethods__["path"] = _core.svn_lock_t_path_get
__swig_setmethods__["token"] = _core.svn_lock_t_token_set
__swig_getmethods__["token"] = _core.svn_lock_t_token_get
__swig_setmethods__["owner"] = _core.svn_lock_t_owner_set
__swig_getmethods__["owner"] = _core.svn_lock_t_owner_get
__swig_setmethods__["comment"] = _core.svn_lock_t_comment_set
__swig_getmethods__["comment"] = _core.svn_lock_t_comment_get
__swig_setmethods__["is_dav_comment"] = _core.svn_lock_t_is_dav_comment_set
__swig_getmethods__["is_dav_comment"] = _core.svn_lock_t_is_dav_comment_get
__swig_setmethods__["creation_date"] = _core.svn_lock_t_creation_date_set
__swig_getmethods__["creation_date"] = _core.svn_lock_t_creation_date_get
__swig_setmethods__["expiration_date"] = _core.svn_lock_t_expiration_date_set
__swig_getmethods__["expiration_date"] = _core.svn_lock_t_expiration_date_get
def set_parent_pool(self, parent_pool=None):
"""Create a new proxy object for svn_lock_t"""
import libsvn.core, weakref
self.__dict__["_parent_pool"] = \
parent_pool or libsvn.core.application_pool;
if self.__dict__["_parent_pool"]:
self.__dict__["_is_valid"] = weakref.ref(
self.__dict__["_parent_pool"]._is_valid)
def assert_valid(self):
"""Assert that this object is using valid pool memory"""
if "_is_valid" in self.__dict__:
assert self.__dict__["_is_valid"](), "Variable has already been deleted"
def __getattr__(self, name):
"""Get an attribute from this object"""
self.assert_valid()
value = _swig_getattr(self, self.__class__, name)
members = self.__dict__.get("_members")
if members is not None:
_copy_metadata_deep(value, members.get(name))
_assert_valid_deep(value)
return value
def __setattr__(self, name, value):
"""Set an attribute on this object"""
self.assert_valid()
src/subversion/subversion/bindings/swig/python/core.py view on Meta::CPAN
def valid(self):
"""Is this object valid?"""
return self._is_valid()
def assert_valid(self):
"""Assert that this object is still valid"""
assert self.valid(), "This object has already been destroyed"
def _unwrap(self):
"""Return underlying SWIG object"""
self.assert_valid()
return self.this
def _mark_weakpool_invalid(weakpool):
if weakpool and weakpool() and hasattr(weakpool(), "_is_valid"):
del weakpool()._is_valid
class apr_pool_t:
"""Proxy of C apr_pool_t struct"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, apr_pool_t, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, apr_pool_t, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
def set_parent_pool(self, parent_pool=None):
"""Create a new memory pool"""
global application_pool
try:
application_pool_lock.acquire()
self._parent_pool = parent_pool or application_pool
self._mark_valid()
# Protect important functions from GC
self._apr_pool_destroy = _core.apr_pool_destroy
self._svn_swig_py_clear_application_pool = \
_core.svn_swig_py_clear_application_pool
# If we are an application-level pool,
# then set this pool to be the application-level pool
if not self._parent_pool:
svn_swig_py_set_application_pool(self, self)
application_pool = self
finally:
application_pool_lock.release()
def valid(self):
"""Check whether this memory pool and its parents
are still valid"""
return hasattr(self,"_is_valid")
def assert_valid(self):
"""Assert that this memory_pool is still valid."""
assert self.valid(), "This pool has already been destroyed"
def clear(self):
"""Clear embedded memory pool. Invalidate all subpools."""
pool = self._parent_pool
apr_pool_clear(self)
self.set_parent_pool(pool)
def destroy(self):
"""Destroy embedded memory pool. If you do not destroy
the memory pool manually, Python will destroy it
automatically."""
global application_pool
self.assert_valid()
is_application_pool = not self._parent_pool
# Destroy pool
self._apr_pool_destroy(self)
# Clear application pool if necessary
if is_application_pool:
application_pool = None
self._svn_swig_py_clear_application_pool()
# Mark self as invalid
if hasattr(self, "_parent_pool"):
del self._parent_pool
if hasattr(self, "_is_valid"):
del self._is_valid
def __del__(self):
"""Automatically destroy memory pools, if necessary"""
if self.valid():
self.destroy()
def _mark_valid(self):
"""Mark pool as valid"""
self._weakparent = None
if self._parent_pool:
import weakref
# Make sure that the parent object is valid
self._parent_pool.assert_valid()
# Refer to self using a weakrefrence so that we don't
# create a reference cycle
weakself = weakref.ref(self)
# Set up callbacks to mark pool as invalid when parents
# are destroyed
self._weakparent = weakref.ref(self._parent_pool._is_valid,
lambda x: _mark_weakpool_invalid(weakself))
# Mark pool as valid
self._is_valid = lambda: 1
def _wrap(self, obj):
"""Mark a SWIG object as owned by this pool"""
self.assert_valid()
if hasattr(obj, "set_parent_pool"):
( run in 0.429 second using v1.01-cache-2.11-cpan-efa8479b9fe )