base

alchemiscale.base.api — reusable components for API services

class alchemiscale.base.api.GufeJSONResponse(*args: Any, **kwargs: Any)

Bases: JSONResponse

class alchemiscale.base.api.GzipRequest(*args: Any, **kwargs: Any)

Bases: Request

class alchemiscale.base.api.GzipRoute(*args: Any, **kwargs: Any)

Bases: APIRoute

class alchemiscale.base.api.QueryGUFEHandler(return_gufe: bool)

Bases: object

Helper class to provide a single-dispatch like handling of the query operations since they can return list or dict.

alchemiscale.base.api.minimize_scope_space(scopes: List[Scope]) List[Scope]

Remove redundant Scopes from a list of Scopes.

alchemiscale.base.api.validate_scopes(scope: Scope, token: TokenData) None

Verify that token data has specified Scope encoded directly or is accessible via scope hierarchy.

alchemiscale.base.api.validate_scopes_query(query_scope: Scope, token: TokenData, as_str: bool = False) list[alchemiscale.models.Scope] | list[str]

Create the intersection of queried scopes and token, where query scopes may include ‘all’ / wildcard (None). No scopes outside of those included in token will be included in scopes returned.

If as_str is True, returns a list of str rather than list of Scopes.


alchemiscale.base.client — base class for API clients

class alchemiscale.base.client.AlchemiscaleBaseClient(api_url: str, identifier: str, key: str, max_retries: int = 5, retry_base_seconds: float = 2.0, retry_max_seconds: float = 60.0, verify: bool = True)

Bases: object

Base class for Alchemiscale API clients.

exception alchemiscale.base.client.AlchemiscaleBaseClientError(*args, **kwargs)

Bases: Exception

exception alchemiscale.base.client.AlchemiscaleConnectionError

Bases: Exception