Lines Matching +full:num +full:- +full:strings

26     Base class for en/de-coders, which are put into sequencers.
28 All have a name and arbitrary user-supplied auxiliary data
42 convert strings to bytes and vice versa, as reversibly as
44 a no-op since the string type *is* the bytes type (<type
45 'unicode'>) is the unicode-ized string type).
50 These are partly for internal use (all strings get converted
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
148 Note that strings can be provided as regular strings, byte
149 strings (same as regular strings in py2k), or Unicode strings
150 (same as regular strings in py3k). Unicode strings will be
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
182 Unpacking strings produces byte arrays. (Of course,
194 You may use e.b2s() to conver them to unicode strings in py3k,
196 anything in py3k, since py2k strings *are* bytes, so it's
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!
432 num = vdict[self.repeat]
433 assert num == len(val)
444 num = vdict[self.repeat]
445 if num is None and noerror:
446 num = 0
448 assert num >= 0
450 nexto = offset + num
456 for i in range(num):
481 sub-encoding.
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))