Fixing some pyflakes complaints

master
Michael P. Soulier 2011-07-23 23:28:45 -04:00
parent add444006c
commit 40977c6f74
7 changed files with 8 additions and 8 deletions

View File

@ -19,3 +19,6 @@ tftpy-doc:
clean:
rm -rf dist src tftpy-doc* MANIFEST
flakes:
pyflakes bin/*.py tftpy/*.py

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys, logging, os
import sys, logging
from optparse import OptionParser
import tftpy

View File

@ -2,10 +2,9 @@
instance of the client, and then use its upload or download method. Logging is
performed via a standard logging object set in TftpShared."""
import time, types
import types
from TftpShared import *
from TftpPacketTypes import *
from TftpPacketFactory import TftpPacketFactory
from TftpContexts import TftpContextClientDownload, TftpContextClientUpload
class TftpClient(TftpSession):

View File

@ -155,7 +155,7 @@ class TftpContext(object):
something, and dispatch appropriate action to that response."""
try:
(buffer, (raddress, rport)) = self.sock.recvfrom(MAX_BLKSIZE)
except socket.timeout, err:
except socket.timeout:
log.warn("Timeout waiting for traffic, retrying...")
raise TftpTimeout, "Timed-out waiting for traffic"

View File

@ -44,7 +44,6 @@ class TftpPacketWithOptions(object):
"""This method decodes the section of the buffer that contains an
unknown number of options. It returns a dictionary of option names and
values."""
nulls = 0
format = "!"
options = {}

View File

@ -3,7 +3,7 @@ instance of the server, and then run the listen() method to listen for client
requests. Logging is performed via a standard logging object set in
TftpShared."""
import socket, os, re, time, random
import socket, os, time
import select
from TftpShared import *
from TftpPacketTypes import *
@ -94,7 +94,6 @@ class TftpServer(TftpSession):
log.debug("Read %d bytes" % len(buffer))
recvpkt = tftp_factory.parse(buffer)
# Forge a session key based on the client's IP and port,
# which should safely work through NAT.
key = "%s:%s" % (raddress, rport)

View File

@ -423,7 +423,7 @@ class TftpStateSentWRQ(TftpState):
log.info("Received OACK from server")
try:
self.handleOACK(pkt)
except TftpException, err:
except TftpException:
log.error("Failed to negotiate options")
self.sendError(TftpErrors.FailedNegotiation)
raise