Skip to content
Closed
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
5 changes: 4 additions & 1 deletion api/architect/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""

import ast
import os
from dataclasses import dataclass, field
from typing import Optional
from pathlib import Path
Expand Down Expand Up @@ -194,6 +193,8 @@ def analyze_module(module_path: str) -> ModuleMetrics:
if isinstance(tree.body[0].value, ast.Constant):
has_docstring = True
except SyntaxError:
# Ignore syntax errors here; docstring detection is best-effort.
# Full syntax error handling is performed when analyzing the module below.
pass

analyzer = CodeAnalyzer(source)
Expand Down Expand Up @@ -243,6 +244,8 @@ def analyze_package(package_path: str) -> list[ModuleMetrics]:
try:
results.append(analyze_module(str(py_file)))
except Exception:
# Intentionally ignore errors for individual modules so that analysis
# can continue for the rest of the package.
pass

return results
Expand Down
5 changes: 3 additions & 2 deletions api/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ def _save_results(self, results: list, output_dir: str, verbose: bool = False):
if len(results) >= 2:
try:
self._generate_pareto_plot(results_data, output_dir, verbose)
except ImportError:
pass
except ImportError as e2:
if verbose:
print(f"[Pareto plot skipped - plotting dependency not installed: {e2}]")

def _get_report_specs(self) -> dict:
"""Get specifications dict for report generation."""
Expand Down
3 changes: 1 addition & 2 deletions api/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
pareto_front = optimizer.run(generations=50)
"""

import math
from dataclasses import dataclass, field
from typing import Optional, Callable, Any
from typing import Optional, Callable
from abc import ABC, abstractmethod


Expand Down
5 changes: 2 additions & 3 deletions api/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import json
from typing import List, Optional, Dict, Any
from dataclasses import dataclass


def _ensure_matplotlib():
Expand Down Expand Up @@ -144,8 +143,8 @@ def _plot_pareto_front(ax, data: list, plt, np):
# Color by rank
colors = plt.cm.RdYlGn_r(np.linspace(0, 1, len(data)))

scatter = ax.scatter(core_losses, copper_losses, s=sizes, c=colors,
edgecolors='black', linewidths=1, alpha=0.8)
ax.scatter(core_losses, copper_losses, s=sizes, c=colors,
edgecolors='black', linewidths=1, alpha=0.8)

# Mark Pareto-optimal points
pareto_mask = _find_pareto_front(core_losses, copper_losses)
Expand Down
1 change: 0 additions & 1 deletion examples/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Provides standardized output generation for all examples.
"""

import os
from pathlib import Path
from typing import List, Any, Optional, Dict

Expand Down
2 changes: 1 addition & 1 deletion tas/models/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from dataclasses import dataclass, field
from typing import Optional, List, Dict, Any
from typing import Optional, List
from enum import Enum


Expand Down
4 changes: 2 additions & 2 deletions tas/models/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
TAS Output models - Simplified results for basic DC-DC converters.
"""

from dataclasses import dataclass, field
from typing import Optional, Dict
from dataclasses import dataclass
from typing import Optional


@dataclass
Expand Down
1 change: 0 additions & 1 deletion tas/models/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from dataclasses import dataclass
from typing import List
from enum import Enum
import math


class WaveformShape(Enum):
Expand Down
1 change: 0 additions & 1 deletion tests/test_bobbin_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

Covers create_basic_bobbin(), bobbin data access, and bobbin fitting checks.
"""
import pytest
import PyOpenMagnetics


Expand Down
4 changes: 3 additions & 1 deletion tests/test_design_builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Tests for PyOpenMagnetics Design Builder API."""

import pytest
import math

# Test configuration
MAX_RESULTS = 5


class TestDesignImports:
Expand Down
1 change: 0 additions & 1 deletion tests/test_losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Covers core losses (multiple models), winding losses (ohmic, skin, proximity),
wire-level per-meter loss functions, and Steinmetz coefficients.
"""
import pytest
import PyOpenMagnetics


Expand Down
6 changes: 0 additions & 6 deletions tests/test_mas_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
DimensionWithTolerance,
CTI,
InsulationType,
OvervoltageCategory,
PollutionDegree,
InsulationStandards,
InsulationRequirements,
IsolationSide,
Expand All @@ -25,19 +23,15 @@
DesignRequirements,
Topology,
OperatingConditions,
Cooling,
Harmonics,
WaveformLabel,
Processed,
Waveform,
SignalDescriptor,
OperatingPointExcitation,
OperatingPoint,
Inputs,
ManufacturerInfo,
Status,
Outputs,
Mas,
Masfromdict,
Mastodict,
from_float,
Expand Down
1 change: 0 additions & 1 deletion tests/test_settings_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Covers get_settings(), set_settings(), reset_settings(),
get_constants(), and get_default_models().
"""
import pytest
import PyOpenMagnetics


Expand Down
2 changes: 0 additions & 2 deletions tests/test_tas_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pytest
import json
import os
from pathlib import Path

from tas import (
Expand All @@ -25,7 +24,6 @@
ModulationType,
ControlMode,
OperatingMode,
TASOutputs,
TASLossBreakdown,
TASKPIs,
create_buck_tas,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Covers waveform processing, harmonics, sampled waveform generation,
power calculations, and reflected waveform transformations.
"""
import pytest
import math
import PyOpenMagnetics


Expand Down