# ``twisted`.`spread`.`banana``

module documentation
(source)

Banana -- s-exp based protocol.

Future Plans: This module is almost entirely stable. The same caveat applies to it as applies to `twisted.spread.jelly`, however. Read its future plans for more details.

Author
Glyph Lefkowitz

Class | `Banana` | `Banana` implements the Banana s-expression protocol, client and server.
Class | `BananaError` | Undocumented
Function | `b1282int` | Convert an integer represented as a base 128 string into an `int`.
Function | `decode` | Decode a banana-encoded string.
Function | `encode` | Encode a list s-expression.
Function | `int2b128` | Undocumented
Function | `setPrefixLimit` | Set the limit on the prefix length for all Banana connections established after this call.
Constant | `FLOAT` | Undocumented
Constant | `HIGH_BIT_SET` | Undocumented
Constant | `INT` | Undocumented
Constant | `LIST` | Undocumented
Constant | `LONGINT` | Undocumented
Constant | `LONGNEG` | Undocumented
Constant | `NEG` | Undocumented
Constant | `SIZE_LIMIT` | Undocumented
Constant | `STRING` | Undocumented
Constant | `VOCAB` | Undocumented
Constant | `_PREFIX_LIMIT` | Undocumented
Variable | `_i` | Undocumented

def b1282int(st): (source)
Convert an integer represented as a base 128 string into an `int`.

Parameters
st:`bytes` | The integer encoded in a byte string.
Returns
`int` | The integer value extracted from the byte string.

def decode(st): (source)
Decode a banana-encoded string.
def encode(lst): (source)
Encode a list s-expression.
def int2b128(integer, stream): (source)

Undocumented

def setPrefixLimit(limit): (source)

Set the limit on the prefix length for all Banana connections established after this call.

The prefix length limit determines how many bytes of prefix a banana decoder will allow before rejecting a potential object as too large.

Parameters
limit:`int` | The number of bytes of prefix for banana to allow when decoding.

FLOAT: `bytes` = (source)

Undocumented

Value

    b'\x84'

HIGH_BIT_SET: `bytes` = (source)

Undocumented

Value

    b'\x80'

INT: `bytes` = (source)

Undocumented

Value

    b'\x81'

LIST: `bytes` = (source)

Undocumented

Value

    b'\x80'

LONGINT: `bytes` = (source)

Undocumented

Value

    b'\x85'

LONGNEG: `bytes` = (source)

Undocumented

Value

    b'\x86'

NEG: `bytes` = (source)

Undocumented

Value

    b'\x83'

SIZE_LIMIT = (source)

Undocumented

Value

    640*1024

STRING: `bytes` = (source)

Undocumented

Value

    b'\x82'

VOCAB: `bytes` = (source)

Undocumented

Value

    b'\x87'

_PREFIX_LIMIT = (source)

Undocumented

Value

    None

_i = (source)

Undocumented