Skip to content

Commit

Permalink
adds type: ignore for now
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Nov 12, 2024
1 parent 0c9f372 commit 9d9d948
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
28 changes: 5 additions & 23 deletions src/posit/connect/packages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import posixpath
from typing import Generator, Literal, Optional, TypedDict, overload
from typing import Generator, Literal, Optional, TypedDict

from typing_extensions import NotRequired, Required, Unpack

Expand Down Expand Up @@ -57,8 +57,7 @@ class _FindBy(TypedDict, total=False):
hash: NotRequired[Optional[str]]
"""Package description hash for R packages."""

@overload
def find_by(self, **conditions: Unpack[_FindBy]):
def find_by(self, **conditions: Unpack[_FindBy]): # type: ignore
"""
Find the first record matching the specified conditions.
Expand Down Expand Up @@ -86,11 +85,6 @@ def find_by(self, **conditions: Unpack[_FindBy]):
Optional[T]
The first record matching the specified conditions, or `None` if no such record exists.
"""

@overload
def find_by(self, **conditions): ...

def find_by(self, **conditions):
return super().find_by(**conditions)


Expand Down Expand Up @@ -152,16 +146,10 @@ class _Fetch(TypedDict, total=False):
version: Required[str]
"""The package version"""

@overload
def fetch(self, **conditions: Unpack[_Fetch]): ...

@overload
def fetch(self, **conditions): ...

def fetch(self, **conditions) -> Generator["Package"]:
def fetch(self, **conditions: Unpack[_Fetch]) -> Generator["Package"]: # type: ignore
# todo - add pagination support to ActiveSequence
url = self._ctx.url + self._path
paginator = Paginator(self._ctx.session, url, conditions)
paginator = Paginator(self._ctx.session, url, dict(**conditions))
for page in paginator.fetch_pages():
results = page.results
yield from (self._create_instance("", **result) for result in results)
Expand Down Expand Up @@ -194,8 +182,7 @@ class _FindBy(TypedDict, total=False):
app_guid: NotRequired[str]
"""The unique identifier of the application this package is associated with"""

@overload
def find_by(self, **conditions: Unpack[_FindBy]) -> "Package | None":
def find_by(self, **conditions: Unpack[_FindBy]) -> "Package | None": # type: ignore
"""
Find the first record matching the specified conditions.
Expand Down Expand Up @@ -223,9 +210,4 @@ def find_by(self, **conditions: Unpack[_FindBy]) -> "Package | None":
Optional[Package]
The first record matching the specified conditions, or `None` if no such record exists.
"""

@overload
def find_by(self, **conditions) -> "Package | None": ...

def find_by(self, **conditions) -> "Package | None":
return super().find_by(**conditions)
4 changes: 2 additions & 2 deletions src/posit/connect/paginator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Generator, List
from typing import TYPE_CHECKING, Generator, List

if TYPE_CHECKING:
import requests
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(
self,
session: requests.Session,
url: str,
params: dict[str, Any] | None = None,
params: dict | None = None,
) -> None:
if params is None:
params = {}
Expand Down
2 changes: 1 addition & 1 deletion src/posit/connect/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _create_instance(self, path: str, /, **kwargs: Any) -> T:
"""Create an instance of 'T'."""
raise NotImplementedError()

def fetch(self, **conditions) -> Iterable[T]:
def fetch(self, **conditions: Any) -> Iterable[T]:
"""Fetch the collection.
Fetches the collection directly from Connect. This operation does not effect the cache state.
Expand Down

0 comments on commit 9d9d948

Please sign in to comment.