Skip to content

Commit 88ee30e

Browse files
New minor version 1.0.2
Add __bool__ method on Collection document ODM class
2 parents b792de5 + 2b4fd53 commit 88ee30e

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

__info__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
"""Information variable used by modules on this package."""
2424

25-
__version__ = '1.0.1'
25+
__version__ = '1.0.2'
2626
__author__ = 'Matteo Guadrini'
2727
__email__ = '[email protected]'
2828
__homepage__ = 'https://github.com/MatteoGuadrini/nosqlapi'

nosqlapi/docdb/odm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ def __len__(self):
103103
def __iter__(self):
104104
return (doc for doc in self.docs)
105105

106+
def __bool__(self):
107+
return True if self.docs else False
108+
106109

107110
class Document:
108111

nosqlapi/docdb/odm.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class Collection:
5454

5555
def __iter__(self) -> Iterator: ...
5656

57+
def __bool__(self) -> bool: ...
58+
5759

5860
class Document:
5961
id: Union[str, Uuid]

0 commit comments

Comments
 (0)