python3: KeyError to use format

Changes KeyError signatures to use `format` instead of `%`

partial: https://github.com/vmware/pyvmomi/issues/55
This commit is contained in:
Shawn Hartsock
2014-07-30 16:38:26 -04:00
parent 297302c5a1
commit c84a6a9afb

View File

@@ -991,7 +991,7 @@ def _SetWsdlType(ns, wsdlName, typ):
# @return type if found else throws KeyError # @return type if found else throws KeyError
def GetWsdlType(ns, name): def GetWsdlType(ns, name):
if ns is None or name is None: if ns is None or name is None:
raise KeyError("%s %s" % (ns, name)) raise KeyError("{0} {1}".format(ns, name))
with _lazyLock: with _lazyLock:
# Check if the type is loaded in the map # Check if the type is loaded in the map
@@ -1003,14 +1003,14 @@ def GetWsdlType(ns, name):
try: try:
return GetWsdlType(ns, name[7:]).Array return GetWsdlType(ns, name[7:]).Array
except KeyError: except KeyError:
raise KeyError("%s %s" % (ns, name)) raise KeyError("{0} {1}".format(ns, name))
else: else:
# Type is not loaded yet, load it # Type is not loaded yet, load it
typ = _LoadVmodlType(_wsdlDefMap[(ns, name)][0]) typ = _LoadVmodlType(_wsdlDefMap[(ns, name)][0])
if typ: if typ:
return typ return typ
raise KeyError("%s %s" % (ns, name)) raise KeyError("{0} {1}".format(ns, name))
## Guess the type from wsdlname with no ns ## Guess the type from wsdlname with no ns
# WARNING! This should not be used in general, as there is no guarantee for # WARNING! This should not be used in general, as there is no guarantee for
@@ -1203,7 +1203,7 @@ def GetWsdlMethod(ns, wsdlName):
LoadManagedType(*method) LoadManagedType(*method)
return _wsdlMethodMap[(ns, wsdlName)] return _wsdlMethodMap[(ns, wsdlName)]
else: else:
raise KeyError("%s %s" % (ns, name)) raise KeyError("{0} {1}".format(ns, name))
## Guess the method from wsdlname with no ns ## Guess the method from wsdlname with no ns
# WARNING! This should not be used in general, as there is no guarantee for # WARNING! This should not be used in general, as there is no guarantee for