| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/fs/__pycache__/ |
Upload File : |
�
��obL � �� � d Z ddlmZmZ ddlZddlZddlmZ ej r
ddlm Z m
Z
mZ g d�Zej G d� d ej e � � Zd
� Zd� Zd� Z ed
� fd�Zy)ziAbstract I/O mode container.
Mode strings are used in in `~fs.base.FS.open` and
`~fs.base.FS.openbin`.
� )�print_function�unicode_literalsN� )�Text)� FrozenSet�Set�Union)�Mode�check_readable�check_writable�validate_openbin_modec �� � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z e
d� fd �Zd
� Ze
d� � Ze
d� � Ze
d
� � Ze
d� � Ze
d� � Ze
d� � Ze
d� � Ze
d� � Ze
d� � Zy)r
a� An abstraction for I/O modes.
A mode object provides properties that can be used to interrogate the
`mode strings <https://docs.python.org/3/library/functions.html#open>`_
used when opening files.
Example:
>>> mode = Mode('rb')
>>> mode.reading
True
>>> mode.writing
False
>>> mode.binary
True
>>> mode.text
False
c �2 � || _ | j � y)z�Create a new `Mode` instance.
Arguments:
mode (str): A *mode* string, as used by `io.open`.
Raises:
ValueError: If the mode string is invalid.
N)�_mode�validate)�self�modes �)/usr/lib/python3/dist-packages/fs/mode.py�__init__z
Mode.__init__- s � � ��
��
�
�� c �8 � dj | j � S )Nz
Mode({!r}))�formatr �r s r �__repr__z
Mode.__repr__; s � ��"�"�4�:�:�.�.r c � � | j S )N)r r s r �__str__zMode.__str__? s � ��z�z�r c �B � t |t � sJ �|| j v S )z+Check if a mode contains a given character.)�
isinstancer r )r � characters r �__contains__zMode.__contains__C s# � � �)�T�*�*�*��D�J�J�&�&r c �r � t j r| j j dd� S | j S )z�Get a mode string for the current platform.
Currently, this just removes the 'x' on PY2 because PY2 doesn't
support exclusive mode.
�x�w)�six�PY2r �replacer s r �to_platformzMode.to_platformI s* � � 03�w�w�t�z�z�!�!�#�s�+�F�D�J�J�Fr c �X � | j � j dd� }d|v r|S |dz S )zvGet a *binary* mode string for the current platform.
This removes the 't' and adds a 'b' if needed.
�t� �b)r'