/usr/lib/python3/dist-packages/twisted/spread/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/spread/__pycache__/banana.cpython-310.pyc (9382B)
o
b/ @ s d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ G d d
d
eZdd Zd
d ZdZdZdZdZdZdZdZdZdZdd Zdaed dZG dd dejej Z!e! Z"e"# e"$d dd Z%d d! Z&dS )"z
Banana -- s-exp based protocol.
Future Plans: This module is almost entirely stable. The same caveat applies
to it as applies to L{twisted.spread.jelly}, however. Read its future plans
for more details.
@author: Glyph Lefkowitz
N)BytesIO)protocol)styles)log) iterbytes)fullyQualifiedNamec @ s e Zd ZdS )BananaErrorN)__name__
__module____qualname__ r r 7/usr/lib/python3/dist-packages/twisted/spread/banana.pyr s r c C sN | dkr
|d d S | dksJ d| r%|t | d@ f | d? } | sd S d S )Nr z!can only encode positive integers )bytes)integerstreamr r r
int2b128 s r c C s6 d}d}t | D ]}t|}||| 7 }|dK }q|S )z
Convert an integer represented as a base 128 string into an L{int}.
@param st: The integer encoded in a byte string.
@type st: L{bytes}
@return: The integer value extracted from the byte string.
@rtype: L{int}
r r )r ord)steicharnr r r
b1282int) s
r c C s | a dS )ak
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.
@type limit: L{int}
@param limit: The number of bytes of prefix for banana to allow when
decoding.
N)
_PREFIX_LIMIT)limitr r r
setPrefixLimitK s
r' @ i
c @ s( e Zd ZdZddgZdZeZdd Zdd Z d d
Z
dd Zd
d Zdd Z
dZdd Zdd Zi ddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d
d?d@dAdBdCdDdEdFZi Ze D ]\ZZeee<