관리-도구
편집 파일: py3compat.cpython-311.pyc
� O�Dg� � �J � d Z ddlZddlZej d dk rGd� Zd� Zd� Zd� Zd"d �Zd � Z d� Z ddlmZ eZdd lm Z eZd� Zd� Zd� Z ej defddi� � ZeZn;d� Zd� Zd� Zd� Zd"d�Zd� Z d� Z ddlmZ ddlmZ ddlmZ eZd� Zd� Zd� Zdd lmZ eZd!� Z[[dS )#a� Compatibility code for handling string/bytes changes from Python 2.x to Py3k In Python 2.x, strings (of type ''str'') contain binary data, including encoded Unicode text (e.g. UTF-8). The separate type ''unicode'' holds Unicode text. Unicode literals are specified via the u'...' prefix. Indexing or slicing either type always produces a string of the same type as the original. Data read from a file is always of '''str'' type. In Python 3.x, strings (type ''str'') may only contain Unicode text. The u'...' prefix and the ''unicode'' type are now redundant. A new type (called ''bytes'') has to be used for binary data (including any particular ''encoding'' of a string). The b'...' prefix allows one to specify a binary literal. Indexing or slicing a string produces another string. Slicing a byte string produces another byte string, but the indexing operation produces an integer. Data read from a file is of '''str'' type if the file was opened in text mode, or of ''bytes'' type otherwise. Since PyCrypto aims at supporting both Python 2.x and 3.x, the following helper functions are used to keep the rest of the library as independent as possible from the actual Python version. In general, the code should always deal with binary strings, and use integers instead of 1-byte character strings. b(s) Take a text string literal (with no prefix or with u'...' prefix) and make a byte string. bchr(c) Take an integer and make a 1-character byte string. bord(c) Take the result of indexing on a byte string and make an integer. tobytes(s) Take a text string, a byte string, or a sequence of character taken from a byte string and make a byte string. � N� c � � | S �N� ��ss �w/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Util/py3compat.py�br B � � ��� c � � t | � � S r )�chrr s r �bchrr D � � ��1�v�v� r c � � t | � � S r )�strr s r �bstrr F r r c � � t | � � S r )�ordr s r �bordr H r r �latin-1c �H � t | t � � r| � |� � S t | t � � r| S t | t � � rt | � � S t | t � � r| � � � S d� | � � S )N� ) � isinstance�unicode�encoder � bytearray�bytes� memoryview�tobytes�join�r �encodings r r r J s� � ��a��!�!� ��8�8�H�%�%�%� ��3� � � ��H� ��9� %� %� ���8�8�O� ��:� &� &� ��9�9�;�;���7�7�1�:�:�r c � � | S r r ��bss r �tostrr'