style: some of the suggestions from flake8 and pylint
diff --git a/serial/serialposix.py b/serial/serialposix.py
index 7e432c7..c920cbe 100644
--- a/serial/serialposix.py
+++ b/serial/serialposix.py
@@ -12,6 +12,7 @@
 #
 # references: http://www.easysw.com/~mike/serial/serial.html
 
+# pylint: disable=abstract-method
 import errno
 import fcntl
 import os
@@ -436,9 +437,9 @@
         # activate settings
         if force_update or [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] != orig_attr:
             termios.tcsetattr(
-                    self.fd,
-                    termios.TCSANOW,
-                    [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
+                self.fd,
+                termios.TCSANOW,
+                [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
 
         # apply custom baud rate, if any
         if custom_baud is not None:
diff --git a/serial/serialutil.py b/serial/serialutil.py
index 7338b09..3474d93 100644
--- a/serial/serialutil.py
+++ b/serial/serialutil.py
@@ -34,10 +34,10 @@
     """Iterate over bytes, returning bytes instead of ints (python3)"""
     if isinstance(b, memoryview):
         b = b.tobytes()
-    x = 0
+    i = 0
     while True:
-        a = b[x:x + 1]
-        x += 1
+        a = b[i:i + 1]
+        i += 1
         if a:
             yield a
         else:
@@ -126,8 +126,7 @@
                  write_timeout=None,
                  dsrdtr=False,
                  inter_byte_timeout=None,
-                 **kwargs
-                 ):
+                 **kwargs):
         """\
         Initialize comm port object. If a "port" is given, then the port will be
         opened immediately. Otherwise a Serial port object in closed state
@@ -135,6 +134,8 @@
         """
 
         self.is_open = False
+        self.portstr = None
+        self.name = None
         # correct values are assigned below through properties
         self._port = None
         self._baudrate = None
@@ -464,6 +465,7 @@
 
     #  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
     # compatibility with io library
+    # pylint: disable=invalid-name,missing-docstring
 
     def readable(self):
         return True
@@ -510,7 +512,6 @@
 
     #  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
     # backwards compatibility / deprecated functions
-    # pylint: disable=invalid-name,missing-docstring
 
     def flushInput(self):
         self.reset_input_buffer()
diff --git a/serial/serialwin32.py b/serial/serialwin32.py
index ade659e..e2fe7f3 100644
--- a/serial/serialwin32.py
+++ b/serial/serialwin32.py
@@ -55,13 +55,13 @@
             # for like COMnotanumber
             pass
         self._port_handle = win32.CreateFile(
-                port,
-                win32.GENERIC_READ | win32.GENERIC_WRITE,
-                0,  # exclusive access
-                None,  # no security
-                win32.OPEN_EXISTING,
-                win32.FILE_ATTRIBUTE_NORMAL | win32.FILE_FLAG_OVERLAPPED,
-                0)
+            port,
+            win32.GENERIC_READ | win32.GENERIC_WRITE,
+            0,  # exclusive access
+            None,  # no security
+            win32.OPEN_EXISTING,
+            win32.FILE_ATTRIBUTE_NORMAL | win32.FILE_FLAG_OVERLAPPED,
+            0)
         if self._port_handle == win32.INVALID_HANDLE_VALUE:
             self._port_handle = None    # 'cause __del__ is called anyway
             raise SerialException("could not open port %r: %r" % (self.portstr, ctypes.WinError()))
@@ -85,9 +85,9 @@
             # Clear buffers:
             # Remove anything that was there
             win32.PurgeComm(
-                    self._port_handle,
-                    win32.PURGE_TXCLEAR | win32.PURGE_TXABORT |
-                    win32.PURGE_RXCLEAR | win32.PURGE_RXABORT)
+                self._port_handle,
+                win32.PURGE_TXCLEAR | win32.PURGE_TXABORT |
+                win32.PURGE_RXCLEAR | win32.PURGE_RXABORT)
         except:
             try:
                 self._close()
