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

Disable ruff split-on-trailing-comma and update ruff #2544

Merged
merged 5 commits into from
Feb 26, 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
7 changes: 1 addition & 6 deletions boefjes/boefjes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
from boefjes.clients.bytes_client import BytesAPIClient
from boefjes.clients.scheduler_client import SchedulerAPIClient, TaskStatus
from boefjes.config import settings
from boefjes.job_handler import (
_find_ooi_in_past,
get_environment_settings,
get_octopoes_api_connector,
serialize_ooi,
)
from boefjes.job_handler import _find_ooi_in_past, get_environment_settings, get_octopoes_api_connector, serialize_ooi
from boefjes.job_models import BoefjeMeta
from boefjes.katalogus.local_repository import LocalPluginRepository, get_local_repository
from boefjes.plugins.models import _default_mime_types
Expand Down
7 changes: 1 addition & 6 deletions boefjes/boefjes/job_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
from boefjes.clients.bytes_client import BytesAPIClient
from boefjes.config import settings
from boefjes.docker_boefjes_runner import DockerBoefjesRunner
from boefjes.job_models import (
BoefjeMeta,
NormalizerMeta,
NormalizerPlainOOI,
NormalizerScanProfile,
)
from boefjes.job_models import BoefjeMeta, NormalizerMeta, NormalizerPlainOOI, NormalizerScanProfile
from boefjes.katalogus.local_repository import LocalPluginRepository
from boefjes.plugins.models import _default_mime_types
from boefjes.runtime_interfaces import BoefjeJobRunner, Handler, NormalizerJobRunner
Expand Down
10 changes: 2 additions & 8 deletions boefjes/boefjes/katalogus/dependencies/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@
from jsonschema.validators import validate
from sqlalchemy.orm import Session

