Skip to content

Commit aa1a782

Browse files
committedDec 28, 2024
fix documentation building
1 parent 7cdbb3a commit aa1a782

File tree

2 files changed

+73
-17
lines changed

2 files changed

+73
-17
lines changed
 

‎docs/client.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
.. currentmodule:: mystbin
2+
13
API Reference
24
=============
35

4-
.. currentmodule:: mystbin
5-
66
Client
7-
-------
7+
------
88
.. autoclass:: Client
99
:members:
1010

1111
Paste
12-
------
13-
.. autoclass:: Paste
12+
-----
13+
.. autoclass:: Paste()
1414
:members:
1515

1616
File
17-
-----
18-
17+
----
1918
.. autoclass:: File
2019
:members:

‎mystbin/paste.py

+67-10
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141

4242

4343
class File:
44-
_lines_of_code: int
45-
_character_count: int
46-
_parent_id: str
47-
_annotation: str
48-
4944
"""Represents a single file within a mystb.in paste.
5045
5146
Attributes
@@ -56,6 +51,11 @@ class File:
5651
The file's contents.
5752
"""
5853

54+
_lines_of_code: int
55+
_character_count: int
56+
_parent_id: str
57+
_annotation: str
58+
5959
__slots__ = (
6060
"_annotation",
6161
"_character_count",
@@ -71,18 +71,42 @@ def __init__(self, *, filename: str, content: str) -> None:
7171

7272
@property
7373
def lines_of_code(self) -> int:
74+
"""The total lines of code this file has.
75+
76+
Returns
77+
--------
78+
:class:`int`
79+
"""
7480
return self._lines_of_code
7581

7682
@property
7783
def character_count(self) -> int:
84+
"""The total character count of this file.
85+
86+
Returns
87+
--------
88+
:class:`int`
89+
"""
7890
return self._character_count
7991

8092
@property
8193
def annotation(self) -> str:
94+
"""The files annotation.
95+
96+
Returns
97+
--------
98+
:class:`str`
99+
"""
82100
return self._annotation
83101

84102
@property
85103
def parent_id(self) -> str:
104+
"""The files parent paste ID.
105+
106+
Returns
107+
--------
108+
:class:`str`
109+
"""
86110
return self._parent_id
87111

88112
@classmethod
@@ -103,10 +127,6 @@ def to_dict(self) -> dict[str, Any]:
103127

104128

105129
class Paste:
106-
_expires: datetime.datetime | None
107-
_views: int | None
108-
_security: str | None
109-
110130
"""Represents a Paste object from mystbin instances.
111131
112132
Attributes
@@ -119,6 +139,10 @@ class Paste:
119139
The list of files within this Paste.
120140
"""
121141

142+
_expires: datetime.datetime | None
143+
_views: int | None
144+
_security: str | None
145+
122146
__slots__ = (
123147
"_expires",
124148
"_http",
@@ -144,18 +168,42 @@ def __repr__(self) -> str:
144168

145169
@property
146170
def url(self) -> str:
147-
return f"{self._http.api_base}{self.id}"
171+
"""The paste URL.
172+
173+
Returns
174+
--------
175+
:class:`str`
176+
"""
177+
return f"{self._http.root_url}{self.id}"
148178

149179
@property
150180
def expires(self) -> datetime.datetime | None:
181+
"""When the paste expires, if at all.
182+
183+
Returns
184+
--------
185+
Optional[:class:`datetime.datetime`]
186+
"""
151187
return self._expires
152188

153189
@property
154190
def views(self) -> int | None:
191+
"""The pastes view count, if any.
192+
193+
Returns
194+
--------
195+
Optional[:class:`int`]
196+
"""
155197
return self._views
156198

157199
@property
158200
def security_token(self) -> str | None:
201+
"""The pastes security token, if any.
202+
203+
Returns
204+
--------
205+
Optional[:class:`str`]
206+
"""
159207
return self._security
160208

161209
@classmethod
@@ -200,6 +248,15 @@ def from_create(cls, payload: CreatePasteResponse, files: Sequence[File], *, htt
200248
return self
201249

202250
async def delete(self) -> None:
251+
"""|coro|
252+
253+
This method will delete this paste from the mystbin instance.
254+
255+
Raises
256+
-------
257+
ValueError
258+
The paste requires the security token to be present.
259+
"""
203260
if not self.security_token:
204261
raise ValueError("Cannot delete a Paste with no Security Token set.")
205262

0 commit comments

Comments
 (0)
Please sign in to comment.