typo/doc updates, destructure namedtuple manually
may lead to less problems in the future, in case the order of the rangetuple chagnes
This commit is contained in:
parent
4af2b8e4df
commit
28fd9e4441
1 changed files with 12 additions and 9 deletions
|
@ -203,7 +203,7 @@ def _create_range_filter(
|
|||
the value to compare the range boundaries to. typically generated by _generate_order_by_func
|
||||
|
||||
To force the values you're sorting by to be in some specified type,
|
||||
this allows a 'conversion_func, which optionally converts the value
|
||||
this allows a 'value_coercion_func', which optionally converts the value
|
||||
returned by attr_func to some shared type (see _datelike_to_float for an example)
|
||||
"""
|
||||
|
||||
|
@ -217,8 +217,9 @@ def _create_range_filter(
|
|||
if rn is None:
|
||||
return None
|
||||
|
||||
# destructure namedtuple
|
||||
(after, before, within) = rn
|
||||
after = rn.after
|
||||
before = rn.before
|
||||
within = rn.within
|
||||
|
||||
# hmm... not sure how to correctly manage
|
||||
# inclusivity here? Is [after, before) currently,
|
||||
|
@ -351,15 +352,17 @@ Specify a type or a key to order the value by""")
|
|||
# (seems like a lot?)
|
||||
raise QueryException("Sorting by custom types is currently unsupported")
|
||||
|
||||
# use the created filter function in select (could be None if the user specified a RangeTuple
|
||||
# like (None, None, None) somehow, but select handles that case
|
||||
# apply leftover arguments from the user (limit, reverse)
|
||||
# use the created filter function
|
||||
# we've already applied drop_exceptions and kwargs related to unsortable values above
|
||||
itr = select(itr, where=filter_func, limit=limit, reverse=reverse)
|
||||
else:
|
||||
# wrap_unsorted may be used here if the user is just specifying an order_key
|
||||
# and nothing else to order or filter range by
|
||||
# i.e. none of the range-related code ran, this is just a select with a key
|
||||
# wrap_unsorted may be used here if the user specified an order_key,
|
||||
# or manually passed a order_value function
|
||||
#
|
||||
# this select is also run if the user didn't specify anything to
|
||||
# order by, and is just returning the data in the same order as
|
||||
# as the srouce iterable
|
||||
# i.e. none of the range-related filtering code ran, this is just a select
|
||||
itr = select(itr,
|
||||
order_by=order_by_chosen,
|
||||
wrap_unsorted=wrap_unsorted,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue