Skip to content

Commit b36328e

Browse files
Enable reportIndexIssue in pyright (#313)
1 parent 5f592d6 commit b36328e

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

pins/meta.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from dataclasses import InitVar, asdict, dataclass, field, fields
44
from pathlib import Path
5-
from typing import ClassVar, Mapping, Sequence
5+
from typing import Any, ClassVar, Mapping, Sequence
66

77
import yaml
88

@@ -104,7 +104,7 @@ def __getattr__(self, k):
104104
except KeyError:
105105
raise AttributeError(f"No metadata field not found: {k}")
106106

107-
def to_dict(self) -> Mapping:
107+
def to_dict(self) -> dict[str, Any]:
108108
data = asdict(self)
109109

110110
return data

pins/rsconnect/api.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from functools import partial
99
from io import IOBase
1010
from pathlib import Path
11-
from typing import Generic, Sequence, TypeVar
11+
from typing import Generic, Literal, Sequence, TypeVar, overload
1212
from urllib.parse import urlencode
1313

1414
import requests
@@ -215,7 +215,15 @@ def query(self, route, method="GET", return_request=False, **kwargs):
215215

216216
return self._raw_query(endpoint, method, return_request, **kwargs)
217217

218-
def _raw_query(self, url, method="GET", return_request=False, **kwargs):
218+
@overload
219+
def _raw_query(
220+
self, url, method, return_request: Literal[True], **kwargs
221+
) -> requests.Response: ...
222+
@overload
223+
def _raw_query(
224+
self, url, method, return_request: Literal[False], **kwargs
225+
) -> dict | list: ...
226+
def _raw_query(self, url, method="GET", return_request: bool = False, **kwargs):
219227
if "headers" in kwargs:
220228
raise KeyError("cannot specify headers param in kwargs")
221229

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ reportArgumentType = false
103103
reportAttributeAccessIssue = false
104104
reportCallIssue = false
105105
reportIncompatibleMethodOverride = false
106-
reportIndexIssue = false
107106
reportMissingImports = false
108107
reportMissingTypeStubs = false
109108
reportOptionalMemberAccess = false

0 commit comments

Comments
 (0)