Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-minidb for openSUSE:Factory 
checked in at 2022-11-01 13:43:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-minidb (Old)
 and      /work/SRC/openSUSE:Factory/.python-minidb.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-minidb"

Tue Nov  1 13:43:06 2022 rev:8 rq:1032574 version:2.0.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-minidb/python-minidb.changes      
2022-09-30 17:58:02.533280390 +0200
+++ /work/SRC/openSUSE:Factory/.python-minidb.new.2275/python-minidb.changes    
2022-11-01 13:43:08.216077608 +0100
@@ -1,0 +2,9 @@
+Fri Oct 28 18:26:51 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com>
+
+- Update to 2.0.7 
+  Test against Python 3.10
+  YAML syntax and me
+  Only pass special keyword args to model __init__
+  Add delete_all() and count_rows()
+
+-------------------------------------------------------------------

Old:
----
  minidb-2.0.6.tar.gz

New:
----
  minidb-2.0.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-minidb.spec ++++++
--- /var/tmp/diff_new_pack.sxDqLk/_old  2022-11-01 13:43:08.984081693 +0100
+++ /var/tmp/diff_new_pack.sxDqLk/_new  2022-11-01 13:43:08.988081715 +0100
@@ -16,12 +16,11 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define modname minidb
 %define         skip_python2 1
 %bcond_without  test
 Name:           python-minidb
-Version:        2.0.6
+Version:        2.0.7
 Release:        0
 Summary:        SQLite3-based store for Python objects
 License:        ISC

++++++ minidb-2.0.6.tar.gz -> minidb-2.0.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minidb-2.0.6/example.py new/minidb-2.0.7/example.py
--- old/minidb-2.0.6/example.py 2022-02-17 12:04:53.000000000 +0100
+++ new/minidb-2.0.7/example.py 2022-09-16 20:41:41.000000000 +0200
@@ -243,6 +243,9 @@
     print('Select Star')
     print(list(Person.query(db, minidb.literal('*'))))
 
+    print('Count items')
+    print(db.count_rows(Person))
+
     print('Group By')
     print(list(Person.query(db, Person.c.username // Person.c.id.count, 
group_by=Person.c.username)))
 
@@ -258,6 +261,12 @@
     print('Pretty-Querying with default star-select')
     Person.pquery(db)
 
+    print('Delete all items')
+    db.delete_all(Person)
+
+    print('Count again after delete')
+    print(db.count_rows(Person))
+
     print('With payload (JSON)')
     WithPayload(payload={'a': [1] * 3}).save(db)
     for payload in WithPayload.load(db):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minidb-2.0.6/minidb.py new/minidb-2.0.7/minidb.py
--- old/minidb-2.0.6/minidb.py  2022-02-17 12:04:53.000000000 +0100
+++ new/minidb-2.0.7/minidb.py  2022-09-16 20:41:41.000000000 +0200
@@ -36,7 +36,7 @@
 
 
 __author__ = 'Thomas Perl <m...@thp.io>'
-__version__ = '2.0.6'
+__version__ = '2.0.7'
 __url__ = 'http://thp.io/2010/minidb/'
 __license__ = 'ISC'
 
@@ -335,6 +335,12 @@
             sql = 'DELETE FROM %s WHERE %s' % (table, ssql)
             return self._execute(sql, args).rowcount
 
+    def delete_all(self, class_):
+        self.delete_where(class_, literal('1'))
+
+    def count_rows(self, class_):
+        return next(self.query(class_, func.count(literal('*'))))[0]
+
     def query(self, class_, select=None, where=None, order_by=None, 
group_by=None, limit=None):
         with self.lock:
             table, slots = self._schema(class_)
@@ -701,7 +707,12 @@
 
     # Call redirected constructor
     if '__minidb_init__' in self.__class__.__dict__:
-        getattr(self, '__minidb_init__')(*args)
+        # Any keyword arguments that are not the primary key ("id") or any of 
the slots
+        # will be passed to the __init__() function of the class, all other 
attributes
+        # will have already been initialized/set by the time __init__() is 
called.
+        kwargs = {k: v for k, v in kwargs.items()
+                  if k != Store.PRIMARY_KEY[0] and k not in 
self.__class__.__minidb_slots__}
+        getattr(self, '__minidb_init__')(*args, **kwargs)
 
 
 class MetaModel(type):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minidb-2.0.6/test/test_minidb.py 
new/minidb-2.0.7/test/test_minidb.py
--- old/minidb-2.0.6/test/test_minidb.py        2022-02-17 12:04:53.000000000 
+0100
+++ new/minidb-2.0.7/test/test_minidb.py        2022-09-16 20:41:41.000000000 
+0200
@@ -646,3 +646,19 @@
                                         where=lambda c: c.id == player_id))
         assert type(query_value.position) == Point
         assert (query_value.position.x, query_value.position.y) == (p.x, p.y)
+
+
+def test_delete_all():
+    class Thing(minidb.Model):
+        bla = str
+        blubb = int
+
+    with minidb.Store(debug=True) as db:
+        db.register(Thing)
+
+        db.save(Thing(bla='a', blubb=123))
+        db.save(Thing(bla='c', blubb=456))
+        assert db.count_rows(Thing) == 2
+
+        db.delete_all(Thing)
+        assert db.count_rows(Thing) == 0

Reply via email to