style: use .format() in various places instead of "%" formatting
diff --git a/serial/__init__.py b/serial/__init__.py
index 2d2237b..049cff1 100644
--- a/serial/__init__.py
+++ b/serial/__init__.py
@@ -30,7 +30,7 @@
elif os.name == 'java':
from serial.serialjava import Serial
else:
- raise ImportError("Sorry: no implementation for your platform ('%s') available" % (os.name,))
+ raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
protocol_handler_packages = [
@@ -66,7 +66,7 @@
# if it is an URL, try to import the handler module from the list of possible packages
if '://' in url_lowercase:
protocol = url_lowercase.split('://', 1)[0]
- module_name = '.protocol_%s' % (protocol,)
+ module_name = '.protocol_{}'.format(protocol)
for package_name in protocol_handler_packages:
try:
importlib.import_module(package_name)
@@ -80,7 +80,7 @@
klass = handler_module.Serial
break
else:
- raise ValueError('invalid URL, protocol %r not known' % (protocol,))
+ raise ValueError('invalid URL, protocol {!r} not known'.format(protocol))
# instantiate and open when desired
instance = klass(None, *args, **kwargs)
instance.port = url