Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self,
host,
port,
filename,
output,
options,
packethook,
timeout,
localip = ""):
TftpContext.__init__(self,
host,
port,
timeout,
localip)
# FIXME: should we refactor setting of these params?
self.file_to_transfer = filename
self.options = options
self.packethook = packethook
self.filelike_fileobj = False
# If the output object has a write() function,
# assume it is file-like.
if hasattr(output, 'write'):
self.fileobj = output
self.filelike_fileobj = True
# If the output filename is -, then use stdout
elif output == '-':
def __init__(self,
host,
port,
timeout,
root,
dyn_file_func=None,
upload_open=None):
TftpContext.__init__(self,
host,
port,
timeout,
)
# At this point we have no idea if this is a download or an upload. We
# need to let the start state determine that.
self.state = TftpStateServerStart(self)
self.root = root
self.dyn_file_func = dyn_file_func
self.upload_open = upload_open
def __init__(self,
host,
port,
filename,
output,
options,
packethook,
timeout,
localip = ""):
TftpContext.__init__(self,
host,
port,
timeout,
localip)
# FIXME: should we refactor setting of these params?
self.file_to_transfer = filename
self.options = options
self.packethook = packethook
self.filelike_fileobj = False
# If the output object has a write() function,
# assume it is file-like.
if hasattr(output, 'write'):
self.fileobj = output
self.filelike_fileobj = True
# If the output filename is -, then use stdout
elif output == '-':
def __init__(self,
host,
port,
filename,
input,
options,
packethook,
timeout,
localip = ""):
TftpContext.__init__(self,
host,
port,
timeout,
localip)
self.file_to_transfer = filename
self.options = options
self.packethook = packethook
# If the input object has a read() function,
# assume it is file-like.
if hasattr(input, 'read'):
self.fileobj = input
elif input == '-':
self.fileobj = sys.stdin
else:
self.fileobj = open(input, "rb")
def __init__(self,
host,
port,
filename,
input,
options,
packethook,
timeout,
localip = ""):
TftpContext.__init__(self,
host,
port,
timeout,
localip)
self.file_to_transfer = filename
self.options = options
self.packethook = packethook
# If the input object has a read() function,
# assume it is file-like.
if hasattr(input, 'read'):
self.fileobj = input
elif input == '-':
self.fileobj = sys.stdin
else:
self.fileobj = open(input, "rb")
def __init__(self,
host,
port,
timeout,
root,
dyn_file_func=None,
upload_open=None):
TftpContext.__init__(self,
host,
port,
timeout,
)
# At this point we have no idea if this is a download or an upload. We
# need to let the start state determine that.
self.state = TftpStateServerStart(self)
self.root = root
self.dyn_file_func = dyn_file_func
self.upload_open = upload_open