aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-04-14 22:25:48 -0400
committerMike Frysinger <vapier@google.com>2021-04-14 22:26:14 -0400
commit95795d8710949b4108b9f0262c14d8d8daa216d0 (patch)
tree4fe2850d8b6f0d46408dcae2d878c8bdc4077445
parentbfa656d5880fc887fd5eba0d2fbabb1bd8faceb8 (diff)
downloadrepohooks-95795d8710949b4108b9f0262c14d8d8daa216d0.tar.gz
lint: clean up newer pylint warnings
Bug: None Test: `repo upload` doesn't flag anything Change-Id: I404e6694bf2ce9705f4aa96d9e4801780407e4df
-rw-r--r--rh/config.py14
-rw-r--r--rh/utils.py6
2 files changed, 10 insertions, 10 deletions
diff --git a/rh/config.py b/rh/config.py
index 2c7b4af..1eb93a7 100644
--- a/rh/config.py
+++ b/rh/config.py
@@ -66,7 +66,7 @@ class RawConfigParser(configparser.RawConfigParser):
def items(self, section=_UNSET, default=_UNSET):
"""Return a list of (key, value) tuples for the options in |section|."""
if section is _UNSET:
- return super(RawConfigParser, self).items()
+ return super().items()
try:
return configparser.RawConfigParser.items(self, section)
@@ -214,7 +214,7 @@ class PreUploadConfig(object):
self.custom_hook(hook)
except ValueError as e:
raise ValidationError('%s: hook "%s" command line is invalid: '
- '%s' % (self.source, hook, e))
+ '%s' % (self.source, hook, e)) from e
# Verify hook options are valid shell strings.
for hook in self.builtin_hooks:
@@ -222,7 +222,7 @@ class PreUploadConfig(object):
self.builtin_hook_option(hook)
except ValueError as e:
raise ValidationError('%s: hook options "%s" are invalid: %s' %
- (self.source, hook, e))
+ (self.source, hook, e)) from e
# Reject unknown tools.
valid_tools = set(rh.hooks.TOOL_PATHS.keys())
@@ -259,13 +259,13 @@ class PreUploadFile(PreUploadConfig):
Args:
path: The config file to load.
"""
- super(PreUploadFile, self).__init__(source=path)
+ super().__init__(source=path)
self.path = path
try:
self.config.read(path)
except configparser.ParsingError as e:
- raise ValidationError('%s: %s' % (path, e))
+ raise ValidationError('%s: %s' % (path, e)) from e
self._validate()
@@ -290,7 +290,7 @@ class LocalPreUploadFile(PreUploadFile):
FILENAME = 'PREUPLOAD.cfg'
def _validate(self):
- super(LocalPreUploadFile, self)._validate()
+ super()._validate()
# Reject Exclude Paths section for local config.
if self.config.has_section(self.BUILTIN_HOOKS_EXCLUDE_SECTION):
@@ -320,7 +320,7 @@ class PreUploadSettings(PreUploadConfig):
paths: The directories to look for config files.
global_paths: The directories to look for global config files.
"""
- super(PreUploadSettings, self).__init__()
+ super().__init__()
self.paths = []
for config in itertools.chain(
diff --git a/rh/utils.py b/rh/utils.py
index 96512ed..f59998c 100644
--- a/rh/utils.py
+++ b/rh/utils.py
@@ -66,7 +66,7 @@ class CompletedProcess(getattr(subprocess, 'CompletedProcess', object)):
self.stderr = stderr
self.returncode = returncode
else:
- super(CompletedProcess, self).__init__(
+ super().__init__(
args=args, returncode=returncode, stdout=stdout, stderr=stderr)
@property
@@ -99,7 +99,7 @@ class CalledProcessError(subprocess.CalledProcessError):
raise TypeError('exception must be an exception instance; got %r'
% (exception,))
- super(CalledProcessError, self).__init__(returncode, cmd, stdout)
+ super().__init__(returncode, cmd, stdout)
# The parent class will set |output|, so delete it.
del self.output
# TODO(vapier): When we're Python 3-only, delete this assignment as the
@@ -431,7 +431,7 @@ def run(cmd, redirect_stdout=False, redirect_stderr=False, cwd=None, input=None,
raise CalledProcessError(
result.returncode, result.cmd, msg=estr, exception=e,
stdout=ensure_text(result.stdout),
- stderr=ensure_text(result.stderr))
+ stderr=ensure_text(result.stderr)) from e
finally:
if proc is not None:
# Ensure the process is dead.