Your IP : 216.73.216.213
B
:��].0 � @ s6 d Z ddlmZmZ ddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z
ddlmZmZmZ dd lmZ G d
d� de�Zdd
� Zdd� Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Z ed�Z!dd� Z"da#e"d� dZ$G dd� de j%ej&�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
� )�absolute_import�divisionN)�BytesIO)�protocol)�styles)�log)� iterbytes�long� _bytesChr)�fullyQualifiedNamec @ s e Zd ZdS )�BananaErrorN)�__name__�
__module__�__qualname__� r r �H/opt/alt/python37/lib64/python3.7/site-packages/twisted/spread/banana.pyr s r c C sN | dkr|t d�� d S | dks(td��x | rH|t | d@ �� | d? } q*W d S )Nr z!can only encode positive integers� � )�chr�AssertionError)�integer�streamr r r �int2b128 s r c C s: d}d}x,t | �D ] }t|�}||| 7 }|dK }qW |S )a
Convert an integer represented as a base 128 string into an L{int} or
L{long}.
@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} or L{long}
� r r )r �ord)�st�e�i�char�nr r r �b1282int'