File: //usr/lib/python3/dist-packages/mercurial/__pycache__/wireprotov1peer.cpython-310.pyc
o
�]LbV � @ s� d dl mZ d dlZd dlZddlmZ ddlmZ ddlm Z m
Z
ddlmZm
ZmZmZmZmZmZmZ ddlmZmZ dd lmZ ejZd
d� Zdd
� ZG dd� dejj�Ze� ej!�G dd� de"��Z#e� ej$ej%�G dd� dej&��Z'dS )� )�absolute_importN� )�_)�bin)�getattr�setattr)�bundle2�changegroup�encoding�error�pushkey�pycompat�util�wireprototypes)�
repositoryr )�hashutilc s* � fdd�}t |d� � t |d� j� |S )a� annotation for batchable methods
Such methods must implement a coroutine as follows:
@batchable
def sample(self, one, two=None):
# Build list of encoded arguments suitable for your wire protocol:
encoded_args = [('one', encode(one),), ('two', encode(two),)]
# Return it, along with a function that will receive the result
# from the batched request.
return encoded_args, decode
The decorator returns a function which wraps this coroutine as a plain
method, but adds the original method as an attribute called "batchable",
which is used by remotebatch to split the call into separate encoding and
decoding phases.
c sB � | i |��\}}|s
|S | d }t �� j�}|�||�}||�S )Nr )r
�bytesurl�__name__�
_submitone)�args�opts�encoded_args_or_res�decode�self�cmd�encoded_res��f� �;/usr/lib/python3/dist-packages/mercurial/wireprotov1peer.py�plain9 s zbatchable.<locals>.plain� batchabler )r r )r r r r r r! &