Skip to content

Commit 2af9e39

Browse files
committed
add overload definitions for fetch
1 parent 3895d72 commit 2af9e39

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/posit/connect/packages.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ def __init__(self, ctx, path):
142142
def _create_instance(self, path, /, **attributes):
143143
return Package(self._ctx, **attributes)
144144

145+
class _Fetch(TypedDict, total=False):
146+
language: Required[Literal["python", "r"]]
147+
"""Programming language ecosystem, options are 'python' and 'r'"""
148+
149+
name: Required[str]
150+
"""The package name"""
151+
152+
version: Required[str]
153+
"""The package version"""
154+
155+
@overload
156+
def fetch(self, **conditions: Unpack[_Fetch]): ...
157+
158+
@overload
159+
def fetch(self, **conditions): ...
160+
145161
def fetch(self, **conditions) -> Generator["Package"]:
146162
# todo - add pagination support to ActiveSequence
147163
url = self._ctx.url + self._path

0 commit comments

Comments
 (0)