jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/516602 )

Change subject: [PEP8] Re-arrange try/exception in SparqlQuery.query()
......................................................................

[PEP8] Re-arrange try/exception in SparqlQuery.query()

Change-Id: I5f4a07fa40cac0d305cd0eec9d6f6e1babed1dec
---
M pywikibot/data/sparql.py
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Matěj Suchánek: Looks good to me, but someone else must approve
  Dalba: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/data/sparql.py b/pywikibot/data/sparql.py
index 11df7c8..3ab573b 100644
--- a/pywikibot/data/sparql.py
+++ b/pywikibot/data/sparql.py
@@ -144,15 +144,15 @@
         while True:
             try:
                 self.last_response = http.fetch(url, headers=headers)
-                if not self.last_response.text:
-                    return None
-                try:
-                    return json.loads(self.last_response.text)
-                except ValueError:
-                    return None
             except Timeout:
                 self.wait()
                 continue
+            if not self.last_response.text:
+                return None
+            try:
+                return json.loads(self.last_response.text)
+            except ValueError:
+                return None

     def wait(self):
         """Determine how long to wait after a failed request."""

--
To view, visit https://gerrit.wikimedia.org/r/516602
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5f4a07fa40cac0d305cd0eec9d6f6e1babed1dec
Gerrit-Change-Number: 516602
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Dalba <[email protected]>
Gerrit-Reviewer: John Vandenberg <[email protected]>
Gerrit-Reviewer: Matěj Suchánek <[email protected]>
Gerrit-Reviewer: jenkins-bot (75)
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to