Repository URL to install this package:
|
Version:
0.1.31 ▾
|
odigos-demo-inventory
/
opt
/
odigos-demo-inventory
/
site-packages
/
jeepney
/
__pycache__
/
fds.cpython-311.pyc
|
|---|
§
hµµhÀ ã ój d dl Z d dlZd dlZd dlmZ G d de¦ « Z G d d¦ « Zdad Z dS )é N)Úwarnc ó e Zd ZdZdS )Ú NoFDErrorzQRaised by :class:`FileDescriptor` methods if it was already closed/converted
N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó ú6/usr/local/lib/python3.11/site-packages/jeepney/fds.pyr r s ðð àDr r c ó e Zd ZdZdZdZdZd Zd Zd Z d Z
d Zd
Zd Z
d Zd
ZddZd Zedd gfd¦ « ZdS )ÚFileDescriptora+ A file descriptor received in a D-Bus message
This wrapper helps ensure that the file descriptor is closed exactly once.
If you don't explicitly convert or close the FileDescriptor object, it will
close its file descriptor when it goes out of scope, and emit a
ResourceWarning.
©Ú_fdéÿÿÿÿéþÿÿÿc ó || _ d S ©Nr ©ÚselfÚfds r Ú__init__zFileDescriptor.__init__ s
Ør c óf | j }| j | j k rd}n| j | j k rd}d| dS )NÚclosedÚ convertedz<FileDescriptor (z)>)r Ú_CLOSEDÚ
_CONVERTED©r Údetails r Ú__repr__zFileDescriptor.__repr__ sD ØØ8t|Ò#Ð#ØFFØ
XÒ
(Ð
(Ø FØ- 6Ð-Ð-Ð-Ð-r c ó¸ | j | j k rdS | j | j k rt d¦ « | j | j c| _ }t j |¦ « dS )a Close the file descriptor
This can safely be called multiple times, but will raise RuntimeError
if called after converting it with one of the ``to_*`` methods.
This object can also be used in a ``with`` block, to close it on
leaving the block.
z.Can't close FileDescriptor after converting itN)r r r r ÚosÚcloser s r r# zFileDescriptor.close$ sX ð 8t|Ò#Ð#ØDØ
XÒ
(Ð
(ÝÐLÑMÔMÐMà<¨¬LDHbÝHRLLLLLr c ó | S r r
©r s r Ú __enter__zFileDescriptor.__enter__5 s Ør c ó. | ¦ « d S r )r# )r Úexc_typeÚexc_valÚexc_tbs r Ú__exit__zFileDescriptor.__exit__8 s Ø
r c ó | j dk r7t d| j dt d| ¬¦ « | ¦ « d S d S )Nr zFileDescriptor (z") was neither closed nor convertedé )Ú
stacklevelÚsource)r r ÚResourceWarningr# r% s r Ú__del__zFileDescriptor.__del__; sU Ø8q==ÝØO 4¤8ÐOÐOÐOݨA°dð
ñ
ô
ð
ð
JJLLLLLð =r c óh | j dk r&| j | j k rdnd}t d| ¦ « d S )Nr r r z"FileDescriptor object was already )r r r r s r Ú_checkzFileDescriptor._checkC sB Ø8a<<Ø!%¤¨T¬\Ò!9Ð!9XX¸{FÝÐIÀÐIÐIÑJÔJÐJð <r c ó8 | ¦ « | j S )zGet the integer file descriptor
This does not change the state of the :class:`FileDescriptor` object,
unlike the ``to_*`` methods.
)r3 r r% s r ÚfilenozFileDescriptor.filenoH s ð
Øxr c óV | ¦ « | j | j c| _ }|S )a, Convert to the low-level integer file descriptor::
raw_fd = fd.to_raw_fd()
os.write(raw_fd, b'xyz')
os.close(raw_fd)
The :class:`FileDescriptor` can't be used after calling this. The caller
is responsible for closing the file descriptor.
)r3 r r r s r Ú to_raw_fdzFileDescriptor.to_raw_fdQ s' ð
ب¬"Ø r Nc óz | ¦ « t | j |||||¬¦ « }| j | _ |S )aK Convert to a Python file object::
with fd.to_file('w') as f:
f.write('xyz')
The arguments are the same as for the builtin :func:`open` function.
The :class:`FileDescriptor` can't be used after calling this. Closing
the file object will also close the file descriptor.
)Ú bufferingÚencodingÚerrorsÚnewline)r3 Úopenr r )r Úmoder9 r: r; r<