]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Pylint: examples: do py2/3 compatible prints
authorMartin <martin.basti@gmail.com>
Sat, 2 Jul 2016 01:28:47 +0000 (03:28 +0200)
committerMartin <martin.basti@gmail.com>
Sat, 2 Jul 2016 01:28:47 +0000 (03:28 +0200)
examples/e164.py
examples/mx.py
examples/name.py
examples/reverse.py
examples/reverse_name.py
examples/xfr.py
examples/zonediff.py

index ad40ccf84b5c439256b1b15406b3ebc92c14202d..dd56baf59510f388fdfbed135c9045a99b32e23f 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import dns.e164
 n = dns.e164.from_e164("+1 555 1212")
-print n
-print dns.e164.to_e164(n)
+print(n)
+print(dns.e164.to_e164(n))
index 3036e70ddf3ead96df677600e8c199232573b83a..99f494e0ba63d770ad42d52b143ac3949de70ce8 100755 (executable)
@@ -1,7 +1,9 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import dns.resolver
 
 answers = dns.resolver.query('nominum.com', 'MX')
 for rdata in answers:
-    print 'Host', rdata.exchange, 'has preference', rdata.preference
+    print('Host', rdata.exchange, 'has preference', rdata.preference)
index b099c49d16675abdbb27e9fe635cc8cab6b422d9..7bb0c0106607001252546bf38e1d3ad8fbe4b227 100755 (executable)
@@ -1,13 +1,15 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import dns.name
 
 n = dns.name.from_text('www.dnspython.org')
 o = dns.name.from_text('dnspython.org')
-print n.is_subdomain(o)         # True
-print n.is_superdomain(o)       # False
-print n > o                     # True
-rel = n.relativize(o)           # rel is the relative name www
+print(n.is_subdomain(o))         # True
+print(n.is_superdomain(o))       # False
+print(n > o)                     # True
+rel = n.relativize(o)            # rel is the relative name www
 n2 = rel + o
-print n2 == n                   # True
-print n.labels                  # ['www', 'dnspython', 'org', '']
+print(n2 == n)                   # True
+print(n.labels)                  # ['www', 'dnspython', 'org', '']
index 9de5a30be8203197219e5f8fe508e919975d207e..431831769eaefc1656e118fb6929e632f892931e 100755 (executable)
@@ -16,6 +16,8 @@
 # If this weren't a demo script, there'd be a way of specifying the
 # origin for each zone instead of constructing it from the filename.
 
+from __future__ import print_function
+
 import dns.zone
 import dns.ipv4
 import os.path
@@ -37,4 +39,4 @@ keys.sort(lambda a1, a2: cmp(dns.ipv4.inet_aton(a1), dns.ipv4.inet_aton(a2)))
 for k in keys:
     v = reverse_map[k]
     v.sort()
-    print k, v
+    print(k, v)
index 351896b01563dd8abd5e834a5d55f01e2c0b7e90..f2540a14ec7e8eb3ce36e29705e68b15af217c72 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import dns.reversename
 n = dns.reversename.from_address("127.0.0.1")
-print n
-print dns.reversename.to_address(n)
+print(n)
+print(dns.reversename.to_address(n))
index e67ab189273df79a47863e273530a0288e3c2e9d..a7c2bb95b4b7864ce96c90f0578d9c6378b3d787 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+from __future__ import print_function
+
 import dns.query
 import dns.resolver
 import dns.zone
@@ -11,4 +13,4 @@ z = dns.zone.from_xfr(dns.query.xfr(master_answer[0].address, 'dnspython.org'))
 names = z.nodes.keys()
 names.sort()
 for n in names:
-        print z[n].to_text(n)
+    print(z[n].to_text(n))
index 0c101781a3ec0c9732a835e511c7b1438fba6873..284101a508e7378a6ab78ee5ebfedcd6c6ba5e74 100755 (executable)
@@ -21,6 +21,8 @@
 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 """See diff_zones.__doc__ for more information"""
 
+from __future__ import print_function
+
 __all__ = ['diff_zones', 'format_changes_plain', 'format_changes_html']
 
 try:
@@ -264,7 +266,7 @@ The differences shown will be logical differences, not textual differences.
     if not changes:
         sys.exit(0)
     if opts.html:
-        print format_changes_html(oldn, newn, changes, opts.ignore_ttl)
+        print(format_changes_html(oldn, newn, changes, opts.ignore_ttl))
     else:
-        print format_changes_plain(oldn, newn, changes, opts.ignore_ttl)
+        print(format_changes_plain(oldn, newn, changes, opts.ignore_ttl))
     sys.exit(1)