Merge "Fix H501 errors"

This commit is contained in:
Jenkins 2015-09-06 09:26:35 +00:00 committed by Gerrit Code Review
commit 75eb62d13e
2 changed files with 35 additions and 17 deletions

View File

@ -30,7 +30,8 @@ class DictKeysMismatch(object):
def describe(self): def describe(self):
return ('Keys in d1 and not d2: %(d1only)s.' return ('Keys in d1 and not d2: %(d1only)s.'
' Keys in d2 and not d1: %(d2only)s' % self.__dict__) ' Keys in d2 and not d1: %(d2only)s' %
{'d1only': self.d1only, 'd2only': self.d2only})
def get_details(self): def get_details(self):
return {} return {}
@ -43,8 +44,8 @@ class ValueMismatch(object):
self.v2 = v2 self.v2 = v2
def describe(self): def describe(self):
return ("Values do not match." return ("Values do not match. v1: %(v1)s v2: %(v2)s" %
" v1: %(v1)s v2: %(v2)s" % self.__dict__) {'v1': self.v1, 'v2': self.v2})
def get_details(self): def get_details(self):
return {} return {}
@ -59,7 +60,9 @@ class DictMismatch(object):
def describe(self): def describe(self):
return ("Dictionaries do not match at %(key)s." return ("Dictionaries do not match at %(key)s."
" d1: %(d1_value)s d2: %(d2_value)s" % self.__dict__) " d1: %(d1_value)s d2: %(d2_value)s" %
{'key': self.key, 'd1_value': self.d1_value,
'd2_value': self.d2_value})
def get_details(self): def get_details(self):
return {} return {}
@ -169,8 +172,8 @@ class ListMismatch(object):
self.l2 = l2 self.l2 = l2
def describe(self): def describe(self):
return ('Lists mismatch: L1=%(l1)s != ' return ('Lists mismatch: L1=%(l1)s != L2=%(l2)s' %
'L2=%(l2)s' % self.__dict__) {'l1': self.l1, 'l2': self.l2})
def get_details(self): def get_details(self):
return {} return {}
@ -183,8 +186,8 @@ class ListLengthMismatch(object):
self.l2 = l2 self.l2 = l2
def describe(self): def describe(self):
return ('Lists lengths mismatch: L1=%(l1)s != ' return ('Lists lengths mismatch: L1=%(l1)s != L2=%(l2)s' %
'L2=%(l2)s' % self.__dict__) {'l1': self.l1, 'l2': self.l2})
def get_details(self): def get_details(self):
return {} return {}
@ -301,7 +304,7 @@ class XMLMismatch(object):
self.actual = state.actual self.actual = state.actual
def describe(self): def describe(self):
return "%(path)s: XML does not match" % self.__dict__ return "%(path)s: XML does not match" % {'path': self.path}
def get_details(self): def get_details(self):
return { return {
@ -323,7 +326,10 @@ class XMLTagMismatch(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML tag mismatch at index %(idx)d: " return ("%(path)s: XML tag mismatch at index %(idx)d: "
"expected tag <%(expected_tag)s>; " "expected tag <%(expected_tag)s>; "
"actual tag <%(actual_tag)s>" % self.__dict__) "actual tag <%(actual_tag)s>" %
{'path': self.path, 'idx': self.idx,
'expected_tag': self.expected_tag,
'actual_tag': self.actual_tag})
class XMLAttrKeysMismatch(XMLMismatch): class XMLAttrKeysMismatch(XMLMismatch):
@ -338,7 +344,9 @@ class XMLAttrKeysMismatch(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML attributes mismatch: " return ("%(path)s: XML attributes mismatch: "
"keys only in expected: %(expected_only)s; " "keys only in expected: %(expected_only)s; "
"keys only in actual: %(actual_only)s" % self.__dict__) "keys only in actual: %(actual_only)s" %
{'path': self.path, 'expected_only': self.expected_only,
'actual_only': self.actual_only})
class XMLAttrValueMismatch(XMLMismatch): class XMLAttrValueMismatch(XMLMismatch):
@ -354,7 +362,10 @@ class XMLAttrValueMismatch(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML attribute value mismatch: " return ("%(path)s: XML attribute value mismatch: "
"expected value of attribute %(key)s: %(expected_value)r; " "expected value of attribute %(key)s: %(expected_value)r; "
"actual value: %(actual_value)r" % self.__dict__) "actual value: %(actual_value)r" %
{'path': self.path, 'key': self.key,
'expected_value': self.expected_value,
'actual_value': self.actual_value})
class XMLTextValueMismatch(XMLMismatch): class XMLTextValueMismatch(XMLMismatch):
@ -369,7 +380,9 @@ class XMLTextValueMismatch(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML text value mismatch: " return ("%(path)s: XML text value mismatch: "
"expected text value: %(expected_text)r; " "expected text value: %(expected_text)r; "
"actual value: %(actual_text)r" % self.__dict__) "actual value: %(actual_text)r" %
{'path': self.path, 'expected_text': self.expected_text,
'actual_text': self.actual_text})
class XMLUnexpectedChild(XMLMismatch): class XMLUnexpectedChild(XMLMismatch):
@ -383,7 +396,8 @@ class XMLUnexpectedChild(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML unexpected child element <%(tag)s> " return ("%(path)s: XML unexpected child element <%(tag)s> "
"present at index %(idx)d" % self.__dict__) "present at index %(idx)d" %
{'path': self.path, 'tag': self.tag, 'idx': self.idx})
class XMLExpectedChild(XMLMismatch): class XMLExpectedChild(XMLMismatch):
@ -397,7 +411,8 @@ class XMLExpectedChild(XMLMismatch):
def describe(self): def describe(self):
return ("%(path)s: XML expected child element <%(tag)s> " return ("%(path)s: XML expected child element <%(tag)s> "
"not present at index %(idx)d" % self.__dict__) "not present at index %(idx)d" %
{'path': self.path, 'tag': self.tag, 'idx': self.idx})
class XMLMatchState(object): class XMLMatchState(object):

View File

@ -131,7 +131,8 @@ class Server(object):
raise raise
(self.host, self.port) = self._socket.getsockname()[0:2] (self.host, self.port) = self._socket.getsockname()[0:2]
LOG.info(_("%(name)s listening on %(host)s:%(port)s") % self.__dict__) LOG.info(_("%(name)s listening on %(host)s:%(port)s"),
{'name': self.name, 'host': self.host, 'port': self.port})
def start(self): def start(self):
"""Start serving a WSGI application. """Start serving a WSGI application.
@ -195,7 +196,9 @@ class Server(object):
except Exception: except Exception:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.error(_("Failed to start %(name)s on %(host)s" LOG.error(_("Failed to start %(name)s on %(host)s"
":%(port)s with SSL support") % self.__dict__) ":%(port)s with SSL support"),
{'name': self.name, 'host': self.host,
'port': self.port})
wsgi_kwargs = { wsgi_kwargs = {
'func': eventlet.wsgi.server, 'func': eventlet.wsgi.server,