pennylane_quantuminspire2.api namespace

Submodules

pennylane_quantuminspire2.api.pagination module

class pennylane_quantuminspire2.api.pagination.PageReader[source]

Bases: Generic[PageType, ItemType]

Helper class for reading fastapi-pagination style pages returned by the compute_api_client.

async get_all(api_call: Callable[[...], Awaitable[PageType]], **kwargs: Any) List[ItemType][source]

Get all items from an API call that supports paging.

async get_single(api_call: Callable[[...], Awaitable[PageType]], **kwargs: Any) ItemType | None[source]

Get a single item from an API call that supports paging.

pennylane_quantuminspire2.api.settings module

class pennylane_quantuminspire2.api.settings.ApiSettings(*, auths: ~typing.Dict[~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], ~qiskit_quantuminspire.api.settings.AuthSettings], default_host: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)])[source]

Bases: BaseModel

The settings class for the Quantum Inspire persistent configuration.

auths: Dict[Url, AuthSettings]
default_host: Url
classmethod from_config_file(path: Path = PosixPath('/home/runner/.quantuminspire/config.json')) ApiSettings[source]

Load the configuration from a file.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

store_tokens(host: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], tokens: ~qiskit_quantuminspire.api.settings.TokenInfo, path: ~pathlib.Path = PosixPath('/home/runner/.quantuminspire/config.json')) None[source]

Stores the team_member_id, access and refresh tokens in the config.json file.

Parameters:
  • host – The hostname of the API for which the tokens are intended.

  • tokens – OAuth access and refresh tokens.

  • path – The path to the config.json file. Defaults to API_SETTINGS_FILE.

Returns:

None

class pennylane_quantuminspire2.api.settings.AuthSettings(*, client_id: str, code_challenge_method: str, code_verifyer_length: int, well_known_endpoint: ~typing.Annotated[str, ~pydantic.functional_validators.BeforeValidator(func=~qiskit_quantuminspire.api.settings.<lambda>, json_schema_input_type=PydanticUndefined)], tokens: ~qiskit_quantuminspire.api.settings.TokenInfo | None, team_member_id: int | None)[source]

Bases: BaseModel

Pydantic model for storing all auth related settings for a given host.

client_id: str
code_challenge_method: str
code_verifyer_length: int
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

team_member_id: int | None
tokens: TokenInfo | None
well_known_endpoint: Url
class pennylane_quantuminspire2.api.settings.TokenInfo(*, access_token: str, expires_in: int, refresh_token: str, refresh_expires_in: int | None = None, generated_at: float = <factory>)[source]

Bases: BaseModel

A pydantic model for storing all information regarding oauth access and refresh tokens.

property access_expires_at: float

Unix timestamp containing the time when the access token will expire.

access_token: str
expires_in: int
generated_at: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

refresh_expires_in: int | None
refresh_token: str