jenkins-bot has submitted this change and it was merged.

Change subject: use point-in-time instead of retrieved
......................................................................


use point-in-time instead of retrieved

As discussed at https://www.wikidata.org/wiki/Property_talk:P813 the
retrieved property is not to be used as a qualifier.

Change-Id: Icc005484441aaef50e0233f46c1f6d2d237db0ee
Signed-off-by: Loic Dachary <l...@dachary.org>
---
M FLOSSbot/bot.py
M FLOSSbot/repository.py
M tests/test_bot.py
3 files changed, 18 insertions(+), 18 deletions(-)

Approvals:
  Dachary: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/FLOSSbot/bot.py b/FLOSSbot/bot.py
index 66eff53..a2509e3 100644
--- a/FLOSSbot/bot.py
+++ b/FLOSSbot/bot.py
@@ -202,8 +202,8 @@
 
     def need_verification(self, claim):
         now = datetime.utcnow()
-        if self.P_retrieved in claim.qualifiers:
-            previous = claim.qualifiers[self.P_retrieved][0]
+        if self.P_point_in_time in claim.qualifiers:
+            previous = claim.qualifiers[self.P_point_in_time][0]
             previous = previous.getTarget()
             previous = datetime(year=previous.year,
                                 month=previous.month,
@@ -213,19 +213,19 @@
         else:
             return True
 
-    def set_retrieved(self, item, claim, now=datetime.utcnow()):
+    def set_point_in_time(self, item, claim, now=datetime.utcnow()):
         when = pywikibot.WbTime(now.year, now.month, now.day)
-        if self.P_retrieved in claim.qualifiers:
-            self.debug(item, "updating retrieved")
-            retrieved = claim.qualifiers[self.P_retrieved][0]
-            retrieved.setTarget(when)
+        if self.P_point_in_time in claim.qualifiers:
+            self.debug(item, "updating point-in-time")
+            point_in_time = claim.qualifiers[self.P_point_in_time][0]
+            point_in_time.setTarget(when)
             if not self.args.dry_run:
                 self.site.save_claim(claim)
         else:
-            self.debug(item, "setting retrieved")
-            retrieved = pywikibot.Claim(self.site,
-                                        self.P_retrieved,
-                                        isQualifier=True)
-            retrieved.setTarget(when)
+            self.debug(item, "setting point-in-time")
+            point_in_time = pywikibot.Claim(self.site,
+                                            self.P_point_in_time,
+                                            isQualifier=True)
+            point_in_time.setTarget(when)
             if not self.args.dry_run:
-                claim.addQualifier(retrieved, bot=True)
+                claim.addQualifier(point_in_time, bot=True)
diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 5d4d9d0..5755c48 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -226,7 +226,7 @@
             if self.verify_protocol(url, protocol, credentials):
                 self.info(item, "VERIFIED " + url)
                 status[url] = 'verified'
-                self.set_retrieved(item, claim)
+                self.set_point_in_time(item, claim)
             else:
                 self.error(item, "VERIFY FAIL " + url)
                 status[url] = 'fail'
@@ -311,7 +311,7 @@
             protocol.setTarget(target_protocol)
             if not self.args.dry_run:
                 claim.addQualifier(protocol, bot=True)
-                self.set_retrieved(item, claim)
+                self.set_point_in_time(item, claim)
             self.info(item, "SET protocol of " + claim.getTarget())
 
     def guess_protocol_from_url(self, url):
diff --git a/tests/test_bot.py b/tests/test_bot.py
index d28537e..24fe02f 100644
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -88,7 +88,7 @@
             assert (datatype ==
                     wikidata_content[wikidata_property]['datatype']), attr
 
-    def test_set_retrieved(self):
+    def test_set_point_in_time(self):
         bot = Bot(argparse.Namespace(
             test=True,
             user='FLOSSbotCI',
@@ -101,9 +101,9 @@
                                 0)
         claim.setTarget("http://repo.com/some";)
         item.addClaim(claim)
-        bot.set_retrieved(item, claim)
+        bot.set_point_in_time(item, claim)
         assert bot.need_verification(claim) is False
-        bot.set_retrieved(item, claim, date(1965, 11, 2))
+        bot.set_point_in_time(item, claim, date(1965, 11, 2))
         assert bot.need_verification(claim) is True
         bot.clear_entity_label(item.getID())
 

-- 
To view, visit https://gerrit.wikimedia.org/r/311957
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icc005484441aaef50e0233f46c1f6d2d237db0ee
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary <l...@dachary.org>
Gerrit-Reviewer: Dachary <l...@dachary.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to