diff options
author | Brian May <brian@linuxpenguins.xyz> | 2018-06-18 17:11:31 +1000 |
---|---|---|
committer | Brian May <brian@linuxpenguins.xyz> | 2018-07-13 15:15:20 +1000 |
commit | cc04ebb4f6ebbf80080b7990d710a55fd55a19a2 (patch) | |
tree | ea5ffabe533be6124b9c30bc82af3e23d08f10dc /lib/python/bugs.py | |
parent | 9889b3ebf70085d28f84371a931adcced2ff19fd (diff) |
Update python exception syntax for Python 3.6 compatibility
Diffstat (limited to 'lib/python/bugs.py')
-rw-r--r-- | lib/python/bugs.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py index bcfa9b1ce5..84b0d4caed 100644 --- a/lib/python/bugs.py +++ b/lib/python/bugs.py @@ -65,12 +65,12 @@ class PackageNote: if type(release) == types.StringType: release = debian_support.internRelease(release) if release is None: - raise ValueError, "invalid release" + raise ValueError("invalid release") self.release = release if type(urgency) == types.StringType: urgency = internUrgency(urgency) if urgency is None: - raise ValueError, "invalid urgency" + raise ValueError("invalid urgency") self.urgency = urgency self.bugs = [] self.package_kind = "unknown" @@ -132,7 +132,7 @@ class PackageNoteFromDB(PackageNote): self.package_kind = package_kind self.loadBugs(cursor) return - raise ValueError, "invalid package note ID %d" % id + raise ValueError("invalid package note ID %d" % id) class PackageNoteParsed(PackageNote): """Subclass with a constructor that parses package notes.""" @@ -159,7 +159,7 @@ class PackageNoteParsed(PackageNote): bugs.append(int(bug)) continue - raise SyntaxError , 'unknown package note %s\n' % `n` + raise SyntaxError('unknown package note %s\n' % repr(n)) PackageNote.__init__(self, package, version, release, urgency) self.bugs = bugs @@ -238,7 +238,7 @@ class BugBase: self.description, self.date or '', self.source_file, self.source_line)) except apsw.ConstraintError: - raise ValueError, "bug name %s is not unique" % self.name + raise ValueError("bug name %s is not unique" % self.name) for (typ, c) in self.comments: cursor.execute("""INSERT INTO bugs_notes @@ -254,8 +254,8 @@ class BugBase: (source, target) VALUES (?, ?)""", (self.name, x)) except apsw.ConstraintError: - raise ValueError, \ - "cross reference to %s appears multiple times" % x + raise ValueError( + "cross reference to %s appears multiple times" % x) class Bug(BugBase): """Class for bugs for which we have some data.""" @@ -332,7 +332,7 @@ class BugFromDB(Bug): if name_source == 'DSA' and 2 <= len(name_components) <= 3: r = lookup_dsa('DSA-' + name_components[1]) if r is None: - raise ValueError, "unknown bug " + `name` + raise ValueError("unknown bug " + repr(name)) rdesc = cursor.getdescription() data = {} @@ -467,7 +467,7 @@ class FileBase(debian_support.PackageFile): match = self.re_non_ascii.match(self.line) if match is not None: self.raiseSyntaxError('invalid non-printable character %s' - % `match.groups()[0]`) + % repr(match.groups()[0])) def rawRecords(self): """Generator which returns raw records. @@ -546,13 +546,13 @@ class FileBase(debian_support.PackageFile): if re_entry.match(x): target.append(x) else: - self.raiseSyntaxError\ - ("invalid cross reference " + `x`, + self.raiseSyntaxError( + "invalid cross reference " + repr(x), lineno) return True else: self.raiseSyntaxError( - "expected cross reference, got: " + `r`, + "expected cross reference, got: " + repr(r), lineno) else: return False @@ -640,11 +640,11 @@ class FileBase(debian_support.PackageFile): else: self.raiseSyntaxError( "invalid special version %s in package entry" - % `r`, lineno) + % repr(r), lineno) continue self.raiseSyntaxError( - "expected package entry, got: " + `r`, lineno) + "expected package entry, got: " + repr(r), lineno) if self.re_not_for_us_required.match(r): match = self.re_not_for_us.match(r) @@ -655,7 +655,7 @@ class FileBase(debian_support.PackageFile): continue else: self.raiseSyntaxError("expected NOT-FOR-US entry, " - + "got: " + `r`, lineno) + + "got: " + repr(r), lineno) match = self.re_reserved.match(r) if match: @@ -680,7 +680,7 @@ class FileBase(debian_support.PackageFile): continue self.raiseSyntaxError('expected CVE annotation, got: %s' - % `r`, lineno) + % repr(r), lineno) break if cve_reserved: @@ -759,7 +759,7 @@ class CVEFile(FileBase): def matchHeader(self, line): match = self.re_cve.match(line) if not match: - self.raiseSyntaxError("expected CVE record, got: %s" % `line`) + self.raiseSyntaxError("expected CVE record, got: %s" % repr(line)) (record_name, description) = match.groups() (cve, desc) = match.groups() if desc: @@ -820,13 +820,13 @@ class DSAFile(FileBase): def matchHeader(self, line): match = self.re_dsa.match(line) if not match: - self.raiseSyntaxError("expected %s record, got: %s" % (self.base, `line`)) + self.raiseSyntaxError("expected %s record, got: %s" % (self.base, repr(line))) (record_name, description) = match.groups() (day, month, year, name, desc) = match.groups() try: month = self.month_names[month] except KeyError: - self.raiseSyntaxError("invalid month name %s" % `month`) + self.raiseSyntaxError("invalid month name %s" % repr(month)) return ("%s-%02d-%s" % (year, month, day), name, desc) def finishBug(self, bug): @@ -861,13 +861,13 @@ class DTSAFile(FileBase): def matchHeader(self, line): match = self.re_dsa.match(line) if not match: - self.raiseSyntaxError("expected DTSA record, got: %s" % `line`) + self.raiseSyntaxError("expected DTSA record, got: %s" % repr(line)) (record_name, description) = match.groups() (month, day, year, name, desc) = match.groups() try: month = self.month_names[month] except KeyError: - self.raiseSyntaxError("invalid month name %s" % `month`) + self.raiseSyntaxError("invalid month name %s" % repr(month)) return ("%s-%02d-%02d" % (year, month, int(day)), name, desc) def finishBug(self, bug): |