Skip to content

Commit 61b2ca1

Browse files
committed
Merge remote-tracking branch 'origin/main' into tdstein/import-typing-extensions
2 parents 2f87694 + 1a2cc55 commit 61b2ca1

File tree

17 files changed

+199
-463
lines changed

17 files changed

+199
-463
lines changed

integration/tests/posit/connect/test_content_item_repository.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from packaging import version
33

44
from posit import connect
5-
from posit.connect.content import ContentItem, ContentItemRepository
5+
from posit.connect.content import ContentItem
6+
from posit.connect.repository import ContentItemRepository
67

78
from . import CONNECT_VERSION
89

@@ -76,12 +77,12 @@ def assert_repo(r: ContentItemRepository):
7677

7778
# Update
7879
ex_branch = "main"
79-
updated_repo = content_repo.update(branch=ex_branch)
80-
assert updated_repo["branch"] == ex_branch
80+
content_repo.update(branch=ex_branch)
81+
assert content_repo["branch"] == ex_branch
8182

82-
assert updated_repo["repository"] == self.repo_repository
83-
assert updated_repo["directory"] == self.repo_directory
84-
assert updated_repo["polling"] is self.repo_polling
83+
assert content_repo["repository"] == self.repo_repository
84+
assert content_repo["directory"] == self.repo_directory
85+
assert content_repo["polling"] is self.repo_polling
8586

8687
# Delete
8788
content_repo.destroy()

integration/tests/posit/connect/test_tags.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ def test_tag_content_items(self):
151151
}
152152

153153
# Update tag
154-
tagDName = tagD.update(name="tagD_updated")
155-
assert tagDName["name"] == "tagD_updated"
154+
tagD.update(name="tagD_updated")
155+
assert tagD["name"] == "tagD_updated"
156156
assert self.client.tags.get(tagD["id"])["name"] == "tagD_updated"
157157

158-
tagDParent = tagDName.update(parent=tagB)
159-
assert tagDParent["parent_id"] == tagB["id"]
158+
tagD.update(parent=tagB)
159+
assert tagD["parent_id"] == tagB["id"]
160160
assert self.client.tags.get(tagD["id"])["parent_id"] == tagB["id"]
161161

162162
# Cleanup

src/posit/connect/_api.py

Lines changed: 0 additions & 143 deletions
This file was deleted.

src/posit/connect/_api_call.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/posit/connect/_json.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/posit/connect/_utils.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,28 @@
33
from typing_extensions import Any
44

55

6-
def drop_none(x: dict[str, Any]) -> dict[str, Any]:
7-
return {k: v for k, v in x.items() if v is not None}
6+
def update_dict_values(obj: dict[str, Any], /, **kwargs: Any) -> None:
7+
"""
8+
Update the values of a dictionary.
9+
10+
This helper method exists as a workaround for the `dict.update` method. Sometimes, `super()` does not return the `dict` class and. If `super().update(**kwargs)` is called unintended behavior will occur.
11+
12+
Therefore, this helper method exists to update the `dict`'s values.
13+
14+
Parameters
15+
----------
16+
obj : dict[str, Any]
17+
The object to update.
18+
kwargs : Any
19+
The key-value pairs to update the object with.
20+
21+
See Also
22+
--------
23+
* https://github.com/posit-dev/posit-sdk-py/pull/366#discussion_r1887845267
24+
"""
25+
# Could also be performed with:
26+
# for key, value in kwargs.items():
27+
# obj[key] = value
28+
29+
# Use the `dict` class to explicity update the object in-place
30+
dict.update(obj, **kwargs)

0 commit comments

Comments
 (0)