remove stupid rules

This commit is contained in:
Deeman
2025-10-12 21:44:56 +02:00
parent 7e06eae5ac
commit 6c93021f2d
9 changed files with 20 additions and 35 deletions

View File

@@ -1,9 +1,10 @@
import niquests
import pathlib
import logging import logging
import pathlib
import sys import sys
from datetime import datetime from datetime import datetime
import niquests
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
@@ -23,7 +24,7 @@ FIRST_MONTH = 8
def extract_psd_file(url:str, extract_to_path: pathlib.Path, http_session: niquests.Session): def extract_psd_file(url:str, extract_to_path: pathlib.Path, http_session: niquests.Session):
logger.info(f"Requesting file {url} ...") logger.info(f"Requesting file {url} ...")
extracted_etags = list(map(lambda file: file.stem, OUTPUT_DIR.rglob("*.zip"))) extracted_etags = [file.stem for file in OUTPUT_DIR.rglob("*.zip")]
response = http_session.head(url) response = http_session.head(url)
if response.status_code == 404: if response.status_code == 404:

View File

@@ -83,30 +83,12 @@ exclude = [
"notebooks", "notebooks",
] ]
# Set line length to match common Python style
line-length = 88
indent-width = 4 indent-width = 4
# Assume Python 3.13
target-version = "py313" target-version = "py313"
[tool.ruff.lint] [tool.ruff.lint]
# Enable recommended rules plus additional useful ones
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
"PL", # pylint
"RUF", # ruff-specific rules
]
# Ignore specific rules that may be too strict
ignore = [ ignore = [
"E501", # line too long (handled by formatter) "E501", # line too long (handled by formatter)
"PLR0913", # too many arguments to function call "PLR0913", # too many arguments to function call

View File

@@ -1,7 +1,8 @@
"""Materia CLI - Management interface for BeanFlows.coffee infrastructure.""" """Materia CLI - Management interface for BeanFlows.coffee infrastructure."""
from typing import Annotated
import typer import typer
from typing_extensions import Annotated
app = typer.Typer( app = typer.Typer(
name="materia", name="materia",

View File

@@ -1,10 +1,12 @@
"""Pipeline execution on ephemeral workers.""" """Pipeline execution on ephemeral workers."""
import paramiko import contextlib
from dataclasses import dataclass from dataclasses import dataclass
from materia.workers import create_worker, destroy_worker import paramiko
from materia.secrets import get_secret from materia.secrets import get_secret
from materia.workers import create_worker, destroy_worker
@dataclass @dataclass
@@ -133,7 +135,5 @@ def run_pipeline(
finally: finally:
if auto_destroy: if auto_destroy:
try: with contextlib.suppress(Exception):
destroy_worker(worker_name, provider) destroy_worker(worker_name, provider)
except Exception:
pass

View File

@@ -16,19 +16,19 @@ class Instance:
class ProviderModule(Protocol): class ProviderModule(Protocol):
def create_instance( def create_instance(
name: str, self: str,
instance_type: str, instance_type: str,
ssh_key: str, ssh_key: str,
location: str | None = None, location: str | None = None,
) -> Instance: ... ) -> Instance: ...
def destroy_instance(instance_id: str) -> None: ... def destroy_instance(self: str) -> None: ...
def list_instances(label: str | None = None) -> list[Instance]: ... def list_instances(self: str | None = None) -> list[Instance]: ...
def get_instance(name: str) -> Instance | None: ... def get_instance(self: str) -> Instance | None: ...
def wait_for_ssh(ip: str, timeout: int = 300) -> bool: ... def wait_for_ssh(self: str, timeout: int = 300) -> bool: ...
def get_provider(provider_name: str) -> ProviderModule: def get_provider(provider_name: str) -> ProviderModule:

View File

@@ -1,7 +1,7 @@
"""Hetzner Cloud provider implementation.""" """Hetzner Cloud provider implementation."""
import time
import socket import socket
import time
from hcloud import Client from hcloud import Client
from hcloud.images import Image from hcloud.images import Image

View File

@@ -3,7 +3,6 @@
from materia.providers import Instance, get_provider from materia.providers import Instance, get_provider
from materia.secrets import get_secret from materia.secrets import get_secret
DEFAULT_PROVIDER = "hetzner" DEFAULT_PROVIDER = "hetzner"

View File

@@ -1,8 +1,9 @@
"""Pytest configuration and fixtures.""" """Pytest configuration and fixtures."""
import pytest
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
import pytest
@pytest.fixture @pytest.fixture
def mock_esc_env(tmp_path): def mock_esc_env(tmp_path):

View File

@@ -1,6 +1,7 @@
"""End-to-end tests for the materia CLI.""" """End-to-end tests for the materia CLI."""
from typer.testing import CliRunner from typer.testing import CliRunner
from materia.cli import app from materia.cli import app
runner = CliRunner() runner = CliRunner()