diff options
author | Richard Vézina <ml.richard.vezina@gmail.com> | 2021-10-15 22:16:35 -0400 |
---|---|---|
committer | Richard Vézina <ml.richard.vezina@gmail.com> | 2021-10-15 22:16:35 -0400 |
commit | 760a43bf5829f4ad84afe8736ccd183c672e1841 (patch) | |
tree | 8cb15a0f6c7544d85c85632e1143f77850a4559c | |
parent | e0cccb9a305352b0c078bfcdfaaf873facdf6c50 (diff) | |
download | tftpy-760a43bf5829f4ad84afe8736ccd183c672e1841.tar.gz |
Enhance PEP8
-rw-r--r-- | tftpy/TftpShared.py | 7 |
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.""" |