diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..0eff6d6 --- /dev/null +++ b/.flake8 @@ -0,0 +1,6 @@ +[flake8] +extend-select = B901, B902, B903, B904 +extend-ignore = ANN101, ANN102 +per-file-ignores = + test/*: ANN + tasks/*: ANN, B028 diff --git a/requirements-dev.txt b/requirements-dev.txt index 0cb0cfe..7ed1256 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,6 @@ mypy flake8 +flake8-annotations flake8-bugbear autopep8 pytest diff --git a/swimprotocol/shuffle.py b/swimprotocol/shuffle.py index dba25c8..74ef933 100644 --- a/swimprotocol/shuffle.py +++ b/swimprotocol/shuffle.py @@ -92,8 +92,8 @@ def choice(self) -> ShuffleT: """ try: weak_val = random.choice(self._values) # nosec - except IndexError: - raise KeyError('choice from an empty set') + except IndexError as exc: + raise KeyError('choice from an empty set') from exc val = weak_val() assert val is not None return val