]> Savannah Git Hosting - gnulib.git/commitdiff
error: formatting cleanup
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 9 Sep 2017 20:41:13 +0000 (23:41 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sat, 9 Sep 2017 20:41:13 +0000 (23:41 +0300)
pygnulib/error.py

index b577f0e119b39cd1ace71abb57d69d456493503d..87b71ffc57fa92a91a6f4fc0affd172fd213776b 100644 (file)
@@ -16,7 +16,7 @@ def type_assert(key, value, types):
                 typeset += [name]
             else:
                 typeset += [module + "." + name]
-        typeset = "{%s}" % ", ".join(set(typeset))
+        typeset = "{0}".format(", ".join(typeset))
         raise TypeError("{0}: {1} expected".format(key, typeset))
 
 
@@ -25,48 +25,42 @@ class AutoconfVersionError(Exception):
     """minimum supported autoconf version mismatch"""
     def __init__(self, version):
         fmt = "minimum supported autoconf version is %f"
-        message = fmt % version
-        super().__init__(message)
+        super().__init__(fmt.format(version))
 
 
 
 class M4BaseMismatchError(Exception):
     """<gnulib-comp.m4> is expected to contain gl_M4_BASE([m4base])"""
     def __init__(self, m4_base):
-        fmt = "<gnulib-comp.m4> is expected to contain gl_M4_BASE([%s])"
-        message = fmt % m4_base
-        super().__init__(message)
+        fmt = "<gnulib-comp.m4> is expected to contain gl_M4_BASE([{0}])"
+        super().__init__(fmt.format(m4_base))
 
 
 
 class ConditionalDependenciesUnavailableError(Exception):
     """conditional dependencies are not supported with tests"""
     def __init__(self):
-        message = "conditional dependencies are not supported with tests"
-        super().__init__(message)
+        super().__init__("conditional dependencies are not supported with tests")
 
 
 
 class IncompatibleLicenseError(Exception):
     """incompatible licenses on modules"""
     def __init__(self, modules):
-        fmt = "incompatible licenses on modules: %r"
-        message = fmt % modules
-        super().__init__(message)
+        fmt = "incompatible licenses on modules: {0}"
+        super().__init__(fmt.format(" ".join(modules)))
 
 
 
 class EmptyFileListError(Exception):
     """cannot process empty file list"""
     def __init__(self):
-        message = "cannot process empty file list"
-        super().__init__(message)
+        super().__init__("cannot process empty file list")
 
 
 
 class UnknownLicenseError(Exception):
     """module lacks a license"""
     def __init__(self, module):
-        fmt = "module lacks a license: %r"
-        message = fmt % module
-        super().__init__(message)
+        fmt = "module lacks a license: {0}"
+        super().__init__(fmt.format(module))