Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Reverting 'ext/' Directory Changes

Gormogon78d4ac34bff0
diff --git a/ext/adblockparser/parser.py b/ext/adblockparser/parser.py
index a796341e..5c9e1eeb 100644
--- a/ext/adblockparser/parser.py
+++ b/ext/adblockparser/parser.py
@@ -98,7 +98,7 @@ class AdblockRule(object):
else:
self.raw_options = []
self.options = {}
- self._options_keys = frozenset(self.options.keys()) - {'match-case'}
+ self._options_keys = frozenset(self.options.keys()) - set(['match-case'])
self.rule_text = rule_text
diff --git a/ext/dns/dnssec.py b/ext/dns/dnssec.py
index 4707f2d4..084f908d 100644
--- a/ext/dns/dnssec.py
+++ b/ext/dns/dnssec.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -104,7 +103,7 @@ def key_id(key, origin=None):
total += (ord(rdata[2 * i]) << 8) + ord(rdata[2 * i + 1])
if len(rdata) % 2 != 0:
total += ord(rdata[len(rdata) - 1]) << 8
- total += ((total >> 16) & 0xffff)
+ total += ((total >> 16) & 0xffff);
return total & 0xffff
def make_ds(name, key, algorithm, origin=None):
@@ -287,7 +286,7 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
rrnamebuf = rrname.to_digestable(origin)
rrfixed = struct.pack('!HHI', rdataset.rdtype, rdataset.rdclass,
rrsig.original_ttl)
- rrlist = sorted(rdataset)
+ rrlist = sorted(rdataset);
for rr in rrlist:
hash.update(rrnamebuf)
hash.update(rrfixed)
@@ -300,9 +299,9 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
if _is_rsa(rrsig.algorithm):
# PKCS1 algorithm identifier goop
- digest += _make_algorithm_id(rrsig.algorithm)
+ digest = _make_algorithm_id(rrsig.algorithm) + digest
padlen = keylen // 8 - len(digest) - 3
- digest += chr(0) + chr(1) + chr(0xFF) * padlen + chr(0)
+ digest = chr(0) + chr(1) + chr(0xFF) * padlen + chr(0) + digest
elif _is_dsa(rrsig.algorithm):
pass
else:
diff --git a/ext/dns/e164.py b/ext/dns/e164.py
index 42ea0152..68f0a316 100644
--- a/ext/dns/e164.py
+++ b/ext/dns/e164.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -59,7 +58,7 @@ def to_e164(name, origin=public_enum_domain, want_plus_prefix=True):
dlabels.reverse()
text = ''.join(dlabels)
if want_plus_prefix:
- text += '+'
+ text = '+' + text
return text
def query(number, domains, resolver=None):
diff --git a/ext/dns/edns.py b/ext/dns/edns.py
index 3d838093..e52b6df3 100644
--- a/ext/dns/edns.py
+++ b/ext/dns/edns.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/entropy.py b/ext/dns/entropy.py
index f7ea58e8..d380cf8c 100644
--- a/ext/dns/entropy.py
+++ b/ext/dns/entropy.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/exception.py b/ext/dns/exception.py
index 88dfaec2..db6ef6e6 100644
--- a/ext/dns/exception.py
+++ b/ext/dns/exception.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/flags.py b/ext/dns/flags.py
index e77e65c7..35a8305e 100644
--- a/ext/dns/flags.py
+++ b/ext/dns/flags.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/grange.py b/ext/dns/grange.py
index 741950a6..c0607d60 100644
--- a/ext/dns/grange.py
+++ b/ext/dns/grange.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -29,6 +28,7 @@ def from_text(text):
"""
# TODO, figure out the bounds on start, stop and step.
+ import pdb
step = 1
cur = ''
state = 0
diff --git a/ext/dns/hash.py b/ext/dns/hash.py
index 57012db2..0c708036 100644
--- a/ext/dns/hash.py
+++ b/ext/dns/hash.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/inet.py b/ext/dns/inet.py
index 44bc0081..3b7e88f7 100644
--- a/ext/dns/inet.py
+++ b/ext/dns/inet.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -99,7 +98,7 @@ def is_multicast(text):
"""
try:
first = ord(dns.ipv4.inet_aton(text)[0])
- return (224 <= first <= 239)
+ return (first >= 224 and first <= 239)
except:
try:
first = ord(dns.ipv6.inet_aton(text)[0])
diff --git a/ext/dns/ipv4.py b/ext/dns/ipv4.py
index 883243e9..85ab48f7 100644
--- a/ext/dns/ipv4.py
+++ b/ext/dns/ipv4.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/ipv6.py b/ext/dns/ipv6.py
index 6900ee5f..1ab00da9 100644
--- a/ext/dns/ipv6.py
+++ b/ext/dns/ipv6.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -149,7 +148,7 @@ def inet_aton(text):
if lc > 4:
raise dns.exception.SyntaxError
if lc != 4:
- c += ('0' * (4 - lc))
+ c = ('0' * (4 - lc)) + c
canonical.append(c)
if l < 8 and not seen_empty:
raise dns.exception.SyntaxError
diff --git a/ext/dns/message.py b/ext/dns/message.py
index 9be37d62..52c0eaea 100644
--- a/ext/dns/message.py
+++ b/ext/dns/message.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -17,6 +16,7 @@
"""DNS Messages"""
import cStringIO
+import random
import struct
import sys
import time
@@ -606,7 +606,7 @@ class _WireReader(object):
(rdtype, rdclass) = \
struct.unpack('!HH',
self.wire[self.current:self.current + 4])
- self.current += 4
+ self.current = self.current + 4
self.message.find_rrset(self.message.question, qname,
rdclass, rdtype, create=True,
force_unique=True)
@@ -636,7 +636,7 @@ class _WireReader(object):
(rdtype, rdclass, ttl, rdlen) = \
struct.unpack('!HHIH',
self.wire[self.current:self.current + 10])
- self.current += 10
+ self.current = self.current + 10
if rdtype == dns.rdatatype.OPT:
if not section is self.message.additional or seen_opt:
raise BadEDNS
@@ -650,7 +650,7 @@ class _WireReader(object):
(otype, olen) = \
struct.unpack('!HH',
self.wire[current:current + 4])
- current += 4
+ current = current + 4
opt = dns.edns.option_from_wire(otype, self.wire, current, olen)
self.message.options.append(opt)
current = current + olen
@@ -831,7 +831,8 @@ class _TextReader(object):
self.updating = True
elif what == 'edns':
self.message.edns = self.tok.get_int()
- self.message.ednsflags |= self.message.edns << 16
+ self.message.ednsflags = self.message.ednsflags | \
+ (self.message.edns << 16)
elif what == 'eflags':
if self.message.edns < 0:
self.message.edns = 0
diff --git a/ext/dns/name.py b/ext/dns/name.py
index 7bb1835f..293ab951 100644
--- a/ext/dns/name.py
+++ b/ext/dns/name.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -96,7 +95,7 @@ def _escapify(label):
for c in label:
if c in _escaped:
text += '\\' + c
- elif 0x20 < ord(c) < 0x7F:
+ elif ord(c) > 0x20 and ord(c) < 0x7F:
text += c
else:
text += '\\%03d' % ord(c)
diff --git a/ext/dns/namedict.py b/ext/dns/namedict.py
index 3f7f40ab..9f5a0efb 100644
--- a/ext/dns/namedict.py
+++ b/ext/dns/namedict.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/node.py b/ext/dns/node.py
index d2d26ff5..e74004f6 100644
--- a/ext/dns/node.py
+++ b/ext/dns/node.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -36,7 +35,7 @@ class Node(object):
"""Initialize a DNS node.
"""
- self.rdatasets = []
+ self.rdatasets = [];
def to_text(self, name, **kw):
"""Convert a node to text format.
diff --git a/ext/dns/opcode.py b/ext/dns/opcode.py
index 3e484f4e..3258c34c 100644
--- a/ext/dns/opcode.py
+++ b/ext/dns/opcode.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -54,7 +53,7 @@ def from_text(text):
if text.isdigit():
value = int(text)
- if 0 <= value <= 15:
+ if value >= 0 and value <= 15:
return value
value = _by_text.get(text.upper())
if value is None:
diff --git a/ext/dns/query.py b/ext/dns/query.py
index 5159dd68..7a1b1f49 100644
--- a/ext/dns/query.py
+++ b/ext/dns/query.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -245,7 +244,7 @@ def _net_read(sock, count, expiration):
n = sock.recv(count)
if n == '':
raise EOFError
- count -= len(n)
+ count = count - len(n)
s = s + n
return s
diff --git a/ext/dns/rcode.py b/ext/dns/rcode.py
index 1d1c951e..7807782a 100644
--- a/ext/dns/rcode.py
+++ b/ext/dns/rcode.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -68,7 +67,7 @@ def from_text(text):
if text.isdigit():
v = int(text)
- if 0 <= v <= 4095:
+ if v >= 0 and v <= 4095:
return v
v = _by_text.get(text.upper())
if v is None:
diff --git a/ext/dns/rdata.py b/ext/dns/rdata.py
index 625305fa..350bf790 100644
--- a/ext/dns/rdata.py
+++ b/ext/dns/rdata.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -105,7 +104,7 @@ def _escapify(qstring):
for c in qstring:
if c in __escaped:
text += '\\' + c
- elif 0x20 <= ord(c) < 0x7F:
+ elif ord(c) >= 0x20 and ord(c) < 0x7F:
text += c
else:
text += '\\%03d' % ord(c)
diff --git a/ext/dns/rdataclass.py b/ext/dns/rdataclass.py
index ded78efb..7601e70c 100644
--- a/ext/dns/rdataclass.py
+++ b/ext/dns/rdataclass.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -64,7 +63,7 @@ _metaclasses = {
ANY : True
}
-_unknown_class_pattern = re.compile('CLASS([0-9]+)$', re.I)
+_unknown_class_pattern = re.compile('CLASS([0-9]+)$', re.I);
class UnknownRdataclass(dns.exception.DNSException):
"""Raised when a class is unknown."""
@@ -82,7 +81,7 @@ def from_text(text):
value = _by_text.get(text.upper())
if value is None:
match = _unknown_class_pattern.match(text)
- if match is None:
+ if match == None:
raise UnknownRdataclass
value = int(match.group(1))
if value < 0 or value > 65535:
diff --git a/ext/dns/rdataset.py b/ext/dns/rdataset.py
index aaa4beb9..dcd2b401 100644
--- a/ext/dns/rdataset.py
+++ b/ext/dns/rdataset.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdatatype.py b/ext/dns/rdatatype.py
index 6b27546c..f64307a7 100644
--- a/ext/dns/rdatatype.py
+++ b/ext/dns/rdatatype.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -176,7 +175,7 @@ _singletons = {
# CNAME is technically a singleton, but we allow multiple CNAMEs.
}
-_unknown_type_pattern = re.compile('TYPE([0-9]+)$', re.I)
+_unknown_type_pattern = re.compile('TYPE([0-9]+)$', re.I);
class UnknownRdatatype(dns.exception.DNSException):
"""Raised if a type is unknown."""
@@ -193,7 +192,7 @@ def from_text(text):
value = _by_text.get(text.upper())
if value is None:
match = _unknown_type_pattern.match(text)
- if match is None:
+ if match == None:
raise UnknownRdatatype
value = int(match.group(1))
if value < 0 or value > 65535:
@@ -220,7 +219,7 @@ def is_metatype(rdtype):
@type rdtype: int
@rtype: bool"""
- if TKEY <= rdtype <= ANY or _metatypes.has_key(rdtype):
+ if rdtype >= TKEY and rdtype <= ANY or _metatypes.has_key(rdtype):
return True
return False
diff --git a/ext/dns/rdtypes/ANY/AFSDB.py b/ext/dns/rdtypes/ANY/AFSDB.py
index 2dd3aeed..c729789a 100644
--- a/ext/dns/rdtypes/ANY/AFSDB.py
+++ b/ext/dns/rdtypes/ANY/AFSDB.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/CERT.py b/ext/dns/rdtypes/ANY/CERT.py
index f452f981..c102521a 100644
--- a/ext/dns/rdtypes/ANY/CERT.py
+++ b/ext/dns/rdtypes/ANY/CERT.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/CNAME.py b/ext/dns/rdtypes/ANY/CNAME.py
index 06a339ba..fb8e9be4 100644
--- a/ext/dns/rdtypes/ANY/CNAME.py
+++ b/ext/dns/rdtypes/ANY/CNAME.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/DLV.py b/ext/dns/rdtypes/ANY/DLV.py
index 9ca267df..8bd79793 100644
--- a/ext/dns/rdtypes/ANY/DLV.py
+++ b/ext/dns/rdtypes/ANY/DLV.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/DNAME.py b/ext/dns/rdtypes/ANY/DNAME.py
index de63483d..d8640011 100644
--- a/ext/dns/rdtypes/ANY/DNAME.py
+++ b/ext/dns/rdtypes/ANY/DNAME.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/DNSKEY.py b/ext/dns/rdtypes/ANY/DNSKEY.py
index 943dd890..1d678d2f 100644
--- a/ext/dns/rdtypes/ANY/DNSKEY.py
+++ b/ext/dns/rdtypes/ANY/DNSKEY.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/DS.py b/ext/dns/rdtypes/ANY/DS.py
index 41d56f52..56b6332d 100644
--- a/ext/dns/rdtypes/ANY/DS.py
+++ b/ext/dns/rdtypes/ANY/DS.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/GPOS.py b/ext/dns/rdtypes/ANY/GPOS.py
index 02f3b53f..38d1d88b 100644
--- a/ext/dns/rdtypes/ANY/GPOS.py
+++ b/ext/dns/rdtypes/ANY/GPOS.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/HINFO.py b/ext/dns/rdtypes/ANY/HINFO.py
index c8795f4a..15fd54e6 100644
--- a/ext/dns/rdtypes/ANY/HINFO.py
+++ b/ext/dns/rdtypes/ANY/HINFO.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/HIP.py b/ext/dns/rdtypes/ANY/HIP.py
index 2e143247..968b36f5 100644
--- a/ext/dns/rdtypes/ANY/HIP.py
+++ b/ext/dns/rdtypes/ANY/HIP.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -15,6 +14,7 @@
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import cStringIO
+import string
import struct
import dns.exception
diff --git a/ext/dns/rdtypes/ANY/ISDN.py b/ext/dns/rdtypes/ANY/ISDN.py
index b5366333..0c2d3cd0 100644
--- a/ext/dns/rdtypes/ANY/ISDN.py
+++ b/ext/dns/rdtypes/ANY/ISDN.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/LOC.py b/ext/dns/rdtypes/ANY/LOC.py
index 27379eb3..154546d7 100644
--- a/ext/dns/rdtypes/ANY/LOC.py
+++ b/ext/dns/rdtypes/ANY/LOC.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
@@ -62,7 +61,7 @@ def _tuple_to_float(what):
return sign * value
def _encode_size(what, desc):
- what = long(what)
+ what = long(what);
exponent = _exponent_of(what, desc) & 0xF
base = what // pow(10, exponent) & 0xF
return base * 16 + exponent
diff --git a/ext/dns/rdtypes/ANY/MX.py b/ext/dns/rdtypes/ANY/MX.py
index 1f173633..92f41532 100644
--- a/ext/dns/rdtypes/ANY/MX.py
+++ b/ext/dns/rdtypes/ANY/MX.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/NS.py b/ext/dns/rdtypes/ANY/NS.py
index 2f2acf5d..6b45d4d4 100644
--- a/ext/dns/rdtypes/ANY/NS.py
+++ b/ext/dns/rdtypes/ANY/NS.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/NSEC.py b/ext/dns/rdtypes/ANY/NSEC.py
index bb422976..ad113a4b 100644
--- a/ext/dns/rdtypes/ANY/NSEC.py
+++ b/ext/dns/rdtypes/ANY/NSEC.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/NSEC3.py b/ext/dns/rdtypes/ANY/NSEC3.py
index 3f4a4666..b42fe4c8 100644
--- a/ext/dns/rdtypes/ANY/NSEC3.py
+++ b/ext/dns/rdtypes/ANY/NSEC3.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/NSEC3PARAM.py b/ext/dns/rdtypes/ANY/NSEC3PARAM.py
index dd5df4a0..4e687825 100644
--- a/ext/dns/rdtypes/ANY/NSEC3PARAM.py
+++ b/ext/dns/rdtypes/ANY/NSEC3PARAM.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/PTR.py b/ext/dns/rdtypes/ANY/PTR.py
index 18a9eb29..4a037537 100644
--- a/ext/dns/rdtypes/ANY/PTR.py
+++ b/ext/dns/rdtypes/ANY/PTR.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/RP.py b/ext/dns/rdtypes/ANY/RP.py
index 5e413212..26c55314 100644
--- a/ext/dns/rdtypes/ANY/RP.py
+++ b/ext/dns/rdtypes/ANY/RP.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/RRSIG.py b/ext/dns/rdtypes/ANY/RRSIG.py
index 046c35bb..63d389cd 100644
--- a/ext/dns/rdtypes/ANY/RRSIG.py
+++ b/ext/dns/rdtypes/ANY/RRSIG.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2004-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/RT.py b/ext/dns/rdtypes/ANY/RT.py
index 20663803..f9653fdb 100644
--- a/ext/dns/rdtypes/ANY/RT.py
+++ b/ext/dns/rdtypes/ANY/RT.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/SOA.py b/ext/dns/rdtypes/ANY/SOA.py
index 3a81cb57..2d6f21b5 100644
--- a/ext/dns/rdtypes/ANY/SOA.py
+++ b/ext/dns/rdtypes/ANY/SOA.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/SPF.py b/ext/dns/rdtypes/ANY/SPF.py
index dc96a06e..8860dd72 100644
--- a/ext/dns/rdtypes/ANY/SPF.py
+++ b/ext/dns/rdtypes/ANY/SPF.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/SSHFP.py b/ext/dns/rdtypes/ANY/SSHFP.py
index be5345d4..4c439511 100644
--- a/ext/dns/rdtypes/ANY/SSHFP.py
+++ b/ext/dns/rdtypes/ANY/SSHFP.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2005-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/TLSA.py b/ext/dns/rdtypes/ANY/TLSA.py
index 143f6749..6ca8c0a5 100644
--- a/ext/dns/rdtypes/ANY/TLSA.py
+++ b/ext/dns/rdtypes/ANY/TLSA.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2005-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/TXT.py b/ext/dns/rdtypes/ANY/TXT.py
index 751fe997..604fd0f4 100644
--- a/ext/dns/rdtypes/ANY/TXT.py
+++ b/ext/dns/rdtypes/ANY/TXT.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/ANY/X25.py b/ext/dns/rdtypes/ANY/X25.py
index 0d944c6f..ae91295f 100644
--- a/ext/dns/rdtypes/ANY/X25.py
+++ b/ext/dns/rdtypes/ANY/X25.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/A.py b/ext/dns/rdtypes/IN/A.py
index ec80626e..372d3332 100644
--- a/ext/dns/rdtypes/IN/A.py
+++ b/ext/dns/rdtypes/IN/A.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/AAAA.py b/ext/dns/rdtypes/IN/AAAA.py
index 23cf55f3..e131bd50 100644
--- a/ext/dns/rdtypes/IN/AAAA.py
+++ b/ext/dns/rdtypes/IN/AAAA.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/APL.py b/ext/dns/rdtypes/IN/APL.py
index 26c8d5b5..260fd6f3 100644
--- a/ext/dns/rdtypes/IN/APL.py
+++ b/ext/dns/rdtypes/IN/APL.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/DHCID.py b/ext/dns/rdtypes/IN/DHCID.py
index 8819d703..5524bead 100644
--- a/ext/dns/rdtypes/IN/DHCID.py
+++ b/ext/dns/rdtypes/IN/DHCID.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/IPSECKEY.py b/ext/dns/rdtypes/IN/IPSECKEY.py
index ab96587b..d85b6fe9 100644
--- a/ext/dns/rdtypes/IN/IPSECKEY.py
+++ b/ext/dns/rdtypes/IN/IPSECKEY.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/KX.py b/ext/dns/rdtypes/IN/KX.py
index e0605624..c7bd5bbe 100644
--- a/ext/dns/rdtypes/IN/KX.py
+++ b/ext/dns/rdtypes/IN/KX.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/NAPTR.py b/ext/dns/rdtypes/IN/NAPTR.py
index 7b10813d..7fe04308 100644
--- a/ext/dns/rdtypes/IN/NAPTR.py
+++ b/ext/dns/rdtypes/IN/NAPTR.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/NSAP.py b/ext/dns/rdtypes/IN/NSAP.py
index ca5f6d15..216cb0a8 100644
--- a/ext/dns/rdtypes/IN/NSAP.py
+++ b/ext/dns/rdtypes/IN/NSAP.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/NSAP_PTR.py b/ext/dns/rdtypes/IN/NSAP_PTR.py
index 1e3704a1..df5b989a 100644
--- a/ext/dns/rdtypes/IN/NSAP_PTR.py
+++ b/ext/dns/rdtypes/IN/NSAP_PTR.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/PX.py b/ext/dns/rdtypes/IN/PX.py
index f4206240..1422b834 100644
--- a/ext/dns/rdtypes/IN/PX.py
+++ b/ext/dns/rdtypes/IN/PX.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/SRV.py b/ext/dns/rdtypes/IN/SRV.py
index 0d38611b..e101b26b 100644
--- a/ext/dns/rdtypes/IN/SRV.py
+++ b/ext/dns/rdtypes/IN/SRV.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/IN/WKS.py b/ext/dns/rdtypes/IN/WKS.py
index 4e5674a9..04c3054e 100644
--- a/ext/dns/rdtypes/IN/WKS.py
+++ b/ext/dns/rdtypes/IN/WKS.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/dsbase.py b/ext/dns/rdtypes/dsbase.py
index dea50a30..6f5559a7 100644
--- a/ext/dns/rdtypes/dsbase.py
+++ b/ext/dns/rdtypes/dsbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/mxbase.py b/ext/dns/rdtypes/mxbase.py
index 0d4e7ec2..abc6a9ed 100644
--- a/ext/dns/rdtypes/mxbase.py
+++ b/ext/dns/rdtypes/mxbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/nsbase.py b/ext/dns/rdtypes/nsbase.py
index 1db7fd0c..fbd5ef1e 100644
--- a/ext/dns/rdtypes/nsbase.py
+++ b/ext/dns/rdtypes/nsbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rdtypes/txtbase.py b/ext/dns/rdtypes/txtbase.py
index 17a99f5a..580f056e 100644
--- a/ext/dns/rdtypes/txtbase.py
+++ b/ext/dns/rdtypes/txtbase.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/renderer.py b/ext/dns/renderer.py
index 05cea0ec..1708e92a 100644
--- a/ext/dns/renderer.py
+++ b/ext/dns/renderer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/resolver.py b/ext/dns/resolver.py
index d695abb0..934d39bd 100644
--- a/ext/dns/resolver.py
+++ b/ext/dns/resolver.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/reversename.py b/ext/dns/reversename.py
index 94ed6ab1..4925cfd6 100644
--- a/ext/dns/reversename.py
+++ b/ext/dns/reversename.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/rrset.py b/ext/dns/rrset.py
index c119ab0b..f6051fea 100644
--- a/ext/dns/rrset.py
+++ b/ext/dns/rrset.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/set.py b/ext/dns/set.py
index 960123c0..14c76a05 100644
--- a/ext/dns/set.py
+++ b/ext/dns/set.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/tokenizer.py b/ext/dns/tokenizer.py
index 6cd608f9..ab568731 100644
--- a/ext/dns/tokenizer.py
+++ b/ext/dns/tokenizer.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/tsig.py b/ext/dns/tsig.py
index f5d81006..6e97dcea 100644
--- a/ext/dns/tsig.py
+++ b/ext/dns/tsig.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2001-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/tsigkeyring.py b/ext/dns/tsigkeyring.py
index 45c66451..10de4db5 100644
--- a/ext/dns/tsigkeyring.py
+++ b/ext/dns/tsigkeyring.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/ttl.py b/ext/dns/ttl.py
index 85708714..ab6ddf4e 100644
--- a/ext/dns/ttl.py
+++ b/ext/dns/ttl.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/update.py b/ext/dns/update.py
index ee2017bb..e6922269 100644
--- a/ext/dns/update.py
+++ b/ext/dns/update.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/version.py b/ext/dns/version.py
index eeb6fbe4..c3d305e2 100644
--- a/ext/dns/version.py
+++ b/ext/dns/version.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/wiredata.py b/ext/dns/wiredata.py
index 9b0cc4c7..86d954a9 100644
--- a/ext/dns/wiredata.py
+++ b/ext/dns/wiredata.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/dns/zone.py b/ext/dns/zone.py
index 0d61ce66..9efcf437 100644
--- a/ext/dns/zone.py
+++ b/ext/dns/zone.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
diff --git a/ext/exifread/classes.py b/ext/exifread/classes.py
index bb1f1efd..0876b4ce 100644
--- a/ext/exifread/classes.py
+++ b/ext/exifread/classes.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import struct
import re
@@ -91,8 +90,8 @@ class ExifHeader:
if self.endian == 'I':
s += chr(offset & 0xFF)
else:
- s += chr(offset & 0xFF)
- offset >>= 8
+ s = chr(offset & 0xFF) + s
+ offset = offset >> 8
return s
def _first_ifd(self):
diff --git a/ext/exifread/exif_log.py b/ext/exifread/exif_log.py
index b86e95a7..82d5aea2 100644
--- a/ext/exifread/exif_log.py
+++ b/ext/exifread/exif_log.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
Custom log output
"""
diff --git a/ext/exifread/tags/exif.py b/ext/exifread/tags/exif.py
index a145b799..4b0d9336 100644
--- a/ext/exifread/tags/exif.py
+++ b/ext/exifread/tags/exif.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
Standard tag definitions.
"""
diff --git a/ext/exifread/tags/makernote.py b/ext/exifread/tags/makernote.py
index 8923c37c..71701476 100644
--- a/ext/exifread/tags/makernote.py
+++ b/ext/exifread/tags/makernote.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
Makernote tag definitions.
"""
diff --git a/ext/exifread/tags/makernote_canon.py b/ext/exifread/tags/makernote_canon.py
index 14b118c7..7b465357 100644
--- a/ext/exifread/tags/makernote_canon.py
+++ b/ext/exifread/tags/makernote_canon.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
Makernote (proprietary) tag definitions for Canon.
diff --git a/ext/exifread/utils.py b/ext/exifread/utils.py
index dc01755c..f5e0d7fe 100644
--- a/ext/exifread/utils.py
+++ b/ext/exifread/utils.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
Misc utilities.
"""
@@ -18,7 +17,7 @@ def make_string(seq):
for c in seq:
# Screen out non-printing characters
try:
- if 32 <= c < 256:
+ if 32 <= c and c < 256:
string += chr(c)
except TypeError:
pass
@@ -52,7 +51,7 @@ def s2n_intel(string):
x = 0
y = 0
for c in string:
- x |= ord_(c) << y
+ x = x | (ord_(c) << y)
y += + 8
return x
diff --git a/ext/pyPdf/filters.py b/ext/pyPdf/filters.py
index f669d0e9..7fe10fb4 100644
--- a/ext/pyPdf/filters.py
+++ b/ext/pyPdf/filters.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
@@ -107,7 +106,7 @@ class FlateDecode(object):
if predictor != 1:
columns = decodeParms["/Columns"]
# PNG prediction:
- if 10 <= predictor <= 15:
+ if predictor >= 10 and predictor <= 15:
output = StringIO()
# PNG prediction can vary from row to row
rowlength = columns + 1
@@ -192,7 +191,7 @@ class ASCII85Decode(object):
break
else:
c = ord(c) - 33
- assert 0 <= c < 85
+ assert c >= 0 and c < 85
group += [ c ]
if len(group) >= 5:
b = group[0] * (85**4) + \
diff --git a/ext/pyPdf/generic.py b/ext/pyPdf/generic.py
index 93af47e2..aaf50318 100644
--- a/ext/pyPdf/generic.py
+++ b/ext/pyPdf/generic.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
@@ -82,7 +81,7 @@ def readObject(stream, pdf):
return NumberObject.readFromStream(stream)
peek = stream.read(20)
stream.seek(-len(peek), 1) # reset to start
- if re.match(r"(\d+)\s(\d+)\sR[^a-zA-Z]", peek) is not None:
+ if re.match(r"(\d+)\s(\d+)\sR[^a-zA-Z]", peek) != None:
return IndirectObject.readFromStream(stream, pdf)
else:
return NumberObject.readFromStream(stream)
@@ -170,7 +169,7 @@ class IndirectObject(PdfObject):
def __eq__(self, other):
return (
- other is not None and
+ other != None and
isinstance(other, IndirectObject) and
self.idnum == other.idnum and
self.generation == other.generation and
@@ -490,7 +489,7 @@ class DictionaryObject(dict, PdfObject):
# return None if no metadata was found on the document root.
def getXmpMetadata(self):
metadata = self.get("/Metadata", None)
- if metadata is None:
+ if metadata == None:
return None
metadata = metadata.getObject()
import xmp
diff --git a/ext/pyPdf/pdf.py b/ext/pyPdf/pdf.py
index 7e18bb8e..bf60d015 100644
--- a/ext/pyPdf/pdf.py
+++ b/ext/pyPdf/pdf.py
@@ -48,6 +48,9 @@ try:
except ImportError:
from StringIO import StringIO
+import filters
+import utils
+import warnings
from generic import *
from utils import readNonWhitespace, readUntilWhitespace, ConvertFunctionsToVirtualList
@@ -195,7 +198,7 @@ class PdfFileWriter(object):
# flag is on.
def encrypt(self, user_pwd, owner_pwd = None, use_128bit = True):
import time, random
- if owner_pwd is None:
+ if owner_pwd == None:
owner_pwd = user_pwd
if use_128bit:
V = 2
@@ -249,7 +252,7 @@ class PdfFileWriter(object):
# copying in a new copy of the page object.
for objIndex in xrange(len(self._objects)):
obj = self._objects[objIndex]
- if isinstance(obj, PageObject) and obj.indirectRef is not None:
+ if isinstance(obj, PageObject) and obj.indirectRef != None:
data = obj.indirectRef
if not externalReferenceMap.has_key(data.pdf):
externalReferenceMap[data.pdf] = {}
@@ -338,7 +341,7 @@ class PdfFileWriter(object):
return data
else:
newobj = externMap.get(data.pdf, {}).get(data.generation, {}).get(data.idnum, None)
- if newobj is None:
+ if newobj == None:
newobj = data.pdf.getObject(data)
self._objects.append(None) # placeholder
idnum = len(self._objects)
@@ -424,7 +427,7 @@ class PdfFileReader(object):
# Stability: Added in v1.0, will exist for all v1.x releases.
# @return Returns an integer.
def getNumPages(self):
- if self.flattenedPages is None:
+ if self.flattenedPages == None:
self._flatten()
return len(self.flattenedPages)
@@ -443,7 +446,7 @@ class PdfFileReader(object):
def getPage(self, pageNumber):
## ensure that we're not trying to access an encrypted PDF
#assert not self.trailer.has_key("/Encrypt")
- if self.flattenedPages is None:
+ if self.flattenedPages == None:
self._flatten()
return self.flattenedPages[pageNumber]
@@ -463,7 +466,7 @@ class PdfFileReader(object):
# @return Returns a dict which maps names to {@link #Destination
# destinations}.
def getNamedDestinations(self, tree=None, retval=None):
- if retval is None:
+ if retval == None:
retval = {}
catalog = self.trailer["/Root"]
@@ -475,7 +478,7 @@ class PdfFileReader(object):
if names.has_key("/Dests"):
tree = names['/Dests']
- if tree is None:
+ if tree == None:
return retval
if tree.has_key("/Kids"):
@@ -491,7 +494,7 @@ class PdfFileReader(object):
if isinstance(val, DictionaryObject) and val.has_key('/D'):
val = val['/D']
dest = self._buildDestination(key, val)
- if dest is not None:
+ if dest != None:
retval[key] = dest
return retval
@@ -509,7 +512,7 @@ class PdfFileReader(object):
# Stability: Added in v1.10, will exist for all future v1.x releases.
# @return Returns a nested list of {@link #Destination destinations}.
def getOutlines(self, node=None, outlines=None):
- if outlines is None:
+ if outlines == None:
outlines = []
catalog = self.trailer["/Root"]
@@ -520,7 +523,7 @@ class PdfFileReader(object):
node = lines["/First"]
self._namedDests = self.getNamedDestinations()
- if node is None:
+ if node == None:
return outlines
# see if there are any more outlines
@@ -586,9 +589,9 @@ class PdfFileReader(object):
NameObject("/Resources"), NameObject("/MediaBox"),
NameObject("/CropBox"), NameObject("/Rotate")
)
- if inherit is None:
+ if inherit == None:
inherit = dict()
- if pages is None:
+ if pages == None:
self.flattenedPages = []
catalog = self.trailer["/Root"].getObject()
pages = catalog["/Pages"].getObject()
@@ -614,7 +617,7 @@ class PdfFileReader(object):
def getObject(self, indirectReference):
retval = self.resolvedObjects.get(indirectReference.generation, {}).get(indirectReference.idnum, None)
- if retval is not None:
+ if retval != None:
return retval
if indirectReference.generation == 0 and \
self.xref_objStm.has_key(indirectReference.idnum):
@@ -957,10 +960,10 @@ def getRectangle(self, name, defaults):
retval = self.get(name)
if isinstance(retval, RectangleObject):
return retval
- if retval is None:
+ if retval == None:
for d in defaults:
retval = self.get(d)
- if retval is not None:
+ if retval != None:
break
if isinstance(retval, IndirectObject):
retval = self.pdf.getObject(retval)
@@ -1692,7 +1695,7 @@ class Destination(DictionaryObject):
def convertToInt(d, size):
if size > 8:
raise utils.PdfReadError("invalid size in convertToInt")
- d += "\x00\x00\x00\x00\x00\x00\x00\x00"
+ d = "\x00\x00\x00\x00\x00\x00\x00\x00" + d
d = d[-8:]
return struct.unpack(">q", d)[0]
diff --git a/ext/pyPdf/utils.py b/ext/pyPdf/utils.py
index 35670088..7c1d472d 100644
--- a/ext/pyPdf/utils.py
+++ b/ext/pyPdf/utils.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
@@ -79,7 +78,7 @@ class ConvertFunctionsToVirtualList(object):
len_self = len(self)
if index < 0:
# support negative indexes
- index += len_self
+ index = len_self + index
if index < 0 or index >= len_self:
raise IndexError, "sequence index out of range"
return self.getFunction(index)
diff --git a/ext/pyPdf/xmp.py b/ext/pyPdf/xmp.py
index aa1e9c09..b070df90 100644
--- a/ext/pyPdf/xmp.py
+++ b/ext/pyPdf/xmp.py
@@ -1,8 +1,8 @@
-# -*- coding: utf-8 -*-
import re
import datetime
import decimal
from generic import PdfObject
+from xml.dom import getDOMImplementation
from xml.dom.minidom import parseString
RDF_NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -66,7 +66,7 @@ class XmpInformation(PdfObject):
for desc in self.rdfRoot.getElementsByTagNameNS(RDF_NAMESPACE, "Description"):
if desc.getAttributeNS(RDF_NAMESPACE, "about") == aboutUri:
attr = desc.getAttributeNodeNS(namespace, name)
- if attr is not None:
+ if attr != None:
yield attr
for element in desc.getElementsByTagNameNS(namespace, name):
yield element
@@ -187,7 +187,7 @@ class XmpInformation(PdfObject):
else:
value = self._getText(element)
break
- if value is not None:
+ if value != None:
value = converter(value)
ns_cache = self.cache.setdefault(namespace, {})
ns_cache[name] = value
diff --git a/ext/pythonwhois/net.py b/ext/pythonwhois/net.py
index 8e04fe78..53f87baf 100644
--- a/ext/pythonwhois/net.py
+++ b/ext/pythonwhois/net.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
import socket, re, sys
from codecs import encode, decode
from . import shared
@@ -30,7 +29,7 @@ def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=Fals
is_exception = True
target_server = exc_serv
break
- if not is_exception:
+ if is_exception == False:
target_server = get_root_server(domain)
else:
target_server = server
@@ -58,7 +57,7 @@ def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=Fals
if re.search("Domain Name: %s\n" % domain.upper(), record):
response = record
break
- if not never_cut:
+ if never_cut == False:
new_list = [response] + previous
server_list.append(target_server)
for line in [x.strip() for x in response.splitlines()]:
diff --git a/ext/pythonwhois/parse.py b/ext/pythonwhois/parse.py
index bc255e9d..66217d60 100644
--- a/ext/pythonwhois/parse.py
+++ b/ext/pythonwhois/parse.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
from __future__ import print_function
import re, sys, datetime, csv, pkgutil
from . import net, shared
@@ -439,7 +438,7 @@ def parse_raw_whois(raw_data, normalized=None, never_query_handles=True, handle_
for segment in raw_data:
for rule_key, rule_regexes in grammar['_data'].items():
- if not (rule_key in data):
+ if (rule_key in data) == False:
for line in segment.splitlines():
for regex in rule_regexes:
result = re.search(regex, line)
@@ -891,11 +890,11 @@ def parse_registrants(data, never_query_handles=True, handle_server=""):
if contact["handle"] == data_reference["handle"]:
found = True
data_reference.update(contact)
- if not found:
+ if found == False:
# The contact definition was not found in the supplied raw WHOIS data. If the
# method has been called with never_query_handles=False, we can use the supplied
# WHOIS server for looking up the handle information separately.
- if not never_query_handles:
+ if never_query_handles == False:
try:
contact = fetch_nic_contact(data_reference["handle"], handle_server)
data_reference.update(contact)
diff --git a/ext/pythonwhois/shared.py b/ext/pythonwhois/shared.py
index 7d20d478..0075da34 100644
--- a/ext/pythonwhois/shared.py
+++ b/ext/pythonwhois/shared.py
@@ -1,3 +1,2 @@
-# -*- coding: utf-8 -*-
class WhoisException(Exception):
pass
diff --git a/ext/socks.py b/ext/socks.py
index a32aa5a1..308eb783 100644
--- a/ext/socks.py
+++ b/ext/socks.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""SocksiPy - Python SOCKS module.
Version 1.00
@@ -46,6 +45,7 @@ to add getaddrinfo, as per http://stackoverflow.com/questions/13184205/dns-over-
import socket
import struct
+import sys
PROXY_TYPE_SOCKS4 = 1
PROXY_TYPE_SOCKS5 = 2
@@ -114,7 +114,7 @@ def wrapmodule(module):
This will only work on modules that import socket directly into the namespace;
most of the Python Standard Library falls into this category.
"""
- if _defaultproxy is not None:
+ if _defaultproxy != None:
module.socket.socket = socksocket
else:
raise GeneralProxyError((4, "no proxy specified"))
@@ -128,7 +128,7 @@ class socksocket(socket.socket):
def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None):
_orgsocket.__init__(self, family, type, proto, _sock)
- if _defaultproxy is not None:
+ if _defaultproxy != None:
self.__proxy = _defaultproxy
else:
self.__proxy = (None, None, None, None, None, None)
@@ -171,7 +171,7 @@ class socksocket(socket.socket):
Negotiates a connection through a SOCKS5 server.
"""
# First we'll send the authentication packages we support.
- if (self.__proxy[4] is not None) and (self.__proxy[5] is not None):
+ if (self.__proxy[4]!=None) and (self.__proxy[5]!=None):
# The username/password details were supplied to the
# setproxy method so we support the USERNAME/PASSWORD
# authentication (in addition to the standard none).
@@ -228,7 +228,7 @@ class socksocket(socket.socket):
# Resolve locally
ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))
req = req + chr(0x01).encode() + ipaddr
- req += struct.pack(">H", destport)
+ req = req + struct.pack(">H", destport)
self.sendall(req)
# Get the response
resp = self.__recvall(4)
@@ -253,7 +253,7 @@ class socksocket(socket.socket):
raise GeneralProxyError((1,_generalerrors[1]))
boundport = struct.unpack(">H", self.__recvall(2))[0]
self.__proxysockname = (boundaddr, boundport)
- if ipaddr is not None:
+ if ipaddr != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
else:
self.__proxypeername = (destaddr, destport)
@@ -295,9 +295,9 @@ class socksocket(socket.socket):
# Construct the request packet
req = struct.pack(">BBH", 0x04, 0x01, destport) + ipaddr
# The username parameter is considered userid for SOCKS4
- if self.__proxy[4] is not None:
+ if self.__proxy[4] != None:
req = req + self.__proxy[4]
- req += chr(0x00).encode()
+ req = req + chr(0x00).encode()
# DNS name if remote resolving is required
# NOTE: This is actually an extension to the SOCKS4 protocol
# called SOCKS4A and may not be supported in all cases.
@@ -320,7 +320,7 @@ class socksocket(socket.socket):
raise Socks4Error((94, _socks4errors[4]))
# Get the bound address/port
self.__proxysockname = (socket.inet_ntoa(resp[4:]), struct.unpack(">H", resp[2:4])[0])
- if rmtrslv is not None:
+ if rmtrslv != None:
self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)
else:
self.__proxypeername = (destaddr, destport)
@@ -367,27 +367,27 @@ class socksocket(socket.socket):
if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):
raise GeneralProxyError((5, _generalerrors[5]))
if self.__proxy[0] == PROXY_TYPE_SOCKS5:
- if self.__proxy[2] is not None:
+ if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 1080
_orgsocket.connect(self, (self.__proxy[1], portnum))
self.__negotiatesocks5(destpair[0], destpair[1])
elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
- if self.__proxy[2] is not None:
+ if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 1080
_orgsocket.connect(self,(self.__proxy[1], portnum))
self.__negotiatesocks4(destpair[0], destpair[1])
elif self.__proxy[0] == PROXY_TYPE_HTTP:
- if self.__proxy[2] is not None:
+ if self.__proxy[2] != None:
portnum = self.__proxy[2]
else:
portnum = 8080
_orgsocket.connect(self,(self.__proxy[1], portnum))
self.__negotiatehttp(destpair[0], destpair[1])
- elif self.__proxy[0] is None:
+ elif self.__proxy[0] == None:
_orgsocket.connect(self, (destpair[0], destpair[1]))
else:
raise GeneralProxyError((4, _generalerrors[4]))