Skip to content

Commit

Permalink
Add some missing typing in code
Browse files Browse the repository at this point in the history
ref: #1430

Signed-off-by: Alexandre Lavigne <lavigne958@gmail.com>
  • Loading branch information
lavigne958 committed Apr 1, 2024
1 parent 29f1066 commit f591810
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 90 deletions.
12 changes: 7 additions & 5 deletions gspread/client.py
Expand Up @@ -39,7 +39,9 @@ def __init__(
) -> None:
self.http_client = http_client(auth, session)

def set_timeout(self, timeout: Optional[Union[float, Tuple[float, float]]] = None):
def set_timeout(
self, timeout: Optional[Union[float, Tuple[float, float]]] = None
) -> None:
"""How long to wait for the server to send
data before giving up, as a float, or a ``(connect timeout,
read timeout)`` tuple.
Expand Down Expand Up @@ -76,7 +78,7 @@ def list_spreadsheet_files(
return files

def _list_spreadsheet_files(
self, title=None, folder_id=None
self, title: Optional[str] = None, folder_id: Optional[str] = None
) -> Tuple[List[Dict[str, Any]], Response]:
files = []
page_token = ""
Expand Down Expand Up @@ -316,9 +318,9 @@ def copy(
continue

new_spreadsheet.share(
email_address=p["emailAddress"],
perm_type=p["type"],
role=p["role"],
email_address=str(p["emailAddress"]),
perm_type=str(p["type"]),
role=str(p["role"]),
notify=False,
)

Expand Down
4 changes: 3 additions & 1 deletion gspread/http_client.py
Expand Up @@ -284,7 +284,9 @@ def spreadsheets_sheets_copy_to(
r = self.request("post", url, json=body)
return r.json()

def fetch_sheet_metadata(self, id: str, params: Optional[ParamsType] = None) -> Any:
def fetch_sheet_metadata(
self, id: str, params: Optional[ParamsType] = None
) -> Mapping[str, Any]:
"""Similar to :method spreadsheets_get:`gspread.http_client.spreadsheets_get`,
get the spreadsheet form the API but by default **does not get the cells data**.
It only retrieve the the metadata from the spreadsheet.
Expand Down

0 comments on commit f591810

Please sign in to comment.