zeroconf: use absolute_import
authortimeless <timeless@mozdev.org>
Tue, 01 Mar 2016 08:42:46 +0000
changeset 28296 a73394e7b47c
parent 28295 01815c159856
child 28297 f6d07520c665
zeroconf: use absolute_import
hgext/zeroconf/Zeroconf.py
hgext/zeroconf/__init__.py
tests/test-check-py3-compat.t
--- a/hgext/zeroconf/Zeroconf.py	Tue Mar 01 07:17:32 2016 +0000
+++ b/hgext/zeroconf/Zeroconf.py	Tue Mar 01 08:42:46 2016 +0000
@@ -1,4 +1,4 @@
-from __future__ import print_function
+from __future__ import absolute_import, print_function
 
 """ Multicast DNS Service Discovery for Python, v0.12
     Copyright (C) 2003, Paul Scott-Murphy
@@ -80,12 +80,12 @@
 __email__ = "paul at scott dash murphy dot com"
 __version__ = "0.12"
 
+import select
+import socket
 import string
-import time
 import struct
-import socket
 import threading
-import select
+import time
 import traceback
 
 __all__ = ["Zeroconf", "ServiceInfo", "ServiceBrowser"]
@@ -763,8 +763,8 @@
 			self.finished = 1
 			for question in self.questions:
 				self.writeQuestion(question)
-			for answer, time in self.answers:
-				self.writeRecord(answer, time)
+			for answer, time_ in self.answers:
+				self.writeRecord(answer, time_)
 			for authority in self.authorities:
 				self.writeRecord(authority, 0)
 			for additional in self.additionals:
@@ -868,9 +868,9 @@
 			else:
 				try:
 					rr, wr, er = select.select(rs, [], [], self.timeout)
-					for socket in rr:
+					for sock in rr:
 						try:
-							self.readers[socket].handle_read()
+							self.readers[sock].handle_read()
 						except Exception:
 							if not globals()['_GLOBAL_DONE']:
 								traceback.print_exc()
--- a/hgext/zeroconf/__init__.py	Tue Mar 01 07:17:32 2016 +0000
+++ b/hgext/zeroconf/__init__.py	Tue Mar 01 08:42:46 2016 +0000
@@ -4,7 +4,6 @@
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
-
 '''discover and advertise repositories on the local network
 
 Zeroconf-enabled repositories will be announced in a network without
@@ -23,13 +22,23 @@
   $ hg paths
   zc-test = http://example.com:8000/test
 '''
+from __future__ import absolute_import
 
-import socket, time, os
+import os
+import socket
+import time
 
-import Zeroconf
-from mercurial import ui, hg, encoding, dispatch
-from mercurial import extensions
-from mercurial.hgweb import server as servermod
+from . import Zeroconf
+from mercurial import (
+    dispatch,
+    encoding,
+    extensions,
+    hg,
+    ui,
+)
+from mercurial.hgweb import (
+    server as servermod
+)
 
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
--- a/tests/test-check-py3-compat.t	Tue Mar 01 07:17:32 2016 +0000
+++ b/tests/test-check-py3-compat.t	Tue Mar 01 08:42:46 2016 +0000
@@ -86,8 +86,6 @@
   hgext/transplant.py not using absolute_import
   hgext/win32mbcs.py not using absolute_import
   hgext/win32text.py not using absolute_import
-  hgext/zeroconf/Zeroconf.py not using absolute_import
-  hgext/zeroconf/__init__.py not using absolute_import
   i18n/check-translation.py not using absolute_import
   i18n/polib.py not using absolute_import
   mercurial/cmdutil.py not using absolute_import