summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Vézina <ml.richard.vezina@gmail.com>2021-10-15 22:16:35 -0400
committerRichard Vézina <ml.richard.vezina@gmail.com>2021-10-15 22:16:35 -0400
commit760a43bf5829f4ad84afe8736ccd183c672e1841 (patch)
tree8cb15a0f6c7544d85c85632e1143f77850a4559c
parente0cccb9a305352b0c078bfcdfaaf873facdf6c50 (diff)
downloadtftpy-760a43bf5829f4ad84afe8736ccd183c672e1841.tar.gz
Enhance PEP8
-rw-r--r--tftpy/TftpShared.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tftpy/TftpShared.py b/tftpy/TftpShared.py
index 7f618e9..452870c 100644
--- a/tftpy/TftpShared.py
+++ b/tftpy/TftpShared.py
@@ -2,8 +2,6 @@
# -*- coding: utf8 -*-
"""This module holds all objects shared by all other modules in tftpy."""
-
-
MIN_BLKSIZE = 8
DEF_BLKSIZE = 512
MAX_BLKSIZE = 65536
@@ -15,6 +13,7 @@ DEF_TFTP_PORT = 69
# A hook for deliberately introducing delay in testing.
DELAY_BLOCK = 0
+
def tftpassert(condition, msg):
"""This function is a simple utility that will check the condition
passed for a false state. If it finds one, it throws a TftpException
@@ -23,6 +22,7 @@ def tftpassert(condition, msg):
if not condition:
raise TftpException(msg)
+
class TftpErrors(object):
"""This class is a convenience for defining the common tftp error codes,
and making them more readable in the code."""
@@ -36,16 +36,19 @@ class TftpErrors(object):
NoSuchUser = 7
FailedNegotiation = 8
+
class TftpException(Exception):
"""This class is the parent class of all exceptions regarding the handling
of the TFTP protocol."""
pass
+
class TftpTimeout(TftpException):
"""This class represents a timeout error waiting for a response from the
other end."""
pass
+
class TftpFileNotFoundError(TftpException):
"""This class represents an error condition where we received a file
not found error."""