Cizz22 5 months ago
parent 4fbd12d15d
commit cf532a21c4

@ -1,152 +1 @@
{
"editor.tabSize": 4,
"editor.rulers": [
120
],
"editor.renderWhitespace": "trailing",
"editor.suggestSelection": "first",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.stickyScroll.enabled": false,
"editor.bracketPairColorization.enabled": false,
"editor.cursorSmoothCaretAnimation": "on",
"editor.suggest.preview": true,
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"debug.onTaskErrors": "debugAnyway",
"explorer.compactFolders": false,
"explorer.confirmDragAndDrop": false,
"explorer.confirmDelete": false,
"explorer.copyRelativePathSeparator": "/",
"files.autoSave": "onFocusChange",
"files.exclude": {
"node_modules/**/*": true,
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
"files.associations": {
"*.pyx": "cython",
".clang*": "yaml",
"*.gpj": "jsonc",
"*.gvw": "jsonc",
"*.hpp.in": "cpp"
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"workbench.startupEditor": "none",
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook",
"*.md": "vscode.markdown.preview.editor",
"*.svg": "svgPreviewer.customEditor"
},
"workbench.colorTheme": "Dracula Theme Soft",
"git.enableSmartCommit": true,
"git.autofetch": true,
"git.confirmSync": false,
"git.openRepositoryInParentFolders": "always",
"partialDiff.enableTelemetry": false,
"prettier.tabWidth": 4,
"prettier.singleQuote": true,
"prettier.jsxSingleQuote": true,
"prettier.trailingComma": "all",
"prettier.useEditorConfig": true,
"prettier.bracketSpacing": false,
"markdown.validate.enabled": true,
"[markdown]": {
"files.trimTrailingWhitespace": false,
"editor.formatOnSave": false,
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 80
},
"[yaml]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "redhat.vscode-yaml",
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 80
},
"[json]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "vscode.json-language-features"
},
"[jsonc]": {
"editor.formatOnSave": false
},
"[plaintext]": {
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 120
},
"[toml]": {
"editor.wordWrap": "wordWrapColumn",
"editor.wordWrapColumn": 80,
"editor.defaultFormatter": "tamasfe.even-better-toml",
"editor.formatOnSave": true
},
"better-comments.tags": [
{
"tag": "XXX",
"color": "#F8C471"
},
{
"tag": "WARN",
"color": "#FF6961"
},
{
"tag": "NOTE",
"color": "#3498DB"
},
{
"tag": "TODO",
"color": "#77C3EC"
}
],
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"codesnap.showWindowControls": false,
"codesnap.shutterAction": "copy",
"Workspace_Formatter.excludePattern": [
"**/build",
"**/.*",
"**/.vscode",
"**/html"
],
"svg.preview.autoOpen": true,
"remote.WSL.fileWatcher.polling": true,
"errorLens.delay": 1000,
"errorLens.enabledDiagnosticLevels": [
"error",
"warning"
],
"errorLens.enabled": false,
"[python]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "mikoz.black-py",
"editor.formatOnType": false
},
"python.languageServer": "Jedi",
"python.analysis.addImport.exactMatchOnly": true,
"python.analysis.autoImportCompletions": false,
"python.analysis.completeFunctionParens": false,
"python.analysis.autoFormatStrings": true,
"python.analysis.logLevel": "Error",
"python.createEnvironment.contentButton": "show",
"python.missingPackage.severity": "Error",
"mypy-type-checker.importStrategy": "fromEnvironment",
"black-formatter.importStrategy": "fromEnvironment",
"isort.check": true,
"isort.importStrategy": "fromEnvironment",
"ruff.organizeImports": false,
"ruff.fixAll": false,
"autoDocstring.generateDocstringOnEnter": true,
"autoDocstring.quoteStyle": "'''",
"jupyter.interactiveWindow.creationMode": "perFile",
"jupyter.askForKernelRestart": false,
"jupyter.themeMatplotlibPlots": true,
"jupyter.logging.level": "error",
"notebook.formatOnSave.enabled": false,
"notebook.output.textLineLimit": 20,
"notebook.compactView": false,
"notebook.diff.ignoreMetadata": true,
"notebook.diff.ignoreOutputs": true
}
{}

@ -88,7 +88,7 @@ class SimulationPlotResult(BaseModel):
class SimulationData(BaseModel):
id: UUID
simulation_name: str
simulation_name: str
status: str
schematic_name: str
reliability: Optional[dict]

@ -550,7 +550,7 @@ async def get_result_ranking(*, db_session: DbSession, simulation_id: UUID):
)
)
query = query.order_by(AerosSimulationCalcResult.eaf.desc()).limit(10)
query = query.order_by(AerosSimulationCalcResult.eaf.desc())
query = query.options(

@ -30,7 +30,7 @@ def calculate_eaf(
total_equivalent_derate_hours = lost_production / estimated_max_capacity if estimated_max_capacity > 0 else 0
# Calculate EAF
effective_available_hours = available_hours - total_equivalent_derate_hours
effective_available_hours = - total_equivalent_derate_hours
return (effective_available_hours / period_hours) * 100 if period_hours > 0 else 0, total_equivalent_derate_hours
except Exception as e:
print("Error calculating EAF:", str(e))

@ -4,7 +4,7 @@ from datetime import datetime
from typing import Generic, Optional, TypeVar
import pytz
from pydantic import BaseModel, Field, SecretStr
from pydantic import BaseModel, Field, SecretStr,Extra
from sqlalchemy import Column, DateTime, String, event, func
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import Mapped, mapped_column
@ -65,14 +65,26 @@ class IdentityMixin:
# Pydantic Models
class DefultBase(BaseModel):
class Config:
# allow model creation directly from ORM objects or attrs
from_attributes = True
# re-validate fields when theyre updated after creation
validate_assignment = True
arbitrary_types_allowed = True
str_strip_whitespace = True
# disallow arbitrary/untyped objects; only safe, supported types allowed
arbitrary_types_allowed = False
# automatically strip leading/trailing whitespace from all str fields
str_strip_whitespace = True
# forbid extra/unexpected fields in input (prevents silent injection/mass assignment)
extra = 'forbid'
# secure JSON serialization: custom formatting for sensitive types
json_encoders = {
# custom output conversion for datetime
# always output datetime in strict ISO8601 with Zulu timezone
datetime: lambda v: v.strftime("%Y-%m-%dT%H:%M:%S.%fZ") if v else None,
# unwrap SecretStr safely when serializing (not leaking in repr/debug)
SecretStr: lambda v: v.get_secret_value() if v else None,
}

Loading…
Cancel
Save