Skip to content

Commit b8bca20

Browse files
committed
Merge doc strings
1 parent 9977e60 commit b8bca20

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/posit/connect/permissions.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,12 @@ def count(self) -> int:
6767
return len(self.find())
6868

6969
@overload
70-
def create(self, *, principal_guid: str, principal_type: str, role: str) -> Permission:
71-
"""Create a permission.
72-
73-
Parameters
74-
----------
75-
principal_guid : str
76-
User guid or Group guid.
77-
principal_type : str
78-
The principal type. Either `"user"` or `"group"`.
79-
role : str
80-
The principal role. Currently only `"viewer"` and `"owner"` are supported
81-
82-
Returns
83-
-------
84-
Permission
85-
"""
70+
def create(self, *, principal_guid: str, principal_type: str, role: str) -> Permission: ...
8671

8772
@overload
88-
def create(self, *args: User | Group, role: str) -> list[Permission]:
73+
def create(self, *args: User | Group, role: str) -> list[Permission]: ...
74+
75+
def create(self, *args: User | Group, **kwargs) -> Permission | list[Permission]:
8976
"""Create a permission.
9077
9178
Parameters
@@ -94,10 +81,18 @@ def create(self, *args: User | Group, role: str) -> list[Permission]:
9481
The principal users or groups to add.
9582
role : str
9683
The principal role. Currently only `"viewer"` and `"owner"` are supported.
84+
principal_guid : str
85+
User guid or Group guid.
86+
principal_type : str
87+
The principal type. Either `"user"` or `"group"`.
88+
role : str
89+
The principal role. Currently only `"viewer"` and `"owner"` are supported
9790
9891
Returns
9992
-------
100-
Permission
93+
Permission | List[Permission]
94+
Returns a `Permission` when the kwargs: `principal_guid`, `principal_type`, and `role`
95+
are used. Returns a `list[Permission]` when `*args` are used.
10196
10297
Examples
10398
--------
@@ -141,8 +136,6 @@ def create(self, *args: User | Group, role: str) -> list[Permission]:
141136
content_item.permissions.find()
142137
```
143138
"""
144-
145-
def create(self, *args: User | Group, **kwargs) -> Permission | list[Permission]:
146139
if len(args) > 0:
147140
# Avoid circular imports
148141
from .groups import Group
@@ -232,7 +225,7 @@ def destroy(self, *permissions: str | Group | User | Permission) -> list[Permiss
232225
Returns
233226
-------
234227
list[Permission]
235-
The removed permissions. If a permission is not found, there is nothing to remove and
228+
The removed permissions. If a permission is not found, there is nothing to remove and
236229
it is not included in the returned list.
237230
238231
Examples

0 commit comments

Comments
 (0)