Dachary has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/314503

Change subject: repository: fixup protocol must ignore novalue / unknown
......................................................................

repository: fixup protocol must ignore novalue / unknown

Use the get_source_code_repository helper instead of looping over the
claims to discard the source code repositories that either have novalue
or unknown.

Change-Id: Ica5c4185abb5d15edb8571fdcb64cd4d90b07800
Signed-off-by: Loic Dachary <[email protected]>
---
M FLOSSbot/repository.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/FLOSSbot 
refs/changes/03/314503/1

diff --git a/FLOSSbot/repository.py b/FLOSSbot/repository.py
index 54a9364..9578e29 100644
--- a/FLOSSbot/repository.py
+++ b/FLOSSbot/repository.py
@@ -154,11 +154,12 @@
         if self.P_source_code_repository not in item.claims:
             return False
 
+        repositories = self.get_source_code_repositories(item)
         urls = []
-        for claim in item.claims[self.P_source_code_repository]:
+        for claim in repositories:
             urls.append(claim.getTarget())
 
-        for claim in item.claims[self.P_source_code_repository]:
+        for claim in repositories:
             url = claim.getTarget()
             extracted = self.extract_repository(url)
             if extracted and extracted not in urls:
@@ -177,10 +178,12 @@
                         claim.changeRank('preferred')
                     self.info(item, "PREFERRED set to " + url)
 
-        for claim in item.claims[self.P_source_code_repository]:
+        repositories = self.get_source_code_repositories(item)
+
+        for claim in repositories:
             self.fixup_url(claim)
 
-        for claim in item.claims[self.P_source_code_repository]:
+        for claim in repositories:
             if self.P_protocol in claim.qualifiers:
                 self.debug(item, "IGNORE " + claim.getTarget() +
                            " because it already has a protocol")

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica5c4185abb5d15edb8571fdcb64cd4d90b07800
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/FLOSSbot
Gerrit-Branch: master
Gerrit-Owner: Dachary <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to