File: //usr/lib/python3/dist-packages/mercurial/__pycache__/httppeer.cpython-310.pyc
o
�]Lb�R � @ s( d dl mZ d dlZd dlZd dlZd dlZd dlZddlmZ ddl m
Z
ddlmZm
Z
mZm Z mZmZmZmZ ddlmZ ejZejZejZdd � ZG d
d� de�Zdd
� Zdd� Zdd� ZG dd� de
j�Z dd� Z!G dd� dej"�Z#G dd� de j$j%�Z&dd� Z'dej(fdd�Z)d dd�Z*dS )!� )�absolute_importN� )�_)�getattr)�bundle2�error�httpconnection�pycompat�statichttprepo�url�util�wireprotov1peer)�urlutilc
C sz t �|�d }|t|d � td� }g }d}t �dt| �|�D ]}|d7 }|�|t|� t �| ||| � �f� q |S )ac Encode a string value into multiple HTTP headers.
``value`` will be encoded into 1 or more HTTP headers with the names
``header-<N>`` where ``<N>`` is an integer starting at 1. Each header
name + value will be at most ``limit`` bytes long.
Returns an iterable of 2-tuples consisting of header names and
values as native strings.
z-%s�000s :
r r )r �strurl�len�xrange�append�str)�value�header�limit�fmt�valuelen�result�n�i� r �4/usr/lib/python3/dist-packages/mercurial/httppeer.py�encodevalueinheaders$ s *r c @ s8 e Zd Zdd� Zedd� �Zd
dd�Zejfdd �Z dS )�
_multifilec G s6 |D ]}t �|d�stdt|�|��q|| _d| _d S )N� lengthsO _multifile only supports file objects that have a length but this one does not:r )r �safehasattr�
ValueError�type� _fileobjs�_index)�self�fileobjs�fr r r �__init__B s ��
z_multifile.__init__c C s t dd� | jD ��S )Nc s s � | ]}|j V qd S �N)�length��.0r) r r r � <genexpr>P s � z$_multifile.length.<locals>.<genexpr>)�sumr% �r'