Skip to content

Commit 11e4730

Browse files
schloerkejonkeane
andauthored
Apply suggestions from code review
Co-authored-by: Jonathan Keane <[email protected]>
1 parent 19f25dd commit 11e4730

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/posit/connect/permissions.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ def destroy(self, *permissions: str | Group | User | Permission) -> list[Permiss
152152
----------
153153
*permissions : str | Group | User | Permission
154154
The content item permissions to remove. If a `str` is received, it is compared against
155-
the `Permissions`' `principal_guid`. If a `Group` or `User` is received, the associated
155+
the `Permissions`'s `principal_guid`. If a `Group` or `User` is received, the associated
156156
`Permission` will be removed.
157157
158158
Returns
159159
-------
160160
list[Permission]
161-
The removed permissions. If a permission is not found, it is not included in the
162-
returned list.
161+
The removed permissions. If a permission is not found, there is nothing to remove and
162+
it is not included in the returned list.
163163
164164
Examples
165165
--------
@@ -206,9 +206,7 @@ def destroy(self, *permissions: str | Group | User | Permission) -> list[Permiss
206206
for arg in permissions:
207207
if isinstance(arg, str):
208208
principal_guid = arg
209-
elif isinstance(arg, Group):
210-
principal_guid: str = arg["guid"]
211-
elif isinstance(arg, User):
209+
elif isinstance(arg, (Group, User)):
212210
principal_guid: str = arg["guid"]
213211
elif isinstance(arg, Permission):
214212
principal_guid: str = arg["principal_guid"]

tests/posit/connect/test_permissions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ def test_destroy(self):
321321
)
322322

323323
# Assert bad input value
324-
325324
with pytest.raises(TypeError):
326325
permissions.destroy(
327326
42 # pyright: ignore[reportArgumentType]

0 commit comments

Comments
 (0)