@@ -126,12 +126,12 @@ def pages(self) -> int:
126
126
127
127
@property
128
128
def has_prev (self ) -> bool :
129
- """`` True` ` if this is not the first page."""
129
+ """`True` if this is not the first page."""
130
130
return self .page > 1
131
131
132
132
@property
133
133
def prev_num (self ) -> t .Optional [int ]:
134
- """The previous page number, or `` None` ` if this is the first page."""
134
+ """The previous page number, or `None` if this is the first page."""
135
135
if not self .has_prev :
136
136
return None
137
137
@@ -140,9 +140,8 @@ def prev_num(self) -> t.Optional[int]:
140
140
def prev (self , * , error_out : bool = False ) -> "PaginatorBase" :
141
141
"""Query the pagination object for the previous page.
142
142
143
- :param error_out: Abort with a ``404 Not Found`` error if no items are returned
144
- and ``page`` is not 1, or if ``page`` or ``per_page`` is less than 1, or if
145
- either are not ints.
143
+ :param error_out: Raise `404 Not Found` error if no items are returned
144
+ and `page` is not 1, or if `page` or `per_page` is less than 1.
146
145
"""
147
146
init_kwargs = self ._get_init_kwargs ()
148
147
init_kwargs .update (
@@ -157,19 +156,24 @@ def prev(self, *, error_out: bool = False) -> "PaginatorBase":
157
156
158
157
@property
159
158
def has_next (self ) -> bool :
160
- """`` True` ` if this is not the last page."""
159
+ """`True` if this is not the last page."""
161
160
return self .page < self .pages
162
161
163
162
@property
164
163
def next_num (self ) -> t .Optional [int ]:
165
- """The next page number, or `` None` ` if this is the last page."""
164
+ """The next page number, or `None` if this is the last page."""
166
165
if not self .has_next :
167
166
return None
168
167
169
168
return self .page + 1
170
169
171
170
def next (self , * , error_out : bool = False ) -> "PaginatorBase" :
172
- """ """
171
+ """
172
+ Query the Pagination object for the next page.
173
+
174
+ :param error_out: Raise `404 Not Found` error if no items are returned
175
+ and `page` is not 1, or if `page` or `per_page` is less than 1.
176
+ """
173
177
init_kwargs = self ._get_init_kwargs ()
174
178
init_kwargs .update (
175
179
page = self .page + 1 ,
@@ -190,15 +194,15 @@ def iter_pages(
190
194
right_current : int = 4 ,
191
195
right_edge : int = 2 ,
192
196
) -> t .Iterator [t .Optional [int ]]:
193
- """Yield page numbers for a pagination widget. Skipped pages between the edges
194
- and middle are represented by a ``None``.
197
+ """
198
+ Yield page numbers for a pagination widget.
199
+ A None represents skipped pages between the edges and middle.
195
200
196
201
For example, if there are 20 pages and the current page is 7, the following
197
202
values are yielded.
198
203
199
- .. code-block:: python
200
-
201
- 1, 2, None, 5, 6, 7, 8, 9, 10, 11, None, 19, 20
204
+ For example:
205
+ 1, 2, None, 5, 6, 7, 8, 9, 10, 11, None, 19, 20
202
206
203
207
:param left_edge: How many pages to show from the first page.
204
208
:param left_current: How many pages to show left of the current page.
0 commit comments