Skip to content

Commit 70706a5

Browse files
committed
Fix pycodestyle issues.
1 parent 17cb979 commit 70706a5

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

lastpass/account.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def fields(self):
3232
def __str__(self):
3333
return "name: {}\n\tusername: {}\n\tpassword: {}\n\turl: {}\n\tgroup: {}\n\tnotes: {}".format(self.name, self.username, self.password, self.url, self.group, self.notes_string())
3434

35+
3536
class SecureNote(Account):
3637
"""
3738
Lastpass Secure Note
@@ -43,4 +44,4 @@ def __str__(self):
4344
try:
4445
return getattr(self, 'unparsed_notes_0').decode()
4546
except AttributeError:
46-
return '\n'.join( [ '\t\t{}: {}'.format(field, getattr(self, field).decode() ) for field in self.fields() ] )
47+
return '\n'.join(['\t\t{}: {}'.format(field, getattr(self, field).decode()) for field in self.fields()])

lastpass/fetcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def request_iteration_count(username, web_client=http):
6060

6161
try:
6262
count = int(response.content)
63-
except:
63+
except Exception:
6464
raise InvalidResponseError('Key iteration count is invalid')
6565

6666
if count > 0:

lastpass/parser.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
compress = zlib.compress
4444
decompress = zlib.decompress
4545

46+
4647
def extract_chunks(blob):
4748
"""Splits the blob into chucks grouped by kind."""
4849
chunks = []
@@ -150,7 +151,7 @@ def parse_secure_note_server(notes):
150151
info[last_field] = b''
151152
if last_field:
152153
old_bytes = info[last_field]
153-
info[last_field] = (old_bytes.decode()+'\n'+line.decode()).encode()
154+
info[last_field] = (old_bytes.decode() + '\n' + line.decode()).encode()
154155
continue
155156

156157
# Split only once so that strings like "Hostname:host.example.com:80"
@@ -242,6 +243,7 @@ def encode_base64(data):
242243
b64data = b64encode(data)
243244
return b64data
244245

246+
245247
def decode_aes256_plain_auto(data, encryption_key):
246248
"""Guesses AES cipher (EBC or CBD) from the length of the plain data."""
247249
assert isinstance(data, bytes)
@@ -324,16 +326,16 @@ def pad(data):
324326
if isinstance(data, str):
325327
try:
326328
data = str.encode(data, 'latin1')
327-
except:
329+
except Exception:
328330
data = bytes(data)
329331
if isinstance(padded, str):
330332
try:
331333
padded = str.encode(padded, 'latin1')
332-
except:
334+
except Exception:
333335
padded = bytes(data)
334336
try:
335337
result = bytes(data + padded)
336-
except:
338+
except Exception:
337339
result = data + padded
338340
return result
339341

@@ -346,10 +348,11 @@ def unpad(data):
346348
if isinstance(data, str):
347349
try:
348350
data = str.encode(data, 'latin1')
349-
except:
351+
except Exception:
350352
data = bytes(data)
351353
return data[0:-ord(data[-1:])]
352354

355+
353356
def decode_aes256(cipher, iv, data, encryption_key):
354357
"""
355358
Decrypt AES-256 bytes.

lastpass/vault.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from . import parser
44
from .exceptions import InvalidResponseError
55

6+
67
class Vault(object):
78
"""
89
Lastpass Vault

0 commit comments

Comments
 (0)