← back to Atmos Game
assets/gen/.venv/lib/python3.12/site-packages/anyio/_core/__pycache__/_fileio.cpython-312.pyc
432 lines
�
c�bj~z � �� � d dl mZ d dlZd dlZd dlZd dlmZmZmZm Z m
Z
d dlmZ d dl
mZ d dlmZ d dlmZmZmZmZmZmZmZmZmZ dd lmZ dd
lmZ ddlmZ ej@ d
k\ rd dlm!Z! nd dl"m!Z! ej@ dk\ rd dl#m$Z$ erd dl%m&Z& d dl'm(Z(m)Z)m*Z*m+Z+ ne,xZ*xZ(xZ)Z+ edd�� Z- G d� deee � Z.e d#dd� d$d�� Z/e d%dd� d&d�� Z/ d'dd� d(d�Z/dd� d)d�Z0 ed�� G d � d!ee- � � Z1 G d"� d� Z2 ejf e2� y)*� )�annotationsN)�
AsyncIterator�Callable�Iterable�Iterator�Sequence)� dataclass)�partial)�PathLike) �IO�
TYPE_CHECKING�Any�AnyStr�ClassVar�Final�Generic�TypeVar�overload� )� to_thread)�
AsyncResource� )�CapacityLimiter)� � )�Self�r � )�PathInfo)�
ModuleType)�OpenBinaryMode�OpenTextMode�ReadableBuffer�WriteableBuffer�T�Path)�boundc �6 � e Zd ZdZdd� dd�Zdd�Zedd�� Zedd�� Zdd�Z dd �Z
d d!d
�Zd d"d�Zd#d�Z
d$d
�Zd%d�Zd%d�Zed&d�� Zed'd�� Zd(d�Ze d)d�� Zed*d�� Zd+d�Zd,d-d�Zej, fd.d�Zd/d�Zdd�Zy)0� AsyncFilea�
An asynchronous file object.
This class wraps a standard file object and provides async friendly versions of the
following blocking methods (where available on the original file object):
* read
* read1
* readline
* readlines
* readinto
* readinto1
* write
* writelines
* truncate
* seek
* tell
* flush
All other methods are directly passed through.
This class supports the asynchronous context manager protocol which closes the
underlying file at the end of the context block.
This class also supports asynchronous iteration::
async with await open_file(...) as f:
async for line in f:
print(line)
N��limiterc � � |�2t |t � s"t d|j j � �� �|| _ || _ y �Nz/limiter must be a CapacityLimiter or None, not )�
isinstancer � TypeError� __class__�__name__�_fp�_limiter)�self�fpr+ s �j/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/anyio/_core/_fileio.py�__init__zAsyncFile.__init__S sJ � � ��z�'�?�'K��A��$�$�-�-�.�0��
�
�����
� c �. � t | j |� S �N)�getattrr2 �r4 �names r6 �__getattr__zAsyncFile.__getattr___ s � ��t�x�x��&�&r8 c � � | j S )zIThe capacity limiter used by this file object, if not the global limiter.�r3 �r4 s r6 r+ zAsyncFile.limiterb � � � �}�}�r8 c � � | j S )zThe wrapped file object.)r2 rA s r6 �wrappedzAsyncFile.wrappedg s
� � �x�x�r8 c �T K � | j � � d { ��� }|r|��� ny �"7 ��wr: )�readline)r4 �lines r6 � __aiter__zAsyncFile.__aiter__l s* � �� ������(�D���
�� �(�s �(�&�(c � � K � t j | j j | j �� � d { ��� S 7 ��w�Nr* )r �run_syncr2 �closer3 rA s r6 �aclosezAsyncFile.acloset �+ � �� ��'�'�������
�
�N�N�N�N�� �9A�A �Ac � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 �readr3 �r4 �sizes r6 rQ zAsyncFile.readw s- � �� ��'�'����
�
�t�T�]�]�S�S�S�S�� �:A�A�Ac � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 �read1r3 rR s r6 rV zAsyncFile.read1z s- � �� ��'�'�������d�m�m�T�T�T�T�rT c � � K � t j | j j | j �� � d { ��� S 7 ��wrJ )r rK r2 rF r3 rA s r6 rF zAsyncFile.readline} s- � �� ��'�'����(9�(9�4�=�=�Q�Q�Q�Q�rO c � � K � t j | j j | j �� � d { ��� S 7 ��wrJ )r rK r2 � readlinesr3 rA s r6 rY zAsyncFile.readlines� s- � �� ��'�'����(:�(:�D�M�M�R�R�R�R�rO c � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 �readintor3 �r4 �bs r6 r[ zAsyncFile.readinto� s/ � �� ��'�'����(9�(9�1�d�m�m�T�T�T�T�rT c � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 � readinto1r3 r\ s r6 r_ zAsyncFile.readinto1� s/ � �� ��'�'����(:�(:�A�t�}�}�U�U�U�U�rT c � � K � y �wr: � r\ s r6 �writezAsyncFile.write� s � �� �GJ�� �c � � K � y �wr: ra r\ s r6 rb zAsyncFile.write� s � �� �:=�rc c � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 rb r3 r\ s r6 rb zAsyncFile.write� s- � �� ��'�'�������4�=�=�Q�Q�Q�Q�rT c � � K � y �wr: ra �r4 �liness r6 �
writelineszAsyncFile.writelines� s � �� � �rc c � � K � y �wr: ra rg s r6 ri zAsyncFile.writelines� s � �� �NQ�rc c � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 ri r3 rg s r6 ri zAsyncFile.writelines� s8 � �� ��'�'��H�H�����
�
�
�
�
�
�rT c � � K � t j | j j || j �� � d { ��� S 7 ��wrJ )r rK r2 �truncater3 rR s r6 rm zAsyncFile.truncate� s/ � �� ��'�'����(9�(9�4����W�W�W�W�rT c � � K � t j | j j ||| j �� � d { ��� S 7 ��wrJ )r rK r2 �seekr3 )r4 �offset�whences r6 ro zAsyncFile.seek� s8 � �� ��'�'��H�H�M�M�6�6�4�=�=�
�
�
�
�� �;A�A�Ac � � K � t j | j j | j �� � d { ��� S 7 ��wrJ )r rK r2 �tellr3 rA s r6 rt zAsyncFile.tell� s+ � �� ��'�'����
�
�t�}�}�M�M�M�M�rO c � � K � t j | j j | j �� � d { ��� S 7 ��wrJ )r rK r2 �flushr3 rA s r6 rv zAsyncFile.flush� rN rO )r5 �
IO[AnyStr]r+ �CapacityLimiter | None�return�None)r= �strry �object�ry rx )ry rw )ry zAsyncIterator[AnyStr]�ry rz )�����)rS �intry r )r4 �AsyncFile[bytes]rS r� ry �bytes)ry r )ry zlist[AnyStr])r4 r� r] r$ ry r� )r4 r� r] r# ry r� )r4 �AsyncFile[str]r] r{ ry r� )r] zReadableBuffer | strry r� )r4 r� rh zIterable[ReadableBuffer]ry rz )r4 r� rh z
Iterable[str]ry rz )rh z(Iterable[ReadableBuffer] | Iterable[str]ry rz r: )rS �
int | Nonery r� )rp r� rq r� ry r� �ry r� )r1 �
__module__�__qualname__�__doc__r7 r>