Hello community,

here is the log from the commit of package python-wptools for openSUSE:Factory 
checked in at 2018-01-16 09:43:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-wptools (Old)
 and      /work/SRC/openSUSE:Factory/.python-wptools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-wptools"

Tue Jan 16 09:43:03 2018 rev:4 rq:564489 version:0.4.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-wptools/python-wptools.changes    
2018-01-10 23:36:43.607635081 +0100
+++ /work/SRC/openSUSE:Factory/.python-wptools.new/python-wptools.changes       
2018-01-16 09:43:04.467712234 +0100
@@ -1,0 +2,8 @@
+Sun Jan 14 18:36:17 UTC 2018 - badshah...@gmail.com
+
+- Update to version 0.4.7:
+  * Added support for non-value Wikidata snaktypes, and category
+    continuations.
+- Rebase python-wptools-avoid-reading-readme.patch.
+
+-------------------------------------------------------------------

Old:
----
  wptools-0.4.6.tar.gz

New:
----
  wptools-0.4.7.tar.gz

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

Other differences:
------------------
++++++ python-wptools.spec ++++++
--- /var/tmp/diff_new_pack.XTbGZK/_old  2018-01-16 09:43:05.287673852 +0100
+++ /var/tmp/diff_new_pack.XTbGZK/_new  2018-01-16 09:43:05.291673666 +0100
@@ -19,7 +19,7 @@
 %define pyname wptools
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-wptools
-Version:        0.4.6
+Version:        0.4.7
 Release:        0
 Summary:        Wikipedia tools (for Humans)
 License:        MIT

++++++ python-wptools-avoid-reading-readme.patch ++++++
--- /var/tmp/diff_new_pack.XTbGZK/_old  2018-01-16 09:43:05.307672916 +0100
+++ /var/tmp/diff_new_pack.XTbGZK/_new  2018-01-16 09:43:05.311672730 +0100
@@ -13,7 +13,7 @@
  
 @@ -12,7 +10,16 @@ setup(
      name='wptools',
-     version='0.4.6',
+     version='0.4.7',
      description='Wikipedia tools (for Humans)',
 -    long_description=readme + '\n\n' + history,
 +    long_description=

++++++ wptools-0.4.6.tar.gz -> wptools-0.4.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/HISTORY.rst 
new/wptools-0.4.7/HISTORY.rst
--- old/wptools-0.4.6/HISTORY.rst       2017-12-23 01:53:04.000000000 +0100
+++ new/wptools-0.4.7/HISTORY.rst       2018-01-11 00:04:40.000000000 +0100
@@ -3,10 +3,12 @@
 Release History
 ---------------
 
-0.4.6 (2017-12-22)
+0.4.7 (2018-01-10)
 ++++++++++++++++++
 
-* Merged deleted Wikidata item PR by @seansay (#97)
+* Added support for category continuations, subcategories (#99)
+* Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
+* Merged @seansay fix for deleted Wikidata item (#97)
 * Fixed TypeError on Windows 10 (#95)
 * Fixed RESTBase LookupError on slash titles (#94)
 * Added boxterm param for more Infobox reach (#91)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/PKG-INFO new/wptools-0.4.7/PKG-INFO
--- old/wptools-0.4.6/PKG-INFO  2017-12-23 01:58:54.000000000 +0100
+++ new/wptools-0.4.7/PKG-INFO  2018-01-11 00:11:01.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: wptools
-Version: 0.4.6
+Version: 0.4.7
 Summary: Wikipedia tools (for Humans)
 Home-page: https://github.com/siznax/wptools/
 Author: Steve @siznax
@@ -139,10 +139,12 @@
         Release History
         ---------------
         
-        0.4.6 (2017-12-22)
+        0.4.7 (2018-01-10)
         ++++++++++++++++++
         
-        * Merged deleted Wikidata item PR by @seansay (#97)
+        * Added support for category continuations, subcategories (#99)
+        * Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
+        * Merged @seansay fix for deleted Wikidata item (#97)
         * Fixed TypeError on Windows 10 (#95)
         * Fixed RESTBase LookupError on slash titles (#94)
         * Added boxterm param for more Infobox reach (#91)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/setup.py new/wptools-0.4.7/setup.py
--- old/wptools-0.4.6/setup.py  2017-12-23 01:53:13.000000000 +0100
+++ new/wptools-0.4.7/setup.py  2018-01-11 00:05:17.000000000 +0100
@@ -10,7 +10,7 @@
 
 setup(
     name='wptools',
-    version='0.4.6',
+    version='0.4.7',
     description='Wikipedia tools (for Humans)',
     long_description=readme + '\n\n' + history,
     url='https://github.com/siznax/wptools/',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/wptools/__init__.py 
new/wptools-0.4.7/wptools/__init__.py
--- old/wptools-0.4.6/wptools/__init__.py       2017-12-23 01:53:23.000000000 
+0100
+++ new/wptools-0.4.7/wptools/__init__.py       2018-01-11 00:05:32.000000000 
+0100
@@ -18,7 +18,7 @@
 __contact__ = "https://github.com/siznax/wptools";
 __license__ = "MIT"
 __title__ = "wptools"
-__version__ = "0.4.6"
+__version__ = "0.4.7"
 
 from . import core
 from . import query
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/wptools/category.py 
new/wptools-0.4.7/wptools/category.py
--- old/wptools-0.4.6/wptools/category.py       2017-12-13 23:35:18.000000000 
+0100
+++ new/wptools-0.4.7/wptools/category.py       2018-01-10 23:49:25.000000000 
+0100
@@ -66,6 +66,24 @@
         if not pageid and not title:
             self.get_random()
 
+    def _add_members(self, catmembers):
+        """
+        Adds category members and subcategories to data
+        """
+        members = [x for x in catmembers if x['ns'] == 0]
+        subcats = [x for x in catmembers if x['ns'] == 14]
+
+        if 'members' in self.data:
+            self.data['members'].extend(members)
+        else:
+            self.data.update({'members': members})
+
+        if subcats:
+            if 'subcategories' in self.data:
+                self.data['subcategories'].extend(subcats)
+            else:
+                self.data.update({'subcategories': subcats})
+
     def _query(self, action, qobj):
         """
         Form query to enumerate category
@@ -76,7 +94,10 @@
         if action == 'random':
             return qobj.random(namespace=14)
         elif action == 'category':
-            return qobj.category(title=title, pageid=pageid)
+            qry = qobj.category(title=title, pageid=pageid)
+            if self.data.get('cmcontinue'):
+                qry += "&cmcontinue=%s" % self.data['cmcontinue']
+            return qry
 
     def _set_data(self, action):
         """
@@ -84,9 +105,19 @@
         """
         data = self._load_response(action)
 
+        try:
+            cmcontinue = data.get('continue').get('cmcontinue')
+            if cmcontinue:
+                self.data['cmcontinue'] = cmcontinue
+                del self.cache['category']
+        except AttributeError:
+            if 'cmcontinue' in self.data:
+                del self.data['cmcontinue']
+
         if action == 'category':
             members = data.get('query').get('categorymembers')
-            self.data.update({'members': members})
+            if members:
+                self._add_members(members)
 
         if action == 'random':
             rand = data['query']['random'][0]
@@ -120,6 +151,10 @@
 
         self._get('category', show, proxy, timeout)
 
+        if self.data.get('cmcontinue'):
+            while self.data.get('cmcontinue'):
+                self._get('category', show, proxy, timeout)
+
         return self
 
     def get_random(self, show=True, proxy=None, timeout=0):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/wptools/wikidata.py 
new/wptools-0.4.7/wptools/wikidata.py
--- old/wptools-0.4.6/wptools/wikidata.py       2017-12-13 23:35:18.000000000 
+0100
+++ new/wptools-0.4.7/wptools/wikidata.py       2018-01-09 23:51:27.000000000 
+0100
@@ -355,26 +355,30 @@
     """
     claims = collections.defaultdict(list)
 
-    for claim in query_claims:
+    for claim, entities in query_claims.items():
 
-        for ent in query_claims.get(claim):
+        for ent in entities:
 
             try:
-                snak = ent.get('mainsnak').get('datavalue').get('value')
+                snak = ent.get('mainsnak')
+                snaktype = snak.get('snaktype')
+                value = snak.get('datavalue').get('value')
             except AttributeError:
                 claims[claim] = []
 
             try:
-                if snak.get('id'):
-                    val = snak.get('id')
-                elif snak.get('text'):
-                    val = snak.get('text')
-                elif snak.get('time'):
-                    val = snak.get('time')
+                if snaktype != 'value':
+                    val = snaktype
+                elif value.get('id'):
+                    val = value.get('id')
+                elif value.get('text'):
+                    val = value.get('text')
+                elif value.get('time'):
+                    val = value.get('time')
                 else:
-                    val = snak
+                    val = value
             except AttributeError:
-                val = snak
+                val = value
 
             if not val or not [x for x in val if x]:
                 raise ValueError("%s %s" % (claim, ent))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.6/wptools.egg-info/PKG-INFO 
new/wptools-0.4.7/wptools.egg-info/PKG-INFO
--- old/wptools-0.4.6/wptools.egg-info/PKG-INFO 2017-12-23 01:58:54.000000000 
+0100
+++ new/wptools-0.4.7/wptools.egg-info/PKG-INFO 2018-01-11 00:11:01.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: wptools
-Version: 0.4.6
+Version: 0.4.7
 Summary: Wikipedia tools (for Humans)
 Home-page: https://github.com/siznax/wptools/
 Author: Steve @siznax
@@ -139,10 +139,12 @@
         Release History
         ---------------
         
-        0.4.6 (2017-12-22)
+        0.4.7 (2018-01-10)
         ++++++++++++++++++
         
-        * Merged deleted Wikidata item PR by @seansay (#97)
+        * Added support for category continuations, subcategories (#99)
+        * Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
+        * Merged @seansay fix for deleted Wikidata item (#97)
         * Fixed TypeError on Windows 10 (#95)
         * Fixed RESTBase LookupError on slash titles (#94)
         * Added boxterm param for more Infobox reach (#91)


Reply via email to