|
13 | 13 | stream_copy, |
14 | 14 | make_sha, |
15 | 15 | FDStreamWrapper, |
16 | | - LockedFD |
| 16 | + LockedFD, |
| 17 | + file_contents_ro, |
| 18 | + LazyMixin |
17 | 19 | ) |
18 | 20 |
|
19 | 21 |
|
@@ -274,36 +276,6 @@ def _obtain_lock(self): |
274 | 276 | # END endless loop |
275 | 277 |
|
276 | 278 |
|
277 | | -class LazyMixin(object): |
278 | | - """ |
279 | | - Base class providing an interface to lazily retrieve attribute values upon |
280 | | - first access. If slots are used, memory will only be reserved once the attribute |
281 | | - is actually accessed and retrieved the first time. All future accesses will |
282 | | - return the cached value as stored in the Instance's dict or slot. |
283 | | - """ |
284 | | - __slots__ = tuple() |
285 | | - |
286 | | - def __getattr__(self, attr): |
287 | | - """ |
288 | | - Whenever an attribute is requested that we do not know, we allow it |
289 | | - to be created and set. Next time the same attribute is reqeusted, it is simply |
290 | | - returned from our dict/slots. |
291 | | - """ |
292 | | - self._set_cache_(attr) |
293 | | - # will raise in case the cache was not created |
294 | | - return object.__getattribute__(self, attr) |
295 | | - |
296 | | - def _set_cache_(self, attr): |
297 | | - """ This method should be overridden in the derived class. |
298 | | - It should check whether the attribute named by attr can be created |
299 | | - and cached. Do nothing if you do not know the attribute or call your subclass |
300 | | - |
301 | | - The derived class may create as many additional attributes as it deems |
302 | | - necessary in case a git command returns more information than represented |
303 | | - in the single attribute.""" |
304 | | - pass |
305 | | - |
306 | | - |
307 | 279 | class IterableList(list): |
308 | 280 | """ |
309 | 281 | List of iterable objects allowing to query an object by id or by named index:: |
|
0 commit comments