[PATCH 3 of 6] cleanup: "raise SomeException()" -> "raise SomeException"
Brodie Rao
brodie at sf.io
Sat May 12 08:39:32 CDT 2012
# HG changeset patch
# User Brodie Rao <brodie at sf.io>
# Date 1336827685 -7200
# Branch stable
# Node ID b7953b84a9963227de8dadd94d4b3a18956c09aa
# Parent c62d8e587f1b4d44abbe19197a7c97dc39e46f54
cleanup: "raise SomeException()" -> "raise SomeException"
diff --git a/contrib/debugcmdserver.py b/contrib/debugcmdserver.py
--- a/contrib/debugcmdserver.py
+++ b/contrib/debugcmdserver.py
@@ -24,7 +24,7 @@ else:
def read(size):
data = sys.stdin.read(size)
if not data:
- raise EOFError()
+ raise EOFError
sys.stdout.write(data)
sys.stdout.flush()
return data
diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -76,7 +76,7 @@ class converter_source(object):
def getheads(self):
"""Return a list of this repository's heads"""
- raise NotImplementedError()
+ raise NotImplementedError
def getfile(self, name, rev):
"""Return a pair (data, mode) where data is the file content
@@ -84,7 +84,7 @@ class converter_source(object):
identifier returned by a previous call to getchanges(). Raise
IOError to indicate that name was deleted in rev.
"""
- raise NotImplementedError()
+ raise NotImplementedError
def getchanges(self, version):
"""Returns a tuple of (files, copies).
@@ -95,18 +95,18 @@ class converter_source(object):
copies is a dictionary of dest: source
"""
- raise NotImplementedError()
+ raise NotImplementedError
def getcommit(self, version):
"""Return the commit object for version"""
- raise NotImplementedError()
+ raise NotImplementedError
def gettags(self):
"""Return the tags as a dictionary of name: revision
Tag names must be UTF-8 strings.
"""
- raise NotImplementedError()
+ raise NotImplementedError
def recode(self, s, encoding=None):
if not encoding:
@@ -133,7 +133,7 @@ class converter_source(object):
This function is only needed to support --filemap
"""
- raise NotImplementedError()
+ raise NotImplementedError
def converted(self, rev, sinkrev):
'''Notify the source that a revision has been converted.'''
@@ -175,13 +175,13 @@ class converter_sink(object):
def getheads(self):
"""Return a list of this repository's heads"""
- raise NotImplementedError()
+ raise NotImplementedError
def revmapfile(self):
"""Path to a file that will contain lines
source_rev_id sink_rev_id
mapping equivalent revision identifiers for each system."""
- raise NotImplementedError()
+ raise NotImplementedError
def authorfile(self):
"""Path to a file that will contain lines
@@ -203,7 +203,7 @@ class converter_sink(object):
a particular revision (or even what that revision would be)
before it receives the file data.
"""
- raise NotImplementedError()
+ raise NotImplementedError
def puttags(self, tags):
"""Put tags into sink.
@@ -212,7 +212,7 @@ class converter_sink(object):
Return a pair (tag_revision, tag_parent_revision), or (None, None)
if nothing was changed.
"""
- raise NotImplementedError()
+ raise NotImplementedError
def setbranch(self, branch, pbranches):
"""Set the current branch name. Called before the first putcommit
@@ -247,7 +247,7 @@ class converter_sink(object):
def hascommit(self, rev):
"""Return True if the sink contains rev"""
- raise NotImplementedError()
+ raise NotImplementedError
class commandline(object):
def __init__(self, ui, command):
diff --git a/hgext/convert/git.py b/hgext/convert/git.py
--- a/hgext/convert/git.py
+++ b/hgext/convert/git.py
@@ -69,7 +69,7 @@ class convert_git(converter_source):
def catfile(self, rev, type):
if rev == hex(nullid):
- raise IOError()
+ raise IOError
data, ret = self.gitread("git cat-file %s %s" % (type, rev))
if ret:
raise util.Abort(_('cannot read %r object at %s') % (type, rev))
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -241,7 +241,7 @@ class mercurial_source(converter_source)
# try to provoke an exception if this isn't really a hg
# repo, but some other bogus compatible-looking url
if not self.repo.local():
- raise error.RepoError()
+ raise error.RepoError
except error.RepoError:
ui.traceback()
raise NoRepo(_("%s is not a local Mercurial repository") % path)
diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -283,11 +283,11 @@ class monotone_source(converter_source,
def getfile(self, name, rev):
if not self.mtnisfile(name, rev):
- raise IOError() # file was deleted or renamed
+ raise IOError # file was deleted or renamed
try:
data = self.mtnrun("get_file_of", name, r=rev)
except:
- raise IOError() # file was deleted or renamed
+ raise IOError # file was deleted or renamed
self.mtnloadmanifest(rev)
node, attr = self.files.get(name, (None, ""))
return data, attr
@@ -317,7 +317,7 @@ class monotone_source(converter_source,
def getchangedfiles(self, rev, i):
# This function is only needed to support --filemap
# ... and we don't support that
- raise NotImplementedError()
+ raise NotImplementedError
def before(self):
# Check if we have a new enough version to use automate stdio
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -870,7 +870,7 @@ class svn_source(converter_source):
def getfile(self, file, rev):
# TODO: ra.get_file transmits the whole file instead of diffs.
if file in self.removed:
- raise IOError()
+ raise IOError
mode = ''
try:
new_module, revnum = revsplit(rev)[1:]
@@ -891,7 +891,7 @@ class svn_source(converter_source):
notfound = (svn.core.SVN_ERR_FS_NOT_FOUND,
svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND)
if e.apr_err in notfound: # File not found
- raise IOError()
+ raise IOError
raise
if mode == 'l':
link_prefix = "link "
diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -129,7 +129,7 @@ def _addchangeset(ui, rsrc, rdst, ctx, r
try:
fctx = ctx.filectx(lfutil.standin(f))
except error.LookupError:
- raise IOError()
+ raise IOError
renamed = fctx.renamed()
if renamed:
renamed = lfutil.splitstandin(renamed[0])
@@ -229,7 +229,7 @@ def _lfconvert_addchangeset(rsrc, rdst,
try:
fctx = ctx.filectx(srcfname)
except error.LookupError:
- raise IOError()
+ raise IOError
renamed = fctx.renamed()
if renamed:
# standin is always a largefile because largefile-ness
@@ -278,7 +278,7 @@ def _getnormalcontext(ui, ctx, f, revmap
try:
fctx = ctx.filectx(f)
except error.LookupError:
- raise IOError()
+ raise IOError
renamed = fctx.renamed()
if renamed:
renamed = renamed[0]
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -308,7 +308,7 @@ class queue(object):
try:
gitmode = ui.configbool('mq', 'git', None)
if gitmode is None:
- raise error.ConfigError()
+ raise error.ConfigError
self.gitmode = gitmode and 'yes' or 'no'
except error.ConfigError:
self.gitmode = ui.config('mq', 'git', 'auto').lower()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1360,7 +1360,7 @@ def amend(ui, repo, commitfunc, old, ext
copied=copied.get(path))
return mctx
except KeyError:
- raise IOError()
+ raise IOError
else:
ui.note(_('copying changeset %s to %s\n') % (old, base))
@@ -1369,7 +1369,7 @@ def amend(ui, repo, commitfunc, old, ext
try:
return old.filectx(path)
except KeyError:
- raise IOError()
+ raise IOError
# See if we got a message from -m or -l, if not, open the editor
# with the message of the changeset to amend
diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -166,7 +166,7 @@ class server(object):
# is the other end closed?
if not data:
- raise EOFError()
+ raise EOFError
return data
diff --git a/mercurial/dagutil.py b/mercurial/dagutil.py
--- a/mercurial/dagutil.py
+++ b/mercurial/dagutil.py
@@ -26,25 +26,25 @@ class basedag(object):
def nodeset(self):
'''set of all node idxs'''
- raise NotImplementedError()
+ raise NotImplementedError
def heads(self):
'''list of head ixs'''
- raise NotImplementedError()
+ raise NotImplementedError
def parents(self, ix):
'''list of parents ixs of ix'''
- raise NotImplementedError()
+ raise NotImplementedError
def inverse(self):
'''inverse DAG, where parents becomes children, etc.'''
- raise NotImplementedError()
+ raise NotImplementedError
def ancestorset(self, starts, stops=None):
'''
set of all ancestors of starts (incl), but stop walk at stops (excl)
'''
- raise NotImplementedError()
+ raise NotImplementedError
def descendantset(self, starts, stops=None):
'''
@@ -59,7 +59,7 @@ class basedag(object):
By "connected list" we mean that if an ancestor and a descendant are in
the list, then so is at least one path connecting them.
'''
- raise NotImplementedError()
+ raise NotImplementedError
def externalize(self, ix):
'''return a list of (or set if given a set) of node ids'''
diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -95,7 +95,7 @@ class continuereader(object):
def __getattr__(self, attr):
if attr in ('close', 'readline', 'readlines', '__iter__'):
return getattr(self.f, attr)
- raise AttributeError()
+ raise AttributeError
def _statusmessage(code):
from BaseHTTPServer import BaseHTTPRequestHandler
diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -534,7 +534,7 @@ def safesend(self, str):
if self.auto_open:
self.connect()
else:
- raise httplib.NotConnected()
+ raise httplib.NotConnected
# send the data to the server. if we get a broken pipe, then close
# the socket. we want to reconnect when somebody tries to send again.
diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -272,7 +272,7 @@ def _buildregexmatch(pats, tail):
try:
pat = '(?:%s)' % '|'.join([_regex(k, p, tail) for (k, p) in pats])
if len(pat) > 20000:
- raise OverflowError()
+ raise OverflowError
return pat, re.compile(pat).match
except OverflowError:
# We're using a Python with a tiny regex engine and we
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -534,7 +534,7 @@ class filestore(object):
if fname in self.data:
return self.data[fname]
if not self.opener or fname not in self.files:
- raise IOError()
+ raise IOError
fn, mode, copied = self.files[fname]
return self.opener.read(fn), mode, copied
@@ -560,7 +560,7 @@ class repobackend(abstractbackend):
try:
fctx = self.ctx[fname]
except error.LookupError:
- raise IOError()
+ raise IOError
flags = fctx.flags()
return fctx.data(), ('l' in flags, 'x' in flags)
@@ -1627,7 +1627,7 @@ def diff(repo, node1=None, node2=None, m
try:
def losedata(fn):
if not losedatafn or not losedatafn(fn=fn):
- raise GitDiffRequired()
+ raise GitDiffRequired
# Buffer the whole output until we are sure it can be generated
return list(difffn(opts.copy(git=False), losedata))
except GitDiffRequired:
diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -94,7 +94,7 @@ class Merge3Text(object):
elif self.a[0].endswith('\r'):
newline = '\r'
if base_marker and reprocess:
- raise CantReprocessAndShowBase()
+ raise CantReprocessAndShowBase
if name_a:
start_marker = start_marker + ' ' + name_a
if name_b:
diff --git a/mercurial/win32.py b/mercurial/win32.py
--- a/mercurial/win32.py
+++ b/mercurial/win32.py
@@ -305,7 +305,7 @@ def executablepath():
buf = ctypes.create_string_buffer(size + 1)
len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
if len == 0:
- raise ctypes.WinError()
+ raise ctypes.WinError
elif len == size:
raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
return buf.value
@@ -315,7 +315,7 @@ def getuser():
size = _DWORD(300)
buf = ctypes.create_string_buffer(size.value + 1)
if not _advapi32.GetUserNameA(ctypes.byref(buf), ctypes.byref(size)):
- raise ctypes.WinError()
+ raise ctypes.WinError
return buf.value
_signalhandler = []
@@ -333,7 +333,7 @@ def setsignalhandler():
h = _SIGNAL_HANDLER(handler)
_signalhandler.append(h) # needed to prevent garbage collection
if not _kernel32.SetConsoleCtrlHandler(h, True):
- raise ctypes.WinError()
+ raise ctypes.WinError
def hidewindow():
@@ -396,7 +396,7 @@ def spawndetached(args):
None, args, None, None, False, _DETACHED_PROCESS,
env, os.getcwd(), ctypes.byref(si), ctypes.byref(pi))
if not res:
- raise ctypes.WinError()
+ raise ctypes.WinError
return pi.dwProcessId
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -304,7 +304,7 @@ def termwidth():
def groupmembers(name):
# Don't support groups on Windows for now
- raise KeyError()
+ raise KeyError
def isexec(f):
return False
diff --git a/tests/test-commandserver.py b/tests/test-commandserver.py
--- a/tests/test-commandserver.py
+++ b/tests/test-commandserver.py
@@ -18,7 +18,7 @@ def writeblock(server, data):
def readchannel(server):
data = server.stdout.read(5)
if not data:
- raise EOFError()
+ raise EOFError
channel, length = struct.unpack('>cI', data)
if channel in 'IL':
return channel, length
More information about the Mercurial-devel
mailing list