Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flake8 lints #552

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# template suggested by `black`

[flake8]
ignore = E203, E266, E501, W503
max-line-length = 80
# max-complexity = 18
# temporary increase due to solo.key.update complexity
max-complexity = 30
select = B,C,E,F,W,T4,B9
extend-exclude = pynitrokey/nethsm/client,pynitrokey/nk3/bootloader/nrf52_upload
# E203,E701 suggested by black, see:
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
# E501 (line length) disabled as this is handled by black which takes better care of edge cases
extend-ignore = E203,E501,E701
max-complexity = 18
extend-exclude = pynitrokey/trussed/bootloader/nrf52_upload
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PYTHON3=python3
PYTHON3_VENV=venv/bin/python3

# whitelist of directories for flake8
FLAKE8_DIRS=pynitrokey/cli/nk3 pynitrokey/nk3
FLAKE8_DIRS=pynitrokey/cli/nk3 pynitrokey/cli/nkpk.py pynitrokey/cli/trussed pynitrokey/nk3 pynitrokey/nkpk.py pynitrokey/trussed

all: init

Expand Down
6 changes: 1 addition & 5 deletions pynitrokey/cli/nkpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distributed except according to those terms.

import re
from typing import Optional, Sequence
from typing import Optional

import click

from pynitrokey.cli.trussed.test import TestCase
from pynitrokey.helpers import local_print
from pynitrokey.nkpk import NKPK_DATA, NitrokeyPasskeyBootloader, NitrokeyPasskeyDevice
from pynitrokey.trussed.base import NitrokeyTrussedBase
from pynitrokey.trussed.bootloader import Device
from pynitrokey.trussed.device import NitrokeyTrussedDevice
from pynitrokey.updates import Repository

from . import trussed

Expand Down
3 changes: 1 addition & 2 deletions pynitrokey/cli/trussed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import os.path
from abc import ABC, abstractmethod
from hashlib import sha256
from re import Pattern
from typing import BinaryIO, Callable, Generic, Optional, Sequence, TypeVar

import click
Expand Down Expand Up @@ -39,7 +38,7 @@
from pynitrokey.trussed.device import NitrokeyTrussedDevice
from pynitrokey.trussed.exceptions import TimeoutException
from pynitrokey.trussed.provisioner_app import ProvisionerApp
from pynitrokey.updates import OverwriteError, Repository
from pynitrokey.updates import OverwriteError

from .test import TestCase

Expand Down
4 changes: 2 additions & 2 deletions pynitrokey/cli/trussed/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from dataclasses import dataclass
from enum import Enum, auto, unique
from types import TracebackType
from typing import Any, Callable, Iterable, Optional, Sequence, Tuple, Type, Union
from typing import Callable, Iterable, Optional, Sequence, Tuple, Type, Union

from pynitrokey.cli.exceptions import CliException
from pynitrokey.fido2 import device_path_to_str
from pynitrokey.helpers import local_print
from pynitrokey.trussed.base import NitrokeyTrussedBase
from pynitrokey.trussed.utils import Uuid, Version
from pynitrokey.trussed.utils import Version

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion pynitrokey/trussed/bootloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dataclasses import dataclass
from io import BytesIO
from re import Pattern
from typing import Callable, Dict, List, Optional, Tuple, Union
from typing import Callable, Dict, Optional, Tuple, Union
from zipfile import ZipFile

from .. import DeviceData
Expand Down
3 changes: 1 addition & 2 deletions pynitrokey/trussed/bootloader/lpc55.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import platform
import re
import sys
from typing import List, Optional, Tuple, TypeVar
from typing import Optional, TypeVar

from spsdk.mboot.error_codes import StatusCode
from spsdk.mboot.interfaces.usb import MbootUSBInterface
from spsdk.mboot.mcuboot import McuBoot
from spsdk.mboot.properties import PropertyTag
Expand Down
2 changes: 1 addition & 1 deletion pynitrokey/trussed/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pynitrokey.fido2 import device_path_to_str

from .base import NitrokeyTrussedBase
from .utils import Fido2Certs, Uuid, Version
from .utils import Fido2Certs, Uuid

T = TypeVar("T", bound="NitrokeyTrussedDevice")

Expand Down