summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Vézina <ml.richard.vezina@gmail.com>2021-10-15 22:02:17 -0400
committerRichard Vézina <ml.richard.vezina@gmail.com>2021-10-15 22:02:17 -0400
commit0689910df4a918b3636faf6108c75bef7c8a4267 (patch)
tree1c1468ab1edb5f5d992ca76555d2f5ef4ea36864
parent4b136c1d59e40c136dc190ffb845c6405900bf41 (diff)
downloadtftpy-0689910df4a918b3636faf6108c75bef7c8a4267.tar.gz
Enhance PEP8
-rw-r--r--tftpy/TftpPacketTypes.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tftpy/TftpPacketTypes.py b/tftpy/TftpPacketTypes.py
index 3d3bdf8..d1361a6 100644
--- a/tftpy/TftpPacketTypes.py
+++ b/tftpy/TftpPacketTypes.py
@@ -11,12 +11,14 @@ from .TftpShared import *
log = logging.getLogger('tftpy.TftpPacketTypes')
+
class TftpSession(object):
"""This class is the base class for the tftp client and server. Any shared
code should be in this class."""
# FIXME: do we need this anymore?
pass
+
class TftpPacketWithOptions(object):
"""This class exists to permit some TftpPacket subclasses to share code
regarding options handling. It does not inherit from TftpPacket, as the
@@ -94,6 +96,7 @@ class TftpPacketWithOptions(object):
return options
+
class TftpPacket(object):
"""This class is the parent class of all tftp packet classes. It is an
abstract class, providing an interface, and should not be instantiated
@@ -120,6 +123,7 @@ class TftpPacket(object):
This is an abstract method."""
raise NotImplementedError("Abstract method")
+
class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
"""This class is a common parent class for the RRQ and WRQ packets, as
they share quite a bit of code."""
@@ -228,6 +232,7 @@ class TftpPacketInitial(TftpPacket, TftpPacketWithOptions):
log.debug("options dict is now %s", self.options)
return self
+
class TftpPacketRRQ(TftpPacketInitial):
"""
::
@@ -248,6 +253,7 @@ class TftpPacketRRQ(TftpPacketInitial):
s += '\n options = %s' % self.options
return s
+
class TftpPacketWRQ(TftpPacketInitial):
"""
::
@@ -268,6 +274,7 @@ class TftpPacketWRQ(TftpPacketInitial):
s += '\n options = %s' % self.options
return s
+
class TftpPacketDAT(TftpPacket):
"""
::
@@ -317,6 +324,7 @@ class TftpPacketDAT(TftpPacket):
log.debug("found %d bytes of data", len(self.data))
return self
+
class TftpPacketACK(TftpPacket):
"""
::
@@ -350,6 +358,7 @@ class TftpPacketACK(TftpPacket):
self.opcode, self.blocknumber)
return self
+
class TftpPacketERR(TftpPacket):
"""
::
@@ -408,7 +417,7 @@ class TftpPacketERR(TftpPacket):
return self
def decode(self):
- "Decode self.buffer, populating instance variables and return self."
+ """Decode self.buffer, populating instance variables and return self."""
buflen = len(self.buffer)
tftpassert(buflen >= 4, "malformed ERR packet, too short")
log.debug("Decoding ERR packet, length %s bytes", buflen)
@@ -428,6 +437,7 @@ class TftpPacketERR(TftpPacket):
% (self.errorcode, self.errmsg))
return self
+
class TftpPacketOACK(TftpPacket, TftpPacketWithOptions):
"""
::