From 7d08ad9158507856c31222fbbd12b2f8ba238c4d Mon Sep 17 00:00:00 2001 From: Brian May Date: Mon, 18 Jun 2018 17:11:31 +1000 Subject: Replace <> with != for Python 3.6 compatibility --- lib/python/bugs.py | 8 ++++---- lib/python/debian_support.py | 6 +++--- lib/python/sectracker/analyzers.py | 2 +- lib/python/sectracker/parsers.py | 4 ++-- lib/python/security_db.py | 18 +++++++++--------- lib/python/web_support.py | 14 +++++++------- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'lib') diff --git a/lib/python/bugs.py b/lib/python/bugs.py index 84b0d4caed..93bef74604 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -165,8 +165,8 @@ class PackageNoteParsed(PackageNote): class PackageNoteNoDSA: def __init__(self, package, release, comment, reason=None): - assert type(package) == types.StringType and package <> '' - assert type(release) == types.StringType and release <> '' + assert type(package) == types.StringType and package != '' + assert type(release) == types.StringType and release != '' assert type(comment) == types.StringType if not reason: reason = '' @@ -764,12 +764,12 @@ class CVEFile(FileBase): (cve, desc) = match.groups() if desc: if desc[0] == '(': - if desc[-1] <> ')': + if desc[-1] != ')': self.raiseSyntaxError("missing closing parenthesis") else: desc = desc[1:-1] elif desc[0] == '[': - if desc[-1] <> ']': + if desc[-1] != ']': self.raiseSyntaxError("missing closing bracket") else: desc = desc[1:-1] diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py index 717705dcd2..e4bc12ee77 100644 --- a/lib/python/debian_support.py +++ b/lib/python/debian_support.py @@ -85,7 +85,7 @@ class Version: version = version.encode('UTF-8') else: assert t == types.StringType, `version` - assert version <> "" + assert version != "" self.__asString = version self.__forCompare = _version_normalize_regexp.sub("", version) @@ -394,14 +394,14 @@ def updateFile(remote, local, verbose=None): + '.gz') except IOError: return downloadFile(remote, local) - if readLinesSHA1(patch_contents ) <> patch_hashes[patch_name]: + if readLinesSHA1(patch_contents ) != patch_hashes[patch_name]: if verbose: print "updateFile: patch was garbled: " + repr(patch_name) return downloadFile(remote, local) patchLines(lines, patchesFromEdScript(patch_contents)) new_hash = readLinesSHA1(lines) - if new_hash <> remote_hash: + if new_hash != remote_hash: if verbose: print "updateFile: patch failed, got %s instead of %s" \ % (new_hash, remote_hash) diff --git a/lib/python/sectracker/analyzers.py b/lib/python/sectracker/analyzers.py index ec664faaa8..856196e5db 100644 --- a/lib/python/sectracker/analyzers.py +++ b/lib/python/sectracker/analyzers.py @@ -85,7 +85,7 @@ def copysources(bugdb, diag): if not _re_source.match(copy_source): copy_source = None for ann in bug.annotations: - if ann.type <> "xref": + if ann.type != "xref": continue for target in ann.bugs: if target not in bugdb: diff --git a/lib/python/sectracker/parsers.py b/lib/python/sectracker/parsers.py index 52af64e2ac..8678469964 100644 --- a/lib/python/sectracker/parsers.py +++ b/lib/python/sectracker/parsers.py @@ -249,12 +249,12 @@ def cvelist(path, f): name, desc = match.groups() if desc: if desc[0] == '(': - if desc[-1] <> ')': + if desc[-1] != ')': diag.error("error", "missing ')'") else: desc = desc[1:-1] elif desc[0] == '[': - if desc[-1] <> ']': + if desc[-1] != ']': diag.error("missing ']'") else: desc = desc[1:-1] diff --git a/lib/python/security_db.py b/lib/python/security_db.py index efebe8b0ed..90529ad38d 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -266,7 +266,7 @@ class DB: except apsw.SQLError: pass c.execute("PRAGMA user_version = 22") - elif v <> self.schema_version: + elif v != self.schema_version: if self.verbose: print "DB: schema version mismatch: expected %d, got %d" \ % (self.schema_version, v) @@ -606,7 +606,7 @@ class DB: self.db.createscalarfunction("archive_to_number", archive_to_number, 1) def release_name(release, subrelease, archive): - if archive <> 'main': + if archive != 'main': release = release + '/' + archive if subrelease: return "%s (%s)" % (release, subrelease) @@ -813,7 +813,7 @@ class DB: source = name if source_version is None: source_version = version - if arch <> 'all' and arch <> architecture: + if arch != 'all' and arch != architecture: raise ValueError("invalid architecture %s for package %s" % (arch, name)) key = (name, release, subrelease, archive, version, @@ -992,7 +992,7 @@ class DB: """SELECT source, target FROM bugs_xref WHERE (""" + source_like + """) AND target LIKE 'CVE-%'""")): - if source <> old_source: + if source != old_source: source_bug = bugs.BugFromDB(cursor, source) old_source = source for n in source_bug.notes: @@ -1610,7 +1610,7 @@ class DB: if not total_urgency: total_urgency = urgency elif total_urgency == 'unknown': - if urgency <> 'unimportant': + if urgency != 'unimportant': total_urgency = urgency elif urgency == 'unknown': if total_urgency == 'unimportant': @@ -1723,7 +1723,7 @@ class DB: ORDER BY name""", (sp, release)): bp_list.append(bp) - if bp_list <> [sp]: + if bp_list != [sp]: # We intentionally store the empty list, it means # that the source package is obsolete as a whole. result.append("%s,%s" % (sp, ' '.join(bp_list))) @@ -1955,7 +1955,7 @@ class DB: AND NOT EXISTS (SELECT * FROM removed_packages WHERE name = package) ORDER BY package, bug_name"""): - if package <> old_package: + if package != old_package: if old_package: yield (old_package, bugs) old_package = package @@ -2003,7 +2003,7 @@ class DB: AND package_notes.rowid NOT IN (SELECT note FROM debian_bugs) AND source_package_status.vulnerable ORDER BY source_package_status.bug_name, source_packages.name"""): - if last_bug is None or last_bug <> bug: + if last_bug is None or last_bug != bug: last_bug = bug result.append((bug, [])) result[-1][1].append(pkg) @@ -2116,7 +2116,7 @@ class DB: AND sp.version <> binary_packages.source_version"""): relation = cmp(debian_support.Version(version), debian_support.Version(source_version)) - assert relation <> 0 + assert relation != 0 if relation <= 0: print "error: binary package is older than source package" else: diff --git a/lib/python/web_support.py b/lib/python/web_support.py index 1e204d06bc..dc54c5b07a 100644 --- a/lib/python/web_support.py +++ b/lib/python/web_support.py @@ -78,7 +78,7 @@ class Service: def read(count): data = '' cnt = 0 - while cnt <> count: + while cnt != count: d = client.recv(count - cnt) if d: data += d @@ -93,9 +93,9 @@ class Service: header = read(24) (magic, version, cli_size, cli_count, env_size, env_count) = \ struct.unpack("!6I", header) - if magic <> 0x15fd34df: + if magic != 0x15fd34df: sys.log("unknown magic number %08X", magic) - if version <> 1: + if version != 1: sys.log("unknown version %08X", magic) cli = read(cli_size).split('\0')[:-1] env = {} @@ -515,7 +515,7 @@ def make_numbered_list(entries): def make_list(lst, separator=", "): """Creates a list of HTML elements.""" - assert type(lst) <> types.StringType + assert type(lst) != types.StringType c = [] if lst: append = c.append @@ -551,12 +551,12 @@ class PathRouter: m = m[element] else: if element == '*': - if x + 1 <> len(p): + if x + 1 != len(p): raise ValueError('wildcard * in the middle of path') m['*'] = value return if element == '**': - if x + 1 <> len(p): + if x + 1 != len(p): raise ValueError( 'wildcard ** in the middle of path') m['**'] = value @@ -756,7 +756,7 @@ class WebService(Service, WebServiceBase): path = environment.get('PATH_INFO', '') server_name = environment.get('SERVER_NAME', '') server_port = environment.get('SERVER_PORT', '') - if server_port and server_port <> 80: + if server_port and server_port != 80: server_name = server_name + ":" + server_port script_name = environment.get('SCRIPT_NAME', '') -- cgit v1.2.3