Patchwork [2,of,8] zeroconf: use absolute_import

login
register
mail settings
Submitter timeless@mozdev.org
Date March 1, 2016, 10:39 a.m.
Message ID <60095e97bd8673ce6d6e.1456828744@waste.org>
Download mbox | patch
Permalink /patch/13489/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 1, 2016, 10:39 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1456821766 0
#      Tue Mar 01 08:42:46 2016 +0000
# Node ID 60095e97bd8673ce6d6e31bfd4a770915ab12fd6
# Parent  7cd59c489eb07dc9ff38a8ce237c77ddc611eb94
zeroconf: use absolute_import

Patch

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -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 struct
+import threading
 import time
-import struct
-import socket
-import threading
-import select
 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()
diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py
--- a/hgext/zeroconf/__init__.py
+++ b/hgext/zeroconf/__init__.py
@@ -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
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -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