summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMartin <martin.basti@gmail.com>2016-07-02 03:28:47 +0200
committerMartin <martin.basti@gmail.com>2016-07-02 03:28:47 +0200
commitb0f40d97f1d87cff92dc5072e8ac28895e5f17c4 (patch)
treee134d93e48c21a8cdf35d69809dd7690e77eadb6 /examples
parentff21c89d70b254027d647c4d8eb83cc1e3954c8b (diff)
downloaddnspython-b0f40d97f1d87cff92dc5072e8ac28895e5f17c4.tar.gz
Pylint: examples: do py2/3 compatible prints
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/e164.py6
-rwxr-xr-xexamples/mx.py4
-rwxr-xr-xexamples/name.py14
-rwxr-xr-xexamples/reverse.py4
-rwxr-xr-xexamples/reverse_name.py6
-rwxr-xr-xexamples/xfr.py4
-rwxr-xr-xexamples/zonediff.py6
7 files changed, 29 insertions, 15 deletions
diff --git a/examples/e164.py b/examples/e164.py
index ad40ccf..dd56baf 100755
--- a/examples/e164.py
+++ b/examples/e164.py
@@ -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))
diff --git a/examples/mx.py b/examples/mx.py
index 3036e70..99f494e 100755
--- a/examples/mx.py
+++ b/examples/mx.py
@@ -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)
diff --git a/examples/name.py b/examples/name.py
index b099c49..7bb0c01 100755
--- a/examples/name.py
+++ b/examples/name.py
@@ -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', '']
diff --git a/examples/reverse.py b/examples/reverse.py
index 9de5a30..4318317 100755
--- a/examples/reverse.py
+++ b/examples/reverse.py
@@ -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)
diff --git a/examples/reverse_name.py b/examples/reverse_name.py
index 351896b..f2540a1 100755
--- a/examples/reverse_name.py
+++ b/examples/reverse_name.py
@@ -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))
diff --git a/examples/xfr.py b/examples/xfr.py
index e67ab18..a7c2bb9 100755
--- a/examples/xfr.py
+++ b/examples/xfr.py
@@ -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))
diff --git a/examples/zonediff.py b/examples/zonediff.py
index 0c10178..284101a 100755
--- a/examples/zonediff.py
+++ b/examples/zonediff.py
@@ -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)