✏️ 正在编辑: encoder.cpython-36.opt-1.pyc
路径:
/usr/lib/python3.6/site-packages/google/protobuf/internal/__pycache__/encoder.cpython-36.opt-1.pyc
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
3 ���h~o � @ s� d Z dZddlZddlZddlmZ dZe Zdd� Zdd � Z d d� Z dd � Zdd� Zdd� Z ee � Z ZZee� ZZee ej� ZZe d� Z ZZe d� Z ZZe d�Zdd� Zdd� Zdd� Zdd� Z dd� Z!dd � Z"d!d"� Z#d#d$� Z$e#� Z%e$� Z&d%d&� Z'd'd(� Z(d)d*� Z)d+d,� Z*d-d.� Z+d/d0� Z,e)ej-e&e � Z. Z/Z0e)ej-e%e� Z1Z2e*ej-e%eej� Z3Z4e+ej5d1�Z6e+ej7d2�Z8e+ej5d3�Z9e+ej7d4�Z:e,ej5d5�Z;e,ej7d6�Z<d7d8� Z=d9d:� Z>d;d<� Z?d=d>� Z@d?d@� ZAdAdB� ZBdCdD� ZCdS )Ea� Code for encoding protocol message primitives. Contains the logic for encoding every logical protocol field type into one of the 5 physical wire types. This code is designed to push the Python interpreter's performance to the limits. The basic idea is that at startup time, for every field (i.e. every FieldDescriptor) we construct two functions: a "sizer" and an "encoder". The sizer takes a value of this field's type and computes its byte size. The encoder takes a writer function and a value. It encodes the value into byte strings and invokes the writer function to write those strings. Typically the writer function is the write() method of a BytesIO. We try to do as much work as possible when constructing the writer and the sizer rather than when calling them. In particular: * We copy any needed global functions to local variables, so that we do not need to do costly global table lookups at runtime. * Similarly, we try to do any attribute lookups at startup time if possible. * Every field's tag is encoded to bytes at startup, since it can't change at runtime. * Whatever component of the field size we can compute at startup, we do. * We *avoid* sharing code if doing so would make the code slower and not sharing does not burden us too much. For example, encoders for repeated fields do not just call the encoders for singular fields in a loop because this would add an extra function call overhead for every loop iteration; instead, we manually inline the single-value encoder into the loop. * If a Python function lacks a return statement, Python actually generates instructions to pop the result of the last statement off the stack, push None onto the stack, and then return that. If we really don't care what value is returned, then we can save two instructions by returning the result of the last statement. It looks funny but it helps. * We assume that type and bounds checking has happened at a higher level. z kenton@google.com (Kenton Varda)� N)�wire_formatg �c C sp | dkrdS | dkrdS | dkr$dS | dkr0dS | d kr<d S | dkrHdS | d krTdS | dkr`dS | dkrldS dS )z#Compute the size of a varint value.� � i�? � i�� � i���� l �� � l ���� l ��� � l ����� l ���� � � � )�valuer r �/usr/lib/python3.6/encoder.py�_VarintSizeR s&