-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Client: get method with provider arguments (#1359)
- Loading branch information
Showing
7 changed files
with
256 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# This code is a Qiskit project. | ||
# | ||
# (C) Copyright IBM 2024. | ||
# | ||
# This code is licensed under the Apache License, Version 2.0. You may | ||
# obtain a copy of this license in the LICENSE.txt file in the root directory | ||
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Any modifications or derivative works of this code must retain this | ||
# copyright notice, and modified files need to carry a notice indicating | ||
# that they have been altered from the originals. | ||
|
||
""" | ||
========================================================== | ||
Json utilities (:mod:`qiskit_serverless.utils.formatting`) | ||
========================================================== | ||
.. currentmodule:: qiskit_serverless.utils.formatting | ||
Qiskit Serverless formatting utilities | ||
====================================== | ||
.. autosummary:: | ||
:toctree: ../stubs/ | ||
format_provider_name_and_title | ||
""" | ||
from typing import Tuple, Union | ||
|
||
|
||
def format_provider_name_and_title( | ||
request_provider, title | ||
) -> Tuple[Union[str, None], str]: | ||
""" | ||
This method returns provider_name and title from a title with / if it contains it | ||
""" | ||
if request_provider: | ||
return request_provider, title | ||
|
||
title_split = title.split("/") | ||
if len(title_split) == 1: | ||
return None, title_split[0] | ||
|
||
return title_split[0], title_split[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.