Skip to content
Commits on Source (2)
......@@ -21,7 +21,7 @@ root_path = setup_paths()
import debian_support
if len(sys.argv) <> 3:
if len(sys.argv) != 3:
sys.stderr.write("usage: apt-update-file REMOTE LOCAL\n")
sys.exit(1)
......
......@@ -30,7 +30,7 @@ def do_parse(f):
if n[0:4] in ('CAN', 'CVE'):
n = n[4:]
if names.has_key(n):
if names[n] <> r.name:
if names[n] != r.name:
sys.stderr.write("error: duplicate CVE entry: %s and %s\n"
% (names[n], r.name))
else:
......@@ -78,7 +78,7 @@ if len(sys.argv) == 2 and sys.argv[1] == "--get":
print ' '.join(l)
sys.exit(0)
if len(sys.argv) <> 3 or find_source(sys.argv[1]) == None:
if len(sys.argv) != 3 or find_source(sys.argv[1]) == None:
l = [src["name"] for src in sources]
l.sort()
sys.stderr.write("usage: check-syntax {%s} file-name\n"
......
......@@ -109,7 +109,7 @@ def deletepaths(db, table, paths):
def prepareupdate(db, ondisk, indb, table):
need_update = [(path, stat) for (path, stat) in ondisk.items()
if path not in indb or stat <> tuple(indb[path][0:2])]
if path not in indb or stat != tuple(indb[path][0:2])]
db.executemany("DELETE FROM " + table + " WHERE path = ?",
((path,) for path, _ in need_update))
return need_update
......
......@@ -27,7 +27,7 @@ else: # len(sys.argv) == 3
# The following has been taken from a debsecan test case.
data = StringIO(data)
if data.readline() <> "VERSION 1\n":
if data.readline() != "VERSION 1\n":
sys.stderr.write("error: server sends data in unknown format\n")
sys.exit(1)
......
......@@ -350,7 +350,7 @@ data source.""")],
return RedirectResult(self.url_cve(url, name),
permanent=False)
return self.page_not_found(url, name)
if bug.name <> name or redirect:
if bug.name != name or redirect:
# Show the normalized bug name in the browser address bar.
return RedirectResult(url.scriptRelativeFull(bug.name))
......@@ -446,7 +446,7 @@ data source.""")],
# for (release, status, reason) in bug.getStatus(cursor):
# if status == 'undetermined':
# reason = self.make_purple(reason)
# elif status <> 'fixed':
# elif status != 'fixed':
# reason = self.make_red(reason)
# yield B('Debian/%s' % release), reason
......@@ -721,7 +721,7 @@ to improve our documentation and procedures, so feedback is welcome.""")])])
else:
old_pkg_name = pkg_name
title = None
if archive <> 'main':
if archive != 'main':
title = "%s (%s)" % (pkg_name, archive)
if remote is None:
......@@ -781,7 +781,7 @@ to improve our documentation and procedures, so feedback is welcome.""")])])
else:
old_pkg_name = pkg_name
title = None
if archive <> 'main':
if archive != 'main':
title = "%s (%s)" % (pkg_name, archive)
if remote is None:
......@@ -841,7 +841,7 @@ to improve our documentation and procedures, so feedback is welcome.""")])])
else:
old_pkg_name = pkg_name
title = None
if section <> 'main':
if section != 'main':
title = "%s (%s)" % (pkg_name, section)
if remote is None:
......@@ -931,7 +931,7 @@ to improve our documentation and procedures, so feedback is welcome.""")])])
title = None
migration = A(self.url_testing_status(url, pkg_name),
"check")
if archive <> 'main':
if archive != 'main':
title = "%s (%s)" % (pkg_name, archive)
if remote is None:
......
......@@ -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]
......
......@@ -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)
......
......@@ -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:
......
......@@ -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]
......
......@@ -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:
......
......@@ -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', '')
......