File: //usr/lib/python3/dist-packages/twisted/python/__pycache__/filepath.cpython-310.pyc
o
�b� � @ s d Z ddlZddlZddlZddlZddlmZmZmZ ddlm Z m
Z
mZmZm
Z
mZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddl m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z' ddl(m)Z)m*Z* dd l+m,Z, dd
l-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4 ej5ej6B ej7B e4B Z8dd
� Z9e:ej;de9�Z<ej=Z>ej?Z@G dd� de&�ZAG dd� deB�ZCG dd� deB�ZDG dd� deE�ZFdd� ZGG dd� d�ZHG dd� de.�ZIG dd� de.�ZJd+d e"eKeLf d!eLd"eKfd#d$�ZMd,d%d&�ZNd,d'd(�ZOe*e'eA�G d)d*� d*eH���ZPePeP_QdS )-z1
Object-oriented filesystem path representation.
� N)�listdir�stat�utime)�abspath�basename�dirname�exists�isabs�join�normpath�splitext)�S_IMODE�S_IRGRP�S_IROTH�S_IRUSR�S_ISBLK�S_ISDIR�S_ISREG�S_ISSOCK�S_IWGRP�S_IWOTH�S_IWUSR�S_IXGRP�S_IXOTH�S_IXUSR)�IO�Union�cast)� Attribute� Interface�implementer)�cmp�
comparable)�platform)�FancyEqMixin)�ERROR_DIRECTORY�ERROR_FILE_NOT_FOUND�ERROR_INVALID_NAME�ERROR_PATH_NOT_FOUND�O_BINARYc C � dS )z�
Always return C{False} if the operating system does not support symlinks.
@param path: A path string.
@type path: L{str}
@return: C{False}
@rtype: L{bool}
F� ��pathr+ r+ �9/usr/lib/python3/dist-packages/twisted/python/filepath.py�_stub_islink@ s
r/ �islinkc @ s� e Zd ZdZed�Zdd� Zd!dd�Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd S )"� IFilePatha�
File path object.
A file path represents a location for a file-like-object and can be
organized into a hierarchy; a file path can can children which are
themselves file paths.
A file path has a name which unique identifies it in the context of its
parent (if it has one); a file path can not have two children with the same
name. This name is referred to as the file path's "base name".
A series of such names can be used to locate nested children of a file
path; such a series is referred to as the child's "path", relative to the
parent. In this case, each name in the path is referred to as a "path
segment"; the child's base name is the segment in the path.
When representing a file path as a string, a "path separator" is used to
delimit the path segments within the string. For a file system path, that
would be C{os.sep}.
Note that the values of child names may be restricted. For example, a file
system path will not allow the use of the path separator in a name, and
certain names (e.g. C{"."} and C{".."}) may be reserved or have special
meanings.
@since: 12.1
z3The path separator to use in string representationsc C r* )a�
Obtain a direct child of this file path. The child may or may not
exist.
@param name: the name of a child of this path. C{name} must be a direct
child of this path and may not contain a path separator.
@return: the child of this path with the given C{name}.
@raise InsecurePath: if C{name} describes a file path that is not a
direct child of this file path.
Nr+ ��namer+ r+ r. �childq � zIFilePath.child�rc C r* )z�
Opens this file path with the given mode.
@return: a file-like object.
@raise Exception: if this file path cannot be opened.
Nr+ )�moder+ r+ r. �open} r5 zIFilePath.openc C r* )zT
Clear any cached information about the state of this path on disk.
Nr+ r+ r+ r+ r. �changed� r5 zIFilePath.changedc C r* )z�
Retrieve the size of this file in bytes.
@return: the size of the file at this file path in bytes.
@raise Exception: if the size cannot be obtained.
Nr+ r+ r+ r+ r. �getsize� r5 zIFilePath.getsizec C r* )��
Retrieve the time of last access from this file.
@return: a number of seconds from the epoch.
@rtype: L{float}
Nr+ r+ r+ r+ r. �getModificationTime� r5 zIFilePath.getModificationTimec C r* )��
Retrieve the time of the last status change for this file.
@return: a number of seconds from the epoch.
@rtype: L{float}
Nr+ r+ r+ r+ r. �getStatusChangeTime� r5 zIFilePath.getStatusChangeTimec C r* )��
Retrieve the time that this file was last accessed.
@return: a number of seconds from the epoch.
@rtype: L{float}
Nr+ r+ r+ r+ r. �
getAccessTime� r5 zIFilePath.getAccessTimec C r* )z�
Check if this file path exists.
@return: C{True} if the file at this file path exists, C{False}
otherwise.
@rtype: L{bool}
Nr+ r+ r+ r+ r. r � r5 zIFilePath.existsc C r* )z�
Check if this file path refers to a directory.
@return: C{True} if the file at this file path is a directory, C{False}
otherwise.
Nr+ r+ r+ r+ r. �isdir� r5 zIFilePath.isdirc C r* )z�
Check if this file path refers to a regular file.
@return: C{True} if the file at this file path is a regular file,
C{False} otherwise.
Nr+ r+ r+ r+ r. �isfile� r5 zIFilePath.isfilec C r* )z�
List the children of this path object.
@return: a sequence of the children of the directory at this file path.
@raise Exception: if the file at this file path is not a directory.
Nr+ r+ r+ r+ r. �children� r5 zIFilePath.childrenc C r* )z�
Retrieve the final component of the file path's path (everything
after the final path separator).
@return: the base name of this file path.
@rtype: L{str}
Nr+ r+ r+ r+ r. r � r5 zIFilePath.basenamec C r* )zV
A file path for the directory containing the file at this file path.
Nr+ r+ r+ r+ r. �parent� r5 zIFilePath.parentc C r* )a$
A file path for the directory containing the file at this file path.
@param name: the name of a sibling of this path. C{name} must be a
direct sibling of this path and may not contain a path separator.
@return: a sibling file path of this one.
Nr+ r2 r+ r+ r. �sibling� r5 zIFilePath.siblingN�r6 )�__name__�
__module__�__qualname__�__doc__r �sepr4 r8 r9 r: r<