Skip to content

Commit

Permalink
Enable reportIndexIssue in pyright (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjmcdougall authored Dec 16, 2024
1 parent 5f592d6 commit b36328e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pins/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from dataclasses import InitVar, asdict, dataclass, field, fields
from pathlib import Path
from typing import ClassVar, Mapping, Sequence
from typing import Any, ClassVar, Mapping, Sequence

import yaml

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

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

return data
Expand Down
12 changes: 10 additions & 2 deletions pins/rsconnect/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from functools import partial
from io import IOBase
from pathlib import Path
from typing import Generic, Sequence, TypeVar
from typing import Generic, Literal, Sequence, TypeVar, overload
from urllib.parse import urlencode

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

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

def _raw_query(self, url, method="GET", return_request=False, **kwargs):
@overload
def _raw_query(
self, url, method, return_request: Literal[True], **kwargs
) -> requests.Response: ...
@overload
def _raw_query(
self, url, method, return_request: Literal[False], **kwargs
) -> dict | list: ...
def _raw_query(self, url, method="GET", return_request: bool = False, **kwargs):
if "headers" in kwargs:
raise KeyError("cannot specify headers param in kwargs")

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ reportArgumentType = false
reportAttributeAccessIssue = false
reportCallIssue = false
reportIncompatibleMethodOverride = false
reportIndexIssue = false
reportMissingImports = false
reportMissingTypeStubs = false
reportOptionalMemberAccess = false
Expand Down

0 comments on commit b36328e

Please sign in to comment.