[PATCH]multiple: use absolute_import , print_function
roby roby
robert.stanca7 at gmail.com
Fri Mar 25 05:38:18 UTC 2016
# HG changeset patch
# User Robert Stanca <robert.stanca7 at gmail.com>
# Date 1458883639 -7200
# Fri Mar 25 07:27:19 2016 +0200
# Node ID 537c362a11af6ddaf33299c0585e94a0235ac6bb
# Parent b4ded5849c3e6a571a1a5aa47f93f9f78e424f6d
multiple: use absolute_import , print_function
diff -r b4ded5849c3e -r 537c362a11af tests/filterpyflakes.py
--- a/tests/filterpyflakes.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/filterpyflakes.py Fri Mar 25 07:27:19 2016 +0200
@@ -2,7 +2,7 @@
# Filter output by pyflakes to control which warnings we check
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import re
import sys
@@ -54,8 +54,8 @@
for msgtype, line in sorted(lines, key=makekey):
sys.stdout.write(line)
-print
+print()
# self test of "undefined name" detection for other than 'memoryview'
if False:
- print undefinedname
+ print (undefinedname)
diff -r b4ded5849c3e -r 537c362a11af tests/generate-working-copy-states.py
--- a/tests/generate-working-copy-states.py Fri Mar 25 07:08:34 2016
+0200
+++ b/tests/generate-working-copy-states.py Fri Mar 25 07:27:19 2016
+0200
@@ -29,7 +29,7 @@
# $ hg forget *_*_*-untracked
# $ rm *_*_missing-*
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import os
import sys
@@ -66,7 +66,7 @@
content = []
for filename, states in combinations:
if target == 'filelist':
- print filename
+ print (filename)
elif target == 'state':
if depth == 'wc':
# Make sure there is content so the file gets written and can
be
@@ -75,7 +75,7 @@
else:
content.append((filename, states[int(depth) - 1]))
else:
- print >> sys.stderr, "unknown target:", target
+ print ("unknown target:", target, file=stderr)
sys.exit(1)
# write actual content
diff -r b4ded5849c3e -r 537c362a11af tests/get-with-headers.py
--- a/tests/get-with-headers.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/get-with-headers.py Fri Mar 25 07:27:19 2016 +0200
@@ -3,7 +3,7 @@
"""This does HTTP GET requests given a host:port and path and returns
a subset of the headers plus the body of the result."""
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import httplib
import json
@@ -41,15 +41,15 @@
conn = httplib.HTTPConnection(host)
conn.request("GET", '/' + path, None, headers)
response = conn.getresponse()
- print response.status, response.reason
+ print (response.status, response.reason)
if show[:1] == ['-']:
show = sorted(h for h, v in response.getheaders()
if h.lower() not in show)
for h in [h.lower() for h in show]:
if response.getheader(h, None) is not None:
- print "%s: %s" % (h, response.getheader(h))
+ print ("%s: %s" % (h, response.getheader(h)))
if not headeronly:
- print
+ print()
data = response.read()
# Pretty print JSON. This also has the beneficial side-effect
@@ -60,7 +60,7 @@
data = json.loads(data)
lines = json.dumps(data, sort_keys=True, indent=2).splitlines()
for line in lines:
- print line.rstrip()
+ print (line.rstrip())
else:
sys.stdout.write(data)
diff -r b4ded5849c3e -r 537c362a11af tests/heredoctest.py
--- a/tests/heredoctest.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/heredoctest.py Fri Mar 25 07:27:19 2016 +0200
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, print_function
import sys
diff -r b4ded5849c3e -r 537c362a11af tests/hypothesishelpers.py
--- a/tests/hypothesishelpers.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/hypothesishelpers.py Fri Mar 25 07:27:19 2016 +0200
@@ -4,6 +4,7 @@
#
# For details see http://hypothesis.readthedocs.org
+from __future__ import absolute_import, print_function
import os
import sys
import traceback
diff -r b4ded5849c3e -r 537c362a11af tests/silenttestrunner.py
--- a/tests/silenttestrunner.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/silenttestrunner.py Fri Mar 25 07:27:19 2016 +0200
@@ -1,4 +1,8 @@
-import unittest, sys, os
+from __future__ import absolute_import, print_function
+
+import unittest
+import sys
+import os
def main(modulename):
'''run the tests found in module, printing nothing when all tests
pass'''
@@ -8,12 +12,12 @@
suite.run(results)
if results.errors or results.failures:
for tc, exc in results.errors:
- print 'ERROR:', tc
- print
+ print ('ERROR:', tc)
+ print()
sys.stdout.write(exc)
for tc, exc in results.failures:
- print 'FAIL:', tc
- print
+ print ('FAIL:', tc)
+ print()
sys.stdout.write(exc)
sys.exit(1)
diff -r b4ded5849c3e -r 537c362a11af tests/test-bdiff.py
--- a/tests/test-bdiff.py Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/test-bdiff.py Fri Mar 25 07:27:19 2016 +0200
@@ -1,5 +1,9 @@
+from __future__ import absolute_import, print_function
import struct
-from mercurial import bdiff, mpatch
+from mercurial import (
+ bdiff,
+ mpatch,
+)
def test1(a, b):
d = bdiff.bdiff(a, b)
@@ -7,13 +11,13 @@
if d:
c = mpatch.patches(a, [d])
if c != b:
- print "***", repr(a), repr(b)
- print "bad:"
- print repr(c)[:200]
- print repr(d)
+ print ("***", repr(a), repr(b))
+ print ("bad:")
+ print (repr(c)[:200])
+ print (repr(d))
def test(a, b):
- print "***", repr(a), repr(b)
+ print ("***", repr(a), repr(b))
test1(a, b)
test1(b, a)
@@ -44,23 +48,23 @@
while pos < len(bin):
p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
pos += 12
- print p1, p2, repr(bin[pos:pos + l])
+ print (p1, p2, repr(bin[pos:pos + l]))
pos += l
showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")
showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n")
-print "done"
+print ("done")
def testfixws(a, b, allws):
c = bdiff.fixws(a, allws)
if c != b:
- print "*** fixws", repr(a), repr(b), allws
- print "got:"
- print repr(c)
+ print ("*** fixws", repr(a), repr(b), allws)
+ print ("got:")
+ print (repr(c))
testfixws(" \ta\r b\t\n", "ab\n", 1)
testfixws(" \ta\r b\t\n", " a b\n", 0)
testfixws("", "", 1)
testfixws("", "", 0)
-print "done"
+print ("done")
diff -r b4ded5849c3e -r 537c362a11af tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t Fri Mar 25 07:08:34 2016 +0200
+++ b/tests/test-check-py3-compat.t Fri Mar 25 07:27:19 2016 +0200
@@ -42,28 +42,18 @@
i18n/check-translation.py not using absolute_import
i18n/polib.py not using absolute_import
setup.py not using absolute_import
- tests/filterpyflakes.py requires print_function
- tests/generate-working-copy-states.py requires print_function
- tests/get-with-headers.py requires print_function
- tests/heredoctest.py requires print_function
- tests/hypothesishelpers.py not using absolute_import
- tests/hypothesishelpers.py requires print_function
tests/killdaemons.py not using absolute_import
tests/md5sum.py not using absolute_import
tests/mockblackbox.py not using absolute_import
tests/printenv.py not using absolute_import
tests/revlog-formatv0.py not using absolute_import
tests/run-tests.py not using absolute_import
- tests/silenttestrunner.py not using absolute_import
- tests/silenttestrunner.py requires print_function
tests/sitecustomize.py not using absolute_import
tests/svn-safe-append.py not using absolute_import
tests/svnxml.py not using absolute_import
tests/test-atomictempfile.py not using absolute_import
tests/test-batching.py not using absolute_import
tests/test-batching.py requires print_function
- tests/test-bdiff.py not using absolute_import
- tests/test-bdiff.py requires print_function
tests/test-context.py not using absolute_import
tests/test-context.py requires print_function
tests/test-demandimport.py not using absolute_import
these patches are exported from a revision with previos patches posted
here, hope it's not o problem to merge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160325/cbf7e7f5/attachment.html>
More information about the Mercurial-devel
mailing list