diff options
Diffstat (limited to 'lib/git/utils.py')
| -rw-r--r-- | lib/git/utils.py | 34 | 
1 files changed, 3 insertions, 31 deletions
| diff --git a/lib/git/utils.py b/lib/git/utils.py index 343338a9..bd7cc0f3 100644 --- a/lib/git/utils.py +++ b/lib/git/utils.py @@ -13,7 +13,9 @@ from gitdb.util import (  	stream_copy,  	make_sha,   	FDStreamWrapper, -	LockedFD +	LockedFD,  +	file_contents_ro,  +	LazyMixin  	) @@ -274,36 +276,6 @@ class BlockingLockFile(LockFile):  		# END endless loop -class LazyMixin(object): -	""" -	Base class providing an interface to lazily retrieve attribute values upon  -	first access. If slots are used, memory will only be reserved once the attribute -	is actually accessed and retrieved the first time. All future accesses will  -	return the cached value as stored in the Instance's dict or slot. -	""" -	__slots__ = tuple() -	 -	def __getattr__(self, attr): -		""" -		Whenever an attribute is requested that we do not know, we allow it  -		to be created and set. Next time the same attribute is reqeusted, it is simply -		returned from our dict/slots. -		""" -		self._set_cache_(attr) -		# will raise in case the cache was not created -		return object.__getattribute__(self, attr) - -	def _set_cache_(self, attr): -		""" This method should be overridden in the derived class.  -		It should check whether the attribute named by attr can be created -		and cached. Do nothing if you do not know the attribute or call your subclass -		 -		The derived class may create as many additional attributes as it deems  -		necessary in case a git command returns more information than represented  -		in the single attribute.""" -		pass - -  class IterableList(list):  	"""  	List of iterable objects allowing to query an object by id or by named index:: | 
