1111)
1212
1313__all__ = ('OInfo' , 'OPackInfo' , 'ODeltaPackInfo' ,
14- 'OStream' , 'OPackStream' , 'ODeltaPackStream' ,
15- 'IStream' , 'InvalidOInfo' , 'InvalidOStream' )
14+ 'OStream' , 'OPackStream' , 'ODeltaPackStream' ,
15+ 'IStream' , 'InvalidOInfo' , 'InvalidOStream' )
1616
1717#{ ODB Bases
1818
19+
1920class OInfo (tuple ):
21+
2022 """Carries information about an object in an ODB, provding information
2123 about the binary sha of the object, the type_string as well as the uncompressed size
2224 in bytes.
@@ -62,6 +64,7 @@ def size(self):
6264
6365
6466class OPackInfo (tuple ):
67+
6568 """As OInfo, but provides a type_id property to retrieve the numerical type id, and
6669 does not include a sha.
6770
@@ -71,7 +74,7 @@ class OPackInfo(tuple):
7174 __slots__ = tuple ()
7275
7376 def __new__ (cls , packoffset , type , size ):
74- return tuple .__new__ (cls , (packoffset ,type , size ))
77+ return tuple .__new__ (cls , (packoffset , type , size ))
7578
7679 def __init__ (self , * args ):
7780 tuple .__init__ (self )
@@ -98,6 +101,7 @@ def size(self):
98101
99102
100103class ODeltaPackInfo (OPackInfo ):
104+
101105 """Adds delta specific information,
102106 Either the 20 byte sha which points to some object in the database,
103107 or the negative offset from the pack_offset, so that pack_offset - delta_info yields
@@ -115,6 +119,7 @@ def delta_info(self):
115119
116120
117121class OStream (OInfo ):
122+
118123 """Base for object streams retrieved from the database, providing additional
119124 information about the stream.
120125 Generally, ODB streams are read-only as objects are immutable"""
@@ -124,7 +129,6 @@ def __new__(cls, sha, type, size, stream, *args, **kwargs):
124129 """Helps with the initialization of subclasses"""
125130 return tuple .__new__ (cls , (sha , type , size , stream ))
126131
127-
128132 def __init__ (self , * args , ** kwargs ):
129133 tuple .__init__ (self )
130134
@@ -141,6 +145,7 @@ def stream(self):
141145
142146
143147class ODeltaStream (OStream ):
148+
144149 """Uses size info of its stream, delaying reads"""
145150
146151 def __new__ (cls , sha , type , size , stream , * args , ** kwargs ):
@@ -157,6 +162,7 @@ def size(self):
157162
158163
159164class OPackStream (OPackInfo ):
165+
160166 """Next to pack object information, a stream outputting an undeltified base object
161167 is provided"""
162168 __slots__ = tuple ()
@@ -176,13 +182,13 @@ def stream(self):
176182
177183
178184class ODeltaPackStream (ODeltaPackInfo ):
185+
179186 """Provides a stream outputting the uncompressed offset delta information"""
180187 __slots__ = tuple ()
181188
182189 def __new__ (cls , packoffset , type , size , delta_info , stream ):
183190 return tuple .__new__ (cls , (packoffset , type , size , delta_info , stream ))
184191
185-
186192 #{ Stream Reader Interface
187193 def read (self , size = - 1 ):
188194 return self [4 ].read (size )
@@ -194,6 +200,7 @@ def stream(self):
194200
195201
196202class IStream (list ):
203+
197204 """Represents an input content stream to be fed into the ODB. It is mutable to allow
198205 the ODB to record information about the operations outcome right in this instance.
199206
@@ -246,7 +253,6 @@ def _binsha(self):
246253
247254 binsha = property (_binsha , _set_binsha )
248255
249-
250256 def _type (self ):
251257 return self [1 ]
252258
@@ -275,6 +281,7 @@ def _set_stream(self, stream):
275281
276282
277283class InvalidOInfo (tuple ):
284+
278285 """Carries information about a sha identifying an object which is invalid in
279286 the queried database. The exception attribute provides more information about
280287 the cause of the issue"""
@@ -301,6 +308,7 @@ def error(self):
301308
302309
303310class InvalidOStream (InvalidOInfo ):
311+
304312 """Carries information about an invalid ODB stream"""
305313 __slots__ = tuple ()
306314
0 commit comments