update file headers with license information (SPDX)
diff --git a/serial/urlhandler/protocol_hwgrep.py b/serial/urlhandler/protocol_hwgrep.py
index f7bf2e7..471f6d0 100644
--- a/serial/urlhandler/protocol_hwgrep.py
+++ b/serial/urlhandler/protocol_hwgrep.py
@@ -7,7 +7,8 @@
# find ports by searching the string descriptions.
#
# (C) 2011-2015 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
+#
+# SPDX-License-Identifier: BSD-3-Clause
#
# URL format: hwgrep://regexp
@@ -32,7 +33,8 @@
def fromURL(self, url):
"""extract host and port from an URL string"""
- if url.lower().startswith("hwgrep://"): url = url[9:]
+ if url.lower().startswith("hwgrep://"):
+ url = url[9:]
# use a for loop to get the 1st element from the generator
for port, desc, hwid in serial.tools.list_ports.grep(url):
return port
diff --git a/serial/urlhandler/protocol_loop.py b/serial/urlhandler/protocol_loop.py
index 6883b4c..756704b 100644
--- a/serial/urlhandler/protocol_loop.py
+++ b/serial/urlhandler/protocol_loop.py
@@ -9,7 +9,8 @@
# and it was so easy to implement ;-)
#
# (C) 2001-2015 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
+#
+# SPDX-License-Identifier: BSD-3-Clause
#
# URL format: loop://[option[/option...]]
# options:
diff --git a/serial/urlhandler/protocol_rfc2217.py b/serial/urlhandler/protocol_rfc2217.py
index 981ba45..fba67d5 100644
--- a/serial/urlhandler/protocol_rfc2217.py
+++ b/serial/urlhandler/protocol_rfc2217.py
@@ -6,6 +6,7 @@
# This is a thin wrapper to load the rfc2271 implementation.
#
# (C) 2011 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
+#
+# SPDX-License-Identifier: BSD-3-Clause
from serial.rfc2217 import Serial
diff --git a/serial/urlhandler/protocol_socket.py b/serial/urlhandler/protocol_socket.py
index 44702c3..4fe188d 100644
--- a/serial/urlhandler/protocol_socket.py
+++ b/serial/urlhandler/protocol_socket.py
@@ -11,22 +11,24 @@
# TCP/IP to serial port converters that do not support RFC 2217.
#
# (C) 2001-2015 Chris Liechti <cliechti@gmx.net>
-# this is distributed under a free software license, see license.txt
+#
+# SPDX-License-Identifier: BSD-3-Clause
#
# URL format: socket://<host>:<port>[/option[/option...]]
# options:
# - "debug" print diagnostic messages
-from serial.serialutil import *
-import time
-import socket
-import select
import logging
+import select
+import socket
+import time
try:
import urlparse
except ImportError:
import urllib.parse as urlparse
+from serial.serialutil import *
+
# map log level names to constants. used in fromURL()
LOGGER_LEVELS = {
'debug': logging.DEBUG,
@@ -271,7 +273,7 @@
sys.stdout.write('%s\n' % s)
sys.stdout.write("write...\n")
- s.write("hello\n")
+ s.write(b"hello\n")
s.flush()
sys.stdout.write("read: %s\n" % s.read(5))