Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`python`.`filepath`.`IFilePath``

interface documentation

`class IFilePath(Interface): (source)`

Known implementations: `twisted.python.filepath.FilePath`, `twisted.python.zippath.ZipPath`

View In Hierarchy

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 `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. `"."` and `".."`) may be reserved or have special meanings.

Present Since
12.1

Method | `basename` | Retrieve the final component of the file path's path (everything after the final path separator).
Method | `changed` | Clear any cached information about the state of this path on disk.
Method | `child` | Obtain a direct child of this file path. The child may or may not exist.
Method | `children` | List the children of this path object.
Method | `exists` | Check if this file path exists.
Method | `getAccessTime` | Retrieve the time that this file was last accessed.
Method | `getModificationTime` | Retrieve the time of last access from this file.
Method | `getsize` | Retrieve the size of this file in bytes.
Method | `getStatusChangeTime` | Retrieve the time of the last status change for this file.
Method | `isdir` | Check if this file path refers to a directory.
Method | `isfile` | Check if this file path refers to a regular file.
Method | `open` | Opens this file path with the given mode.
Method | `parent` | A file path for the directory containing the file at this file path.
Method | `sibling` | A file path for the directory containing the file at this file path.
Attribute | `sep` | The path separator to use in string representations

def basename(): (source)

Retrieve the final component of the file path's path (everything after the final path separator).

Returns
`str` | the base name of this file path.

def changed(): (source)

Clear any cached information about the state of this path on disk.

def child(name): (source)

Obtain a direct child of this file path. The child may or may not exist.

Parameters
name | the name of a child of this path. `name` must be a direct child of this path and may not contain a path separator.
Returns
the child of this path with the given `name`.
Raises
`InsecurePath` | if `name` describes a file path that is not a direct child of this file path.

def children(): (source)

List the children of this path object.

Returns
a sequence of the children of the directory at this file path.
Raises
`Exception` | if the file at this file path is not a directory.

def exists(): (source)

Check if this file path exists.

Returns
`bool` | `True` if the file at this file path exists, `False` otherwise.

def getAccessTime(): (source)

Retrieve the time that this file was last accessed.

Returns
`float` | a number of seconds from the epoch.

def getModificationTime(): (source)

Retrieve the time of last access from this file.

Returns
`float` | a number of seconds from the epoch.

def getsize(): (source)

Retrieve the size of this file in bytes.

Returns
the size of the file at this file path in bytes.
Raises
`Exception` | if the size cannot be obtained.

def getStatusChangeTime(): (source)

Retrieve the time of the last status change for this file.

Returns
`float` | a number of seconds from the epoch.

def isdir(): (source)

Check if this file path refers to a directory.

Returns
`True` if the file at this file path is a directory, `False` otherwise.

def isfile(): (source)

Check if this file path refers to a regular file.

Returns
`True` if the file at this file path is a regular file, `False` otherwise.

def open(mode='r'): (source)

Opens this file path with the given mode.

Returns
a file-like object.
Raises
`Exception` | if this file path cannot be opened.

def parent(): (source)

A file path for the directory containing the file at this file path.

def sibling(name): (source)

A file path for the directory containing the file at this file path.

Parameters
name | the name of a sibling of this path. `name` must be a direct sibling of this path and may not contain a path separator.
Returns
a sibling file path of this one.

sep = (source)

The path separator to use in string representations