Skip to content

Commit

Permalink
fixup! refactor: isort for package import
Browse files Browse the repository at this point in the history
  • Loading branch information
phbelitz committed Dec 23, 2022
1 parent 9722d83 commit d78dfa6
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 26 deletions.
9 changes: 6 additions & 3 deletions connaisseur/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from jinja2 import StrictUndefined, Template

from connaisseur.admission_request import AdmissionRequest
from connaisseur.exceptions import (AlertSendingError, ConfigurationError,
InvalidConfigurationFormatError,
InvalidImageFormatError)
from connaisseur.exceptions import (
AlertSendingError,
ConfigurationError,
InvalidConfigurationFormatError,
InvalidImageFormatError,
)
from connaisseur.util import safe_json_open, validate_schema


Expand Down
8 changes: 5 additions & 3 deletions connaisseur/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

import yaml

from connaisseur.exceptions import (InvalidConfigurationFormatError,
NoMatchingPolicyRuleError,
NotFoundException)
from connaisseur.exceptions import (
InvalidConfigurationFormatError,
NoMatchingPolicyRuleError,
NotFoundException,
)
from connaisseur.image import Image
from connaisseur.util import safe_path_func, validate_schema
from connaisseur.validators.validator import Validator
Expand Down
8 changes: 5 additions & 3 deletions connaisseur/flask_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
from connaisseur.admission_request import AdmissionRequest
from connaisseur.alert import send_alerts
from connaisseur.config import Config
from connaisseur.exceptions import (AlertSendingError,
BaseConnaisseurException,
ConfigurationError)
from connaisseur.exceptions import (
AlertSendingError,
BaseConnaisseurException,
ConfigurationError,
)
from connaisseur.util import get_admission_review

APP = Flask(__name__)
Expand Down
18 changes: 13 additions & 5 deletions connaisseur/validators/cosign/cosign_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
from concurrent.futures import ThreadPoolExecutor

import connaisseur.constants as const
from connaisseur.exceptions import (CosignError, CosignTimeout,
InvalidFormatException, NotFoundException,
UnexpectedCosignData, ValidationError,
WrongKeyError)
from connaisseur.exceptions import (
CosignError,
CosignTimeout,
InvalidFormatException,
NotFoundException,
UnexpectedCosignData,
ValidationError,
WrongKeyError,
)
from connaisseur.image import Image
from connaisseur.trust_root import ECDSAKey, KMSKey, TrustRoot
from connaisseur.util import safe_path_func # nosec
Expand Down Expand Up @@ -157,7 +162,10 @@ def __get_cosign_validated_digests(self, image: str, trust_root: dict):
digest = sig_data["critical"]["image"].get(
"docker-manifest-digest", ""
)
if re.match(rf"{const.SHA256}:[0-9A-Fa-f]{{64}}", digest) is None:
if (
re.match(rf"{const.SHA256}:[0-9A-Fa-f]{{64}}", digest)
is None
):
msg = "Digest '{digest}' does not match expected digest pattern."
raise InvalidFormatException(message=msg, digest=digest)
except Exception as err:
Expand Down
8 changes: 6 additions & 2 deletions connaisseur/validators/notaryv1/notary.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
import aiohttp
import requests

from connaisseur.exceptions import (InvalidFormatException, NotFoundException,
PathTraversalError, UnknownTypeException)
from connaisseur.exceptions import (
InvalidFormatException,
NotFoundException,
PathTraversalError,
UnknownTypeException,
)
from connaisseur.image import Image
from connaisseur.validators.notaryv1.trust_data import TrustData
from connaisseur.validators.notaryv1.tuf_role import TUFRole
Expand Down
9 changes: 6 additions & 3 deletions connaisseur/validators/notaryv1/notaryv1_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import logging

import connaisseur.constants as const
from connaisseur.exceptions import (AmbiguousDigestError,
InsufficientTrustDataError,
NotFoundException, ValidationError)
from connaisseur.exceptions import (
AmbiguousDigestError,
InsufficientTrustDataError,
NotFoundException,
ValidationError,
)
from connaisseur.image import Image
from connaisseur.trust_root import TrustRoot
from connaisseur.validators.interface import ValidatorInterface
Expand Down
10 changes: 7 additions & 3 deletions connaisseur/validators/notaryv1/trust_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
from dateutil import parser

import connaisseur.constants as const
from connaisseur.exceptions import (InvalidTrustDataFormatError,
NoSuchClassError, NotFoundException,
ValidationError, WrongKeyError)
from connaisseur.exceptions import (
InvalidTrustDataFormatError,
NoSuchClassError,
NotFoundException,
ValidationError,
WrongKeyError,
)
from connaisseur.trust_root import ECDSAKey, TrustRoot
from connaisseur.util import validate_schema
from connaisseur.validators.notaryv1.key_store import KeyStore
Expand Down
6 changes: 2 additions & 4 deletions connaisseur/validators/validator.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from connaisseur.exceptions import NoSuchClassError
from connaisseur.validators.cosign.cosign_validator import CosignValidator
from connaisseur.validators.notaryv1.notaryv1_validator import \
NotaryV1Validator
from connaisseur.validators.notaryv2.notaryv2_validator import \
NotaryV2Validator
from connaisseur.validators.notaryv1.notaryv1_validator import NotaryV1Validator
from connaisseur.validators.notaryv2.notaryv2_validator import NotaryV2Validator
from connaisseur.validators.static.static_validator import StaticValidator


Expand Down

0 comments on commit d78dfa6

Please sign in to comment.