xal Package

xal Package

Execution abstraction layer.

provider Module

Base stuff for XAL providers.

class xal.provider.Provider

Bases: object

Base class for XAL providers.

A XAL provider implements an API related to some environment actions.

name = None

Provider name. May be used in registry.

session = None

XAL session instance in which the provider is registered.

Providers can use this instance internally to get information about the context or to interact with the environment through other providers.

supports(session)

Return True if provider is compatible with session.

class xal.provider.ResourceProvider(resource_factory=None)

Bases: xal.provider.Provider

Provider specialized for a specific kind of resource.

resource_factory = None

Resource factory: could a class or a callable.

registry Module

Default XAL registry implementation.

class xal.registry.Registry(*args, **kwargs)

Bases: xal.provider.Provider

XAL Registry.

active = None

Mapping of active providers for interfaces.

default(interface)

Return default provider for interface.

Raise KeyError if no provider is available for the given interface and compatible with the current execution context.

get_provider_name(provider)

Guess best provider name.

guess(interface)

Find a provider available for interface and return its name.

This method uses provider’s supports() method to ignore providers which are incompatible with the current execution context.

items = None

Catalog of providers.

There may be more providers than interfaces available: the registry can store several providers for one interface, but it will remember one as active.

register(**kwargs)

Add one or several providers to the registry.

unregister(interface, name)

Remove one provider from the registry.

There could remain other providers for the given interface.

use(interface, name)

Remember provider identified by name as active one for interface.

resource Module

Base stuff for XAL resources.

class xal.resource.Resource

Bases: object

Base class for XAL resources.

diagnosis(items)

Return a mapping containing diagnosis about the resource.

Diagnosis are not supposed to alter the resource.

diagnosis_methods = None

List of internal methods that provides diagnosis information.

exists()

Return True if the resource exists in current execution context.

session = None

Execution context which the resource belongs to.

test(items)

Run tests on the resource.

Tests may temporarily use or alter the resource with some mock/fake actions: write data to a file, connect to a database...