Skip to content

Commit f2c3b4f

Browse files
committed
Added flake8 as development dependency and fixed reported issues
1 parent 3c5ee59 commit f2c3b4f

File tree

8 files changed

+65
-15
lines changed

8 files changed

+65
-15
lines changed

poetry.lock

Lines changed: 52 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pytest = "^5.0"
4242
pytest-cov = "^2.7"
4343
tox = "^3.13"
4444
mypy = "^0.720"
45+
flake8 = "^3.7"
4546

4647

4748
[build-system]

rsa/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939

4040
__all__ = ["newkeys", "encrypt", "decrypt", "sign", "verify", 'PublicKey',
4141
'PrivateKey', 'DecryptionError', 'VerificationError',
42-
'compute_hash', 'sign_hash']
42+
'find_signature_hash', 'compute_hash', 'sign_hash']

rsa/_compat.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
"""Python compatibility wrappers."""
1818

19-
import itertools
20-
import sys
2119
from struct import pack
2220

2321

rsa/cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def keygen() -> None:
3737

3838
# Parse the CLI options
3939
parser = optparse.OptionParser(usage='usage: %prog [options] keysize',
40-
description='Generates a new RSA keypair of "keysize" bits.')
40+
description='Generates a new RSA keypair of "keysize" bits.')
4141

4242
parser.add_option('--pubout', type='string',
4343
help='Output filename for the public key. The public key is '
@@ -203,7 +203,7 @@ class EncryptOperation(CryptoOperation):
203203
operation_progressive = 'encrypting'
204204

205205
def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey,
206-
cli_args: Indexable=()):
206+
cli_args: Indexable = ()):
207207
"""Encrypts files."""
208208
assert isinstance(pub_key, rsa.key.PublicKey)
209209
return rsa.encrypt(indata, pub_key)
@@ -221,7 +221,7 @@ class DecryptOperation(CryptoOperation):
221221
key_class = rsa.PrivateKey
222222

223223
def perform_operation(self, indata: bytes, priv_key: rsa.key.AbstractKey,
224-
cli_args: Indexable=()):
224+
cli_args: Indexable = ()):
225225
"""Decrypts files."""
226226
assert isinstance(priv_key, rsa.key.PrivateKey)
227227
return rsa.decrypt(indata, priv_key)
@@ -244,7 +244,7 @@ class SignOperation(CryptoOperation):
244244
'to stdout if this option is not present.')
245245

246246
def perform_operation(self, indata: bytes, priv_key: rsa.key.AbstractKey,
247-
cli_args: Indexable):
247+
cli_args: Indexable):
248248
"""Signs files."""
249249
assert isinstance(priv_key, rsa.key.PrivateKey)
250250

@@ -271,7 +271,7 @@ class VerifyOperation(CryptoOperation):
271271
has_output = False
272272

273273
def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey,
274-
cli_args: Indexable):
274+
cli_args: Indexable):
275275
"""Verifies files."""
276276
assert isinstance(pub_key, rsa.key.PublicKey)
277277

rsa/key.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ def load_pkcs1(cls, keyfile: bytes, format='PEM') -> 'AbstractKey':
118118
return method(keyfile)
119119

120120
@staticmethod
121-
def _assert_format_exists(file_format: str, methods: typing.Mapping[str, typing.Callable]) -> typing.Callable:
121+
def _assert_format_exists(file_format: str, methods: typing.Mapping[str, typing.Callable]) \
122+
-> typing.Callable:
122123
"""Checks whether the given file format exists in 'methods'.
123124
"""
124125

rsa/pkcs1.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@
3333
import sys
3434
import typing
3535

36+
from . import common, transform, core, key
37+
3638
if sys.version_info < (3, 6):
3739
# Python 3.6 and newer have SHA-3 support. For Python 3.5 we need a third party library.
3840
# This library monkey-patches the hashlib module so that it looks like Python actually
3941
# supports SHA-3 natively.
40-
import sha3
41-
42-
43-
from . import common, transform, core, key
42+
import sha3 # noqa: F401
4443

4544
# ASN.1 codes that describe the hash algorithm used.
4645
HASH_ASN1 = {

rsa/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def bytes2int(raw_bytes: bytes) -> int:
3636
return int.from_bytes(raw_bytes, 'big', signed=False)
3737

3838

39-
def int2bytes(number: int, fill_size: int=0) -> bytes:
39+
def int2bytes(number: int, fill_size: int = 0) -> bytes:
4040
"""
4141
Convert an unsigned integer to bytes (big-endian)::
4242

0 commit comments

Comments
 (0)