@@ -193,15 +193,15 @@ def restrict_in_place(self, restriction):
193193
194194 def __and__ (self , restriction ):
195195 """
196- Restriction operator e.g. q1 & q2.
196+ Restriction operator e.g. `` q1 & q2`` .
197197 :return: a restricted copy of the input argument
198198 See QueryExpression.restrict for more detail.
199199 """
200200 return self .restrict (restriction )
201201
202202 def __xor__ (self , restriction ):
203203 """
204- Permissive restriction operator ignoring compatibility check e.g. q1 ^ q2.
204+ Permissive restriction operator ignoring compatibility check e.g. `` q1 ^ q2`` .
205205 """
206206 if inspect .isclass (restriction ) and issubclass (restriction , QueryExpression ):
207207 restriction = restriction ()
@@ -211,15 +211,15 @@ def __xor__(self, restriction):
211211
212212 def __sub__ (self , restriction ):
213213 """
214- Inverted restriction e.g. q1 - q2.
214+ Inverted restriction e.g. `` q1 - q2`` .
215215 :return: a restricted copy of the input argument
216216 See QueryExpression.restrict for more detail.
217217 """
218218 return self .restrict (Not (restriction ))
219219
220220 def __neg__ (self ):
221221 """
222- Convert between restriction and inverted restriction e.g. -q1.
222+ Convert between restriction and inverted restriction e.g. `` -q1`` .
223223 :return: target restriction
224224 See QueryExpression.restrict for more detail.
225225 """
@@ -229,14 +229,14 @@ def __neg__(self):
229229
230230 def __mul__ (self , other ):
231231 """
232- join of query expressions `self` and `other` e.g. q1 * q2.
232+ join of query expressions `self` and `other` e.g. `` q1 * q2`` .
233233 """
234234 return self .join (other )
235235
236236 def __matmul__ (self , other ):
237237 """
238238 Permissive join of query expressions `self` and `other` ignoring compatibility check
239- e.g. q1 @ q2.
239+ e.g. `` q1 @ q2`` .
240240 """
241241 if inspect .isclass (other ) and issubclass (other , QueryExpression ):
242242 other = other () # instantiate
@@ -282,7 +282,7 @@ def join(self, other, semantic_check=True, left=False):
282282 return result
283283
284284 def __add__ (self , other ):
285- """union e.g. q1 + q2."""
285+ """union e.g. `` q1 + q2`` ."""
286286 return Union .create (self , other )
287287
288288 def proj (self , * attributes , ** named_attributes ):
@@ -435,7 +435,7 @@ def tail(self, limit=25, **fetch_kwargs):
435435 return self .fetch (order_by = "KEY DESC" , limit = limit , ** fetch_kwargs )[::- 1 ]
436436
437437 def __len__ (self ):
438- """:return: number of elements in the result set e.g. len(q1)."""
438+ """:return: number of elements in the result set e.g. `` len(q1)`` ."""
439439 return self .connection .query (
440440 'SELECT count(DISTINCT {fields}) FROM {from_}{where}' .format (
441441 fields = self .heading .as_sql (self .primary_key , include_aliases = False ),
@@ -445,7 +445,7 @@ def __len__(self):
445445 def __bool__ (self ):
446446 """
447447 :return: True if the result is not empty. Equivalent to len(self) > 0 but often
448- faster e.g. bool(q1).
448+ faster e.g. `` bool(q1)`` .
449449 """
450450 return bool (self .connection .query (
451451 'SELECT EXISTS(SELECT 1 FROM {from_}{where})' .format (
@@ -454,7 +454,8 @@ def __bool__(self):
454454
455455 def __contains__ (self , item ):
456456 """
457- returns True if a restriction results with any records e.g. restriction in q1.
457+ returns True if the restriction in item matches any entries in self
458+ e.g. ``restriction in q1``.
458459 :param item: any restriction
459460 (item in query_expression) is equivalent to bool(query_expression & item) but may be
460461 executed more efficiently.
@@ -463,7 +464,7 @@ def __contains__(self, item):
463464
464465 def __iter__ (self ):
465466 """
466- returns an iterator-compatible QueryExpression object e.g. iter(q1).
467+ returns an iterator-compatible QueryExpression object e.g. `` iter(q1)`` .
467468
468469 :param self: iterator-compatible QueryExpression object
469470 """
@@ -474,9 +475,11 @@ def __iter__(self):
474475 def __next__ (self ):
475476 """
476477 returns the next record on an iterator-compatible QueryExpression object
477- e.g. next(q1).
478+ e.g. `` next(q1)`` .
478479
479- :param self: fetch1 record
480+ :param self: A query expression
481+ :type self: :class:`QueryExpression`
482+ :rtype: dict
480483 """
481484 try :
482485 key = self ._iter_keys .pop (0 )
@@ -514,9 +517,11 @@ def cursor(self, offset=0, limit=None, order_by=None, as_dict=False):
514517
515518 def __repr__ (self ):
516519 """
517- returns the string representation of a QueryExpression object e.g. str(q1).
520+ returns the string representation of a QueryExpression object e.g. `` str(q1)`` .
518521
519- :param self: String version of query result
522+ :param self: A query expression
523+ :type self: :class:`QueryExpression`
524+ :rtype: str
520525 """
521526 return super ().__repr__ () if config ['loglevel' ].lower () == 'debug' else self .preview ()
522527
0 commit comments