summaryrefslogtreecommitdiff
path: root/serial/urlhandler/protocol_alt.py
diff options
context:
space:
mode:
Diffstat (limited to 'serial/urlhandler/protocol_alt.py')
-rw-r--r--serial/urlhandler/protocol_alt.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/serial/urlhandler/protocol_alt.py b/serial/urlhandler/protocol_alt.py
index e33144e..c14a87e 100644
--- a/serial/urlhandler/protocol_alt.py
+++ b/serial/urlhandler/protocol_alt.py
@@ -30,23 +30,23 @@ def serial_class_for_url(url):
if parts.scheme != 'alt':
raise serial.SerialException(
'expected a string in the form "alt://port[?option[=value][&option[=value]]]": '
- 'not starting with alt:// (%r)' % (parts.scheme,))
+ 'not starting with alt:// ({!r})'.format(parts.scheme))
class_name = 'Serial'
try:
for option, values in urlparse.parse_qs(parts.query, True).items():
if option == 'class':
class_name = values[0]
else:
- raise ValueError('unknown option: %r' % (option,))
+ raise ValueError('unknown option: {!r}'.format(option))
except ValueError as e:
raise serial.SerialException(
'expected a string in the form '
- '"alt://port[?option[=value][&option[=value]]]": %s' % e)
+ '"alt://port[?option[=value][&option[=value]]]": {!r}'.format(e))
if not hasattr(serial, class_name):
- raise ValueError('unknown class: %r' % (class_name,))
+ raise ValueError('unknown class: {!r}'.format(class_name))
cls = getattr(serial, class_name)
if not issubclass(cls, serial.Serial):
- raise ValueError('class %r is not an instance of Serial' % (class_name,))
+ raise ValueError('class {!r} is not an instance of Serial'.format(class_name))
return (''.join([parts.netloc, parts.path]), cls)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -