Hello community,

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

Package is "python-wptools"

Sun Jan 28 20:32:26 2018 rev:5 rq:570013 version:0.4.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-wptools/python-wptools.changes    
2018-01-16 09:43:04.467712234 +0100
+++ /work/SRC/openSUSE:Factory/.python-wptools.new/python-wptools.changes       
2018-01-28 20:33:35.110436159 +0100
@@ -1,0 +2,7 @@
+Fri Jan 26 16:49:40 UTC 2018 - [email protected]
+
+- Update to version 0.4.7:
+  * Fixed Wikidata pageid, image bugs and added Commons image
+    metadata.
+
+-------------------------------------------------------------------

Old:
----
  wptools-0.4.7.tar.gz

New:
----
  wptools-0.4.8.tar.gz

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

Other differences:
------------------
++++++ python-wptools.spec ++++++
--- /var/tmp/diff_new_pack.xiZSzZ/_old  2018-01-28 20:33:35.814403275 +0100
+++ /var/tmp/diff_new_pack.xiZSzZ/_new  2018-01-28 20:33:35.818403089 +0100
@@ -19,7 +19,7 @@
 %define pyname wptools
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-wptools
-Version:        0.4.7
+Version:        0.4.8
 Release:        0
 Summary:        Wikipedia tools (for Humans)
 License:        MIT

++++++ python-wptools-avoid-reading-readme.patch ++++++
--- /var/tmp/diff_new_pack.xiZSzZ/_old  2018-01-28 20:33:35.882400099 +0100
+++ /var/tmp/diff_new_pack.xiZSzZ/_new  2018-01-28 20:33:35.886399912 +0100
@@ -13,7 +13,7 @@
  
 @@ -12,7 +10,16 @@ setup(
      name='wptools',
-     version='0.4.7',
+     version='0.4.8',
      description='Wikipedia tools (for Humans)',
 -    long_description=readme + '\n\n' + history,
 +    long_description=

++++++ wptools-0.4.7.tar.gz -> wptools-0.4.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/HISTORY.rst 
new/wptools-0.4.8/HISTORY.rst
--- old/wptools-0.4.7/HISTORY.rst       2018-01-11 00:04:40.000000000 +0100
+++ new/wptools-0.4.8/HISTORY.rst       2018-01-19 22:27:38.000000000 +0100
@@ -3,9 +3,11 @@
 Release History
 ---------------
 
-0.4.7 (2018-01-10)
+0.4.8 (2018-01-19)
 ++++++++++++++++++
 
+* Added image (license, assessment) metadata (#104, #105)
+* Fixed Wikidata pageid, image bugs (#101, #102)
 * Added support for category continuations, subcategories (#99)
 * Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
 * Merged @seansay fix for deleted Wikidata item (#97)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/PKG-INFO new/wptools-0.4.8/PKG-INFO
--- old/wptools-0.4.7/PKG-INFO  2018-01-11 00:11:01.000000000 +0100
+++ new/wptools-0.4.8/PKG-INFO  2018-01-19 22:32:57.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: wptools
-Version: 0.4.7
+Version: 0.4.8
 Summary: Wikipedia tools (for Humans)
 Home-page: https://github.com/siznax/wptools/
 Author: Steve @siznax
@@ -139,9 +139,11 @@
         Release History
         ---------------
         
-        0.4.7 (2018-01-10)
+        0.4.8 (2018-01-19)
         ++++++++++++++++++
         
+        * Added image (license, assessment) metadata (#104, #105)
+        * Fixed Wikidata pageid, image bugs (#101, #102)
         * Added support for category continuations, subcategories (#99)
         * Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
         * Merged @seansay fix for deleted Wikidata item (#97)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/setup.py new/wptools-0.4.8/setup.py
--- old/wptools-0.4.7/setup.py  2018-01-11 00:05:17.000000000 +0100
+++ new/wptools-0.4.8/setup.py  2018-01-19 22:28:53.000000000 +0100
@@ -10,7 +10,7 @@
 
 setup(
     name='wptools',
-    version='0.4.7',
+    version='0.4.8',
     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.7/wptools/__init__.py 
new/wptools-0.4.8/wptools/__init__.py
--- old/wptools-0.4.7/wptools/__init__.py       2018-01-11 00:05:32.000000000 
+0100
+++ new/wptools-0.4.8/wptools/__init__.py       2018-01-19 22:29:05.000000000 
+0100
@@ -18,7 +18,7 @@
 __contact__ = "https://github.com/siznax/wptools";
 __license__ = "MIT"
 __title__ = "wptools"
-__version__ = "0.4.7"
+__version__ = "0.4.8"
 
 from . import core
 from . import query
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/wptools/core.py 
new/wptools-0.4.8/wptools/core.py
--- old/wptools-0.4.7/wptools/core.py   2018-01-10 22:33:40.000000000 +0100
+++ new/wptools-0.4.8/wptools/core.py   2018-01-12 20:54:36.000000000 +0100
@@ -223,7 +223,7 @@
                 value = ', '.join(value.keys())
             elif isinstance(value, int):
                 prefix = "%s:" % prefix
-                if prefix != 'pageid:':
+                if 'pageid' not in prefix:
                     value = "{:,}".format(value)
             elif isinstance(value, list):
                 prefix = "%s: <list(%d)>" % (prefix, len(value))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/wptools/page.py 
new/wptools-0.4.8/wptools/page.py
--- old/wptools-0.4.7/wptools/page.py   2017-12-13 23:35:18.000000000 +0100
+++ new/wptools-0.4.8/wptools/page.py   2018-01-19 18:53:17.000000000 +0100
@@ -76,15 +76,18 @@
         else:
             self.show()
 
-    def __update_imagedata(self, title, _from, info):
+    def __insert_image_info(self, title, _from, info):
         """
-        Update page images with get_imageinfo() data
+        Insert API image INFO into matching image dict
 
-        We make one imageinfo request containing only unique
-        image['file'] names. We match the API response data to an
-        image['file'] by API title/file match or API
-        normalized["from"]/file match. So, some imageinfo data will be
-        applied to more than one image['kind'].
+        We make one imageinfo request containing only unique image
+        filenames. We reduce duplication by asking for image data per
+        file, instead of per "kind" or source (Wikipedia, Wikidata,
+        etc.), because some sources reference the same image file. We
+        match API imageinfo response data to existing image filenames
+        by API title or normalized "from" title. So, some imageinfo
+        data will be applied to more than one image "kind" (source) if
+        they share the same filename.
         """
         for img in self.data['image']:
             if 'url' not in img:
@@ -93,6 +96,28 @@
                 elif _from == img['file']:  # matching from/file
                     img.update(info)
 
+    def __pull_image_info(self, title, imageinfo, normalized):
+        """
+        Pull image INFO from API response and insert
+        """
+        for info in imageinfo:
+            info.update({'title': title})
+
+            # get API normalized "from" filename for matching
+            _from = None
+            for norm in normalized:
+                if title == norm['to']:
+                    _from = norm['from']
+
+            # let's put all "metadata" in one member
+            info['metadata'] = {}
+            extmetadata = info.get('extmetadata')
+            if extmetadata:
+                info['metadata'].update(extmetadata)
+                del info['extmetadata']
+
+            self.__insert_image_info(title, _from, info)
+
     def _missing_imageinfo(self):
         """
         returns list of image filenames that are missing info
@@ -189,14 +214,9 @@
 
         for page in pages:
             title = page.get('title')
-            if page.get('imageinfo'):
-                for info in page['imageinfo']:
-                    info.update({'title': title})
-                    _from = None  # normalized filename
-                    for norm in normalized:
-                        if title == norm['to']:
-                            _from = norm['from']
-                    self.__update_imagedata(title, _from, info)
+            imageinfo = page.get('imageinfo')
+            if imageinfo:
+                self.__pull_image_info(title, imageinfo, normalized)
 
         # Mark missing imageinfo to prevent duplicate requests
         for img in self.data['image']:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/wptools/query.py 
new/wptools-0.4.8/wptools/query.py
--- old/wptools-0.4.7/wptools/query.py  2017-12-13 23:35:18.000000000 +0100
+++ new/wptools-0.4.8/wptools/query.py  2018-01-19 18:53:17.000000000 +0100
@@ -37,7 +37,7 @@
         "${WIKI}/w/api.php?action=query"
         "&format=json"
         "&formatversion=2"
-        "&iiprop=size|url|timestamp"
+        "&iiprop=size|url|timestamp|extmetadata"
         "&prop=imageinfo"
         "&titles=${FILES}"))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/wptools/wikidata.py 
new/wptools-0.4.8/wptools/wikidata.py
--- old/wptools-0.4.7/wptools/wikidata.py       2018-01-09 23:51:27.000000000 
+0100
+++ new/wptools-0.4.8/wptools/wikidata.py       2018-01-12 21:22:34.000000000 
+0100
@@ -163,7 +163,7 @@
         entities = data.get('entities')
         item = entities.get(next(iter(entities)))
 
-        self.data['pageid'] = item.get('pageid')
+        self.data['wikidata_pageid'] = item.get('pageid')
 
         aliases = item.get('aliases')
         if aliases:
@@ -191,7 +191,7 @@
         """
         add images from Wikidata
         """
-        wd_images = self.data['wikidata'].get('image (P18)')
+        wd_images = self.data['claims'].get('P18')  # image
 
         if wd_images:
             if not isinstance(wd_images, list):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/wptools-0.4.7/wptools.egg-info/PKG-INFO 
new/wptools-0.4.8/wptools.egg-info/PKG-INFO
--- old/wptools-0.4.7/wptools.egg-info/PKG-INFO 2018-01-11 00:11:01.000000000 
+0100
+++ new/wptools-0.4.8/wptools.egg-info/PKG-INFO 2018-01-19 22:32:57.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: wptools
-Version: 0.4.7
+Version: 0.4.8
 Summary: Wikipedia tools (for Humans)
 Home-page: https://github.com/siznax/wptools/
 Author: Steve @siznax
@@ -139,9 +139,11 @@
         Release History
         ---------------
         
-        0.4.7 (2018-01-10)
+        0.4.8 (2018-01-19)
         ++++++++++++++++++
         
+        * Added image (license, assessment) metadata (#104, #105)
+        * Fixed Wikidata pageid, image bugs (#101, #102)
         * Added support for category continuations, subcategories (#99)
         * Merged @RobbieClarken fix for non-value Wikidata snaktypes (#98)
         * Merged @seansay fix for deleted Wikidata item (#97)


Reply via email to