Skip to content

Commit 8fbe8a6

Browse files
committed
Docstring improvements
1 parent 8b8d42e commit 8fbe8a6

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

cachetclient/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,17 @@ def update(self):
4646
>> updated_resource = resource.update()
4747
4848
Returns:
49-
The updated resource from the server
49+
Resource: The updated resource from the server
5050
"""
5151
return self._manager.update(self.get("id"), **self.attrs)
5252

5353
def delete(self) -> None:
54-
"""Deletes the resource from the server"""
54+
"""
55+
Deletes the resource from the server.
56+
57+
Raises:
58+
HTTPException if the resource don't exist.
59+
"""
5560
self._manager.delete(self.get("id"))
5661

5762
def __repr__(self) -> str:

cachetclient/v1/components.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,18 @@ def updated_at(self) -> Optional[datetime]:
130130
def set_tags(self, names: Iterable[str]):
131131
"""Replace the current tags.
132132
133-
Note:: We use the provided names also as the slugs.
134-
When the resource is returned from the server the next time
135-
it will be slugified.
133+
.. Note:: We use the provided names also as the slugs.
134+
When the resource is returned from the server the next time
135+
it will be slugified.
136136
"""
137137
self._data["tags"] = {n: n for n in names}
138138

139139
def add_tags(self, names: Iterable[str]) -> None:
140140
"""Add multiple tags.
141141
142-
Note:: We use the provided name also as the slug.
143-
When the resource is returned from the server the next time
144-
it will be slugified.
142+
.. Note:: We use the provided name also as the slug.
143+
When the resource is returned from the server the next time
144+
it will be slugified.
145145
146146
Args:
147147
names (Iterable[str]): Iterable with names such as a list or set
@@ -152,9 +152,9 @@ def add_tags(self, names: Iterable[str]) -> None:
152152
def add_tag(self, name: str) -> None:
153153
"""Add a new tag.
154154
155-
Note: We use the provided name also as the slug.
156-
When the resource is returned from the server the next time
157-
it will be slugified.
155+
.. Note: We use the provided name also as the slug.
156+
When the resource is returned from the server the next time
157+
it will be slugified.
158158
159159
Args:
160160
name (str): Name of the tag
@@ -190,8 +190,8 @@ def has_tag(self, name: str = None, slug: str = None) -> bool:
190190
Tags and slugs are case insensitive.
191191
192192
Args:
193-
name (str): Tag name
194-
slug (str): Slug name
193+
name (str): Name of the tag
194+
slug (str): Slug for the tag
195195
196196
Returns:
197197
bool: If the tag exists
@@ -218,7 +218,7 @@ def update(self):
218218
>> updated_resource = resource.update()
219219
220220
Returns:
221-
The updated resource from the server
221+
Resource: The updated resource from the server
222222
"""
223223
# Transform tags into an iterable
224224
data = copy.deepcopy(self.attrs)

0 commit comments

Comments
 (0)