| Server IP : 93.86.61.54 / Your IP : 216.73.216.156 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/fs/__pycache__/ |
Upload File : |
o
�Q `�0 � @ s d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddl Z dd l
mZ dd
lm
Z
ddlmZ ddlmZ dd
lmZ ddlmZmZ ejr}ddlmZ ddlmZmZmZmZmZmZ eeeeef f Z ee!gef Z"e�#d�Z$e j%G dd� de��Z&dS )z0Container for filesystem resource informations.
� )�absolute_import)�print_function)�unicode_literalsN)�cast)�deepcopy� )�join)�ResourceType)�MissingInfoNamespace)�Permissions)�epoch_to_datetime)�overload�Text)�datetime)�Any�Callable�List�Mapping�Optional�Union�Tc @ s� e Zd ZdZg d�Zefdd�Zdd� ZeZdd� Z e
d d
� �Ze
dd
� �Zdd
� Ze
d
d� �Ze
dd� �ZdBdd�Zdd� Z
dd� Zdd� ZdBdd�Zdd� Zedd� �Zedd� �Zed d!� �Zed"d#� �Zed$d%� �Zed&d'� �Zed(d)� �Zed*d+� �Zed,d-� �Zed.d/� �Zed0d1� �Zed2d3� �Zed4d5� �Zed6d7� �Z ed8d9� �Z!ed:d;� �Z"ed<d=� �Z#ed>d?� �Z$ed@dA� �Z%dS )C�Infoa� Container for :ref:`info`.
Resource information is returned by the following methods:
* `~fs.base.FS.getinfo`
* `~fs.base.FS.scandir`
* `~fs.base.FS.filterdir`
Arguments:
raw_info (dict): A dict containing resource info.
to_datetime (callable): A callable that converts an
epoch time to a datetime object. The default uses
:func:`~fs.time.epoch_to_datetime`.
)�raw�_to_datetime�
namespacesc C s || _ || _t| j �� �| _dS )z<Create a resource info object from a raw info dict.
N)r r � frozenset�keysr )�self�raw_info�to_datetime� r �)/usr/lib/python3/dist-packages/fs/info.py�__init__2 s z
Info.__init__c C s | j r d�| j�S d�| j�S )Nz
<dir '{}'>z<file '{}'>)�is_dir�format�name�r r r r! �__str__: s zInfo.__str__c C s | j t|dd �kS )Nr )r �getattr)r �otherr r r! �__eq__C s zInfo.__eq__c C � d S �Nr �r �tr r r! �_make_datetimeG � zInfo._make_datetimec C r+ r, r r- r r r! r/ L r0 c C s |d ur | � |�S d S r, )r r- r r r! r/ Q s
c C r+ r, r )r � namespace�keyr r r! �getX r0 zInfo.getc C r+ r, r �r r1 r2 �defaultr r r! r3 ] r0 Nc C s, z
| j | �||�W S ty | Y S w )a� Get a raw info value.
Arguments:
namespace (str): A namespace identifier.
key (str): A key within the namespace.
default (object, optional): A default value to return
if either the namespace or the key within the namespace
is not found.
Example:
>>> info.get('access', 'permissions')
['u_r', 'u_w', '_wx']
)r r3 �KeyErrorr4 r r r! r3 b s
�c C s || j vr t|��dS )z�Check if the given namespace is present in the info.
Raises:
~fs.errors.MissingInfoNamespace: if the given namespace is not
present in the info.
N)r r
�r r1 r r r! �_require_namespacew s
�zInfo._require_namespacec C s | � |dd�}||v S )a5 Check if a given key in a namespace is writable.
Uses `~fs.base.FS.setinfo`.
Arguments:
namespace (str): A namespace identifier.
key (str): A key within the namespace.
Returns:
bool: `True` if the key can be modified, `False` otherwise.
�_writer )r3 )r r1 r2 �
_writeabler r r! �is_writeable� s zInfo.is_writeablec C s
|| j v S )z�Check if the resource info contains a given namespace.
Arguments:
namespace (str): A namespace identifier.
Returns:
bool: `True` if the namespace was found, `False` otherwise.
)r r7 r r r! �
has_namespace� s
zInfo.has_namespacec C s t t| j�|p | jd�S )z4Create a copy of this resource info object.
)r )r r r r )r r r r r! �copy� s z Info.copyc C s t || j�S )z�Make a path by joining ``dir_path`` with the resource name.
Arguments:
dir_path (str): A path to a directory.
Returns:
str: A path to the resource.
)r r% )r �dir_pathr r r! � make_path� s zInfo.make_pathc C � t t| �dd��S )z"`str`: the resource name.
�basicr% )r r r3 r&