from boefjes.katalogus.clients import (
PluginRepositoryClient,
PluginRepositoryClientInterface,
)
from boefjes.katalogus.local_repository import (
LocalPluginRepository,
get_local_repository,
)
from boefjes.katalogus.clients import PluginRepositoryClient, PluginRepositoryClientInterface
from boefjes.katalogus.local_repository import LocalPluginRepository, get_local_repository
from boefjes.katalogus.models import RESERVED_LOCAL_ID, PluginType, Repository
from boefjes.katalogus.storage.interfaces import (
NotFound,
Expand Down
5 changes: 1 addition & 4 deletions boefjes/boefjes/katalogus/routers/organisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

from boefjes.katalogus.dependencies.organisations import get_organisations_store
from boefjes.katalogus.models import Organisation
from boefjes.katalogus.storage.interfaces import (
OrganisationNotFound,
OrganisationStorage,
)
from boefjes.katalogus.storage.interfaces import OrganisationNotFound, OrganisationStorage
from boefjes.sql.db import ObjectNotFoundException

router = APIRouter(prefix="/organisations", tags=["organisations"])
Expand Down
5 changes: 1 addition & 4 deletions boefjes/boefjes/katalogus/storage/diskcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
from diskcache import Cache

from boefjes.katalogus.models import Organisation, Repository
from boefjes.katalogus.storage.interfaces import (
OrganisationStorage,
RepositoryStorage,
)
from boefjes.katalogus.storage.interfaces import OrganisationStorage, RepositoryStorage

# todo: improve duplicate code

Expand Down
4 changes: 1 addition & 3 deletions boefjes/boefjes/katalogus/tests/test_organisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from fastapi.testclient import TestClient

from boefjes.katalogus.api import app
from boefjes.katalogus.dependencies.organisations import (
get_organisations_store,
)
from boefjes.katalogus.dependencies.organisations import get_organisations_store
from boefjes.katalogus.models import Organisation
from boefjes.katalogus.storage.memory import OrganisationStorageMemory

Expand Down
6 changes: 1 addition & 5 deletions boefjes/boefjes/katalogus/tests/test_plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
from boefjes.katalogus.local_repository import LocalPluginRepository
from boefjes.katalogus.models import RESERVED_LOCAL_ID, Bit, Boefje, Normalizer, Repository
from boefjes.katalogus.storage.interfaces import SettingsNotConformingToSchema
from boefjes.katalogus.storage.memory import (
PluginStatesStorageMemory,
RepositoryStorageMemory,
SettingsStorageMemory,
)
from boefjes.katalogus.storage.memory import PluginStatesStorageMemory, RepositoryStorageMemory, SettingsStorageMemory


def get_plugin_seed():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.software import Software, SoftwareInstance


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.software import Software, SoftwareInstance


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from boefjes.plugins.kat_binaryedge.services.normalize import get_name_from_cpe
from octopoes.models import OOI, Reference
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.software import Software, SoftwareInstance


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.software import Software


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol


def run(normalizer_meta: NormalizerMeta, raw: bytes | str) -> Iterable[OOI]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.service import IPService, Service


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
from boefjes.plugins.kat_binaryedge.services.normalize import get_name_from_cpe
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import Finding, KATFindingType
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.service import IPService, Service
from octopoes.models.ooi.software import Software, SoftwareInstance

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@

from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.software import Software, SoftwareInstance


Expand Down
14 changes: 2 additions & 12 deletions boefjes/boefjes/plugins/kat_censys/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@
from octopoes.models import OOI, Reference
from octopoes.models.ooi.certificate import X509Certificate
from octopoes.models.ooi.dns.zone import Hostname
from octopoes.models.ooi.network import (
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPPort, Network, PortState, Protocol
from octopoes.models.ooi.service import IPService, Service
from octopoes.models.ooi.software import Software, SoftwareInstance
from octopoes.models.ooi.web import (
HTTPHeader,
HTTPResource,
IPAddressHTTPURL,
Website,
)
from octopoes.models.ooi.web import HTTPHeader, HTTPResource, IPAddressHTTPURL, Website


def run(normalizer_meta: NormalizerMeta, raw: bytes | str) -> Iterable[OOI]:
Expand Down
4 changes: 1 addition & 3 deletions boefjes/boefjes/plugins/kat_dns_zone/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI
from octopoes.models.ooi.dns.records import (
DNSSOARecord,
)
from octopoes.models.ooi.dns.records import DNSSOARecord
from octopoes.models.ooi.dns.zone import DNSZone, Hostname
from octopoes.models.ooi.network import Network

Expand Down
9 changes: 1 addition & 8 deletions boefjes/boefjes/plugins/kat_masscan/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@

from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol


def get_ip_ports_and_service(ip_with_ports: dict, network: Network, netblock: Reference) -> Iterator[OOI]:
Expand Down
9 changes: 1 addition & 8 deletions boefjes/boefjes/plugins/kat_nmap_tcp/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@

from boefjes.job_models import NormalizerMeta
from octopoes.models import OOI, Reference
from octopoes.models.ooi.network import (
IPAddressV4,
IPAddressV6,
IPPort,
Network,
PortState,
Protocol,
)
from octopoes.models.ooi.network import IPAddressV4, IPAddressV6, IPPort, Network, PortState, Protocol
from octopoes.models.ooi.service import IPService, Service


Expand Down
7 changes: 1 addition & 6 deletions boefjes/boefjes/plugins/kat_snyk/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
from boefjes.job_models import NormalizerMeta
from boefjes.plugins.kat_snyk import check_version
from octopoes.models import OOI, Reference
from octopoes.models.ooi.findings import (
CVEFindingType,
Finding,
KATFindingType,
SnykFindingType,
)
from octopoes.models.ooi.findings import CVEFindingType, Finding, KATFindingType, SnykFindingType

logger = logging.getLogger(__name__)

Expand Down
10 changes: 1 addition & 9 deletions boefjes/boefjes/sql/db_models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Integer,
String,
Table,
UniqueConstraint,
)
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Table, UniqueConstraint
from sqlalchemy.orm import relationship

from boefjes.sql.db import SQL_BASE
Expand Down
5 changes: 1 addition & 4 deletions boefjes/boefjes/sql/organisation_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

from boefjes.config import Settings, settings
from boefjes.katalogus.models import Organisation, Repository
from boefjes.katalogus.storage.interfaces import (
OrganisationNotFound,
OrganisationStorage,
)
from boefjes.katalogus.storage.interfaces import OrganisationNotFound, OrganisationStorage
from boefjes.sql.db import ObjectNotFoundException
from boefjes.sql.db_models import OrganisationInDB, RepositoryInDB
from boefjes.sql.repository_storage import SQLRepositoryStorage
Expand Down
4 changes: 1 addition & 3 deletions boefjes/tests/test_cve_finding_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from boefjes.job_models import NormalizerMeta
from boefjes.plugins.kat_cve_finding_types.normalize import run
from octopoes.models.ooi.findings import RiskLevelSeverity
from octopoes.models.types import (
CVEFindingType,
)
from octopoes.models.types import CVEFindingType
from tests.loading import get_dummy_data


Expand Down
6 changes: 1 addition & 5 deletions boefjes/tests/test_snyk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from boefjes.plugins.kat_snyk.main import run as run_boefje
from boefjes.plugins.kat_snyk.normalize import run
from octopoes.models.ooi.findings import SnykFindingType
from octopoes.models.types import (
CVEFindingType,
Finding,
Software,
)
from octopoes.models.types import CVEFindingType, Finding, Software
from tests.loading import get_dummy_data


Expand Down
10 changes: 1 addition & 9 deletions bytes/bytes/database/sql_meta_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
from bytes.config import Settings, get_settings
from bytes.database.db import SQL_BASE, get_engine
from bytes.database.db_models import BoefjeMetaInDB, NormalizerMetaInDB, RawFileInDB, SigningProviderInDB
from bytes.models import (
Boefje,
BoefjeMeta,
MimeType,
Normalizer,
NormalizerMeta,
RawData,
RawDataMeta,
)
from bytes.models import Boefje, BoefjeMeta, MimeType, Normalizer, NormalizerMeta, RawData, RawDataMeta
from bytes.raw.file_raw_repository import create_raw_repository
from bytes.repositories.hash_repository import HashRepository
from bytes.repositories.meta_repository import BoefjeMetaFilter, MetaDataRepository, NormalizerMetaFilter, RawDataFilter
Expand Down
6 changes: 1 addition & 5 deletions bytes/bytes/timestamping/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

from pydantic import AwareDatetime

from bytes.models import (
HashingAlgorithm,
RawData,
SecureHash,
)
from bytes.models import HashingAlgorithm, RawData, SecureHash

logger = logging.getLogger(__name__)

Expand Down
10 changes: 1 addition & 9 deletions bytes/tests/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
from uuid import UUID

from bytes.config import BASE_DIR
from bytes.models import (
Boefje,
BoefjeMeta,
MimeType,
Normalizer,
NormalizerMeta,
RawData,
RawDataMeta,
)
from bytes.models import Boefje, BoefjeMeta, MimeType, Normalizer, NormalizerMeta, RawData, RawDataMeta


def load_stub(relative_path: str) -> dict[str, Any]:
Expand Down
Loading