From 9b529a23f64c4b27c427a2680428f3e17531e9c3 Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Tue, 18 Mar 2014 12:49:40 +0100 Subject: Python 3: use new style of raise, replace "raise class, args" with "raise class(args)" --- paste/util/PySourceColor.py | 10 +++++----- paste/util/multidict.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'paste/util') diff --git a/paste/util/PySourceColor.py b/paste/util/PySourceColor.py index c2a9363..35efc7f 100644 --- a/paste/util/PySourceColor.py +++ b/paste/util/PySourceColor.py @@ -750,11 +750,11 @@ def cli(): linenumbers=linenumbers, header=header, footer=footer, form=form) else: - raise PathError, 'File does not exists!' + raise PathError('File does not exists!') else: try: if sys.stdin.isatty(): - raise InputError, 'Please check input!' + raise InputError('Please check input!') else: if output in [None,"-","stdout"]: str2stdout(sys.stdin.read(), colors=colorscheme, @@ -780,7 +780,7 @@ def cli(): show=show, markup=markup, quiet=quiet, header=header, footer=footer, linenumbers=linenumbers, form=form) else: - raise PathError, 'File does not exists!' + raise PathError('File does not exists!') Usage() ######################################################### Simple markup tests @@ -1009,7 +1009,7 @@ def convert(source, outdir=None, colors=None, path2file(source, outdir, colors, show, markup, quiet, form, header, footer, linenumbers, count) else: - raise PathError, 'File does not exist!' + raise PathError('File does not exist!') # If we pass in a dir we need to walkdir for files. # Then we need to colorize them with path2file else: @@ -1095,7 +1095,7 @@ def tagreplace(sourcestr, colors=lite, markup='xhtml', end = sourcestr[dataend+len(tagend):] sourcestr = ''.join([start,data,end]) else: - raise InputError,'Tag mismatch!\nCheck %s,%s tags'%tagstart,tagend + raise InputError('Tag mismatch!\nCheck %s,%s tags'%tagstart,tagend) if not dosheet: css = None return css, sourcestr diff --git a/paste/util/multidict.py b/paste/util/multidict.py index 867f309..d81cce0 100644 --- a/paste/util/multidict.py +++ b/paste/util/multidict.py @@ -145,8 +145,8 @@ class MultiDict(DictMixin): def pop(self, key, *args): if len(args) > 1: - raise TypeError, "pop expected at most 2 arguments, got "\ - + repr(1 + len(args)) + raise TypeError("pop expected at most 2 arguments, got " + + repr(1 + len(args))) for i in range(len(self._items)): if self._items[i][0] == key: v = self._items[i][1] -- cgit v1.2.1