aria.parser.loading

Loading package.

aria.parser.loading.LoadingContext Loading context.
aria.parser.loading.LoaderException ARIA loader exception.
aria.parser.loading.LoaderNotFoundError ARIA loader error: loader not found for source.
aria.parser.loading.DocumentNotFoundException ARIA loader exception: document not found.
aria.parser.loading.LoaderSource Base class for ARIA loader sources.
aria.parser.loading.DefaultLoaderSource The default ARIA loader source will generate a UriTextLoader for UriLocation and a LiteralLoader for a LiteralLocation.

Loaders

aria.parser.loading.Loader Base class for ARIA loaders.
aria.parser.loading.FileTextLoader ARIA file text loader.
aria.parser.loading.LiteralLoader ARIA literal loader.
aria.parser.loading.RequestLoader Base class for ARIA request-based loaders.
aria.parser.loading.RequestTextLoader ARIA request-based text loader.
aria.parser.loading.UriTextLoader Base class for ARIA URI loaders.

Locations

aria.parser.loading.Location Base class for ARIA locations.
aria.parser.loading.UriLocation A URI location can be absolute or relative, and can include a scheme or not.
exception aria.parser.loading.LoaderException(message=None, cause=None, cause_traceback=None)

Bases: aria.exceptions.AriaException

ARIA loader exception.

exception aria.parser.loading.LoaderNotFoundError(message=None, cause=None, cause_traceback=None)

Bases: aria.parser.loading.exceptions.LoaderException

ARIA loader error: loader not found for source.

exception aria.parser.loading.DocumentNotFoundException(message=None, cause=None, cause_traceback=None)

Bases: aria.parser.loading.exceptions.LoaderException

ARIA loader exception: document not found.

class aria.parser.loading.LoadingContext

Bases: object

Loading context.

Variables:
class aria.parser.loading.Loader

Bases: object

Base class for ARIA loaders.

Loaders extract a document by consuming a document source.

Though the extracted document is often textual (a string or string-like data), loaders may provide any format.

close()
load()
open()
class aria.parser.loading.LoaderSource

Bases: object

Base class for ARIA loader sources.

Loader sources provide appropriate Loader instances for locations.

get_loader(context, location, origin_location)
class aria.parser.loading.DefaultLoaderSource

Bases: aria.parser.loading.source.LoaderSource

The default ARIA loader source will generate a UriTextLoader for UriLocation and a LiteralLoader for a LiteralLocation.

get_loader(context, location, origin_location)
class aria.parser.loading.Location

Bases: object

Base class for ARIA locations.

Locations are used by LoaderSource to delegate to an appropriate Loader.

is_equivalent(location)
prefix
class aria.parser.loading.UriLocation(uri)

Bases: aria.parser.loading.location.Location

A URI location can be absolute or relative, and can include a scheme or not.

If no scheme is included, it should be treated as a filesystem path.

See UriTextLoader.

is_equivalent(location)
prefix
class aria.parser.loading.LiteralLocation(content, name='literal')

Bases: aria.parser.loading.location.Location

A location that embeds content.

See LiteralLoader.

is_equivalent(location)
class aria.parser.loading.LiteralLoader(location)

Bases: aria.parser.loading.loader.Loader

ARIA literal loader.

See LiteralLocation.

load()
class aria.parser.loading.UriTextLoader(context, location, origin_location=None)

Bases: aria.parser.loading.loader.Loader

Base class for ARIA URI loaders.

See UriLocation.

Supports a list of search prefixes that are tried in order if the URI cannot be found. They will be:

  • If origin_location is provided its prefix will come first.
  • Then the prefixes in the LoadingContext will be added.
  • Finally, the parser can supply a uri_loader_prefix function with extra prefixes.
close()
load()
open()
class aria.parser.loading.RequestLoader(context, uri, headers=None)

Bases: aria.parser.loading.loader.Loader

Base class for ARIA request-based loaders.

Extracts a document from a URI by performing a request.

Note that the “file:” schema is not supported: FileTextLoader should be used instead.

load()
open()
class aria.parser.loading.RequestTextLoader(context, uri, headers=None)

Bases: aria.parser.loading.request.RequestLoader

ARIA request-based text loader.

load()
class aria.parser.loading.FileTextLoader(context, path, encoding='utf-8')

Bases: aria.parser.loading.loader.Loader

ARIA file text loader.

Extracts a text document from a file. The default encoding is UTF-8, but other supported encoding can be specified instead.

close()
load()
open()