HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/__pycache__/_cpcompat.cpython-310.pyc
o

�N�g��@sLdZddlZd
dd�Zd
dd�Zd
dd	�Zd
d�Zeejdd�Z	e
efZdS)a�Compatibility code for using CherryPy with various versions of Python.

To retain compatibility with older Python versions, this module provides a
useful abstraction over the differences between Python versions, sometimes by
preferring a newer idiom, sometimes an older one, and sometimes a custom one.

In particular, Python 2 uses str and '' for byte strings, while Python 3
uses str and '' for unicode strings. We will call each of these the 'native
string' type for each version. Because of this major difference, this module
provides
two functions: 'ntob', which translates native strings (of type 'str') into
byte strings regardless of Python version, and 'ntou', which translates native
strings to unicode strings.

Try not to use the compatibility functions 'ntob', 'ntou', 'tonative'.
They were created with Python 2.3-2.5 compatibility in mind.
Instead, use unicode literals (from __future__) and bytes literals
and their .encode/.decode methods as needed.
�N�
ISO-8859-1cCst|�|�|�S)zOReturn the given native string as a byte string in the given
    encoding.
    )�
assert_native�encode��n�encoding�r�F/opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/_cpcompat.py�ntobs
r
cCst|�|S)zTReturn the given native string as a unicode string with the given
    encoding.
    )rrrrr	�ntou!srcCst|t�r
|�|�S|S)zAReturn the given string as a native string in the given encoding.)�
isinstance�bytes�decoderrrr	�tonative*s

rcCs t|t�stdt|�j��dS)Nzn must be a native str (got %s))r�str�	TypeError�type�__name__)rrrr	r2s
�r�HTTPSConnection)r)
�__doc__�http.client�httpr
rrr�getattr�clientrrr
Z
text_or_bytesrrrr	�<module>s