diff --git a/.vscode/cspell.json b/.vscode/cspell.json new file mode 100644 index 0000000..582ec6d --- /dev/null +++ b/.vscode/cspell.json @@ -0,0 +1,94 @@ +{ + // Version of the setting file. Always 0.2 + "version": "0.2", + // language - current active spelling language + "language": "en,fr", + // words - list of words to be always considered correct + "words": [ + "abcn", + "absolufy", + "acsr", + "aldrey", + "asarray", + "astype", + "bline", + "bnline", + "bnpline", + "bysource", + "cohl", + "cosgini", + "cterm", + "curmg", + "cython", + "direc", + "dline", + "dropna", + "dtype", + "elmlodmv", + "elmpvsys", + "furo", + "gpslat", + "gpslon", + "gscale", + "htmlcov", + "ilini", + "imiso", + "inom", + "isort", + "mathjax", + "mathrm", + "mlei", + "nbsphinx", + "ndarray", + "nlnph", + "nneutral", + "noloadloss", + "normhkva", + "nphase", + "nphases", + "nplin", + "opendss", + "pcutr", + "pgini", + "phasor", + "phasors", + "phtech", + "pipx", + "plini", + "pmatrix", + "pmax", + "pyproj", + "pyproject", + "pytest", + "pyupgrade", + "qgini", + "qlini", + "qurs", + "raphson", + "rline", + "rnline", + "rnpline", + "rtol", + "sgini", + "slini", + "strn", + "susceptance", + "transfo", + "uknom", + "uktr", + "ureg", + "utrn", + "xline", + "xlpe", + "xnet", + "xnline", + "xnpline", + "yesqa" + ], + // flagWords - list of words to be always considered incorrect + // This is useful for offensive words and common spelling errors. + // For example "hte" should be "the" + "flagWords": [ + "hte" + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..51acae9 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "charliermarsh.ruff", + "esbenp.prettier-vscode", + "ms-python.python", + "ms-python.vscode-pylance", + ], +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4ad513a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,33 @@ +{ + // Jupyter Notebook + "jupyter.notebookFileRoot": "${workspaceFolder}", + "notebook.formatOnSave.enabled": true, + "notebook.codeActionsOnSave": { + "source.organizeImports.ruff": "explicit", + }, + + // Python + "python.analysis.diagnosticSeverityOverrides": { + "reportInvalidStringEscapeSequence": "warning", + "reportImportCycles": "warning", + "reportUnusedImport": "warning", + }, + "python.testing.pytestEnabled": true, + "[python]": { + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports.ruff": "explicit", + }, + }, + // Prettier + "prettier.printWidth": 120, + "[markdown][yaml][html][css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + }, + // Json + "[json]": { + "editor.indentSize": 2, + }, +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..689358f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,44 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "options": { "cwd": "${workspaceFolder}" }, + "presentation": { + "showReuseMessage": true, + "clear": true, + }, + "tasks": [ + { + "label": "Build docs", + "detail": "Build the docs using Sphinx.", + "type": "shell", + "command": "make -C doc html", + "group": { + "kind": "build", + "isDefault": true, + }, + "problemMatcher": [], + "presentation": { + "reveal": "silent", + "focus": true, + }, + }, + { + "label": "Open docs", + "detail": "Open the docs in the browser.", + "type": "shell", + "command": "open build/html/index.html", + "presentation": { + "reveal": "never", + "close": true, + "focus": false, + "panel": "dedicated", + }, + "group": { + "kind": "build", + "isDefault": true, + }, + "isBackground": true, + }, + ], +} diff --git a/roseau/load_flow_single/__init__.py b/roseau/load_flow_single/__init__.py index e91ca7b..1465ea3 100644 --- a/roseau/load_flow_single/__init__.py +++ b/roseau/load_flow_single/__init__.py @@ -15,22 +15,24 @@ __status__, __url__, ) -from roseau.load_flow_single.models.branches import AbstractBranch -from roseau.load_flow_single.models.buses import Bus -from roseau.load_flow_single.models.core import Element -from roseau.load_flow_single.models.lines import Line, LineParameters -from roseau.load_flow_single.models.loads import ( +from roseau.load_flow_single.models import ( + AbstractBranch, AbstractLoad, + Bus, Control, CurrentLoad, + Element, FlexibleParameter, ImpedanceLoad, + Line, + LineParameters, PowerLoad, Projection, + Switch, + Transformer, + TransformerParameters, + VoltageSource, ) -from roseau.load_flow_single.models.sources import VoltageSource -from roseau.load_flow_single.models.switches import Switch -from roseau.load_flow_single.models.transformers import Transformer, TransformerParameters from roseau.load_flow_single.network import ElectricalNetwork __version__ = importlib.metadata.version("roseau-load-flow-single") diff --git a/roseau/load_flow_single/models/__init__.py b/roseau/load_flow_single/models/__init__.py index 9e74bca..693665c 100644 --- a/roseau/load_flow_single/models/__init__.py +++ b/roseau/load_flow_single/models/__init__.py @@ -1,19 +1,14 @@ +from roseau.load_flow import Projection, TransformerParameters from roseau.load_flow_single.models.branches import AbstractBranch from roseau.load_flow_single.models.buses import Bus from roseau.load_flow_single.models.core import Element -from roseau.load_flow_single.models.lines import Line, LineParameters -from roseau.load_flow_single.models.loads import ( - AbstractLoad, - Control, - CurrentLoad, - FlexibleParameter, - ImpedanceLoad, - PowerLoad, - Projection, -) +from roseau.load_flow_single.models.flexible_parameters import Control, FlexibleParameter +from roseau.load_flow_single.models.line_parameters import LineParameters +from roseau.load_flow_single.models.lines import Line +from roseau.load_flow_single.models.loads import AbstractLoad, CurrentLoad, ImpedanceLoad, PowerLoad from roseau.load_flow_single.models.sources import VoltageSource from roseau.load_flow_single.models.switches import Switch -from roseau.load_flow_single.models.transformers import Transformer, TransformerParameters +from roseau.load_flow_single.models.transformers import Transformer __all__ = [ "Element", diff --git a/roseau/load_flow_single/models/loads/flexible_parameters.py b/roseau/load_flow_single/models/flexible_parameters.py similarity index 100% rename from roseau/load_flow_single/models/loads/flexible_parameters.py rename to roseau/load_flow_single/models/flexible_parameters.py diff --git a/roseau/load_flow_single/models/lines/parameters.py b/roseau/load_flow_single/models/line_parameters.py similarity index 100% rename from roseau/load_flow_single/models/lines/parameters.py rename to roseau/load_flow_single/models/line_parameters.py diff --git a/roseau/load_flow_single/models/lines/lines.py b/roseau/load_flow_single/models/lines.py similarity index 99% rename from roseau/load_flow_single/models/lines/lines.py rename to roseau/load_flow_single/models/lines.py index 87c0375..8f6d147 100644 --- a/roseau/load_flow_single/models/lines/lines.py +++ b/roseau/load_flow_single/models/lines.py @@ -9,7 +9,7 @@ from roseau.load_flow_engine.cy_engine import CyShuntLine, CySimplifiedLine from roseau.load_flow_single.models.branches import AbstractBranch from roseau.load_flow_single.models.buses import Bus -from roseau.load_flow_single.models.lines.parameters import LineParameters +from roseau.load_flow_single.models.line_parameters import LineParameters logger = logging.getLogger(__name__) diff --git a/roseau/load_flow_single/models/lines/__init__.py b/roseau/load_flow_single/models/lines/__init__.py deleted file mode 100644 index 06fe1f6..0000000 --- a/roseau/load_flow_single/models/lines/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from roseau.load_flow_single.models.lines.lines import Line -from roseau.load_flow_single.models.lines.parameters import LineParameters - -__all__ = ["Line", "LineParameters"] diff --git a/roseau/load_flow_single/models/loads/loads.py b/roseau/load_flow_single/models/loads.py similarity index 100% rename from roseau/load_flow_single/models/loads/loads.py rename to roseau/load_flow_single/models/loads.py diff --git a/roseau/load_flow_single/models/loads/__init__.py b/roseau/load_flow_single/models/loads/__init__.py deleted file mode 100644 index 2509765..0000000 --- a/roseau/load_flow_single/models/loads/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from roseau.load_flow.models.loads.flexible_parameters import Projection -from roseau.load_flow_single.models.loads.flexible_parameters import Control, FlexibleParameter -from roseau.load_flow_single.models.loads.loads import AbstractLoad, CurrentLoad, ImpedanceLoad, PowerLoad - -__all__ = ["PowerLoad", "AbstractLoad", "FlexibleParameter", "Control", "Projection", "CurrentLoad", "ImpedanceLoad"] diff --git a/roseau/load_flow_single/models/transformers/transformers.py b/roseau/load_flow_single/models/transformers.py similarity index 100% rename from roseau/load_flow_single/models/transformers/transformers.py rename to roseau/load_flow_single/models/transformers.py diff --git a/roseau/load_flow_single/models/transformers/__init__.py b/roseau/load_flow_single/models/transformers/__init__.py deleted file mode 100644 index 9b8db51..0000000 --- a/roseau/load_flow_single/models/transformers/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from roseau.load_flow.models.transformers.parameters import TransformerParameters -from roseau.load_flow_single.models.transformers.transformers import Transformer - -__all__ = [ - "Transformer", - "TransformerParameters", -] diff --git a/roseau/load_flow_single/network.py b/roseau/load_flow_single/network.py index c05c248..57a46df 100644 --- a/roseau/load_flow_single/network.py +++ b/roseau/load_flow_single/network.py @@ -24,15 +24,14 @@ from roseau.load_flow.utils.types import _DTYPES, LoadTypeDtype from roseau.load_flow_engine.cy_engine import CyElectricalNetwork, CyGround, CyPotentialRef from roseau.load_flow_single.io import network_from_dict, network_to_dict -from roseau.load_flow_single.models import Transformer from roseau.load_flow_single.models.branches import AbstractBranch from roseau.load_flow_single.models.buses import Bus from roseau.load_flow_single.models.core import Element from roseau.load_flow_single.models.lines import Line -from roseau.load_flow_single.models.loads import AbstractLoad, PowerLoad -from roseau.load_flow_single.models.loads.loads import CurrentLoad, ImpedanceLoad +from roseau.load_flow_single.models.loads import AbstractLoad, CurrentLoad, ImpedanceLoad, PowerLoad from roseau.load_flow_single.models.sources import VoltageSource from roseau.load_flow_single.models.switches import Switch +from roseau.load_flow_single.models.transformers import Transformer if TYPE_CHECKING: from networkx import Graph