File: //usr/lib/python3/dist-packages/mercurial/__pycache__/commandserver.cpython-310.pyc
o
�]Lb\b � @ sl d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z z d dl
Z
e
j W n ey> ddl
mZ
Y nw ddlmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlmZmZ G d d
� d
e�ZG dd� de�Z G d
d� de�Z!ddd� iZ"dd� Z#G dd� de�Z$d"dd�Z%G dd� de�Z&dd� Z'dd� Z(G dd� de�Z)G d d!� d!e�Z*dS )#� )�absolute_importN� )�
selectors2)�_)�getattr)�encoding�error�loggingutil�pycompat� repocache�util�vfs)�cborutil�procutilc @ s4 e Zd ZdZdd� Zedd� �Zdd� Zdd � Zd
S )�channeledoutputz^
Write data to out in the following format:
data length (unsigned int),
data
c C � || _ || _d S �N)�out�channel)�selfr r � r �9/usr/lib/python3/dist-packages/mercurial/commandserver.py�__init__3 �
zchanneledoutput.__init__c C �
d| j S �Ns <%c-channel>�r �r r r r �name7 �
zchanneledoutput.namec C s6 |sd S | j �t�d| jt|��| � | j �� d S )N� >cI)r �write�struct�packr �len�flush)r �datar r r r! ; s zchanneledoutput.writec C � |dv rt |��t| j|�S �N)�isatty�fileno�tell�seek)�AttributeErrorr r �r �attrr r r �__getattr__B � zchanneledoutput.__getattr__N) �__name__�
__module__�__qualname__�__doc__r �propertyr r! r0 r r r r r + s
r c @ s, e Zd ZdZdZdd� Zdd� Zdd� Zd S )
�channeledmessagea
Write encoded message and metadata to out in the following format:
data length (unsigned int),
encoded message and metadata, as a flat key-value dict.
Each message should have 'type' attribute. Messages of unknown type
should be ignored.
Tc C s t ||�| _|| _|| _d S r )r �_coutr � _encodefn)r r r �
encodename�encodefnr r r r V s
zchanneledmessage.__init__c K s0 t �|�}|d ur
||d<