jenkins-bot has submitted this change and it was merged.
Change subject: flake8
......................................................................
flake8
- remove unused imports
- improve code example block so it is compilable
- reorder code in threadedhttp to avoid triggering a flake8 error
Change-Id: I352c5f32528f91b9a1ec4df1c929f32a3c621f30
---
M pywikibot/comms/http.py
M pywikibot/comms/threadedhttp.py
2 files changed, 9 insertions(+), 13 deletions(-)
Approvals:
John Vandenberg: Looks good to me, but someone else must approve
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index affc571..6912361 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -22,8 +22,6 @@
__docformat__ = 'epytext'
import sys
-import urllib
-import logging
import atexit
import time
diff --git a/pywikibot/comms/threadedhttp.py b/pywikibot/comms/threadedhttp.py
index 5dd0840..6cb44ea 100644
--- a/pywikibot/comms/threadedhttp.py
+++ b/pywikibot/comms/threadedhttp.py
@@ -9,9 +9,9 @@
"""
-# (C) 2007 Pywikibot team, 2007-2014
-# (C) 2006 Httplib 2 team, 2006
-# (C) 2007 Metaweb Technologies, Inc.
+# (C) Pywikibot team, 2007-2014
+# (C) Httplib 2 team, 2006
+# (C) Metaweb Technologies, Inc., 2007
#
# Partially distributed under the MIT license
# Partially distributed under Metaweb Technologies, Incs license
@@ -24,10 +24,6 @@
import sys
import re
import threading
-import time
-import logging
-
-import urllib
if sys.version_info[0] == 2:
import cookielib
@@ -118,14 +114,14 @@
if identifier not in self.connections:
self.connections[identifier] = []
- if len(self.connections[identifier]) == self.maxnum:
+ if len(self.connections[identifier]) != self.maxnum:
+ self.connections[identifier].append(connection)
+ else:
pywikibot.debug(u"closing %s connection %r"
% (identifier, connection),
_logger)
connection.close()
del connection
- else:
- self.connections[identifier].append(connection)
finally:
self.lock.release()
@@ -311,6 +307,8 @@
Usage:
+ >>> import Queue
+ >>> queue = Queue.Queue()
>> request =
HttpRequest('http://www.google.com')
>> queue.put(request)
>> request.lock.acquire()
@@ -455,7 +453,7 @@
def getheaders(self, k):
k = k.lower()
- v = self.response.get(k.lower(), None)
+ self.response.get(k.lower(), None)
if k not in self.response:
return []
#return self.response[k].split(re.compile(',\\s*'))
--
To view, visit
https://gerrit.wikimedia.org/r/114989
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I352c5f32528f91b9a1ec4df1c929f32a3c621f30
Gerrit-PatchSet: 6
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Mdupont <jamesmikedupont(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>