Skip to content

Commit

Permalink
fix: docstring and type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
umonaca committed Dec 1, 2021
1 parent 192c2c9 commit ba4fc1f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions obplatform/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

import time
from typing import Any, Dict, List, Optional
from typing import Any, Dict, Iterator, List, Optional, Tuple

import requests
from tqdm import tqdm
Expand Down Expand Up @@ -139,14 +139,16 @@ def check_health(self) -> bool:
response = self.session.get(self.endpoint + "/api/v1/health")
return response.json()["status"] == "ok" # type: ignore

def _yield_payload_dict_item(self, params):
def _yield_payload_dict_item(
self, params: Dict[str, Any]
) -> Iterator[Tuple[str, str]]:
"""
Returns a dictionary key-value pair. Used by _get_payload_dict(params).
Args:
params: Params dictionary. See _get_payload_dict(params) for details.
Returns:
Yields:
A dictionary key-value pair.
"""
for key, list_ in params.items():
Expand All @@ -157,7 +159,7 @@ def _yield_payload_dict_item(self, params):
for subkey, subvalue in item.items():
yield f"{key}[{i}][{subkey}]", subvalue

def _get_payload(self, params):
def _get_payload(self, params: Dict[str, Any]) -> Dict[str, str]:
"""
Returns a dictionary of the form::
Expand Down Expand Up @@ -257,7 +259,7 @@ def list_studies(
)
response = self.session.get(self.endpoint + "/api/v1/studies", params=payload)
response.raise_for_status()
return response.json()
return response.json() # type: ignore


class ProgressBar:
Expand Down

0 comments on commit ba4fc1f

Please sign in to comment.