@@ -277,18 +277,18 @@
                 buf = ctypes.create_string_buffer(n)
                 rc = win32.DWORD()
                 read_ok = win32.ReadFile(
-                        self._port_handle,
-                        buf,
-                        n,
-                        ctypes.byref(rc),
-                        ctypes.byref(self._overlapped_read))
+                    self._port_handle,
+                    buf,
+                    n,
+                    ctypes.byref(rc),
+                    ctypes.byref(self._overlapped_read))
                 if not read_ok and win32.GetLastError() not in (win32.ERROR_SUCCESS, win32.ERROR_IO_PENDING):
                     raise SerialException("ReadFile failed (%r)" % ctypes.WinError())
                 win32.GetOverlappedResult(
-                        self._port_handle,
-                        ctypes.byref(self._overlapped_read),
-                        ctypes.byref(rc),
-                        True)
+                    self._port_handle,
+                    ctypes.byref(self._overlapped_read),
+                    ctypes.byref(rc),
+                    True)
                 read = buf.raw[:rc.value]
             else:
                 read = bytes()
diff --git a/serial/urlhandler/protocol_alt.py b/serial/urlhandler/protocol_alt.py
index af1646a..e33144e 100644
--- a/serial/urlhandler/protocol_alt.py
+++ b/serial/urlhandler/protocol_alt.py
@@ -16,19 +16,21 @@
 #   use poll based implementation on Posix (Linux):
 #   python -m serial.tools.miniterm alt:///dev/ttyUSB0?class=PosixPollSerial
 
-import serial
-
 try:
     import urlparse
 except ImportError:
     import urllib.parse as urlparse
 
+import serial
+
 
 def serial_class_for_url(url):
     """extract host and port from an URL string"""
     parts = urlparse.urlsplit(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,))
+        raise serial.SerialException(
+            'expected a string in the form "alt://port[?option[=value][&option[=value]]]": '
+            'not starting with alt:// (%r)' % (parts.scheme,))
     class_name = 'Serial'
     try:
         for option, values in urlparse.parse_qs(parts.query, True).items():
@@ -37,7 +39,9 @@
             else:
                 raise ValueError('unknown option: %r' % (option,))
     except ValueError as e:
-        raise serial.SerialException('expected a string in the form "alt://port[?option[=value][&option[=value]]]": %s' % e)
+        raise serial.SerialException(
+            'expected a string in the form '
+            '"alt://port[?option[=value][&option[=value]]]": %s' % e)
     if not hasattr(serial, class_name):
         raise ValueError('unknown class: %r' % (class_name,))
     cls = getattr(serial, class_name)
diff --git a/serial/urlhandler/protocol_spy.py b/serial/urlhandler/protocol_spy.py
index 55563f9..4921990 100644
--- a/serial/urlhandler/protocol_spy.py
+++ b/serial/urlhandler/protocol_spy.py
@@ -80,18 +80,21 @@
         self.tx_color = '\x1b[31m'
 
     def rx(self, data):
+        """show received data"""
         if self.color:
             self.output.write(self.rx_color)
         self.output.write(data)
         self.output.flush()
 
     def tx(self, data):
+        """show transmitted data"""
         if self.color:
             self.output.write(self.tx_color)
         self.output.write(data)
         self.output.flush()
 
     def control(self, name, value):
+        """(do not) show control calls"""
         pass
 
 
@@ -123,6 +126,7 @@
         self.output.flush()
 
     def rx(self, data):
+        """show received data as hex dump"""
         if self.color:
             self.output.write(self.rx_color)
         if data:
@@ -132,12 +136,14 @@
             self.write_line(time.time() - self.start_time, 'RX', '<empty>')
 
     def tx(self, data):
+        """show transmitted data as hex dump"""
         if self.color:
             self.output.write(self.tx_color)
         for offset, row in hexdump(data):
             self.write_line(time.time() - self.start_time, 'TX', '{:04X}  '.format(offset), row)
 
     def control(self, name, value):
+        """show control calls"""
         if self.color:
             self.output.write(self.control_color)
         self.write_line(time.time() - self.start_time, name, value)
@@ -262,6 +268,6 @@
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 if __name__ == '__main__':
-    s = Serial(None)
-    s.port = 'spy:///dev/ttyS0'
-    print(s)
+    ser = Serial(None)
+    ser.port = 'spy:///dev/ttyS0'
+    print(ser)
diff --git a/serial/win32.py b/serial/win32.py
index e7d625a..43caae1 100644
--- a/serial/win32.py
+++ b/serial/win32.py
@@ -7,7 +7,8 @@
 #
 # SPDX-License-Identifier:    BSD-3-Clause
 
-# pylint: disable=invalid-name,too-few-public-methods
+# pylint: disable=invalid-name,too-few-public-methods,protected-access,too-many-instance-attributes
+
 from ctypes import c_ulong, c_void_p, c_int64, c_char, \
                    WinDLL, sizeof, Structure, Union, POINTER
 from ctypes.wintypes import HANDLE