matevfs.URI
Prev | The matevfs class reference | Next

## matevfs.URI

matevfs.URI — Object encapsulating a URI

## Synopsis

    class matevfs.URI:
        matevfs.URI(text_uri)
        def append_file_name(file_name)
        def append_path(path)
        def append_string(path)
        def copy()
        def is_parent(item, recursive)
        def resolve_relative(relative_reference)

## Description

## Attributes

dirname | Read/Write | The name of the directory in which the file pointed to by this URI is located.
fragment_identifier | Read/Write |
host_name | Read | Server hostname (for remote schemes).
host_port | Read | Server port (for remote schemes).
is_local | Read/Write | Whether the URI is a local filesystem.
parent | Read/Write | The parent URI.
password | Read | Password (for schemes which require authorization).
path | Read/Write | The full path name.
scheme | Read/Write | The URI scheme (`gzip', `tar', `http', etc).
short_name | Read/Write | The base name for the file referred to by this URI. This matches the XPG definition of a basename. This is useful when you want the name of the URI target, but don't care whether the URI points to a file or directory. If the URI points to the root of a domain, this is the host name.
short_path_name | Read/Write | Same as short_name, but if the URI points to the root of a domain, this is equal to /
toplevel | Read/Write | The toplevel URI
user_name | Read | User name (for schemes which require authorization).

## Constructor

                matevfs.URI(text_uri)

`text_uri`: | A string representing the URI.
Returns: | the new matevfs.URI

## Methods

### matevfs.URI.append_file_name

                def append_file_name(file_name)

`file_name`: | The file name to append.
Returns: | The new URI.

Create a new URI by appending `file_name`. This will add the appropriate directory separator if necessary.

### matevfs.URI.append_path

                def append_path(path)

`path`: | The path to append (unescaped)
Returns: | The new URI.

Create a new URI by appending `path`. This will add the appropriate directory separator if necessary.

### matevfs.URI.append_string

                def append_string(path)

`path`: | The path to append (fully escaped)
Returns: | The new URI.

Create a new URI by appending `path`. This will add the appropriate directory separator if necessary.

### matevfs.URI.copy

                def copy()

Returns: | A copy of this URI.

Create a copy of this URI.

### matevfs.URI.is_parent

                def is_parent(item, recursive)

`item`: | The item to search for.
`recursive`: | Whether to check the entire hierarchy.
Returns: | True if `item` is a child of self.

Check if this URI is a parent of `item`. If `recursive` is True, check the entire hierarchy.

### matevfs.URI.resolve_relative

                def resolve_relative(relative_reference)

`relative_reference`: | A string representing the (possibly) relative URI.
Returns: | The new URI.

Create a new URI from `relative_reference` relative to self. The resolution algorithm follows RFC 2396. For details, see section 5.2 of http://www.ietf.org/rfc/rfc2396.txt .

In short, if the base uri ends in '/', relative_reference is appended to base, otherwise it replaces the part of base after the last '/'.

Prev | Up | Next
matevfs.Handle | Home | matevfs.Volume