mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-25 22:36:13 +01:00
User super() instead of referencing parent classes explicitly
This commit is contained in:
parent
1442a55c96
commit
3296fd8d89
@ -93,7 +93,7 @@ class SectionLine(Line):
|
|||||||
CommentLine() or OptionLine() instances.
|
CommentLine() or OptionLine() instances.
|
||||||
"""
|
"""
|
||||||
def __init__(self, sectname):
|
def __init__(self, sectname):
|
||||||
Line.__init__(self, sectname, 'section')
|
super().__init__(sectname, 'section')
|
||||||
self._lines = []
|
self._lines = []
|
||||||
|
|
||||||
def _find(self, name):
|
def _find(self, name):
|
||||||
@ -155,7 +155,7 @@ class SectionLine(Line):
|
|||||||
class CommentLine(Line):
|
class CommentLine(Line):
|
||||||
"""Store a commentline"""
|
"""Store a commentline"""
|
||||||
def __init__(self, line):
|
def __init__(self, line):
|
||||||
Line.__init__(self, line.strip('\n'), 'comment')
|
super().__init__(line.strip('\n'), 'comment')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@ -176,7 +176,7 @@ class OptionLine(Line):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, optname, line):
|
def __init__(self, optname, line):
|
||||||
Line.__init__(self, optname, 'option')
|
super().__init__(optname, 'option')
|
||||||
self.name = optname
|
self.name = optname
|
||||||
self.format(line)
|
self.format(line)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import rpm
|
|||||||
|
|
||||||
class KeyError(Exception):
|
class KeyError(Exception):
|
||||||
def __init__(self, key, *args):
|
def __init__(self, key, *args):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.args = args
|
self.args = args
|
||||||
self.key = key
|
self.key = key
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -2569,7 +2569,7 @@ class ReviewState(AbstractState):
|
|||||||
if not review_node.get('state'):
|
if not review_node.get('state'):
|
||||||
raise oscerr.APIError('invalid review node (state attr expected): %s' % \
|
raise oscerr.APIError('invalid review node (state attr expected): %s' % \
|
||||||
ET.tostring(review_node, encoding=ET_ENCODING))
|
ET.tostring(review_node, encoding=ET_ENCODING))
|
||||||
AbstractState.__init__(self, review_node.tag)
|
super().__init__(review_node.tag)
|
||||||
self.state = review_node.get('state')
|
self.state = review_node.get('state')
|
||||||
self.by_user = review_node.get('by_user')
|
self.by_user = review_node.get('by_user')
|
||||||
self.by_group = review_node.get('by_group')
|
self.by_group = review_node.get('by_group')
|
||||||
@ -2597,7 +2597,7 @@ class RequestHistory(AbstractState):
|
|||||||
re_name = re.compile(r'^Request (?:got )?([^\s]+)$')
|
re_name = re.compile(r'^Request (?:got )?([^\s]+)$')
|
||||||
|
|
||||||
def __init__(self, history_node):
|
def __init__(self, history_node):
|
||||||
AbstractState.__init__(self, history_node.tag)
|
super().__init__(history_node.tag)
|
||||||
self.who = history_node.get('who')
|
self.who = history_node.get('who')
|
||||||
self.when = history_node.get('when')
|
self.when = history_node.get('when')
|
||||||
if not history_node.find('description') is None and \
|
if not history_node.find('description') is None and \
|
||||||
@ -2639,7 +2639,7 @@ class RequestState(AbstractState):
|
|||||||
if not state_node.get('name'):
|
if not state_node.get('name'):
|
||||||
raise oscerr.APIError('invalid request state node (name attr expected): %s' % \
|
raise oscerr.APIError('invalid request state node (name attr expected): %s' % \
|
||||||
ET.tostring(state_node, encoding=ET_ENCODING))
|
ET.tostring(state_node, encoding=ET_ENCODING))
|
||||||
AbstractState.__init__(self, state_node.tag)
|
super().__init__(state_node.tag)
|
||||||
self.name = state_node.get('name')
|
self.name = state_node.get('name')
|
||||||
self.who = state_node.get('who')
|
self.who = state_node.get('who')
|
||||||
self.when = state_node.get('when')
|
self.when = state_node.get('when')
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
class OscBaseError(Exception):
|
class OscBaseError(Exception):
|
||||||
def __init__(self, args=()):
|
def __init__(self, args=()):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.args = args
|
self.args = args
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return ''.join(self.args)
|
return ''.join(self.args)
|
||||||
@ -18,7 +18,7 @@ class UserAbort(OscBaseError):
|
|||||||
class ConfigError(OscBaseError):
|
class ConfigError(OscBaseError):
|
||||||
"""Exception raised when there is an error in the config file"""
|
"""Exception raised when there is an error in the config file"""
|
||||||
def __init__(self, msg, fname):
|
def __init__(self, msg, fname):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.file = fname
|
self.file = fname
|
||||||
|
|
||||||
@ -28,24 +28,24 @@ class ConfigError(OscBaseError):
|
|||||||
class ConfigMissingApiurl(ConfigError):
|
class ConfigMissingApiurl(ConfigError):
|
||||||
"""Exception raised when a apiurl does not exist in the config file"""
|
"""Exception raised when a apiurl does not exist in the config file"""
|
||||||
def __init__(self, msg, fname, url):
|
def __init__(self, msg, fname, url):
|
||||||
ConfigError.__init__(self, msg, fname)
|
super().__init__(msg, fname)
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
class ConfigMissingCredentialsError(ConfigError):
|
class ConfigMissingCredentialsError(ConfigError):
|
||||||
def __init__(self, msg, fname, url):
|
def __init__(self, msg, fname, url):
|
||||||
ConfigError.__init__(self, msg, fname)
|
super().__init__(msg, fname)
|
||||||
self.url = url
|
self.url = url
|
||||||
|
|
||||||
class APIError(OscBaseError):
|
class APIError(OscBaseError):
|
||||||
"""Exception raised when there is an error in the output from the API"""
|
"""Exception raised when there is an error in the output from the API"""
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class NoConfigfile(OscBaseError):
|
class NoConfigfile(OscBaseError):
|
||||||
"""Exception raised when osc's configfile cannot be found"""
|
"""Exception raised when osc's configfile cannot be found"""
|
||||||
def __init__(self, fname, msg):
|
def __init__(self, fname, msg):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.file = fname
|
self.file = fname
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
@ -55,14 +55,14 @@ class NoConfigfile(OscBaseError):
|
|||||||
class ExtRuntimeError(OscBaseError):
|
class ExtRuntimeError(OscBaseError):
|
||||||
"""Exception raised when there is a runtime error of an external tool"""
|
"""Exception raised when there is a runtime error of an external tool"""
|
||||||
def __init__(self, msg, fname):
|
def __init__(self, msg, fname):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.file = fname
|
self.file = fname
|
||||||
|
|
||||||
class ServiceRuntimeError(OscBaseError):
|
class ServiceRuntimeError(OscBaseError):
|
||||||
"""Exception raised when the execution of a source service failed"""
|
"""Exception raised when the execution of a source service failed"""
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class WrongArgs(OscBaseError):
|
class WrongArgs(OscBaseError):
|
||||||
@ -98,26 +98,26 @@ class WorkingCopyOutdated(OscBaseError):
|
|||||||
class PackageError(OscBaseError):
|
class PackageError(OscBaseError):
|
||||||
"""Base class for all Package related exceptions"""
|
"""Base class for all Package related exceptions"""
|
||||||
def __init__(self, prj, pac):
|
def __init__(self, prj, pac):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.prj = prj
|
self.prj = prj
|
||||||
self.pac = pac
|
self.pac = pac
|
||||||
|
|
||||||
class WorkingCopyInconsistent(PackageError):
|
class WorkingCopyInconsistent(PackageError):
|
||||||
"""Exception raised when the working copy is in an inconsistent state"""
|
"""Exception raised when the working copy is in an inconsistent state"""
|
||||||
def __init__(self, prj, pac, dirty_files, msg):
|
def __init__(self, prj, pac, dirty_files, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.dirty_files = dirty_files
|
self.dirty_files = dirty_files
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class LinkExpandError(PackageError):
|
class LinkExpandError(PackageError):
|
||||||
"""Exception raised when source link expansion fails"""
|
"""Exception raised when source link expansion fails"""
|
||||||
def __init__(self, prj, pac, msg):
|
def __init__(self, prj, pac, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class OscIOError(OscBaseError):
|
class OscIOError(OscBaseError):
|
||||||
def __init__(self, e, msg):
|
def __init__(self, e, msg):
|
||||||
OscBaseError.__init__(self)
|
super().__init__()
|
||||||
self.e = e
|
self.e = e
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ class PackageNotInstalled(OscBaseError):
|
|||||||
Exception raised when a package is not installed on local system
|
Exception raised when a package is not installed on local system
|
||||||
"""
|
"""
|
||||||
def __init__(self, pkg):
|
def __init__(self, pkg):
|
||||||
OscBaseError.__init__(self, (pkg,))
|
super().__init__((pkg,))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Package %s is required for this operation' % self.args
|
return 'Package %s is required for this operation' % self.args
|
||||||
@ -155,7 +155,7 @@ class PackageExists(PackageError):
|
|||||||
Exception raised when a local object already exists
|
Exception raised when a local object already exists
|
||||||
"""
|
"""
|
||||||
def __init__(self, prj, pac, msg):
|
def __init__(self, prj, pac, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class PackageMissing(PackageError):
|
class PackageMissing(PackageError):
|
||||||
@ -163,7 +163,7 @@ class PackageMissing(PackageError):
|
|||||||
Exception raised when a local object doesn't exist
|
Exception raised when a local object doesn't exist
|
||||||
"""
|
"""
|
||||||
def __init__(self, prj, pac, msg):
|
def __init__(self, prj, pac, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class PackageFileConflict(PackageError):
|
class PackageFileConflict(PackageError):
|
||||||
@ -172,12 +172,12 @@ class PackageFileConflict(PackageError):
|
|||||||
Conflict doesn't mean an unsuccessfull merge in this context.
|
Conflict doesn't mean an unsuccessfull merge in this context.
|
||||||
"""
|
"""
|
||||||
def __init__(self, prj, pac, file, msg):
|
def __init__(self, prj, pac, file, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.file = file
|
self.file = file
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
class PackageInternalError(PackageError):
|
class PackageInternalError(PackageError):
|
||||||
def __init__(self, prj, pac, msg):
|
def __init__(self, prj, pac, msg):
|
||||||
PackageError.__init__(self, prj, pac)
|
super().__init__(prj, pac)
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
# vim: sw=4 et
|
# vim: sw=4 et
|
||||||
|
@ -28,7 +28,7 @@ if not hasattr(os, 'SEEK_SET'):
|
|||||||
class ArError(Exception):
|
class ArError(Exception):
|
||||||
"""Base class for all ar related errors"""
|
"""Base class for all ar related errors"""
|
||||||
def __init__(self, fn, msg):
|
def __init__(self, fn, msg):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.file = fn
|
self.file = fn
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class ArHdr:
|
|||||||
class ArFile(BytesIO):
|
class ArFile(BytesIO):
|
||||||
"""Represents a file which resides in the archive"""
|
"""Represents a file which resides in the archive"""
|
||||||
def __init__(self, fn, uid, gid, mode, buf):
|
def __init__(self, fn, uid, gid, mode, buf):
|
||||||
BytesIO.__init__(self, buf)
|
super().__init__(buf)
|
||||||
self.name = fn
|
self.name = fn
|
||||||
self.uid = uid
|
self.uid = uid
|
||||||
self.gid = gid
|
self.gid = gid
|
||||||
|
@ -30,7 +30,7 @@ if not hasattr(os, 'SEEK_SET'):
|
|||||||
class CpioError(Exception):
|
class CpioError(Exception):
|
||||||
"""base class for all cpio related errors"""
|
"""base class for all cpio related errors"""
|
||||||
def __init__(self, fn, msg):
|
def __init__(self, fn, msg):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.file = fn
|
self.file = fn
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -4,7 +4,7 @@ from .helper import decode_it
|
|||||||
class PackageError(Exception):
|
class PackageError(Exception):
|
||||||
"""base class for all package related errors"""
|
"""base class for all package related errors"""
|
||||||
def __init__(self, fname, msg):
|
def __init__(self, fname, msg):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.fname = fname
|
self.fname = fname
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ def xml_equal(actual, exp):
|
|||||||
class RequestWrongOrder(Exception):
|
class RequestWrongOrder(Exception):
|
||||||
"""raised if an unexpected request is issued to urllib2"""
|
"""raised if an unexpected request is issued to urllib2"""
|
||||||
def __init__(self, url, exp_url, method, exp_method):
|
def __init__(self, url, exp_url, method, exp_method):
|
||||||
Exception.__init__(self)
|
super().__init__()
|
||||||
self.url = url
|
self.url = url
|
||||||
self.exp_url = exp_url
|
self.exp_url = exp_url
|
||||||
self.method = method
|
self.method = method
|
||||||
|
@ -22,7 +22,7 @@ class TestInitPackage(OscTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
if os.path.exists(os.path.join(FIXTURES_DIR, 'osctest')):
|
if os.path.exists(os.path.join(FIXTURES_DIR, 'osctest')):
|
||||||
os.rmdir(os.path.join(FIXTURES_DIR, 'osctest'))
|
os.rmdir(os.path.join(FIXTURES_DIR, 'osctest'))
|
||||||
OscTestCase.tearDown(self)
|
super().tearDown()
|
||||||
|
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
"""initialize a package dir"""
|
"""initialize a package dir"""
|
||||||
|
@ -22,7 +22,7 @@ class TestInitProject(OscTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
if os.path.exists(os.path.join(FIXTURES_DIR, 'osctest')):
|
if os.path.exists(os.path.join(FIXTURES_DIR, 'osctest')):
|
||||||
os.rmdir(os.path.join(FIXTURES_DIR, 'osctest'))
|
os.rmdir(os.path.join(FIXTURES_DIR, 'osctest'))
|
||||||
OscTestCase.tearDown(self)
|
super().tearDown()
|
||||||
|
|
||||||
def test_simple(self):
|
def test_simple(self):
|
||||||
"""initialize a project dir"""
|
"""initialize a project dir"""
|
||||||
|
@ -18,7 +18,7 @@ class TestRequest(OscTestCase):
|
|||||||
return FIXTURES_DIR
|
return FIXTURES_DIR
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
OscTestCase.setUp(self, copytree=False)
|
super().setUp(copytree=False)
|
||||||
|
|
||||||
def test_createsr(self):
|
def test_createsr(self):
|
||||||
"""create a simple submitrequest"""
|
"""create a simple submitrequest"""
|
||||||
|
@ -12,7 +12,7 @@ def suite():
|
|||||||
|
|
||||||
class TestResults(OscTestCase):
|
class TestResults(OscTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
OscTestCase.setUp(self, copytree=False)
|
super().setUp(copytree=False)
|
||||||
|
|
||||||
def _get_fixtures_name(self):
|
def _get_fixtures_name(self):
|
||||||
return 'results_fixtures'
|
return 'results_fixtures'
|
||||||
|
@ -14,7 +14,7 @@ def suite():
|
|||||||
|
|
||||||
class TestSetLinkRev(OscTestCase):
|
class TestSetLinkRev(OscTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
OscTestCase.setUp(self, copytree=False)
|
super().setUp(copytree=False)
|
||||||
|
|
||||||
def _get_fixtures_dir(self):
|
def _get_fixtures_dir(self):
|
||||||
return FIXTURES_DIR
|
return FIXTURES_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user