�
|�d � �` � d Z ddlZdZdZeeu reZeZeZ e
ZeZe
Zd� ZdS ddlZeZd� ZeZd� Z d� Zd � Zd
� Zd� Zdej j � � � k rd
Z eej � � e_ dej j � � � k rd
Z eej � � e_ dS dS )a Handle bytes and strings in a polyglot fashion.
copied from ../ntpclient/ntpq.py which got it from
https://gitlab.com/esr/practical-python-porting/blob/master/polystr-inclusion.py
see http://www.catb.org/esr/faqs/practical-python-porting/ for more information.
� Nzlatin-1Fc �, � | � d� � S )zString_escape/unicode_escape.�
string_escape)�decode��ss �*/usr/lib/python3/dist-packages/ntp/poly.pyr r - s � ��x�x��(�(�(� c � � t | t � � r| S t | t � � st | � � S t | t �� � S )z$Polymorphic string factory function.��encoding)�
isinstance�str�bytes�master_encoding)�os r �polystrr 6 sI � ��a���� ��H��!�U�#�#� ��q�6�6�M��1��/�/�/�/r c � � t | t � � r| S t | t � � st | � � S t | t �� � S )z%Polymorphic string encoding function.r )r
r r r r s r � polybytesr @ sI � ��a���� ��H��!�S�!�!� ���8�8�O��Q��1�1�1�1r c �N � t | t � � rt | � � S | S )zPolymorphic ord() function)r
r �ord��cs r �polyordr H �$ � ��a���� ��q�6�6�M��Hr c �N � t | t � � rt | � � S | S )zPolymorphic chr() function)r
�int�chrr s r �polychrr O r r c �\ � | � t � � � d� � S )z)Polymorphic string_escape/unicode_escape.�unicode_escape)�encoder r r s r r r V s% � � �x�x��(�(�/�/�0@�A�A�Ar c �< |