Skip to content

Commit 5d96d8b

Browse files
committed
Bumped up ellar version and some code docs
1 parent b3515d7 commit 5d96d8b

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

ellar_sqlalchemy/pagination/base.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ def pages(self) -> int:
126126

127127
@property
128128
def has_prev(self) -> bool:
129-
"""``True`` if this is not the first page."""
129+
"""`True` if this is not the first page."""
130130
return self.page > 1
131131

132132
@property
133133
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."""
135135
if not self.has_prev:
136136
return None
137137

@@ -140,9 +140,8 @@ def prev_num(self) -> t.Optional[int]:
140140
def prev(self, *, error_out: bool = False) -> "PaginatorBase":
141141
"""Query the pagination object for the previous page.
142142
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.
146145
"""
147146
init_kwargs = self._get_init_kwargs()
148147
init_kwargs.update(
@@ -157,19 +156,24 @@ def prev(self, *, error_out: bool = False) -> "PaginatorBase":
157156

158157
@property
159158
def has_next(self) -> bool:
160-
"""``True`` if this is not the last page."""
159+
"""`True` if this is not the last page."""
161160
return self.page < self.pages
162161

163162
@property
164163
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."""
166165
if not self.has_next:
167166
return None
168167

169168
return self.page + 1
170169

171170
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+
"""
173177
init_kwargs = self._get_init_kwargs()
174178
init_kwargs.update(
175179
page=self.page + 1,
@@ -190,15 +194,15 @@ def iter_pages(
190194
right_current: int = 4,
191195
right_edge: int = 2,
192196
) -> 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.
195200
196201
For example, if there are 20 pages and the current page is 7, the following
197202
values are yielded.
198203
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
202206
203207
:param left_edge: How many pages to show from the first page.
204208
:param left_current: How many pages to show left of the current page.

ellar_sqlalchemy/pagination/decorator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def paginate(
2424
"""
2525
=========ROUTE FUNCTION DECORATOR ==============
2626
27-
# :param ttl: the time to live
28-
# :param key_prefix: cache key prefix
29-
# :param version: will be used in constructing the key
30-
# :param backend: Cache Backend to use. Default is `default`
31-
# :param make_key_callback: Key dynamic construct.
27+
:param pagination_class: Pagination Class of type PaginationBase
28+
:param model: SQLAlchemy Model or SQLAlchemy Select Statement
29+
:param template_context: If True adds `paginator` object to templating context data
30+
:param item_schema: Pagination Object Schema for serializing object and creating response schema documentation
31+
:param paginator_options: Other keyword args for initializing `pagination_class`
3232
:return: TCallable
3333
"""
3434
paginator_options.update(model=model)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ classifiers = [
3232
]
3333

3434
dependencies = [
35-
"ellar >= 0.6.6",
35+
"ellar >= 0.6.7",
3636
"sqlalchemy >= 2.0.23",
3737
"alembic >= 1.10.0",
3838
"python-magic >= 0.4.27",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy