Lines Matching +full:sub +full:- +full:parts
26 Base class for en/de-coders, which are put into sequencers.
28 All have a name and arbitrary user-supplied auxiliary data
44 a no-op since the string type *is* the bytes type (<type
45 'unicode'>) is the unicode-ized string type).
51 to UTF-8 byte sequences when coding a _string_ type) and partly
61 return byte_sequence.decode('utf-8', 'surrogateescape')
66 return unicode_sequence.encode('utf-8', 'surrogateescape')
75 return string.encode('utf-8', 'surrogateescape')
79 "transform bytes to string - no-op in python2.7"
85 return string.encode('utf-8', 'surrogateescape')
89 "encode value <val> into a byte-string"
105 like a qid or stat instance -- those require a Sequence and
128 >>> e.pack({}, {}, -1)
131 SequenceError: failed while packing 'eggs'=-1
134 used out of the bytestring or byte-array argument. If there
151 converted to UTF-8 before being packed. Since this leaves
152 7-bit characters alone, these examples work in both py2k and
153 py3k. (Note: the UTF-8 encoding of u'\u1234' is
156 tries to display the utf-8 encoded data as a string.)
172 The byte length of the utf-8 data cannot exceed 65535 since
173 the encoding has the length as a 2-byte field (a la the
174 encoding for 'eggs' here). A too-long string produces
280 instance with all-None members.
308 that unpacking will leave un-selected items set to None (see
368 We take the name of repeat count variable, and a sub-coder
369 (Sequencer instance). For instance, we can en/de-code
371 name='wqid', in a Twalk en/de-code.
373 Note that we don't pack or unpack the repeat count itself --
386 When using noerror, the first sub-item that fails to decode
387 completely starts the None-s. Strings whose length fails to
398 As a special case, supplying None for the sub-coder
401 A too-short byte string is simply truncated!
415 def __init__(self, repeat, name, sub, aux=None): argument
419 self.sub = sub
424 self.repeat, self.name, self.sub)
426 self.repeat, self.name, self.sub, self.aux)
434 if self.sub is None:
437 parts = []
439 parts.extend(self.sub.apack(vdict, cdict, i))
440 return parts
449 if self.sub is None:
457 obj, offset = self.sub.unpack(vdict, cdict, bstring, offset,
481 sub-encoding.
484 (returns a list of parts) and a plain pack(). Users should
499 packed output, or are taken from the byte-string during
503 offset and/or omit verification that the entire byte-string
530 The incoming dictionary-like object may be pre-initialized
531 if you like; only sequences that decode are filled-in:
541 the object itself must have a len() and be index-able:
553 acquired the repeat-count variable's value by the time we hit
590 "add EncDec en/de-coder, conditional on cond"
601 self.dprint('skip %r - %r is False' % (code, cond))
605 self.dprint('pack %r - no cond or %r is True' % (code, cond))
631 self.dprint('skip %r - %r is False' % (code, cond))
635 self.dprint('unpack %r - no cond or %r is True' % (code, cond))
649 len(bstring) - offset))