Skip to content

Commit

Permalink
Make parameters after password keyword-only
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed Nov 10, 2023
1 parent 933b910 commit 14d9e02
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 16 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
### Bioblend v1.2.0 - 2023-06-30
### BioBlend v

* Parameters after ``password`` in the ``__init__()`` method of the
``GalaxyClient``, ``GalaxyInstance`` and ``ToolShedInstance`` classes are now
keyword-only.

### BioBlend v1.2.0 - 2023-06-30

* Dropped support for Galaxy releases 17.09-19.01. Added support for Galaxy
release 23.1.
Expand Down
2 changes: 1 addition & 1 deletion bioblend/_tests/TestGalaxyObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class GalaxyObjectsTestBase(unittest.TestCase):
def setUpClass(cls) -> None:
galaxy_key = os.environ["BIOBLEND_GALAXY_API_KEY"]
galaxy_url = os.environ["BIOBLEND_GALAXY_URL"]
cls.gi = galaxy_instance.GalaxyInstance(galaxy_url, galaxy_key)
cls.gi = galaxy_instance.GalaxyInstance(galaxy_url, api_key=galaxy_key)


class TestWorkflow(GalaxyObjectsTestBase):
Expand Down
2 changes: 1 addition & 1 deletion bioblend/_tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def skip_unless_galaxy(min_release: Optional[str] = None) -> Callable:
if "BIOBLEND_GALAXY_API_KEY" not in os.environ and "BIOBLEND_GALAXY_MASTER_API_KEY" in os.environ:
galaxy_url = os.environ["BIOBLEND_GALAXY_URL"]
galaxy_master_api_key = os.environ["BIOBLEND_GALAXY_MASTER_API_KEY"]
gi = bioblend.galaxy.GalaxyInstance(galaxy_url, galaxy_master_api_key)
gi = bioblend.galaxy.GalaxyInstance(galaxy_url, key=galaxy_master_api_key)

if "BIOBLEND_GALAXY_USER_EMAIL" in os.environ:
galaxy_user_email = os.environ["BIOBLEND_GALAXY_USER_EMAIL"]
Expand Down
3 changes: 2 additions & 1 deletion bioblend/galaxy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
key: Optional[str] = None,
email: Optional[str] = None,
password: Optional[str] = None,
*,
verify: bool = True,
) -> None:
"""
Expand Down Expand Up @@ -81,7 +82,7 @@ def __init__(
:param verify: Whether to verify the server's TLS certificate
:type verify: bool
"""
super().__init__(url, key, email, password, verify=verify)
super().__init__(url, key=key, email=email, password=password, verify=verify)
self.libraries = libraries.LibraryClient(self)
self.histories = histories.HistoryClient(self)
self.workflows = workflows.WorkflowClient(self)
Expand Down
7 changes: 4 additions & 3 deletions bioblend/galaxy/objects/galaxy_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class GalaxyInstance:
Example: get a list of all histories for a user with API key 'foo'::
from bioblend.galaxy.objects import *
gi = GalaxyInstance('http://127.0.0.1:8080', 'foo')
from bioblend.galaxy.objects import GalaxyInstance
gi = GalaxyInstance('http://127.0.0.1:8080', api_key='foo')
histories = gi.histories.list()
"""

Expand All @@ -56,9 +56,10 @@ def __init__(
api_key: Optional[str] = None,
email: Optional[str] = None,
password: Optional[str] = None,
*,
verify: bool = True,
) -> None:
self.gi = bioblend.galaxy.GalaxyInstance(url, api_key, email, password, verify)
self.gi = bioblend.galaxy.GalaxyInstance(url, key=api_key, email=email, password=password, verify=verify)
self.log = bioblend.log
self.datasets = client.ObjDatasetClient(self)
self.dataset_collections = client.ObjDatasetCollectionClient(self)
Expand Down
1 change: 1 addition & 0 deletions bioblend/galaxyclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(
key: Optional[str] = None,
email: Optional[str] = None,
password: Optional[str] = None,
*,
verify: bool = True,
timeout: Optional[float] = None,
) -> None:
Expand Down
3 changes: 2 additions & 1 deletion bioblend/toolshed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(
key: Optional[str] = None,
email: Optional[str] = None,
password: Optional[str] = None,
*,
verify: bool = True,
) -> None:
"""
Expand Down Expand Up @@ -59,7 +60,7 @@ def __init__(
:param verify: Whether to verify the server's TLS certificate
:type verify: bool
"""
super().__init__(url, key, email, password, verify=verify)
super().__init__(url, key=key, email=email, password=password, verify=verify)
self.categories = categories.ToolShedCategoryClient(self)
self.repositories = repositories.ToolShedRepositoryClient(self)
self.tools = tools.ToolShedToolClient(self)
2 changes: 1 addition & 1 deletion docs/examples/create_user_get_api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
galaxy_api_key = sys.argv[2]

# Initiating Galaxy connection
gi = bioblend.galaxy.GalaxyInstance(galaxy_url, galaxy_api_key)
gi = bioblend.galaxy.GalaxyInstance(galaxy_url, key=galaxy_api_key)

# Create a new user and get a new API key for her
new_user = gi.users.create_local_user(sys.argv[3], sys.argv[4], sys.argv[5])
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/list_data_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

print("Initiating Galaxy connection")

gi = GalaxyInstance(galaxy_url, galaxy_key)
gi = GalaxyInstance(galaxy_url, api_key=galaxy_key)

print("Retrieving Data Library list")

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/list_histories.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

print("Initiating Galaxy connection")

gi = GalaxyInstance(galaxy_url, galaxy_key)
gi = GalaxyInstance(galaxy_url, api_key=galaxy_key)

print("Retrieving History list")

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/list_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

print("Initiating Galaxy connection")

gi = GalaxyInstance(galaxy_url, galaxy_key)
gi = GalaxyInstance(galaxy_url, api_key=galaxy_key)

print("Retrieving Workflows list")

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/small.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
API_KEY = os.getenv("GALAXY_API_KEY", "YOUR_API_KEY")
if API_KEY == "YOUR_API_KEY":
sys.exit("API_KEY not set, see the README.txt file")
gi = GalaxyInstance(URL, API_KEY)
gi = GalaxyInstance(URL, api_key=API_KEY)

# import the workflow from the JSON dump

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/w2_bacterial_reseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
API_KEY = os.getenv("GALAXY_API_KEY", "YOUR_API_KEY")
if API_KEY == "YOUR_API_KEY":
sys.exit("API_KEY not set, see the README.txt file")
gi = GalaxyInstance(URL, API_KEY)
gi = GalaxyInstance(URL, api_key=API_KEY)

# Select "W2 - Bacterial re-sequencing | Paired-end" from published workflows

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/w3_bacterial_denovo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
API_KEY = os.getenv("GALAXY_API_KEY", "YOUR_API_KEY")
if API_KEY == "YOUR_API_KEY":
sys.exit("API_KEY not set, see the README.txt file")
gi = GalaxyInstance(URL, API_KEY)
gi = GalaxyInstance(URL, api_key=API_KEY)

# Select "W3 - Bacterial de novo assembly | Paired-end" from published workflows

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/objects/w5_metagenomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
API_KEY = os.getenv("GALAXY_API_KEY", "YOUR_API_KEY")
if API_KEY == "YOUR_API_KEY":
sys.exit("API_KEY not set, see the README.txt file")
gi = GalaxyInstance(URL, API_KEY)
gi = GalaxyInstance(URL, api_key=API_KEY)

# Select "W5 - Metagenomics" from published workflows

Expand Down

0 comments on commit 14d9e02

Please sign in to comment.