File: //lib/python3.12/__pycache__/_pyio.cpython-312.pyc
�
    )!�h�m �                   �p  � d Z ddlZddlZddlZddlZddlZddlZddlmZ	 ej                  dv rddlmZ
 ndZ
ddlZddlmZmZmZmZ h d�Z eed�      r6ej+                  ej,                  �       ej+                  ej.                  �       d	ZeZ eed
�      xs ej4                  j6                  ZeZd.d�Ze	 	 d/d��       Z d
� Z!	 ejD                  Z"	 ejH                  Z$ G d� dejN                  ��      Z(ejP                  jS                  e(�        G d� de(�      Z*ejT                  jS                  e*�       ddl+m,Z, e*jS                  e,�        G d� de(�      Z-ejZ                  jS                  e-�        G d� de-�      Z. G d� de-�      Z/ G d� de.�      Z0 G d� de.�      Z1 G d � d!e-�      Z2 G d"� d#e1e0�      Z3 G d$� d%e*�      Z, G d&� d'e(�      Z4ejh                  jS                  e4�        G d(� d)ejj                  �      Z6 G d*� d+e4�      Z7 G d,� d-e7�      Z8y# e#$ r e!Z"Y ��Kw xY w# e#$ r  G d� de%e&�      Z$Y ��Vw xY w)0z)
Python implementation of the io module.
�    N)�
allocate_lock>   �win32�cygwin)�setmode)�__all__�SEEK_SET�SEEK_CUR�SEEK_END>   r   �   �   �	SEEK_HOLEi    �gettotalrefcountc                 �   � | �Wt         j                  j                  rd} nd} t         j                  j                  rddl}|j                  dt        |dz   �       | S )a  
    A helper function to choose the text encoding.
    When encoding is not None, this function returns it.
    Otherwise, this function returns the default text encoding
    (i.e. "locale" or "utf-8" depends on UTF-8 mode).
    This function emits an EncodingWarning if *encoding* is None and
    sys.flags.warn_default_encoding is true.
    This can be used in APIs with an encoding=None parameter
    that pass it to TextIOWrapper or open.
    However, please consider using encoding="utf-8" for new APIs.
    N�utf-8�localer   z"'encoding' argument not specified.r   )�sys�flags�	utf8_mode�warn_default_encoding�warnings�warn�EncodingWarning)�encoding�
stacklevelr   s      �/usr/lib/python3.12/_pyio.py�
text_encodingr   +   sN   � � ���9�9����H��H��9�9�*�*���M�M�>�)�:��>�
;��O�    c                 �  � t        | t        �      st        j                  | �      } t        | t        t
        t        f�      st
        d| z  �      �t        |t        �      st
        d|z  �      �t        |t        �      st
        d|z  �      �|�t        |t        �      st
        d|z  �      �|�t        |t        �      st
        d|z  �      �t        |�      }|t        d�      z
  st        |�      t        |�      kD  rt        d|z  �      �d|v }	d	|v }
d
|v }d|v }d|v }
d
|v }d|v }|r
|rt        d�      �|	|
z   |z   |z   dkD  rt        d�      �|	s|
s|s
|st        d�      �|r
|�t        d�      �|r
|�t        d�      �|r
|�t        d�      �|r |dk(  rddl
}|j                  dt        d�       t        | |	xr dxs d|
xr d	xs dz   |xr d
xs dz   |xr dxs dz   |
xr dxs dz   ||��      }|}	 d}|dk(  s|dk  r|j                  �       rd}d}|dk  r<t        }	 t        j                   |j#                  �       �      j$                  }|dkD  r|}	 |dk  rt        d�      �|dk(  r|r|S t        d�      �|
r
t+        ||�      }n0|	s|s|r
t-        ||�      }n|
r
t/        ||�      }nt        d |z  �      �|}|r|S t1        |�      }t3        |||||�      }|}||_        |S # t&