@@ -19,7 +19,7 @@ def xtra(self:Table, **kwargs):
19
19
20
20
@patch
21
21
def get_last (self :Table , as_cls :bool = True ):
22
- assert self .last_rowid
22
+ assert self .last_rowid is not None
23
23
row = first (self .rows_where ('_rowid_=?' , (self .last_rowid ,)))
24
24
assert row , f"Couldn't find { self .last_rowid } "
25
25
vals = [row [pk ] for pk in self .pks ]
@@ -70,8 +70,7 @@ def get(self:Table, pk_values: list|tuple|str|int, as_cls:bool=True)->Any:
70
70
return row
71
71
72
72
@patch
73
- def __getitem__ (self :Table , pk_values ):
74
- return self .get (pk_values )
73
+ def __getitem__ (self :Table , pk_values ): return self .get (pk_values )
75
74
76
75
77
76
@patch
@@ -131,7 +130,7 @@ def update(self:Table, updates: dict|None=None, pk_values: list|tuple|str|int|fl
131
130
if is_dataclass (updates ): updates = asdict (updates )
132
131
xtra = getattr (self , 'xtra_id' , {})
133
132
updates = {** updates , ** kwargs , ** xtra }
134
- if not pk_values : pk_values = [updates [o ] for o in self .pks ]
133
+ if pk_values is None : pk_values = [updates [o ] for o in self .pks ]
135
134
self ._orig_update (pk_values , updates = updates , alter = alter , conversions = conversions )
136
135
return self .get_last ()
137
136
0 commit comments