v0.1-sprint0: Esqueleto completo AR-ShipDesign
- Estructura completa de carpetas (236 módulos stub + implementados) - pyproject.toml, requirements, .gitignore, LICENSE (propietario) - core/project.py: serialización .arsd (ZIP con JSON) - core/units.py: conversiones SI <-> imperial completas - ui/main_window.py: layout DELFTship-style con todos los paneles - Árbol de proyecto (dock izquierda) - Tabs de módulos (centro) - Panel de propiedades (dock derecha) - Panel hidrostáticos en vivo (inferior, fijo) - ui/i18n: español e inglés - ui/themes: tema claro y oscuro - utils/logger.py, settings.py, validation.py - data/liquids.json: 15 líquidos navales - data/stability_criteria.json: IMO IS Code 2008, A.749(18), USCG - tests/test_startup.py: 12 tests, todos PASSED - Módulo scantling/ ISO 12215 (stubs Sprint 2.5) - Módulo fabrication/molds/ para moldes FRP (stubs Sprint 13B) - Módulo fabrication/ para CNC plasma/router/laser (stubs Sprint 13)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
"""
|
||||
Utilidades de validación de datos de entrada.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def is_positive(value: float, name: str = "valor") -> float:
|
||||
"""Valida que un valor sea positivo. Lanza ValueError si no."""
|
||||
if value <= 0:
|
||||
raise ValueError(f"{name} debe ser positivo, se recibió {value}")
|
||||
return value
|
||||
|
||||
|
||||
def is_in_range(value: float, low: float, high: float, name: str = "valor") -> float:
|
||||
"""Valida que un valor esté en el rango [low, high]."""
|
||||
if not (low <= value <= high):
|
||||
raise ValueError(f"{name} debe estar entre {low} y {high}, se recibió {value}")
|
||||
return value
|
||||
Reference in New Issue
Block a user