oqtopus_client
¶
Public package interface for oqtopus_client.
Classes:
-
OqtopusClient–Synchronous public client; internal HTTP calls are executed asynchronously.
-
OqtopusConfig–Shared client configuration bundle.
-
OqtopusDevice–Public device object wrapper.
-
OqtopusEstimationJobResult–Specialized SDK result object for estimation jobs.
-
OqtopusEstimationOperator–Typed operator wrapper for estimation-style job specifications.
-
OqtopusJobResult–SDK result object for a job's state and execution output payloads.
-
OqtopusJobSpec–Thin wrapper input for job submission.
-
OqtopusMultiManualJobResult–Specialized SDK result object for multi_manual jobs.
-
OqtopusSamplingJobResult–Specialized SDK result object for sampling jobs.
-
OqtopusSseJobResult–Specialized SDK result object for sse jobs.
-
ResponseValidationError–Raised when a successful API response cannot be validated.
-
UserApiError–Raised when the API returns a non-success status.
Functions:
-
bitstring_dict_to_int_keys–Convert bitstring-keyed mappings to int-keyed mappings.
-
bitstring_to_int–Convert a bitstring key such as
0101or0b0101to an integer. -
convert_sampling_counts_to_int_keys–Convert sampling result bitstring keys to integers.
OqtopusClient
¶
OqtopusClient(
config: OqtopusConfig | None = None,
default_headers: Mapping[str, str] | None = None,
user_agent: str | None = None,
)
Synchronous public client; internal HTTP calls are executed asynchronously.
Parameters:
-
(config¶Optional, default:None) –Client configuration bundle. If omitted,
OqtopusConfig.from_file()is used. In normal mode, the resolved config must provide a non-emptybase_url. -
(default_headers¶Optional, default:None) –Additional headers merged into every request.
-
(user_agent¶Optional, default:None) –Custom User-Agent header value.
Methods:
-
cancel_job–Cancel a job by id.
-
create_api_token–Create an API token.
-
delete_api_token–Delete current API token.
-
delete_job–Delete a job by id.
-
get_announcement–Get one announcement by id.
-
get_announcements_list–List service announcements.
-
get_api_token–Get API token status.
-
get_api_token_status–Get API token status.
-
get_device–Get one device by id.
-
get_job–Fetch one job by id and convert to typed SDK result.
-
get_job_result–Alias of :meth:
get_job. -
get_job_status–Get current status for one job.
-
get_sselog–Get encoded SSE log archive for one job.
-
is_finished–Return whether the job is in terminal status.
-
list_devices–List available devices.
-
list_jobs–List jobs with optional filters.
-
refresh–Alias of :meth:
get_job_result. -
result–Alias of :meth:
get_job_result. -
run_estimation–Run an estimation job and return estimation-typed SDK result.
-
run_job–Submit one job spec, wait until completion, and return typed result.
-
run_jobs_batch–Submit multiple jobs, then wait for all of them.
-
run_multi_manual–Run a multi-manual job and return multi-manual-typed SDK result.
-
run_sampling–Run a sampling job and return sampling-typed SDK result.
-
run_sse–Run an SSE job and return SSE-typed SDK result.
-
run_sse_file–Build and run an SSE job directly from a script file and return SSE result.
-
status–Get current job status enum for one job.
-
submit_job–Submit one job and return submission response.
-
submit_jobs–Submit multiple jobs in parallel.
-
submit_jobs_async–Submit multiple jobs concurrently in an async context.
-
wait–Alias of :meth:
wait_for_job. -
wait_for_job–Poll one job until terminal status/timeout and return typed result.
-
wait_for_jobs–Wait multiple jobs in parallel.
-
wait_for_jobs_async–Wait multiple jobs concurrently in an async context.
cancel_job
¶
cancel_job(job_id: str) -> SuccessSuccessResponse
Cancel a job by id.
Parameters:
-
(job_id¶Required) –Target job ID to cancel.
Returns:
-
SuccessSuccessResponse–Success response from the API.
create_api_token
¶
create_api_token() -> ApiTokenApiToken
Create an API token.
Returns:
-
ApiTokenApiToken–The created API token payload.
delete_job
¶
delete_job(job_id: str) -> SuccessSuccessResponse
Delete a job by id.
Parameters:
-
(job_id¶Required) –Target job ID to delete.
Returns:
-
SuccessSuccessResponse–Success response from the API.
get_announcement
¶
get_announcement(
announcement_id: int,
) -> AnnouncementsGetAnnouncementResponse
Get one announcement by id.
Parameters:
-
(announcement_id¶Required) –Target announcement ID.
Returns:
-
AnnouncementsGetAnnouncementResponse–The requested announcement payload.
get_announcements_list
¶
get_announcements_list() -> (
AnnouncementsGetAnnouncementsListResponse
)
List service announcements.
Returns:
-
AnnouncementsGetAnnouncementsListResponse–Announcements list returned by the API.
get_api_token
¶
get_api_token() -> ApiTokenApiTokenStatus
Get API token status.
Returns:
-
ApiTokenApiTokenStatus–The current API token status payload.
get_api_token_status
¶
get_api_token_status() -> ApiTokenApiTokenStatus
Get API token status.
Returns:
-
ApiTokenApiTokenStatus–The current API token status payload.
get_device
¶
get_device(device_id: str) -> OqtopusDevice
Get one device by id.
Parameters:
-
(device_id¶Required) –Target device ID to fetch.
Returns:
-
OqtopusDevice–The requested device wrapped as an SDK device object.
get_job
¶
get_job(job_id: str) -> OqtopusJobResult
Fetch one job by id and convert to typed SDK result.
Parameters:
-
(job_id¶Required) –Target job ID to fetch.
Returns:
-
OqtopusJobResult–The fetched job as an SDK result wrapper.
get_job_result
¶
get_job_result(job_id: str) -> OqtopusJobResult
Alias of :meth:get_job.
Parameters:
-
(job_id¶Required) –Target job ID to fetch.
Returns:
-
OqtopusJobResult–The fetched job as an SDK result wrapper.
get_job_status
¶
get_job_status(job_id: str) -> JobsGetJobStatusResponse
Get current status for one job.
Parameters:
-
(job_id¶Required) –Target job ID to get status for.
Returns:
-
JobsGetJobStatusResponse–Raw job status response from the API.
get_sselog
¶
get_sselog(job_id: str) -> JobsGetSselogResponse
Get encoded SSE log archive for one job.
Parameters:
-
(job_id¶Required) –Target SSE job ID.
Returns:
-
JobsGetSselogResponse–Encoded SSE log archive response from the API.
is_finished
¶
is_finished(
job_id: str,
*,
terminal_statuses: set[JobsJobStatus] | None = None,
) -> bool
list_devices
¶
list_devices() -> list[OqtopusDevice]
List available devices.
Returns:
-
list[OqtopusDevice]–Available devices wrapped as SDK device objects.
list_jobs
¶
list_jobs(
*,
fields: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
status: JobsJobStatus | None = None,
q: str | None = None,
page: int | None = None,
size: int | None = None,
order: str | None = None,
) -> list[JobsJob]
List jobs with optional filters.
Returns:
-
list[JobsJob]–Jobs returned by the API.
refresh
¶
refresh(job_id: str) -> OqtopusJobResult
Alias of :meth:get_job_result.
Parameters:
-
(job_id¶Required) –Target job ID to fetch.
Returns:
-
OqtopusJobResult–The fetched job as an SDK result wrapper.
result
¶
result(job_id: str) -> OqtopusJobResult
Alias of :meth:get_job_result.
Parameters:
-
(job_id¶Required) –Target job ID to fetch.
Returns:
-
OqtopusJobResult–The fetched job as an SDK result wrapper.
run_estimation
¶
run_estimation(
job: OqtopusJobSpec,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusEstimationJobResult
Run an estimation job and return estimation-typed SDK result.
Parameters:
-
(job¶Required) –OqtopusJobSpecwithjob_type='estimation'. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusEstimationJobResult–The finished job as an estimation result wrapper.
run_job
¶
run_job(
job: OqtopusJobSpec,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusJobResult
Submit one job spec, wait until completion, and return typed result.
Parameters:
-
(job¶Required) –OqtopusJobSpec. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusJobResult–The finished job as an SDK result wrapper.
run_jobs_batch
¶
run_jobs_batch(
jobs: list[OqtopusJobSpec],
*,
submit_workers: int = 4,
wait_workers: int = 4,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
) -> list[OqtopusJobResult]
Submit multiple jobs, then wait for all of them.
Parameters:
-
(jobs¶Required) –List of
OqtopusJobSpec. -
(submit_workers¶Optional, default:4) –Submission concurrency. Default is
4. -
(wait_workers¶Optional, default:4) –Waiting concurrency. Default is
4. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
Returns:
-
list[OqtopusJobResult]–Finished jobs as SDK result wrappers.
Raises:
-
TypeError–If any item in
jobsis not anOqtopusJobSpec. -
ValueError–If
submit_workersis less than1.
run_multi_manual
¶
run_multi_manual(
job: OqtopusJobSpec,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusMultiManualJobResult
Run a multi-manual job and return multi-manual-typed SDK result.
Parameters:
-
(job¶Required) –OqtopusJobSpecwithjob_type='multi_manual'. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusMultiManualJobResult–The finished job as a multi-manual result wrapper.
run_sampling
¶
run_sampling(
job: OqtopusJobSpec,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusSamplingJobResult
Run a sampling job and return sampling-typed SDK result.
Parameters:
-
(job¶Required) –OqtopusJobSpecwithjob_type='sampling'. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusSamplingJobResult–The finished job as a sampling result wrapper.
run_sse
¶
run_sse(
job: OqtopusJobSpec,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusSseJobResult
Run an SSE job and return SSE-typed SDK result.
Parameters:
-
(job¶Required) –OqtopusJobSpecwithjob_type='sse'. -
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusSseJobResult–The finished job as an SSE result wrapper.
run_sse_file
¶
run_sse_file(
*,
file_path: str | Path,
device_id: str,
name: str | None = None,
description: str | None = None,
transpiler_info: dict[str, object] | None = None,
simulator_info: dict[str, object] | None = None,
mitigation_info: dict[str, object] | None = None,
shots: int = 1,
max_file_size: int = 10 * 1024 * 1024,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusSseJobResult
Build and run an SSE job directly from a script file and return SSE result.
Parameters:
-
(file_path¶Required) –Path to the Python script.
-
(device_id¶Required) –Target device ID.
-
(name¶Optional, default:None) –Job name.
-
(description¶Optional, default:None) –Job description.
-
(transpiler_info¶Optional, default:None) –Transpiler settings.
-
(simulator_info¶Optional, default:None) –Simulator settings.
-
(mitigation_info¶Optional, default:None) –Error mitigation settings.
-
(shots¶Optional, default:1) –Number of shots.
-
(max_file_size¶Optional, default:10 * 1024 * 1024) –Max script size in bytes.
-
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusSseJobResult–The finished job as an SSE result wrapper.
status
¶
status(job_id: str) -> JobsJobStatus
Get current job status enum for one job.
Parameters:
-
(job_id¶Required) –Target job ID to get status for.
Returns:
-
JobsJobStatus–The current job status.
submit_job
¶
submit_job(body: OqtopusJobSpec) -> JobsRegisterJobResponse
Submit one job and return submission response.
Parameters:
-
(body¶Required) –OqtopusJobSpec.
Returns:
-
JobsRegisterJobResponse–Submission response for the created job.
Raises:
-
TypeError–If
bodyis not anOqtopusJobSpec.
submit_jobs
¶
submit_jobs(
jobs: Sequence[OqtopusJobSpec], *, max_workers: int = 4
) -> list[JobsRegisterJobResponse]
Submit multiple jobs in parallel.
Parameters:
-
(jobs¶Required) –List of
OqtopusJobSpec. -
(max_workers¶Optional, default:4) –Submission concurrency. Default is
4.
Returns:
-
list[JobsRegisterJobResponse]–Submission responses for all jobs.
Raises:
-
TypeError–If any item in
jobsis not anOqtopusJobSpec. -
ValueError–If
max_workersis less than1.
submit_jobs_async
async
¶
submit_jobs_async(
jobs: Sequence[OqtopusJobSpec], *, max_workers: int = 4
) -> list[JobsRegisterJobResponse]
Submit multiple jobs concurrently in an async context.
Parameters:
-
(jobs¶Required) –List of
OqtopusJobSpec. -
(max_workers¶Optional, default:4) –Submission concurrency. Default is
4.
Returns:
-
list[JobsRegisterJobResponse]–Submission responses for all jobs.
Raises:
-
TypeError–If any item in
jobsis not anOqtopusJobSpec. -
ValueError–If
max_workersis less than1.
wait
¶
wait(
job_id: str,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusJobResult
Alias of :meth:wait_for_job.
Parameters:
-
(job_id¶Required) –Target job ID to wait for.
-
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusJobResult–The finished job as an SDK result wrapper.
wait_for_job
¶
wait_for_job(
job_id: str,
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
terminal_statuses: set[JobsJobStatus] | None = None,
failure_statuses: set[JobsJobStatus] | None = None,
on_status: Callable[[JobsGetJobStatusResponse], None]
| None = None,
) -> OqtopusJobResult
Poll one job until terminal status/timeout and return typed result.
Parameters:
-
(job_id¶Required) –Target job ID to wait for.
-
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(terminal_statuses¶Optional, default:None) –Statuses treated as terminal.
-
(failure_statuses¶Optional, default:None) –Statuses treated as failures.
-
(on_status¶Optional, default:None) –Callback invoked on each polled status.
Returns:
-
OqtopusJobResult–The finished job as an SDK result wrapper.
wait_for_jobs
¶
wait_for_jobs(
job_ids: list[str],
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
max_workers: int = 4,
) -> list[OqtopusJobResult]
Wait multiple jobs in parallel.
Parameters:
-
(job_ids¶Required) –List of job IDs to wait for.
-
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(max_workers¶Optional, default:4) –Waiting concurrency. Default is
4.
Returns:
-
list[OqtopusJobResult]–Finished jobs as SDK result wrappers.
Raises:
-
ValueError–If
max_workersis less than1.
wait_for_jobs_async
async
¶
wait_for_jobs_async(
job_ids: list[str],
*,
interval: float = 1.0,
interval_backoff: float = 1.0,
max_interval: float | None = None,
timeout: float | None = 300.0,
max_workers: int = 4,
) -> list[OqtopusJobResult]
Wait multiple jobs concurrently in an async context.
Parameters:
-
(job_ids¶Required) –List of job IDs to wait for.
-
(interval¶Optional, default:1.0) –Polling interval in seconds.
-
(interval_backoff¶Optional, default:1.0) –Backoff multiplier for polling interval.
-
(max_interval¶Optional, default:None) –Upper bound of polling interval in seconds.
-
(timeout¶Optional, default:300.0) –Timeout in seconds.
-
(max_workers¶Optional, default:4) –Waiting concurrency. Default is
4.
Returns:
-
list[OqtopusJobResult]–Finished jobs as SDK result wrappers.
Raises:
-
ValueError–If
max_workersis less than1.
OqtopusConfig
dataclass
¶
OqtopusConfig(
base_url: str,
api_token: str | None = None,
proxy: str | None = None,
timeout: float = 30.0,
retry_max_attempts: int = 3,
retry_backoff_seconds: float = 0.2,
retry_status_codes: frozenset[int] | None = None,
retry_methods: frozenset[str] | None = None,
)
Shared client configuration bundle.
Attributes:
-
base_url(str) –OQTOPUS API base URL.
-
api_token(str | None) –API token string.
-
timeout(float) –HTTP request timeout seconds.
-
retry_max_attempts(int) –Max retry attempts for retryable requests.
-
retry_backoff_seconds(float) –Exponential backoff base seconds.
-
retry_status_codes(frozenset[int] | None) –HTTP status codes treated as retryable.
-
retry_methods(frozenset[str] | None) –HTTP methods treated as retryable.
Methods:
-
from_env–Load configuration from environment variables.
-
from_file–Load configuration from an INI-style profile file.
from_env
classmethod
¶
from_env(
*,
base_url_env: str = DEFAULT_BASE_URL_ENV,
proxy_env: str = DEFAULT_PROXY_ENV,
api_token_env: str = DEFAULT_API_TOKEN_ENV,
) -> OqtopusConfig
Load configuration from environment variables.
Parameters:
-
(base_url_env¶Optional, default:DEFAULT_BASE_URL_ENV) –Environment variable name used for the API base URL. Defaults to
OQTOPUS_BASE_URL. -
(proxy_env¶Optional, default:DEFAULT_PROXY_ENV) –Environment variable name used for the proxy URL. Defaults to
OQTOPUS_PROXY. -
(api_token_env¶Optional, default:DEFAULT_API_TOKEN_ENV) –Environment variable name used for the API token. Defaults to
OQTOPUS_API_TOKEN.
Returns:
-
OqtopusConfig–Configuration loaded from environment variables.
Raises:
-
ValueError–If the base URL environment variable is not set.
from_file
classmethod
¶
from_file(
section: str = DEFAULT_SECTION,
path: str | Path | object = _DEFAULT_CONFIG_PATH,
) -> OqtopusConfig
Load configuration from an INI-style profile file.
Parameters:
-
(section¶Optional, default:DEFAULT_SECTION) –INI section name to load. Defaults to
default. -
(path¶Optional, default:_DEFAULT_CONFIG_PATH) –Config file path. When omitted, this method reads
$XDG_CONFIG_HOME/oqtopus/config.iniifXDG_CONFIG_HOMEis set; otherwise it reads~/.config/oqtopus/config.ini.
Example
OqtopusClient(OqtopusConfig.from_file("oqtopus-dev"))
Returns:
-
OqtopusConfig–Configuration loaded from the requested profile.
Raises:
-
ValueError–If
sectionorpathis invalid, or if the profile is missing required values.
OqtopusDevice
dataclass
¶
OqtopusDevice(raw: DevicesDeviceInfo)
Public device object wrapper.
Attributes:
-
available_at(datetime | None) –Estimated next available time, if provided.
-
basis_gates(list[str]) –Supported basis gates.
-
calibrated_at(datetime | None) –Last calibration timestamp, if provided.
-
description(str) –Human-readable device description.
-
device_id(str) –Unique device identifier.
-
device_info(dict[str, object] | None) –Additional device information as a parsed dictionary.
-
device_info_str(str | None) –Additional device information as raw JSON text.
-
device_type(str) –Device type string returned by the API.
-
n_pending_jobs(int) –Number of queued jobs for this device.
-
n_qubits(int | None) –Qubit count, when available.
-
status(str) –Current availability status.
-
supported_instructions(list[str]) –Supported instruction set names.
available_at
property
¶
available_at: datetime | None
Estimated next available time, if provided.
This is useful when a device is busy or under maintenance and the API reports an expected recovery time.
basis_gates
property
¶
basis_gates: list[str]
Supported basis gates.
Use this list to understand which transpiled instruction set the device accepts natively.
calibrated_at
property
¶
calibrated_at: datetime | None
Last calibration timestamp, if provided.
This helps assess how recently the hardware calibration data was updated.
description
property
¶
description: str
Human-readable device description.
This is intended for display in UIs and logs rather than as a stable key.
device_id
property
¶
device_id: str
Unique device identifier.
This value is used when submitting jobs to a specific backend.
device_info
property
¶
device_info: dict[str, object] | None
Additional device information as a parsed dictionary.
The API returns this field as JSON text. This property parses that payload into a dictionary for easier consumption.
device_info_str
property
¶
device_info_str: str | None
Additional device information as raw JSON text.
Use this property when you need the original API payload without JSON parsing or when inspecting malformed values returned by the backend.
device_type
property
¶
device_type: str
Device type string returned by the API.
Typical values distinguish hardware and simulator-style backends.
n_pending_jobs
property
¶
n_pending_jobs: int
Number of queued jobs for this device.
This can help estimate queue pressure across multiple candidate devices.
n_qubits
property
¶
n_qubits: int | None
Qubit count, when available.
Some backends may omit this value when the information is not published.
status
property
¶
status: str
Current availability status.
Use this field to check whether the device is available or temporarily unavailable before job submission.
supported_instructions
property
¶
supported_instructions: list[str]
Supported instruction set names.
These values summarize higher-level instruction families supported by the backend.
OqtopusEstimationJobResult
¶
OqtopusEstimationJobResult(
*,
job_id: str,
job_type: JobsJobType | str,
status: JobsJobStatus | str,
name: str,
description: str | None = None,
device_id: str,
shots: int,
job_info: JobsJobInfo | Mapping[str, Any],
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
transpile_result: JobsS3TranspileResult
| Mapping[str, Any]
| None = None,
message: str | None = None,
execution_time: float | None = None,
submitted_at: datetime | None = None,
ready_at: datetime | None = None,
running_at: datetime | None = None,
ended_at: datetime | None = None,
client: object | None = None,
)
flowchart TD
oqtopus_client.OqtopusEstimationJobResult[OqtopusEstimationJobResult]
oqtopus_client.services.job_results.OqtopusJobResult[OqtopusJobResult]
oqtopus_client.services.job_results.OqtopusJobResult --> oqtopus_client.OqtopusEstimationJobResult
click oqtopus_client.OqtopusEstimationJobResult href "" "oqtopus_client.OqtopusEstimationJobResult"
click oqtopus_client.services.job_results.OqtopusJobResult href "" "oqtopus_client.services.job_results.OqtopusJobResult"
Specialized SDK result object for estimation jobs.
Raises:
-
ValueError–If
job_typeorstatusis invalid.
Methods:
-
from_raw–Build a result object from a full job payload.
-
get_exp_value–Return estimation exp_value.
-
get_stds–Return estimation stds.
-
is_estimation–Return
Truewhen this result belongs to an estimation job. -
is_multi_manual–Return
Truewhen this result belongs to a multi-manual job. -
is_sampling–Return
Truewhen this result belongs to a sampling job. -
is_sse–Return
Truewhen this result belongs to an SSE job.
Attributes:
-
description(str | None) –Return the related job description when known.
-
device_id(str | None) –Return the related device id when known.
-
ended_at(datetime | None) –Return the related end time when known.
-
estimation(EstimationPayload) –Return estimation payload only, or
Nonewhen unavailable. -
execution_time(float | int | None) –Return the related execution time in seconds when known.
-
exp_value(float | None) –Alias of :meth:
get_exp_value. -
job_id(str | None) –Return the related job id when known.
-
job_info(JobsJobInfo | Mapping[str, Any] | None) –Return the related
job_infopayload when known. -
job_type(JobsJobType | None) –Return the related job type when known.
-
message(str | None) –Return the related message when known.
-
mitigation_info(Mapping[str, Any] | None) –Return the related mitigation info when known.
-
name(str | None) –Return the related job name when known.
-
ready_at(datetime | None) –Return the related ready time when known.
-
running_at(datetime | None) –Return the related running time when known.
-
sampling(SamplingPayload) –Return sampling payload when result is sampling-like.
-
shots(int | None) –Return the related shot count when known.
-
simulator_info(Mapping[str, Any] | None) –Return the related simulator info when known.
-
status(JobsJobStatus | None) –Return related job status when known.
-
stds(float | None) –Alias of :meth:
get_stds. -
submitted_at(datetime | None) –Return the related submission time when known.
-
transpile_result(JobsS3TranspileResult | Mapping[str, Any] | None) –Return the related transpile result when known.
-
transpiler_info(Mapping[str, Any] | None) –Return the related transpiler info when known.
description
property
¶
description: str | None
Return the related job description when known.
This corresponds to the optional description supplied at submission time.
device_id
property
¶
device_id: str | None
Return the related device id when known.
This identifies the backend where the job was submitted.
ended_at
property
¶
ended_at: datetime | None
Return the related end time when known.
This timestamp is set when the job reaches a terminal state.
estimation
property
¶
estimation: EstimationPayload
Return estimation payload only, or None when unavailable.
Returns:
-
EstimationPayload–Estimation payload when available.
execution_time
property
¶
execution_time: float | int | None
Return the related execution time in seconds when known.
This value is reported by the API and may be absent for unfinished jobs.
exp_value
property
¶
exp_value: float | None
Alias of :meth:get_exp_value.
Returns:
-
float | None–Estimated expectation value when available.
job_id
property
¶
job_id: str | None
Return the related job id when known.
This is the same identifier used by client methods such as status(),
wait(), and cancel_job().
job_info
property
¶
job_info: JobsJobInfo | Mapping[str, Any] | None
Return the related job_info payload when known.
This contains nested execution results and other API-provided metadata.
job_type
property
¶
job_type: JobsJobType | None
Return the related job type when known.
Examples include sampling, estimation, multi_manual, and
sse.
message
property
¶
message: str | None
Return the related message when known.
Error details and backend-provided status messages are often surfaced here.
mitigation_info
property
¶
mitigation_info: Mapping[str, Any] | None
Return the related mitigation info when known.
This contains error-mitigation settings associated with the job.
name
property
¶
name: str | None
Return the related job name when known.
This corresponds to the optional name supplied when the job was submitted.
ready_at
property
¶
ready_at: datetime | None
Return the related ready time when known.
This timestamp is set when the job has been prepared and is ready to run.
running_at
property
¶
running_at: datetime | None
Return the related running time when known.
This timestamp is set when execution actually starts.
sampling
property
¶
sampling: SamplingPayload
Return sampling payload when result is sampling-like.
Returns:
-
SamplingPayload–Sampling payload when available.
shots
property
¶
shots: int | None
Return the related shot count when known.
For job types that do not use sampling-style shots, this may be absent.
simulator_info
property
¶
simulator_info: Mapping[str, Any] | None
Return the related simulator info when known.
This is typically present for simulator-backed executions.
status
property
¶
status: JobsJobStatus | None
Return related job status when known.
Possible values are submitted, ready, running,
succeeded, failed, and cancelled.
For helpers that wait for completion such as wait() and run_*(),
the returned status is typically succeeded, failed, or
cancelled.
stds
property
¶
stds: float | None
Alias of :meth:get_stds.
Returns:
-
float | None–Estimated standard deviation when available.
submitted_at
property
¶
submitted_at: datetime | None
Return the related submission time when known.
This timestamp is set when the API accepts the job.
transpile_result
property
¶
transpile_result: (
JobsS3TranspileResult | Mapping[str, Any] | None
)
Return the related transpile result when known.
This may include transpiled circuits or backend-specific transpilation metadata returned by the API.
transpiler_info
property
¶
transpiler_info: Mapping[str, Any] | None
Return the related transpiler info when known.
This is the transpiler metadata submitted with the job or echoed back by the API.
from_raw
classmethod
¶
Build a result object from a full job payload.
Parameters:
-
(job¶Required) –Job definition returned by the API.
-
(client¶Optional, default:None) –Client object bound to this result.
Returns:
-
Self–A result object populated from the job definition.
Raises:
-
ValueError–If the payload is missing required submitted-job fields.
get_exp_value
¶
get_exp_value() -> float | None
Return estimation exp_value.
Returns:
-
float | None–Estimated expectation value when available.
get_stds
¶
get_stds() -> float | None
Return estimation stds.
Returns:
-
float | None–Estimated standard deviation when available.
is_estimation
¶
is_estimation() -> bool
Return True when this result belongs to an estimation job.
Returns:
-
bool–Truewhen the job type is estimation.
is_multi_manual
¶
is_multi_manual() -> bool
Return True when this result belongs to a multi-manual job.
Returns:
-
bool–Truewhen the job type is multi-manual.
is_sampling
¶
is_sampling() -> bool
Return True when this result belongs to a sampling job.
Returns:
-
bool–Truewhen the job type is sampling.
is_sse
¶
is_sse() -> bool
Return True when this result belongs to an SSE job.
Returns:
-
bool–Truewhen the job type is SSE.
OqtopusEstimationOperator
dataclass
¶
OqtopusEstimationOperator(
pauli: str, coeff: float | None = None
)
Typed operator wrapper for estimation-style job specifications.
Methods:
-
from_model–Build a wrapper from a REST
JobsS3OperatorItemmodel. -
to_model–Convert this wrapper to the REST
JobsS3OperatorItemmodel.
from_model
classmethod
¶
from_model(
operator: JobsS3OperatorItem,
) -> OqtopusEstimationOperator
Build a wrapper from a REST JobsS3OperatorItem model.
Parameters:
-
(operator¶Required) –REST model to convert.
Returns:
-
OqtopusEstimationOperator–The converted operator wrapper.
to_model
¶
to_model() -> JobsS3OperatorItem
Convert this wrapper to the REST JobsS3OperatorItem model.
Returns:
-
JobsS3OperatorItem–The API model for this operator.
OqtopusJobResult
¶
OqtopusJobResult(
*,
job_id: str,
job_type: JobsJobType | str,
status: JobsJobStatus | str,
name: str,
description: str | None = None,
device_id: str,
shots: int,
job_info: JobsJobInfo | Mapping[str, Any],
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
transpile_result: JobsS3TranspileResult
| Mapping[str, Any]
| None = None,
message: str | None = None,
execution_time: float | None = None,
submitted_at: datetime | None = None,
ready_at: datetime | None = None,
running_at: datetime | None = None,
ended_at: datetime | None = None,
client: object | None = None,
)
SDK result object for a job's state and execution output payloads.
Raises:
-
ValueError–If
job_typeorstatusis invalid.
Methods:
-
from_raw–Build a result object from a full job payload.
-
is_estimation–Return
Truewhen this result belongs to an estimation job. -
is_multi_manual–Return
Truewhen this result belongs to a multi-manual job. -
is_sampling–Return
Truewhen this result belongs to a sampling job. -
is_sse–Return
Truewhen this result belongs to an SSE job.
Attributes:
-
description(str | None) –Return the related job description when known.
-
device_id(str | None) –Return the related device id when known.
-
ended_at(datetime | None) –Return the related end time when known.
-
estimation(EstimationPayload) –Return estimation payload when result is estimation-like.
-
execution_time(float | int | None) –Return the related execution time in seconds when known.
-
job_id(str | None) –Return the related job id when known.
-
job_info(JobsJobInfo | Mapping[str, Any] | None) –Return the related
job_infopayload when known. -
job_type(JobsJobType | None) –Return the related job type when known.
-
message(str | None) –Return the related message when known.
-
mitigation_info(Mapping[str, Any] | None) –Return the related mitigation info when known.
-
name(str | None) –Return the related job name when known.
-
ready_at(datetime | None) –Return the related ready time when known.
-
running_at(datetime | None) –Return the related running time when known.
-
sampling(SamplingPayload) –Return sampling payload when result is sampling-like.
-
shots(int | None) –Return the related shot count when known.
-
simulator_info(Mapping[str, Any] | None) –Return the related simulator info when known.
-
status(JobsJobStatus | None) –Return related job status when known.
-
submitted_at(datetime | None) –Return the related submission time when known.
-
transpile_result(JobsS3TranspileResult | Mapping[str, Any] | None) –Return the related transpile result when known.
-
transpiler_info(Mapping[str, Any] | None) –Return the related transpiler info when known.
description
property
¶
description: str | None
Return the related job description when known.
This corresponds to the optional description supplied at submission time.
device_id
property
¶
device_id: str | None
Return the related device id when known.
This identifies the backend where the job was submitted.
ended_at
property
¶
ended_at: datetime | None
Return the related end time when known.
This timestamp is set when the job reaches a terminal state.
estimation
property
¶
estimation: EstimationPayload
Return estimation payload when result is estimation-like.
Returns:
-
EstimationPayload–Estimation payload when available.
execution_time
property
¶
execution_time: float | int | None
Return the related execution time in seconds when known.
This value is reported by the API and may be absent for unfinished jobs.
job_id
property
¶
job_id: str | None
Return the related job id when known.
This is the same identifier used by client methods such as status(),
wait(), and cancel_job().
job_info
property
¶
job_info: JobsJobInfo | Mapping[str, Any] | None
Return the related job_info payload when known.
This contains nested execution results and other API-provided metadata.
job_type
property
¶
job_type: JobsJobType | None
Return the related job type when known.
Examples include sampling, estimation, multi_manual, and
sse.
message
property
¶
message: str | None
Return the related message when known.
Error details and backend-provided status messages are often surfaced here.
mitigation_info
property
¶
mitigation_info: Mapping[str, Any] | None
Return the related mitigation info when known.
This contains error-mitigation settings associated with the job.
name
property
¶
name: str | None
Return the related job name when known.
This corresponds to the optional name supplied when the job was submitted.
ready_at
property
¶
ready_at: datetime | None
Return the related ready time when known.
This timestamp is set when the job has been prepared and is ready to run.
running_at
property
¶
running_at: datetime | None
Return the related running time when known.
This timestamp is set when execution actually starts.
sampling
property
¶
sampling: SamplingPayload
Return sampling payload when result is sampling-like.
Returns:
-
SamplingPayload–Sampling payload when available.
shots
property
¶
shots: int | None
Return the related shot count when known.
For job types that do not use sampling-style shots, this may be absent.
simulator_info
property
¶
simulator_info: Mapping[str, Any] | None
Return the related simulator info when known.
This is typically present for simulator-backed executions.
status
property
¶
status: JobsJobStatus | None
Return related job status when known.
Possible values are submitted, ready, running,
succeeded, failed, and cancelled.
For helpers that wait for completion such as wait() and run_*(),
the returned status is typically succeeded, failed, or
cancelled.
submitted_at
property
¶
submitted_at: datetime | None
Return the related submission time when known.
This timestamp is set when the API accepts the job.
transpile_result
property
¶
transpile_result: (
JobsS3TranspileResult | Mapping[str, Any] | None
)
Return the related transpile result when known.
This may include transpiled circuits or backend-specific transpilation metadata returned by the API.
transpiler_info
property
¶
transpiler_info: Mapping[str, Any] | None
Return the related transpiler info when known.
This is the transpiler metadata submitted with the job or echoed back by the API.
from_raw
classmethod
¶
Build a result object from a full job payload.
Parameters:
-
(job¶Required) –Job definition returned by the API.
-
(client¶Optional, default:None) –Client object bound to this result.
Returns:
-
Self–A result object populated from the job definition.
Raises:
-
ValueError–If the payload is missing required submitted-job fields.
is_estimation
¶
is_estimation() -> bool
Return True when this result belongs to an estimation job.
Returns:
-
bool–Truewhen the job type is estimation.
is_multi_manual
¶
is_multi_manual() -> bool
Return True when this result belongs to a multi-manual job.
Returns:
-
bool–Truewhen the job type is multi-manual.
is_sampling
¶
is_sampling() -> bool
Return True when this result belongs to a sampling job.
Returns:
-
bool–Truewhen the job type is sampling.
is_sse
¶
is_sse() -> bool
Return True when this result belongs to an SSE job.
Returns:
-
bool–Truewhen the job type is SSE.
OqtopusJobSpec
dataclass
¶
OqtopusJobSpec(
device_id: str,
job_type: JobsJobType | str,
program: str | Sequence[str],
shots: int = 1000,
name: str | None = None,
description: str | None = None,
transpiler_info: Mapping[str, Any] = dict(),
simulator_info: Mapping[str, Any] = dict(),
mitigation_info: Mapping[str, Any] = dict(),
operator: Sequence[
OqtopusEstimationOperator
| JobsS3OperatorItem
| Mapping[str, Any]
]
| None = None,
)
Thin wrapper input for job submission.
Use job_type to choose the execution type (e.g. sampling / estimation).
Attributes:
-
device_id(Required) –Target device ID.
-
job_type(Required) –Job type.
-
program(Required) –One program string or a sequence of program strings.
-
shots(Optional) –Number of shots. Default is
1000. -
name(Optional) –Job name.
-
description(Optional) –Job description.
-
transpiler_info(Optional) –Transpiler settings.
-
simulator_info(Optional) –Simulator settings.
-
mitigation_info(Optional) –Error mitigation settings.
-
operator(Optional) –Operator definitions for estimation-style jobs.
Methods:
-
estimation–Create an estimation job request helper.
-
multi_manual–Create a multi-manual job request helper.
-
sampling–Create a sampling job request helper.
-
sse–Create an SSE job request helper.
-
to_model–Convert to the generated
JobsSubmitJobRequestmodel. -
to_s3_submit_job_info–Convert to the generated
JobsS3SubmitJobInfomodel.
estimation
classmethod
¶
estimation(
*,
device_id: str,
program: str | Sequence[str],
shots: int = 1000,
name: str | None = None,
description: str | None = None,
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
operator: Sequence[
OqtopusEstimationOperator
| JobsS3OperatorItem
| Mapping[str, Any]
]
| None = None,
) -> OqtopusJobSpec
Create an estimation job request helper.
Parameters:
-
(device_id¶Required) –Target device ID.
-
(program¶Required) –A QASM string or a sequence of QASM strings.
-
(shots¶Optional, default:1000) –Number of shots. Default is
1000. -
(name¶Optional, default:None) –Job name.
-
(description¶Optional, default:None) –Job description.
-
(transpiler_info¶Optional, default:None) –Transpiler settings.
-
(simulator_info¶Optional, default:None) –Simulator settings.
-
(mitigation_info¶Optional, default:None) –Error mitigation settings.
-
(operator¶Optional, default:None) –Operator definitions.
Returns:
-
OqtopusJobSpec–An estimation job specification.
multi_manual
classmethod
¶
multi_manual(
*,
device_id: str,
program: str | Sequence[str],
shots: int = 1000,
name: str | None = None,
description: str | None = None,
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
operator: Sequence[
OqtopusEstimationOperator
| JobsS3OperatorItem
| Mapping[str, Any]
]
| None = None,
) -> OqtopusJobSpec
Create a multi-manual job request helper.
Parameters:
-
(device_id¶Required) –Target device ID.
-
(program¶Required) –A QASM string or a sequence of QASM strings.
-
(shots¶Optional, default:1000) –Number of shots. Default is
1000. -
(name¶Optional, default:None) –Job name.
-
(description¶Optional, default:None) –Job description.
-
(transpiler_info¶Optional, default:None) –Transpiler settings.
-
(simulator_info¶Optional, default:None) –Simulator settings.
-
(mitigation_info¶Optional, default:None) –Error mitigation settings.
-
(operator¶Optional, default:None) –Operator definitions.
Returns:
-
OqtopusJobSpec–A multi-manual job specification.
sampling
classmethod
¶
sampling(
*,
device_id: str,
program: str | Sequence[str],
shots: int = 1000,
name: str | None = None,
description: str | None = None,
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
operator: Sequence[
OqtopusEstimationOperator
| JobsS3OperatorItem
| Mapping[str, Any]
]
| None = None,
) -> OqtopusJobSpec
Create a sampling job request helper.
Parameters:
-
(device_id¶Required) –Target device ID.
-
(program¶Required) –A QASM string or a sequence of QASM strings.
-
(shots¶Optional, default:1000) –Number of shots. Default is
1000. -
(name¶Optional, default:None) –Job name.
-
(description¶Optional, default:None) –Job description.
-
(transpiler_info¶Optional, default:None) –Transpiler settings.
-
(simulator_info¶Optional, default:None) –Simulator settings.
-
(mitigation_info¶Optional, default:None) –Error mitigation settings.
-
(operator¶Optional, default:None) –Operator definitions.
Returns:
-
OqtopusJobSpec–A sampling job specification.
sse
classmethod
¶
sse(
*,
device_id: str,
program: str | Sequence[str],
shots: int = 1000,
name: str | None = None,
description: str | None = None,
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
) -> OqtopusJobSpec
Create an SSE job request helper.
Parameters:
-
(device_id¶Required) –Target device ID.
-
(program¶Required) –A Python script string or a sequence of script strings.
-
(shots¶Optional, default:1000) –Number of shots. Default is
1000. -
(name¶Optional, default:None) –Job name.
-
(description¶Optional, default:None) –Job description.
-
(transpiler_info¶Optional, default:None) –Transpiler settings.
-
(simulator_info¶Optional, default:None) –Simulator settings.
-
(mitigation_info¶Optional, default:None) –Error mitigation settings.
Returns:
-
OqtopusJobSpec–An SSE job specification.
to_model
¶
to_model() -> JobsSubmitJobRequest
Convert to the generated JobsSubmitJobRequest model.
This method has no arguments. It converts required/optional fields already set on this instance.
Returns:
-
JobsSubmitJobRequest–The generated job submission request model.
to_s3_submit_job_info
¶
to_s3_submit_job_info() -> JobsS3SubmitJobInfo
Convert to the generated JobsS3SubmitJobInfo model.
Returns:
-
JobsS3SubmitJobInfo–The generated S3 offload payload model.
Raises:
-
ValueError–If an SSE job does not contain exactly one Python program.
OqtopusMultiManualJobResult
¶
OqtopusMultiManualJobResult(
*,
job_id: str,
job_type: JobsJobType | str,
status: JobsJobStatus | str,
name: str,
description: str | None = None,
device_id: str,
shots: int,
job_info: JobsJobInfo | Mapping[str, Any],
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
transpile_result: JobsS3TranspileResult
| Mapping[str, Any]
| None = None,
message: str | None = None,
execution_time: float | None = None,
submitted_at: datetime | None = None,
ready_at: datetime | None = None,
running_at: datetime | None = None,
ended_at: datetime | None = None,
client: object | None = None,
)
flowchart TD
oqtopus_client.OqtopusMultiManualJobResult[OqtopusMultiManualJobResult]
oqtopus_client.services.job_results.OqtopusSamplingJobResult[OqtopusSamplingJobResult]
oqtopus_client.services.job_results.OqtopusJobResult[OqtopusJobResult]
oqtopus_client.services.job_results.OqtopusSamplingJobResult --> oqtopus_client.OqtopusMultiManualJobResult
oqtopus_client.services.job_results.OqtopusJobResult --> oqtopus_client.services.job_results.OqtopusSamplingJobResult
click oqtopus_client.OqtopusMultiManualJobResult href "" "oqtopus_client.OqtopusMultiManualJobResult"
click oqtopus_client.services.job_results.OqtopusSamplingJobResult href "" "oqtopus_client.services.job_results.OqtopusSamplingJobResult"
click oqtopus_client.services.job_results.OqtopusJobResult href "" "oqtopus_client.services.job_results.OqtopusJobResult"
Specialized SDK result object for multi_manual jobs.
Raises:
-
ValueError–If
job_typeorstatusis invalid.
Methods:
-
counts_with_integer_keys–Convert bitstring keys to integer keys for sampling payload.
-
from_raw–Build a result object from a full job payload.
-
get_counts–Return raw counts with original bitstring keys.
-
get_divided_counts–Return integer-keyed counts per sub-result from
divided_counts. -
is_estimation–Return
Truewhen this result belongs to an estimation job. -
is_multi_manual–Return
Truewhen this result belongs to a multi-manual job. -
is_sampling–Return
Truewhen this result belongs to a sampling job. -
is_sse–Return
Truewhen this result belongs to an SSE job.
Attributes:
-
description(str | None) –Return the related job description when known.
-
device_id(str | None) –Return the related device id when known.
-
ended_at(datetime | None) –Return the related end time when known.
-
estimation(EstimationPayload) –Return estimation payload when result is estimation-like.
-
execution_time(float | int | None) –Return the related execution time in seconds when known.
-
job_id(str | None) –Return the related job id when known.
-
job_info(JobsJobInfo | Mapping[str, Any] | None) –Return the related
job_infopayload when known. -
job_type(JobsJobType | None) –Return the related job type when known.
-
message(str | None) –Return the related message when known.
-
mitigation_info(Mapping[str, Any] | None) –Return the related mitigation info when known.
-
name(str | None) –Return the related job name when known.
-
ready_at(datetime | None) –Return the related ready time when known.
-
running_at(datetime | None) –Return the related running time when known.
-
sampling(SamplingPayload) –Return sampling payload only, or
Nonewhen unavailable. -
shots(int | None) –Return the related shot count when known.
-
simulator_info(Mapping[str, Any] | None) –Return the related simulator info when known.
-
status(JobsJobStatus | None) –Return related job status when known.
-
submitted_at(datetime | None) –Return the related submission time when known.
-
transpile_result(JobsS3TranspileResult | Mapping[str, Any] | None) –Return the related transpile result when known.
-
transpiler_info(Mapping[str, Any] | None) –Return the related transpiler info when known.
description
property
¶
description: str | None
Return the related job description when known.
This corresponds to the optional description supplied at submission time.
device_id
property
¶
device_id: str | None
Return the related device id when known.
This identifies the backend where the job was submitted.
ended_at
property
¶
ended_at: datetime | None
Return the related end time when known.
This timestamp is set when the job reaches a terminal state.
estimation
property
¶
estimation: EstimationPayload
Return estimation payload when result is estimation-like.
Returns:
-
EstimationPayload–Estimation payload when available.
execution_time
property
¶
execution_time: float | int | None
Return the related execution time in seconds when known.
This value is reported by the API and may be absent for unfinished jobs.
job_id
property
¶
job_id: str | None
Return the related job id when known.
This is the same identifier used by client methods such as status(),
wait(), and cancel_job().
job_info
property
¶
job_info: JobsJobInfo | Mapping[str, Any] | None
Return the related job_info payload when known.
This contains nested execution results and other API-provided metadata.
job_type
property
¶
job_type: JobsJobType | None
Return the related job type when known.
Examples include sampling, estimation, multi_manual, and
sse.
message
property
¶
message: str | None
Return the related message when known.
Error details and backend-provided status messages are often surfaced here.
mitigation_info
property
¶
mitigation_info: Mapping[str, Any] | None
Return the related mitigation info when known.
This contains error-mitigation settings associated with the job.
name
property
¶
name: str | None
Return the related job name when known.
This corresponds to the optional name supplied when the job was submitted.
ready_at
property
¶
ready_at: datetime | None
Return the related ready time when known.
This timestamp is set when the job has been prepared and is ready to run.
running_at
property
¶
running_at: datetime | None
Return the related running time when known.
This timestamp is set when execution actually starts.
sampling
property
¶
sampling: SamplingPayload
Return sampling payload only, or None when unavailable.
Returns:
-
SamplingPayload–Sampling payload when available.
shots
property
¶
shots: int | None
Return the related shot count when known.
For job types that do not use sampling-style shots, this may be absent.
simulator_info
property
¶
simulator_info: Mapping[str, Any] | None
Return the related simulator info when known.
This is typically present for simulator-backed executions.
status
property
¶
status: JobsJobStatus | None
Return related job status when known.
Possible values are submitted, ready, running,
succeeded, failed, and cancelled.
For helpers that wait for completion such as wait() and run_*(),
the returned status is typically succeeded, failed, or
cancelled.
submitted_at
property
¶
submitted_at: datetime | None
Return the related submission time when known.
This timestamp is set when the API accepts the job.
transpile_result
property
¶
transpile_result: (
JobsS3TranspileResult | Mapping[str, Any] | None
)
Return the related transpile result when known.
This may include transpiled circuits or backend-specific transpilation metadata returned by the API.
transpiler_info
property
¶
transpiler_info: Mapping[str, Any] | None
Return the related transpiler info when known.
This is the transpiler metadata submitted with the job or echoed back by the API.
counts_with_integer_keys
¶
counts_with_integer_keys() -> dict[str, dict[int, Any]]
Convert bitstring keys to integer keys for sampling payload.
Returns:
-
dict[str, dict[int, Any]]–Sampling counts with integer keys.
from_raw
classmethod
¶
Build a result object from a full job payload.
Parameters:
-
(job¶Required) –Job definition returned by the API.
-
(client¶Optional, default:None) –Client object bound to this result.
Returns:
-
Self–A result object populated from the job definition.
Raises:
-
ValueError–If the payload is missing required submitted-job fields.
get_counts
¶
get_counts() -> dict[str, Any]
Return raw counts with original bitstring keys.
Returns:
-
dict[str, Any]–Raw sampling counts keyed by bitstring.
get_divided_counts
¶
get_divided_counts() -> dict[str, dict[int, Any]]
Return integer-keyed counts per sub-result from divided_counts.
Returns:
-
dict[str, dict[int, Any]]–Integer-keyed counts keyed by sub-result id.
is_estimation
¶
is_estimation() -> bool
Return True when this result belongs to an estimation job.
Returns:
-
bool–Truewhen the job type is estimation.
is_multi_manual
¶
is_multi_manual() -> bool
Return True when this result belongs to a multi-manual job.
Returns:
-
bool–Truewhen the job type is multi-manual.
is_sampling
¶
is_sampling() -> bool
Return True when this result belongs to a sampling job.
Returns:
-
bool–Truewhen the job type is sampling.
is_sse
¶
is_sse() -> bool
Return True when this result belongs to an SSE job.
Returns:
-
bool–Truewhen the job type is SSE.
OqtopusSamplingJobResult
¶
OqtopusSamplingJobResult(
*,
job_id: str,
job_type: JobsJobType | str,
status: JobsJobStatus | str,
name: str,
description: str | None = None,
device_id: str,
shots: int,
job_info: JobsJobInfo | Mapping[str, Any],
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
transpile_result: JobsS3TranspileResult
| Mapping[str, Any]
| None = None,
message: str | None = None,
execution_time: float | None = None,
submitted_at: datetime | None = None,
ready_at: datetime | None = None,
running_at: datetime | None = None,
ended_at: datetime | None = None,
client: object | None = None,
)
flowchart TD
oqtopus_client.OqtopusSamplingJobResult[OqtopusSamplingJobResult]
oqtopus_client.services.job_results.OqtopusJobResult[OqtopusJobResult]
oqtopus_client.services.job_results.OqtopusJobResult --> oqtopus_client.OqtopusSamplingJobResult
click oqtopus_client.OqtopusSamplingJobResult href "" "oqtopus_client.OqtopusSamplingJobResult"
click oqtopus_client.services.job_results.OqtopusJobResult href "" "oqtopus_client.services.job_results.OqtopusJobResult"
Specialized SDK result object for sampling jobs.
Raises:
-
ValueError–If
job_typeorstatusis invalid.
Methods:
-
counts_with_integer_keys–Convert bitstring keys to integer keys for sampling payload.
-
from_raw–Build a result object from a full job payload.
-
get_counts–Return raw counts with original bitstring keys.
-
is_estimation–Return
Truewhen this result belongs to an estimation job. -
is_multi_manual–Return
Truewhen this result belongs to a multi-manual job. -
is_sampling–Return
Truewhen this result belongs to a sampling job. -
is_sse–Return
Truewhen this result belongs to an SSE job.
Attributes:
-
description(str | None) –Return the related job description when known.
-
device_id(str | None) –Return the related device id when known.
-
ended_at(datetime | None) –Return the related end time when known.
-
estimation(EstimationPayload) –Return estimation payload when result is estimation-like.
-
execution_time(float | int | None) –Return the related execution time in seconds when known.
-
job_id(str | None) –Return the related job id when known.
-
job_info(JobsJobInfo | Mapping[str, Any] | None) –Return the related
job_infopayload when known. -
job_type(JobsJobType | None) –Return the related job type when known.
-
message(str | None) –Return the related message when known.
-
mitigation_info(Mapping[str, Any] | None) –Return the related mitigation info when known.
-
name(str | None) –Return the related job name when known.
-
ready_at(datetime | None) –Return the related ready time when known.
-
running_at(datetime | None) –Return the related running time when known.
-
sampling(SamplingPayload) –Return sampling payload only, or
Nonewhen unavailable. -
shots(int | None) –Return the related shot count when known.
-
simulator_info(Mapping[str, Any] | None) –Return the related simulator info when known.
-
status(JobsJobStatus | None) –Return related job status when known.
-
submitted_at(datetime | None) –Return the related submission time when known.
-
transpile_result(JobsS3TranspileResult | Mapping[str, Any] | None) –Return the related transpile result when known.
-
transpiler_info(Mapping[str, Any] | None) –Return the related transpiler info when known.
description
property
¶
description: str | None
Return the related job description when known.
This corresponds to the optional description supplied at submission time.
device_id
property
¶
device_id: str | None
Return the related device id when known.
This identifies the backend where the job was submitted.
ended_at
property
¶
ended_at: datetime | None
Return the related end time when known.
This timestamp is set when the job reaches a terminal state.
estimation
property
¶
estimation: EstimationPayload
Return estimation payload when result is estimation-like.
Returns:
-
EstimationPayload–Estimation payload when available.
execution_time
property
¶
execution_time: float | int | None
Return the related execution time in seconds when known.
This value is reported by the API and may be absent for unfinished jobs.
job_id
property
¶
job_id: str | None
Return the related job id when known.
This is the same identifier used by client methods such as status(),
wait(), and cancel_job().
job_info
property
¶
job_info: JobsJobInfo | Mapping[str, Any] | None
Return the related job_info payload when known.
This contains nested execution results and other API-provided metadata.
job_type
property
¶
job_type: JobsJobType | None
Return the related job type when known.
Examples include sampling, estimation, multi_manual, and
sse.
message
property
¶
message: str | None
Return the related message when known.
Error details and backend-provided status messages are often surfaced here.
mitigation_info
property
¶
mitigation_info: Mapping[str, Any] | None
Return the related mitigation info when known.
This contains error-mitigation settings associated with the job.
name
property
¶
name: str | None
Return the related job name when known.
This corresponds to the optional name supplied when the job was submitted.
ready_at
property
¶
ready_at: datetime | None
Return the related ready time when known.
This timestamp is set when the job has been prepared and is ready to run.
running_at
property
¶
running_at: datetime | None
Return the related running time when known.
This timestamp is set when execution actually starts.
sampling
property
¶
sampling: SamplingPayload
Return sampling payload only, or None when unavailable.
Returns:
-
SamplingPayload–Sampling payload when available.
shots
property
¶
shots: int | None
Return the related shot count when known.
For job types that do not use sampling-style shots, this may be absent.
simulator_info
property
¶
simulator_info: Mapping[str, Any] | None
Return the related simulator info when known.
This is typically present for simulator-backed executions.
status
property
¶
status: JobsJobStatus | None
Return related job status when known.
Possible values are submitted, ready, running,
succeeded, failed, and cancelled.
For helpers that wait for completion such as wait() and run_*(),
the returned status is typically succeeded, failed, or
cancelled.
submitted_at
property
¶
submitted_at: datetime | None
Return the related submission time when known.
This timestamp is set when the API accepts the job.
transpile_result
property
¶
transpile_result: (
JobsS3TranspileResult | Mapping[str, Any] | None
)
Return the related transpile result when known.
This may include transpiled circuits or backend-specific transpilation metadata returned by the API.
transpiler_info
property
¶
transpiler_info: Mapping[str, Any] | None
Return the related transpiler info when known.
This is the transpiler metadata submitted with the job or echoed back by the API.
counts_with_integer_keys
¶
counts_with_integer_keys() -> dict[str, dict[int, Any]]
Convert bitstring keys to integer keys for sampling payload.
Returns:
-
dict[str, dict[int, Any]]–Sampling counts with integer keys.
from_raw
classmethod
¶
Build a result object from a full job payload.
Parameters:
-
(job¶Required) –Job definition returned by the API.
-
(client¶Optional, default:None) –Client object bound to this result.
Returns:
-
Self–A result object populated from the job definition.
Raises:
-
ValueError–If the payload is missing required submitted-job fields.
get_counts
¶
get_counts() -> dict[str, Any]
Return raw counts with original bitstring keys.
Returns:
-
dict[str, Any]–Raw sampling counts keyed by bitstring.
is_estimation
¶
is_estimation() -> bool
Return True when this result belongs to an estimation job.
Returns:
-
bool–Truewhen the job type is estimation.
is_multi_manual
¶
is_multi_manual() -> bool
Return True when this result belongs to a multi-manual job.
Returns:
-
bool–Truewhen the job type is multi-manual.
is_sampling
¶
is_sampling() -> bool
Return True when this result belongs to a sampling job.
Returns:
-
bool–Truewhen the job type is sampling.
is_sse
¶
is_sse() -> bool
Return True when this result belongs to an SSE job.
Returns:
-
bool–Truewhen the job type is SSE.
OqtopusSseJobResult
¶
OqtopusSseJobResult(
*,
job_id: str,
job_type: JobsJobType | str,
status: JobsJobStatus | str,
name: str,
description: str | None = None,
device_id: str,
shots: int,
job_info: JobsJobInfo | Mapping[str, Any],
transpiler_info: Mapping[str, Any] | None = None,
simulator_info: Mapping[str, Any] | None = None,
mitigation_info: Mapping[str, Any] | None = None,
transpile_result: JobsS3TranspileResult
| Mapping[str, Any]
| None = None,
message: str | None = None,
execution_time: float | None = None,
submitted_at: datetime | None = None,
ready_at: datetime | None = None,
running_at: datetime | None = None,
ended_at: datetime | None = None,
client: object | None = None,
)
flowchart TD
oqtopus_client.OqtopusSseJobResult[OqtopusSseJobResult]
oqtopus_client.services.job_results.OqtopusJobResult[OqtopusJobResult]
oqtopus_client.services.job_results.OqtopusJobResult --> oqtopus_client.OqtopusSseJobResult
click oqtopus_client.OqtopusSseJobResult href "" "oqtopus_client.OqtopusSseJobResult"
click oqtopus_client.services.job_results.OqtopusJobResult href "" "oqtopus_client.services.job_results.OqtopusJobResult"
Specialized SDK result object for sse jobs.
Raises:
-
ValueError–If
job_typeorstatusis invalid.
Methods:
-
download_log–Download SSE archive from
/jobs/{job_id}/sselog. -
from_raw–Build a result object from a full job payload.
-
get_job_result–Return a job result object with the specific type based on available payload.
-
is_estimation–Return
Truewhen this result belongs to an estimation job. -
is_multi_manual–Return
Truewhen this result belongs to a multi-manual job. -
is_sampling–Return
Truewhen this result belongs to a sampling job. -
is_sse–Return
Truewhen this result belongs to an SSE job. -
read_log_text–Decode SSE log response and return readable text.
-
show_log–Read SSE log text and print it.
Attributes:
-
description(str | None) –Return the related job description when known.
-
device_id(str | None) –Return the related device id when known.
-
ended_at(datetime | None) –Return the related end time when known.
-
estimation(EstimationPayload) –Return estimation payload when result is estimation-like.
-
execution_time(float | int | None) –Return the related execution time in seconds when known.
-
job_id(str | None) –Return the related job id when known.
-
job_info(JobsJobInfo | Mapping[str, Any] | None) –Return the related
job_infopayload when known. -
job_type(JobsJobType | None) –Return the related job type when known.
-
message(str | None) –Return the related message when known.
-
mitigation_info(Mapping[str, Any] | None) –Return the related mitigation info when known.
-
name(str | None) –Return the related job name when known.
-
ready_at(datetime | None) –Return the related ready time when known.
-
running_at(datetime | None) –Return the related running time when known.
-
sampling(SamplingPayload) –Return sampling payload when result is sampling-like.
-
shots(int | None) –Return the related shot count when known.
-
simulator_info(Mapping[str, Any] | None) –Return the related simulator info when known.
-
status(JobsJobStatus | None) –Return related job status when known.
-
submitted_at(datetime | None) –Return the related submission time when known.
-
transpile_result(JobsS3TranspileResult | Mapping[str, Any] | None) –Return the related transpile result when known.
-
transpiler_info(Mapping[str, Any] | None) –Return the related transpiler info when known.
description
property
¶
description: str | None
Return the related job description when known.
This corresponds to the optional description supplied at submission time.
device_id
property
¶
device_id: str | None
Return the related device id when known.
This identifies the backend where the job was submitted.
ended_at
property
¶
ended_at: datetime | None
Return the related end time when known.
This timestamp is set when the job reaches a terminal state.
estimation
property
¶
estimation: EstimationPayload
Return estimation payload when result is estimation-like.
Returns:
-
EstimationPayload–Estimation payload when available.
execution_time
property
¶
execution_time: float | int | None
Return the related execution time in seconds when known.
This value is reported by the API and may be absent for unfinished jobs.
job_id
property
¶
job_id: str | None
Return the related job id when known.
This is the same identifier used by client methods such as status(),
wait(), and cancel_job().
job_info
property
¶
job_info: JobsJobInfo | Mapping[str, Any] | None
Return the related job_info payload when known.
This contains nested execution results and other API-provided metadata.
job_type
property
¶
job_type: JobsJobType | None
Return the related job type when known.
Examples include sampling, estimation, multi_manual, and
sse.
message
property
¶
message: str | None
Return the related message when known.
Error details and backend-provided status messages are often surfaced here.
mitigation_info
property
¶
mitigation_info: Mapping[str, Any] | None
Return the related mitigation info when known.
This contains error-mitigation settings associated with the job.
name
property
¶
name: str | None
Return the related job name when known.
This corresponds to the optional name supplied when the job was submitted.
ready_at
property
¶
ready_at: datetime | None
Return the related ready time when known.
This timestamp is set when the job has been prepared and is ready to run.
running_at
property
¶
running_at: datetime | None
Return the related running time when known.
This timestamp is set when execution actually starts.
sampling
property
¶
sampling: SamplingPayload
Return sampling payload when result is sampling-like.
Returns:
-
SamplingPayload–Sampling payload when available.
shots
property
¶
shots: int | None
Return the related shot count when known.
For job types that do not use sampling-style shots, this may be absent.
simulator_info
property
¶
simulator_info: Mapping[str, Any] | None
Return the related simulator info when known.
This is typically present for simulator-backed executions.
status
property
¶
status: JobsJobStatus | None
Return related job status when known.
Possible values are submitted, ready, running,
succeeded, failed, and cancelled.
For helpers that wait for completion such as wait() and run_*(),
the returned status is typically succeeded, failed, or
cancelled.
submitted_at
property
¶
submitted_at: datetime | None
Return the related submission time when known.
This timestamp is set when the API accepts the job.
transpile_result
property
¶
transpile_result: (
JobsS3TranspileResult | Mapping[str, Any] | None
)
Return the related transpile result when known.
This may include transpiled circuits or backend-specific transpilation metadata returned by the API.
transpiler_info
property
¶
transpiler_info: Mapping[str, Any] | None
Return the related transpiler info when known.
This is the transpiler metadata submitted with the job or echoed back by the API.
download_log
¶
download_log(
*,
save_dir: str | Path | None = None,
file_name: str | None = None,
overwrite: bool = False,
persist: bool = False,
) -> bytes | str
Download SSE archive from /jobs/{job_id}/sselog.
Default behavior keeps processing in-memory and returns archive bytes.
Set persist=True to write the archive file to disk and return its path.
Parameters:
-
(save_dir¶Optional, default:None) –Destination directory used when
persist=True. -
(file_name¶Optional, default:None) –Saved archive file name when
persist=True. -
(overwrite¶Optional, default:False) –Whether to overwrite an existing file when
persist=True. -
(persist¶Optional, default:False) –Whether to save the archive to disk instead of returning bytes.
Returns:
-
bytes | str–Archive bytes in memory, or a saved file path when
persist=True.
Raises:
-
ValueError–If persistence arguments are inconsistent with
persist.
from_raw
classmethod
¶
Build a result object from a full job payload.
Parameters:
-
(job¶Required) –Job definition returned by the API.
-
(client¶Optional, default:None) –Client object bound to this result.
Returns:
-
Self–A result object populated from the job definition.
Raises:
-
ValueError–If the payload is missing required submitted-job fields.
get_job_result
¶
get_job_result() -> OqtopusJobResult
Return a job result object with the specific type based on available payload.
Returns:
-
OqtopusJobResult–A job result object with the specific type based on available payload.
is_estimation
¶
is_estimation() -> bool
Return True when this result belongs to an estimation job.
Returns:
-
bool–Truewhen the job type is estimation.
is_multi_manual
¶
is_multi_manual() -> bool
Return True when this result belongs to a multi-manual job.
Returns:
-
bool–Truewhen the job type is multi-manual.
is_sampling
¶
is_sampling() -> bool
Return True when this result belongs to a sampling job.
Returns:
-
bool–Truewhen the job type is sampling.
is_sse
¶
is_sse() -> bool
Return True when this result belongs to an SSE job.
Returns:
-
bool–Truewhen the job type is SSE.
read_log_text
¶
show_log
¶
show_log(
*,
encoding: str = "utf-8",
errors: str = "replace",
print_fn: Callable[[str], Any] = print,
) -> str
Read SSE log text and print it.
Parameters:
-
(encoding¶Optional, default:'utf-8') –Text encoding used to decode log contents.
-
(errors¶Optional, default:'replace') –Error handling mode passed to
decode(). -
(print_fn¶Optional, default:print) –Printer function used to display the decoded log.
Returns:
-
str–The printed SSE log text.
ResponseValidationError
¶
ResponseValidationError(
message: str, payload: object | None = None
)
flowchart TD
oqtopus_client.ResponseValidationError[ResponseValidationError]
click oqtopus_client.ResponseValidationError href "" "oqtopus_client.ResponseValidationError"
Raised when a successful API response cannot be validated.
UserApiError
¶
UserApiError(
status_code: int,
message: str,
payload: object | None = None,
)
flowchart TD
oqtopus_client.UserApiError[UserApiError]
click oqtopus_client.UserApiError href "" "oqtopus_client.UserApiError"
Raised when the API returns a non-success status.
bitstring_dict_to_int_keys
¶
bitstring_dict_to_int_keys(
values: Mapping[str, object] | None,
) -> dict[int, object]
Convert bitstring-keyed mappings to int-keyed mappings.
Parameters:
-
(values¶Optional) –Mapping whose keys are bitstrings.
Returns:
-
dict[int, object]–A mapping with integer keys.
bitstring_to_int
¶
bitstring_to_int(bitstring: str) -> int
Convert a bitstring key such as 0101 or 0b0101 to an integer.
Parameters:
-
(bitstring¶Required) –Bitstring text to clean and convert.
Returns:
-
int–The integer value of the cleaned bitstring.
Raises:
-
ValueError–If
bitstringis not a valid binary string.
convert_sampling_counts_to_int_keys
¶
convert_sampling_counts_to_int_keys(
sampling_result: JobsS3SamplingResult
| Mapping[str, object]
| None,
) -> dict[
str, dict[int, object] | dict[int, dict[int, object]]
]
Convert sampling result bitstring keys to integers.
Parameters:
-
(sampling_result¶Optional) –Sampling result model or mapping containing
countsanddivided_counts.
Returns:
-
dict[str, dict[int, object] | dict[int, dict[int, object]]]–countsanddivided_countsdictionaries with integer keys.