Skip to content

Commit 3832fda

Browse files
weblorinphilipbaileynar
authored andcommitted
improve typing and doc for run_query without changing rest of file
1 parent af739bf commit 3832fda

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

pydex/classes/RiverscapesAPI.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,18 @@ def search_count(self, search_params: RiverscapesSearchParams):
547547
stats = results['data']['searchProjects']['stats']
548548
return (total, stats)
549549

550-
def run_query(self, query, variables):
551-
""" A simple function to use requests.post to make the API call. Note the json= section.
550+
def run_query(self, query: str, variables: dict) -> dict:
551+
"""A simple function to use requests.post to make the API call. Note the json= section.
552552
553553
Args:
554-
query (_type_): _description_
555-
variables (_type_): _description_
554+
query (str): GraphQL query string
555+
variables (dict): mapping variable names to values
556556
557557
Raises:
558-
Exception: _description_
558+
Exception: RiverscapesAPIException
559559
560560
Returns:
561-
_type_: _description_
561+
dict: parsed JSON response from the API
562562
"""
563563
headers = {"authorization": "Bearer " + self.access_token} if self.access_token else {}
564564
request = requests.post(self.uri, json={

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ pydex = ["**/*.graphql", "**/*.json"]
5151
line-length = 240
5252
target-version = "py312"
5353

54+
[tool.ruff.format]
55+
quote-style = "preserve"
56+
5457
[tool.ruff.lint]
5558
# I = isort (import sorting fix)
5659
# E, F = Flake8 (standard errors)

0 commit comments

Comments
 (0)