Skip to content

Commit

Permalink
python3: KeyError to use format
Browse files Browse the repository at this point in the history
Changes KeyError signatures to use `format` instead of `%`

partial: vmware#55
  • Loading branch information
hartsock committed Jul 30, 2014
1 parent 297302c commit c84a6a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pyVmomi/VmomiSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ def _SetWsdlType(ns, wsdlName, typ):
# @return type if found else throws KeyError
def GetWsdlType(ns, name):
if ns is None or name is None:
raise KeyError("%s %s" % (ns, name))
raise KeyError("{0} {1}".format(ns, name))

with _lazyLock:
# Check if the type is loaded in the map
Expand All @@ -1003,14 +1003,14 @@ def GetWsdlType(ns, name):
try:
return GetWsdlType(ns, name[7:]).Array
except KeyError:
raise KeyError("%s %s" % (ns, name))
raise KeyError("{0} {1}".format(ns, name))
else:
# Type is not loaded yet, load it
typ = _LoadVmodlType(_wsdlDefMap[(ns, name)][0])
if typ:
return typ

raise KeyError("%s %s" % (ns, name))
raise KeyError("{0} {1}".format(ns, name))

## Guess the type from wsdlname with no ns
# WARNING! This should not be used in general, as there is no guarantee for
Expand Down Expand Up @@ -1203,7 +1203,7 @@ def GetWsdlMethod(ns, wsdlName):
LoadManagedType(*method)
return _wsdlMethodMap[(ns, wsdlName)]
else:
raise KeyError("%s %s" % (ns, name))
raise KeyError("{0} {1}".format(ns, name))

## Guess the method from wsdlname with no ns
# WARNING! This should not be used in general, as there is no guarantee for
Expand Down

3 comments on commit c84a6a9

@joshk0
Copy link

@joshk0 joshk0 commented on c84a6a9 Jul 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it - though you could use singlequotes for these format strings, that's a tiny nit and not sure how that fits in to the style guide for this project overall.

@hartsock
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally I would just enforce pep8 style, but this project has its own unique style right now. I'm open to suggestions for establishing a style.

Edit:
NOTE - I don't want style based changes in this release.

@joshk0
Copy link

@joshk0 joshk0 commented on c84a6a9 Jul 31, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pep8 is the best way to go (least surprise) and we can take care of that all in one go when you are ready.

Please sign in to comment.