Fix a bunch of indentation errors.
Maybe that whitespace merge flag was not so great an idea.
This commit is contained in:
parent
b2be63ec62
commit
7e8623f06f
|
@ -135,7 +135,7 @@ class SSHClient (object):
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
for hostname, keys in self._host_keys.items():
|
for hostname, keys in self._host_keys.items():
|
||||||
for keytype, key in keys.items():
|
for keytype, key in keys.items():
|
||||||
f.write('%s %s %s\n' % (hostname, keytype, key.get_base64()))
|
f.write('%s %s %s\n' % (hostname, keytype, key.get_base64()))
|
||||||
|
|
||||||
def get_host_keys(self):
|
def get_host_keys(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -86,20 +86,20 @@ class BufferedFile (object):
|
||||||
return
|
return
|
||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
def next(self):
|
def next(self):
|
||||||
"""
|
"""
|
||||||
Returns the next line from the input, or raises
|
Returns the next line from the input, or raises
|
||||||
`~exceptions.StopIteration` when EOF is hit. Unlike Python file
|
`~exceptions.StopIteration` when EOF is hit. Unlike Python file
|
||||||
objects, it's okay to mix calls to `next` and `readline`.
|
objects, it's okay to mix calls to `next` and `readline`.
|
||||||
|
|
||||||
:raises StopIteration: when the end of the file is reached.
|
:raises StopIteration: when the end of the file is reached.
|
||||||
|
|
||||||
:return: a line (`str`) read from the file.
|
:return: a line (`str`) read from the file.
|
||||||
"""
|
"""
|
||||||
line = self.readline()
|
line = self.readline()
|
||||||
if not line:
|
if not line:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
return line
|
return line
|
||||||
else:
|
else:
|
||||||
def __next__(self):
|
def __next__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -257,7 +257,7 @@ class Message (object):
|
||||||
self.packet.write(max_byte)
|
self.packet.write(max_byte)
|
||||||
self.add_string(util.deflate_long(n))
|
self.add_string(util.deflate_long(n))
|
||||||
else:
|
else:
|
||||||
self.packet.write(struct.pack('>I', n))
|
self.packet.write(struct.pack('>I', n))
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def add_int64(self, n):
|
def add_int64(self, n):
|
||||||
|
|
|
@ -253,8 +253,8 @@ class PKey (object):
|
||||||
:raises SSHException: if the key file is invalid.
|
:raises SSHException: if the key file is invalid.
|
||||||
"""
|
"""
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
data = self._read_private_key(tag, f, password)
|
data = self._read_private_key(tag, f, password)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _read_private_key(self, tag, f, password=None):
|
def _read_private_key(self, tag, f, password=None):
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|
|
@ -114,14 +114,14 @@ class ModulusPack (object):
|
||||||
"""
|
"""
|
||||||
self.pack = {}
|
self.pack = {}
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if (len(line) == 0) or (line[0] == '#'):
|
if (len(line) == 0) or (line[0] == '#'):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
self._parse_modulus(line)
|
self._parse_modulus(line)
|
||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def get_modulus(self, min, prefer, max):
|
def get_modulus(self, min, prefer, max):
|
||||||
bitsizes = sorted(self.pack.keys())
|
bitsizes = sorted(self.pack.keys())
|
||||||
|
|
|
@ -526,8 +526,8 @@ class SFTPClient(BaseSFTP):
|
||||||
Began returning rich attribute objects.
|
Began returning rich attribute objects.
|
||||||
"""
|
"""
|
||||||
with self.file(remotepath, 'wb') as fr:
|
with self.file(remotepath, 'wb') as fr:
|
||||||
fr.set_pipelined(True)
|
fr.set_pipelined(True)
|
||||||
size = 0
|
size = 0
|
||||||
while True:
|
while True:
|
||||||
data = fl.read(32768)
|
data = fl.read(32768)
|
||||||
fr.write(data)
|
fr.write(data)
|
||||||
|
@ -593,8 +593,8 @@ class SFTPClient(BaseSFTP):
|
||||||
Added the ``callable`` param.
|
Added the ``callable`` param.
|
||||||
"""
|
"""
|
||||||
with self.open(remotepath, 'rb') as fr:
|
with self.open(remotepath, 'rb') as fr:
|
||||||
file_size = self.stat(remotepath).st_size
|
file_size = self.stat(remotepath).st_size
|
||||||
fr.prefetch()
|
fr.prefetch()
|
||||||
size = 0
|
size = 0
|
||||||
while True:
|
while True:
|
||||||
data = fr.read(32768)
|
data = fr.read(32768)
|
||||||
|
|
|
@ -131,7 +131,7 @@ def bit_length(n):
|
||||||
try:
|
try:
|
||||||
return n.bitlength()
|
return n.bitlength()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
norm = deflate_long(n, 0)
|
norm = deflate_long(n, 0)
|
||||||
hbyte = byte_ord(norm[0])
|
hbyte = byte_ord(norm[0])
|
||||||
if hbyte == 0:
|
if hbyte == 0:
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in New Issue