From d9e6ce8a4381d7517254017a659717e087faab5c Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Sun, 8 Mar 2026 17:34:48 -0300 Subject: [PATCH 1/7] feat: complete epic-01 packaging & CI modernization - Modernize pyproject.toml with classifiers, typed marker, dev dep groups - Restructure CI into parallel jobs (lint, typecheck, test, docs) - Migrate docs deployment to official GitHub Pages actions - Create release workflow with trusted publishing (OIDC) - Add pre-commit hooks for ruff and mypy - Fix ruff violations (E711, F811) and apply ruff formatting Co-Authored-By: Claude Opus 4.6 --- .github/workflows/docs.yml | 38 ++++++----- .github/workflows/main.yml | 58 ++++++++++++----- .github/workflows/publish.yml | 40 ------------ .github/workflows/release.yml | 40 ++++++++++++ .pre-commit-config.yaml | 17 +++++ idessem/dessem/entdados.py | 5 +- idessem/dessem/modelos/areacont.py | 10 +-- idessem/dessem/modelos/blocos/dataestudo.py | 4 +- idessem/dessem/modelos/deflant.py | 5 +- idessem/dessem/modelos/desselet.py | 8 ++- idessem/dessem/modelos/dessopc.py | 1 - idessem/dessem/modelos/pdo_operacao.py | 4 +- idessem/dessem/modelos/respot.py | 8 +-- pyproject.toml | 26 +++++--- .../dessem/componentes/test_stagedatefield.py | 1 - tests/dessem/test_avl_estatfpha.py | 2 +- tests/dessem/test_avl_fpha3.py | 3 +- tests/dessem/test_dadvaz.py | 16 +++-- tests/dessem/test_deflant.py | 18 ++---- tests/dessem/test_entdados.py | 4 +- tests/dessem/test_operuh.py | 4 +- tests/dessem/test_pdo_aval_qmaxusih.py | 2 - tests/dessem/test_pdo_eco_fcfcortes.py | 1 - tests/dessem/test_pdo_eco_usih.py | 12 +--- tests/dessem/test_pdo_eco_usih_polin.py | 1 - tests/dessem/test_pdo_eolica.py | 1 - tests/dessem/test_pdo_hidr.py | 1 - tests/dessem/test_pdo_inter.py | 1 - tests/dessem/test_pdo_oper_lpp.py | 1 - tests/dessem/test_pdo_oper_term.py | 1 - tests/dessem/test_pdo_oper_tviag_calha.py | 1 - tests/dessem/test_pdo_oper_usih.py | 8 +-- tests/dessem/test_pdo_reserva.py | 1 - tests/dessem/test_pdo_sist.py | 1 - tests/dessem/test_pdo_term.py | 1 - tests/dessem/test_renovaveis.py | 10 --- tests/dessem/test_respot.py | 55 ++++++++-------- tests/libs/test_usinas_hidreletricas.py | 12 +--- .../arquivos/pdo_oper_titulacao_contratos.py | 63 ++++++++++++++++++- tests/mocks/arquivos/respot.py | 63 ++++++++++++++++++- tests/mocks/arquivos/uch.py | 4 +- 41 files changed, 348 insertions(+), 204 deletions(-) delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 71c72338..0d77cb84 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,33 +1,39 @@ name: Docs + on: push: branches: - main workflow_dispatch: - + +permissions: + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + jobs: docs: runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deploy.outputs.page_url }} steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v3 - name: Set up Python - run: uv python install + run: uv python install 3.12 - name: Install the project - run: | - uv sync --all-extras --dev - - name: Runs tests - run: | - uv run pytest ./tests + run: uv sync --extra docs - name: Sphinx build - run: | - uv run sphinx-build -M html docs/source docs/build - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: uv run sphinx-build -M html docs/source docs/build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - publish_branch: gh-pages - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/build/html - force_orphan: true \ No newline at end of file + path: docs/build/html + - name: Deploy to GitHub Pages + id: deploy + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93cd8261..469c0bf7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: tests +name: CI on: push: @@ -9,6 +9,32 @@ on: - main jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v3 + - name: Set up Python + run: uv python install 3.12 + - name: Install dependencies + run: uv sync --extra lint + - name: Run ruff linter + run: uv run ruff check ./idessem + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v3 + - name: Set up Python + run: uv python install 3.12 + - name: Install dependencies + run: uv sync --extra lint + - name: Run mypy + run: uv run mypy ./idessem + test: runs-on: ubuntu-latest strategy: @@ -20,12 +46,10 @@ jobs: uses: astral-sh/setup-uv@v3 - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} - - name: Install the project - run: | - uv sync --all-extras --dev - - name: Runs tests - run: | - uv run pytest --cov-report=xml --cov=idessem ./tests + - name: Install dependencies + run: uv sync --extra test + - name: Run tests + run: uv run pytest --cov-report=xml --cov=idessem ./tests - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -35,12 +59,16 @@ jobs: name: codecov-idessem fail_ci_if_error: true verbose: true - - name: Static type check - run: | - uv run mypy ./idessem - - name: Linter code check - run: | - uv run ruff check ./idessem + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v3 + - name: Set up Python + run: uv python install 3.12 + - name: Install dependencies + run: uv sync --extra docs - name: Sphinx build - run: | - uv run sphinx-build -M html docs/source docs/build \ No newline at end of file + run: uv run sphinx-build -M html docs/source docs/build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 3ba38d3a..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: deploy - - -on: - release: - types: [created] - -jobs: - build-and-publish: - runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/idessem - permissions: - id-token: write - steps: - - uses: actions/checkout@v4 - - name: Install uv - uses: astral-sh/setup-uv@v3 - - name: Set up Python - run: uv python install 3.11 - - name: Install the project - run: | - uv sync --all-extras --dev - - name: Runs tests - run: | - uv run pytest ./tests - - name: Static typing check - run: | - uv run mypy ./idessem - - name: PEP8 check - run: | - uv run ruff check ./idessem - - name: Builds package - if: startsWith(github.ref, 'refs/tags') - run: | - uv build - - name: PyPI publish - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c9938609 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + release: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/idessem + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v3 + - name: Set up Python + run: uv python install 3.12 + - name: Validate version matches tag + run: | + TAG_VERSION="${GITHUB_REF#refs/tags/v}" + PKG_VERSION=$(grep -oP '__version__\s*=\s*"\K[^"]+' idessem/__init__.py) + if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then + echo "::error::Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)" + exit 1 + fi + - name: Install the project + run: uv sync + - name: Build package + run: uv build + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Create GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create "$GITHUB_REF_NAME" dist/* --generate-notes diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..77a303b1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.5 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + + - repo: local + hooks: + - id: mypy + name: mypy + entry: uv run mypy ./idessem + language: system + types: [python] + pass_filenames: false + stages: [manual] diff --git a/idessem/dessem/entdados.py b/idessem/dessem/entdados.py index b0009ed3..f20bbf26 100644 --- a/idessem/dessem/entdados.py +++ b/idessem/dessem/entdados.py @@ -163,8 +163,9 @@ def __expande_colunas_df(self, df: pd.DataFrame) -> pd.DataFrame: num_elementos = len(df.at[0, c]) particoes_coluna = [f"{c}_{i}" for i in range(1, num_elementos + 1)] df[particoes_coluna] = df.apply( - lambda linha: linha[c] - + [np.nan] * max(0, num_elementos - len(linha[c])), + lambda linha: ( + linha[c] + [np.nan] * max(0, num_elementos - len(linha[c])) + ), axis=1, result_type="expand", ) diff --git a/idessem/dessem/modelos/areacont.py b/idessem/dessem/modelos/areacont.py index 4c73ce8e..680bcad3 100644 --- a/idessem/dessem/modelos/areacont.py +++ b/idessem/dessem/modelos/areacont.py @@ -91,12 +91,13 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: indice_linha += 1 for i, c in enumerate(cols): dados[c].append(dados_linha[i]) - # Override def write(self, file: IO, *args, **kwargs): if not isinstance(self.data, list): - raise ValueError("Dados do areacont.dat não foram lidos com sucesso") + raise ValueError( + "Dados do areacont.dat não foram lidos com sucesso" + ) file.write("AREA\n") comentarios = self.data[0] @@ -201,12 +202,13 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: indice_linha += 1 for i, c in enumerate(cols): dados[c].append(dados_linha[i]) - # Override def write(self, file: IO, *args, **kwargs): if not isinstance(self.data, list): - raise ValueError("Dados do areacont.dat não foram lidos com sucesso") + raise ValueError( + "Dados do areacont.dat não foram lidos com sucesso" + ) file.write("USINA\n") comentarios = self.data[0] diff --git a/idessem/dessem/modelos/blocos/dataestudo.py b/idessem/dessem/modelos/blocos/dataestudo.py index fc5de192..c52e3156 100644 --- a/idessem/dessem/modelos/blocos/dataestudo.py +++ b/idessem/dessem/modelos/blocos/dataestudo.py @@ -17,9 +17,7 @@ def __eq__(self, o: object) -> bool: if not isinstance(o, DataEstudo): return False else: - if not all( - [type(self.data) is datetime, type(o.data) is datetime] - ): + if not all([type(self.data) is datetime, type(o.data) is datetime]): return False return self.data == o.data diff --git a/idessem/dessem/modelos/deflant.py b/idessem/dessem/modelos/deflant.py index e093d430..d3b92d34 100644 --- a/idessem/dessem/modelos/deflant.py +++ b/idessem/dessem/modelos/deflant.py @@ -6,6 +6,7 @@ from idessem.dessem.modelos.componentes.stagedatefield import StageDateField from typing import Optional, Union + class DEFANT(Register): """ Registro que contém as defluências anteriores ao início do período @@ -18,10 +19,10 @@ class DEFANT(Register): [ IntegerField(3, 9), IntegerField(3, 14), - LiteralField(1,19), + LiteralField(1, 19), StageDateField(starting_position=24, special_day_character="I"), StageDateField(starting_position=32, special_day_character="F"), - FloatField(10,44,1) + FloatField(10, 44, 1), ] ) diff --git a/idessem/dessem/modelos/desselet.py b/idessem/dessem/modelos/desselet.py index 3366d42c..7a34d0d2 100644 --- a/idessem/dessem/modelos/desselet.py +++ b/idessem/dessem/modelos/desselet.py @@ -76,7 +76,9 @@ def write(self, file: IO, *args, **kwargs): for linha in self.__comentarios: file.write(linha) if not isinstance(self.data, pd.DataFrame): - raise ValueError("Dados do desselet.dat não foram lidos com sucesso") + raise ValueError( + "Dados do desselet.dat não foram lidos com sucesso" + ) for _, lin in self.data.iterrows(): linha_escrita = lin.tolist() file.write(self.__linha.write(linha_escrita)) @@ -175,7 +177,9 @@ def write(self, file: IO, *args, **kwargs): for linha in self.__comentarios: file.write(linha) if not isinstance(self.data, pd.DataFrame): - raise ValueError("Dados do desselet.dat não foram lidos com sucesso") + raise ValueError( + "Dados do desselet.dat não foram lidos com sucesso" + ) for _, lin in self.data.iterrows(): linha_escrita = lin.tolist() file.write(self.__linha.write(linha_escrita)) diff --git a/idessem/dessem/modelos/dessopc.py b/idessem/dessem/modelos/dessopc.py index 1f971a9b..32b20793 100644 --- a/idessem/dessem/modelos/dessopc.py +++ b/idessem/dessem/modelos/dessopc.py @@ -6,7 +6,6 @@ class BlocoUctPar(Block): - """ Flag para definir o número de núcleos para processamento paralelo no DESSEM, existente no `dessopc.dat` diff --git a/idessem/dessem/modelos/pdo_operacao.py b/idessem/dessem/modelos/pdo_operacao.py index db18906f..9f3c2448 100644 --- a/idessem/dessem/modelos/pdo_operacao.py +++ b/idessem/dessem/modelos/pdo_operacao.py @@ -131,9 +131,7 @@ def converte_tabela_em_df() -> pd.DataFrame: linha.split(":")[1].strip() ) linha = file.readline() - custo_futuro = FloatField(size=15).read( - linha.split(":")[1].strip() - ) + custo_futuro = FloatField(size=15).read(linha.split(":")[1].strip()) estagios.append(estagio) custos_presentes.append(custo_presente) diff --git a/idessem/dessem/modelos/respot.py b/idessem/dessem/modelos/respot.py index c626b69b..ff17947f 100644 --- a/idessem/dessem/modelos/respot.py +++ b/idessem/dessem/modelos/respot.py @@ -6,6 +6,7 @@ from idessem.dessem.modelos.componentes.stagedatefield import StageDateField from typing import Optional, Union + class RP(Register): """ Registro que contém as áreas e janela de tempo para consideração das @@ -19,7 +20,7 @@ class RP(Register): IntegerField(3, 4), StageDateField(starting_position=9, special_day_character="I"), StageDateField(starting_position=17, special_day_character="F"), - LiteralField(40,30) + LiteralField(40, 30), ] ) @@ -37,7 +38,6 @@ def codigo_area(self) -> Optional[int]: def codigo_area(self, u: int): self.data[0] = u - @property def dia_inicial(self) -> Optional[Union[str, int]]: """ @@ -138,6 +138,7 @@ def descricao(self) -> Optional[str]: def descricao(self, cod: str): self.data[3] = cod + class LM(Register): """ Registro que contém a reserva mínima de potência para a área. @@ -150,7 +151,7 @@ class LM(Register): IntegerField(3, 4), StageDateField(starting_position=9, special_day_character="I"), StageDateField(starting_position=17, special_day_character="F"), - FloatField(10,25,2) + FloatField(10, 25, 2), ] ) @@ -168,7 +169,6 @@ def codigo_area(self) -> Optional[int]: def codigo_area(self, u: int): self.data[0] = u - @property def dia_inicial(self) -> Optional[Union[str, int]]: """ diff --git a/pyproject.toml b/pyproject.toml index 53c4836c..0d185d92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ authors = [ {name = "Rogerio Alves", email = "rogerioalves.ee@gmail.com"}, {name = "Mariana Noel", email = "marianasimoesnoel@gmail.com"}, ] -description = "idessem" +description = "Pacote Python para manipulacao dos arquivos de entrada e saida do DESSEM" readme = "README.md" license = {file = "LICENSE.md"} classifiers = [ @@ -23,21 +23,33 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", + "Typing :: Typed", ] [project.optional-dependencies] -dev = [ +test = [ "pytest", "pytest-cov", - "ruff", + "pytest-xdist", +] +lint = [ "mypy", - "sphinx-rtd-theme", - "sphinx-gallery", - "sphinx", + "pre-commit", + "ruff", +] +docs = [ + "matplotlib", "numpydoc", "plotly", - "matplotlib", + "sphinx", + "sphinx-gallery", + "sphinx-rtd-theme", +] +dev = [ + "idessem[test,lint,docs]", ] [project.urls] diff --git a/tests/dessem/componentes/test_stagedatefield.py b/tests/dessem/componentes/test_stagedatefield.py index 9474b0da..fc08b862 100644 --- a/tests/dessem/componentes/test_stagedatefield.py +++ b/tests/dessem/componentes/test_stagedatefield.py @@ -1,5 +1,4 @@ from idessem.dessem.modelos.componentes.stagedatefield import StageDateField -import numpy as np def test_stagedatefield_read(): diff --git a/tests/dessem/test_avl_estatfpha.py b/tests/dessem/test_avl_estatfpha.py index 6d214f26..f99fa98b 100644 --- a/tests/dessem/test_avl_estatfpha.py +++ b/tests/dessem/test_avl_estatfpha.py @@ -2,7 +2,7 @@ from idessem.dessem.modelos.avl_estatfpha import ( BlocoDesvios, ) -from datetime import datetime, timedelta +from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch from tests.mocks.arquivos.avl_estatfpha import ( diff --git a/tests/dessem/test_avl_fpha3.py b/tests/dessem/test_avl_fpha3.py index 3f9e8c7c..68c2dcba 100644 --- a/tests/dessem/test_avl_fpha3.py +++ b/tests/dessem/test_avl_fpha3.py @@ -57,8 +57,7 @@ def test_tabela_avl_fpha3(): == 241.0 ) assert ( - avl.tabela.at[avl.tabela.shape[0] - 1, "vazao_lateral_m3s"] - == 15552 + avl.tabela.at[avl.tabela.shape[0] - 1, "vazao_lateral_m3s"] == 15552 ) assert avl.tabela.at[avl.tabela.shape[0] - 1, "desvio_percentual"] == 0 diff --git a/tests/dessem/test_dadvaz.py b/tests/dessem/test_dadvaz.py index 9545844b..17ce5e14 100644 --- a/tests/dessem/test_dadvaz.py +++ b/tests/dessem/test_dadvaz.py @@ -74,6 +74,7 @@ def test_bloco_dados_horizonte(): b.dia_semana_inicial = 0 assert b.dia_semana_inicial == 0 + def test_blocos(): m: MagicMock = mock_open(read_data="".join(MockDadvaz)) with patch("builtins.open", m): @@ -93,11 +94,12 @@ def test_blocos(): assert ad.dia_semana_inicial == 6 ad.dia_semana_inicial = 0 assert ad.dia_semana_inicial == 0 - assert ad.vazoes.at[0,"codigo_usina"] == 1 - df = ad.vazoes - df.at[0,"codigo_usina"] = 0 - ad.vazoes = df - assert ad.vazoes.at[0,"codigo_usina"] == 0 + assert ad.vazoes.at[0, "codigo_usina"] == 1 + df = ad.vazoes + df.at[0, "codigo_usina"] = 0 + ad.vazoes = df + assert ad.vazoes.at[0, "codigo_usina"] == 0 + def test_bloco_vazoes(): m: MagicMock = mock_open(read_data="".join(MockBlocoVazoes)) @@ -144,7 +146,9 @@ def test_leitura_escrita_dadvaz(): cf1.write(ARQ_TESTE) # Recupera o que foi escrito chamadas = m_escrita.mock_calls - linhas_escritas = [chamadas[i].args[0] for i in range(1, len(chamadas) - 1)] + linhas_escritas = [ + chamadas[i].args[0] for i in range(1, len(chamadas) - 1) + ] m_releitura: MagicMock = mock_open(read_data="".join(linhas_escritas)) with patch("builtins.open", m_releitura): cf2 = Dadvaz.read(ARQ_TESTE) diff --git a/tests/dessem/test_deflant.py b/tests/dessem/test_deflant.py index 3bed3797..46122887 100644 --- a/tests/dessem/test_deflant.py +++ b/tests/dessem/test_deflant.py @@ -1,12 +1,11 @@ from idessem.dessem.deflant import Deflant from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch -from tests.mocks.arquivos.deflant import ( - MockDeflant -) +from tests.mocks.arquivos.deflant import MockDeflant ARQ_TESTE = "./tests/__init__.py" + def test_campos_encontrados_deflant(): m: MagicMock = mock_open(read_data="".join(MockDeflant)) with patch("builtins.open", m): @@ -15,17 +14,10 @@ def test_campos_encontrados_deflant(): assert d.defant(codigo_usina_montante=2) is not None assert d.defant(codigo_elemento_jusante=6) is not None assert d.defant(codigo_usina_montante=1) is None - assert d.defant(df=True).at[0,"defluencia"] == 110 + assert d.defant(df=True).at[0, "defluencia"] == 110 reg = d.defant(codigo_usina_montante=2) - assert reg.data == [ - 2, - 4, - "H", - [10, 0, 0], - ["F", None, None], - 110 - ] + assert reg.data == [2, 4, "H", [10, 0, 0], ["F", None, None], 110] assert reg.codigo_usina_montante == 2 reg.codigo_usina_montante = -1 @@ -57,7 +49,7 @@ def test_campos_encontrados_deflant(): assert reg.defluencia == 110 reg.defluencia = -1 assert reg.defluencia == -1 - + def test_eq_deflant(): m: MagicMock = mock_open(read_data="".join(MockDeflant)) diff --git a/tests/dessem/test_entdados.py b/tests/dessem/test_entdados.py index be884c3d..ac998e0e 100644 --- a/tests/dessem/test_entdados.py +++ b/tests/dessem/test_entdados.py @@ -1970,9 +1970,7 @@ def test_campos_encontrados_entdados(): assert d.rd is not None assert d.rivar(999) is not None - assert ( - d.tm(dia_inicial=11, hora_inicial=0, meia_hora_inicial=1) is not None - ) + assert d.tm(dia_inicial=11, hora_inicial=0, meia_hora_inicial=1) is not None assert d.sist(1) is not None assert d.ree(1) is not None assert d.uh(1) is not None diff --git a/tests/dessem/test_operuh.py b/tests/dessem/test_operuh.py index 2fa4f6c8..4ca0b618 100644 --- a/tests/dessem/test_operuh.py +++ b/tests/dessem/test_operuh.py @@ -205,7 +205,9 @@ def test_leitura_escrita_operuh(): d1.write("./tests/mocks/arquivos/operuh.py") # Recupera o que foi escrito chamadas = m_escrita.mock_calls - linhas_escritas = [chamadas[i].args[0] for i in range(1, len(chamadas) - 1)] + linhas_escritas = [ + chamadas[i].args[0] for i in range(1, len(chamadas) - 1) + ] m_releitura: MagicMock = mock_open(read_data="".join(linhas_escritas)) with patch("builtins.open", m_releitura): d2 = Operuh.read("./tests/mocks/arquivos/operuh.py") diff --git a/tests/dessem/test_pdo_aval_qmaxusih.py b/tests/dessem/test_pdo_aval_qmaxusih.py index e32d23c8..66e8ed4d 100644 --- a/tests/dessem/test_pdo_aval_qmaxusih.py +++ b/tests/dessem/test_pdo_aval_qmaxusih.py @@ -1,9 +1,7 @@ from idessem.dessem.pdo_aval_qmaxusih import PdoAvalQmaxUsih -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch -import numpy as np from tests.mocks.arquivos.pdo_aval_qmaxusih import ( MockPdoAvalQmaxUsih2001, diff --git a/tests/dessem/test_pdo_eco_fcfcortes.py b/tests/dessem/test_pdo_eco_fcfcortes.py index 636da8b0..0b8604e5 100644 --- a/tests/dessem/test_pdo_eco_fcfcortes.py +++ b/tests/dessem/test_pdo_eco_fcfcortes.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_eco_fcfcortes import PdoEcoFcfCortes -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_eco_usih.py b/tests/dessem/test_pdo_eco_usih.py index 0756ea90..2e2cf498 100644 --- a/tests/dessem/test_pdo_eco_usih.py +++ b/tests/dessem/test_pdo_eco_usih.py @@ -61,9 +61,7 @@ def test_tabela_pdo_eco_usih(): pdo.tabela.at[0, "volume_soleira_vertedouro_util_percentual"] == 0 ) assert pdo.tabela.at[0, "volume_soleira_desvio_hm3"] == 120.00 - assert ( - pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 - ) + assert pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 assert pdo.tabela.at[0, "volume_referencia_hm3"] == 792.00 assert pdo.tabela.at[0, "tipo_reservatorio"] == "RV" assert pdo.tabela.at[0, "tipo_regularizacao"] == "M" @@ -143,9 +141,7 @@ def test_tabela_pdo_eco_usih_190402(): pdo.tabela.at[0, "volume_soleira_vertedouro_util_percentual"] == 0 ) assert pdo.tabela.at[0, "volume_soleira_desvio_hm3"] == 120.00 - assert ( - pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 - ) + assert pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 assert pdo.tabela.at[0, "volume_referencia_hm3"] == 792.00 assert pdo.tabela.at[0, "tipo_reservatorio"] == "RV" assert pdo.tabela.at[0, "tipo_regularizacao"] == "M" @@ -228,9 +224,7 @@ def test_tabela_pdo_eco_usih_190301(): pdo.tabela.at[0, "volume_soleira_vertedouro_util_percentual"] == 0 ) assert pdo.tabela.at[0, "volume_soleira_desvio_hm3"] == 120.00 - assert ( - pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 - ) + assert pdo.tabela.at[0, "volume_soleira_desvio_util_percentual"] == 0.00 assert pdo.tabela.at[0, "volume_referencia_hm3"] == 792.00 assert pdo.tabela.at[0, "tipo_regularizacao"] == "M" assert pdo.tabela.at[0, "flag_evaporacao"] == 1 diff --git a/tests/dessem/test_pdo_eco_usih_polin.py b/tests/dessem/test_pdo_eco_usih_polin.py index 2298d002..57621d59 100644 --- a/tests/dessem/test_pdo_eco_usih_polin.py +++ b/tests/dessem/test_pdo_eco_usih_polin.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_eco_usih_polin import PdoEcoUsihPolin -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_eolica.py b/tests/dessem/test_pdo_eolica.py index 0b93a0b3..41259dbe 100644 --- a/tests/dessem/test_pdo_eolica.py +++ b/tests/dessem/test_pdo_eolica.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_eolica import PdoEolica -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_hidr.py b/tests/dessem/test_pdo_hidr.py index 2e7d9038..dee8c5cd 100644 --- a/tests/dessem/test_pdo_hidr.py +++ b/tests/dessem/test_pdo_hidr.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_hidr import PdoHidr -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_inter.py b/tests/dessem/test_pdo_inter.py index 0a2ef861..bbffe221 100644 --- a/tests/dessem/test_pdo_inter.py +++ b/tests/dessem/test_pdo_inter.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_inter import PdoInter -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_oper_lpp.py b/tests/dessem/test_pdo_oper_lpp.py index 5964a535..ca1cfe4c 100644 --- a/tests/dessem/test_pdo_oper_lpp.py +++ b/tests/dessem/test_pdo_oper_lpp.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_oper_lpp import PdoOperLpp -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_oper_term.py b/tests/dessem/test_pdo_oper_term.py index 58b48dfb..bb834b38 100644 --- a/tests/dessem/test_pdo_oper_term.py +++ b/tests/dessem/test_pdo_oper_term.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_oper_term import PdoOperTerm -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_oper_tviag_calha.py b/tests/dessem/test_pdo_oper_tviag_calha.py index d1d0deda..e2742e88 100644 --- a/tests/dessem/test_pdo_oper_tviag_calha.py +++ b/tests/dessem/test_pdo_oper_tviag_calha.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_oper_tviag_calha import PdoOperTviagCalha -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_oper_usih.py b/tests/dessem/test_pdo_oper_usih.py index 1f778b2a..e27ab070 100644 --- a/tests/dessem/test_pdo_oper_usih.py +++ b/tests/dessem/test_pdo_oper_usih.py @@ -66,10 +66,10 @@ def test_tabela_pdo_oper_usih(): assert pdo.tabela.at[0, "volume_desviado"] == 0.0 assert pdo.tabela.at[0, "vazao_bombeada"] == 0.0 assert pdo.tabela.at[0, "volume_bombeado"] == 0.0 - assert pdo.tabela.at[0, "taxa_enchimento_volume_morto"] == None - assert pdo.tabela.at[0, "volume_enchimento_volume_morto"] == None - assert pdo.tabela.at[0, "taxa_descarga_fundo"] == None - assert pdo.tabela.at[0, "volume_descaga_fundo"] == None + assert pdo.tabela.at[0, "taxa_enchimento_volume_morto"] is None + assert pdo.tabela.at[0, "volume_enchimento_volume_morto"] is None + assert pdo.tabela.at[0, "taxa_descarga_fundo"] is None + assert pdo.tabela.at[0, "volume_descaga_fundo"] is None assert pdo.tabela.at[0, "geracao"] == 9.07 assert pdo.tabela.at[0, "geracao_maxima"] == 46.0 assert pdo.tabela.at[0, "geracao_minima"] == 0.0 diff --git a/tests/dessem/test_pdo_reserva.py b/tests/dessem/test_pdo_reserva.py index fe381887..b5bfd77f 100644 --- a/tests/dessem/test_pdo_reserva.py +++ b/tests/dessem/test_pdo_reserva.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_reserva import PdoReserva -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_sist.py b/tests/dessem/test_pdo_sist.py index 7afadfe6..f047798f 100644 --- a/tests/dessem/test_pdo_sist.py +++ b/tests/dessem/test_pdo_sist.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_sist import PdoSist -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_pdo_term.py b/tests/dessem/test_pdo_term.py index 23e443ef..926f168e 100644 --- a/tests/dessem/test_pdo_term.py +++ b/tests/dessem/test_pdo_term.py @@ -1,5 +1,4 @@ from idessem.dessem.pdo_term import PdoTerm -import pandas as pd # type: ignore from datetime import datetime from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch diff --git a/tests/dessem/test_renovaveis.py b/tests/dessem/test_renovaveis.py index 84fc8553..08c2d2b7 100644 --- a/tests/dessem/test_renovaveis.py +++ b/tests/dessem/test_renovaveis.py @@ -130,16 +130,6 @@ def test_campos_nao_encontrados_renovaveis(): assert d.eolica_geracao() is None -def test_campos_nao_encontrados_renovaveis(): - m: MagicMock = mock_open(read_data="") - with patch("builtins.open", m): - d = Renovaveis.read("") - assert d.eolica() is None - assert d.eolicabarra() is None - assert d.eolicasubm() is None - assert d.eolica_geracao() is None - - def test_campos_encontrados_renovaveis(): m: MagicMock = mock_open(read_data="".join(MockRenovaveis)) with patch("builtins.open", m): diff --git a/tests/dessem/test_respot.py b/tests/dessem/test_respot.py index fdf1b841..ab5a4270 100644 --- a/tests/dessem/test_respot.py +++ b/tests/dessem/test_respot.py @@ -1,16 +1,9 @@ -from idessem.dessem.modelos.respot import ( - RP, - LM -) +from idessem.dessem.modelos.respot import RP, LM from idessem.dessem.respot import Respot from tests.mocks.mock_open import mock_open from unittest.mock import MagicMock, patch -from tests.mocks.arquivos.respot import ( - MockRP, - MockLM, - MockRespot -) +from tests.mocks.arquivos.respot import MockRP, MockLM, MockRespot ARQ_TESTE = "./tests/__init__.py" @@ -23,13 +16,17 @@ def test_registro_rp_respot(): r.read(fp) assert r.data == [ 1, - [11, - 0, - 0,], - ["F", - None, - None,], - "5% CARGA DO SIN NO CAG SECO" + [ + 11, + 0, + 0, + ], + [ + "F", + None, + None, + ], + "5% CARGA DO SIN NO CAG SECO", ] assert r.codigo_area == 1 @@ -53,10 +50,10 @@ def test_registro_rp_respot(): assert r.meia_hora_final is None r.meia_hora_final = 0 assert r.meia_hora_final == 0 - assert r.descricao =="5% CARGA DO SIN NO CAG SECO" + assert r.descricao == "5% CARGA DO SIN NO CAG SECO" r.descricao = "X" assert r.descricao == "X" - + def test_registro_lm_respot(): m: MagicMock = mock_open(read_data="".join(MockLM)) @@ -66,12 +63,17 @@ def test_registro_lm_respot(): r.read(fp) assert r.data == [ 1, - [11, - 0, - 0,], - ["F", - None, - None,],3285 + [ + 11, + 0, + 0, + ], + [ + "F", + None, + None, + ], + 3285, ] assert r.codigo_area == 1 @@ -95,17 +97,18 @@ def test_registro_lm_respot(): assert r.meia_hora_final is None r.meia_hora_final = 0 assert r.meia_hora_final == 0 - assert r.limite_inferior ==3285.0 + assert r.limite_inferior == 3285.0 r.limite_inferior = 0 assert r.limite_inferior == 0 + def test_campos_nao_encontrados_respot(): m: MagicMock = mock_open(read_data="") with patch("builtins.open", m): d = Respot.read(".") assert d.rp(1) is None assert d.lm(1) is None - + def test_campos_encontrados_respot(): m: MagicMock = mock_open(read_data="".join(MockRespot)) diff --git a/tests/libs/test_usinas_hidreletricas.py b/tests/libs/test_usinas_hidreletricas.py index 3dc71fd7..767eb914 100644 --- a/tests/libs/test_usinas_hidreletricas.py +++ b/tests/libs/test_usinas_hidreletricas.py @@ -121,9 +121,7 @@ def test_df_polinjus_hidreletrica_curvajusante_polinomio_segmento(): ) assert df_curvajusante_polinomio_segmento.at[2, "codigo_usina"] == 1 assert df_curvajusante_polinomio_segmento.at[2, "indice_familia"] == 2 - assert ( - df_curvajusante_polinomio_segmento.at[2, "indice_polinomio"] == 1 - ) + assert df_curvajusante_polinomio_segmento.at[2, "indice_polinomio"] == 1 assert ( df_curvajusante_polinomio_segmento.at[ 2, "limite_inferior_vazao_jusante" @@ -252,9 +250,7 @@ def test_registro_polinjus_hidreletrica_curvajusante_afogamentoexplicito_usina() def test_registro_polinjus_hidreletrica_curvajusante_afogamentoexplicito_padrao(): m: MagicMock = mock_open( - read_data="".join( - MockHidreletricaCurvaJusanteAfogamentoExplicitoPadrao - ) + read_data="".join(MockHidreletricaCurvaJusanteAfogamentoExplicitoPadrao) ) r = HidreletricaCurvaJusanteAfogamentoExplicitoPadrao() with patch("builtins.open", m): @@ -280,9 +276,7 @@ def test_neq_polinjus(): with patch("builtins.open", m): log1 = UsinasHidreletricas.read(ARQ_TESTE) log2 = UsinasHidreletricas.read(ARQ_TESTE) - log1.hidreletrica_curvajusante_polinomio_segmento()[ - 0 - ].codigo_usina = -1 + log1.hidreletrica_curvajusante_polinomio_segmento()[0].codigo_usina = -1 assert log1 != log2 diff --git a/tests/mocks/arquivos/pdo_oper_titulacao_contratos.py b/tests/mocks/arquivos/pdo_oper_titulacao_contratos.py index cee46fbf..c0a51876 100644 --- a/tests/mocks/arquivos/pdo_oper_titulacao_contratos.py +++ b/tests/mocks/arquivos/pdo_oper_titulacao_contratos.py @@ -1 +1,62 @@ -MockPdoOperTitulacaoContratos = ['***********************************************************************\n', '* *\n', '* CEPEL - CENTRO DE PESQUISAS DE ENERGIA ELETRICA *\n', '* MODELO DESSEM - VERSAO 20.0.11 - Setembro de 2024 (CPLEX) *\n', '* *\n', '***********************************************************************\n', '\n', '\n', ' PROGRAMA LICENCIADO PARA ONS \n', '\n', '\n', '____________________________________________________________________\n', '\n', ' TE PMO - JANEIRO/25 - FEVEREIRO/25 - REV 3 - FCF COM CVAR - 12 REE - VALOR ESP- Data do Caso: 24/01/2025 \n', '____________________________________________________________________\n', '\n', '--------------------------------------------------\n', 'Titulacao dos contrataos de importacao de energia. \n', '--------------------------------------------------\n', '-----------------------------------------------------------------------------------\n', 'IPER: Indice do periodo. \n', 'TIPO: Tipo de contrato: \n', ' CI: Contrato de importacao de energia \n', ' CE: Contrato de exportacao de energia \n', 'CONTR: Numero do contrato de imp/exp de energia \n', 'NomeContr: Nome do contrato de imp/exp de energia \n', 'Barra: Barra da rede eletrica \n', 'Sist: Numero do subsistema \n', 'Inflexibilidade: Titulacao do contrato da UTE por parcelas devido a inflexibilidade \n', 'CustContr: Custo (Preco) da energia imp/exp \n', 'Geracao: Geracao do contrato da UTE por parcelas \n', 'CMO: Custo marginal de operacao \n', 'CMB: Custo marginal de operacao da barra \n', 'ORD.MER.TOTAL: Indica que a usina esta na ordem de merito gerando o maximo . \n', 'Titulacao: Titulacao das unidades termicas. \n', '-----------------------------------------------------------------------------------\n', '\n', '-----;----;-----;-----------;------;----;-----------------;---------;-----------------;----------;------------;-------------;------------------------------;\n', 'IPER ;TIPO;CONTR; NomeContr ;Barra ;Sist; Inflexibilidade ;CustContr; Geracao ; CMO ; CMB ;ORD.MER.TOTAL; Titulacao ;\n', ' - ; - ; - ; - ; - ; - ; MW ; (MW) ; MW ; (R$/MWh) ; (R$/MWh) ; - ; - ;\n', '-----;----;-----;-----------;------;----;-----------------;---------;-----------------;----------;------------;-------------;------------------------------;\n', ' 1 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 59.93 ; 63.42 ; ; Inflexibilidade ;\n', ' 1 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 59.93 ; 63.42 ; ; Inflexibilidade ;\n', ' 2 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 40.98 ; 43.36 ; ; Inflexibilidade ;\n', ' 2 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 40.98 ; 43.36 ; ; Inflexibilidade ;\n', ' 3 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 37.22 ; 39.25 ; ; Inflexibilidade ;\n', ' 3 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 37.22 ; 39.25 ; ; Inflexibilidade ;\n', ' 4 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 35.52 ; 37.59 ; ; Inflexibilidade ;\n', ' 4 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 35.52 ; 37.59 ; ; Inflexibilidade ;\n', ' 5 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 35.31 ; 37.35 ; ; Inflexibilidade ;\n', ' 5 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 35.31 ; 37.35 ; ; Inflexibilidade ;\n', ' 6 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.98 ; 36.98 ; ; Inflexibilidade ;\n', ' 6 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.98 ; 36.98 ; ; Inflexibilidade ;\n', ' 7 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.51 ; 36.59 ; ; Inflexibilidade ;\n', ' 7 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.51 ; 36.59 ; ; Inflexibilidade ;\n', ' 8 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.35 ; 36.42 ; ; Inflexibilidade ;\n', ' 8 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.35 ; 36.42 ; ; Inflexibilidade ;\n', ' 9 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.42 ; 36.47 ; ; Inflexibilidade ;\n', ' 9 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.42 ; 36.47 ; ; Inflexibilidade ;\n', ' 10 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.26 ; 36.33 ; ; Inflexibilidade ;\n'] \ No newline at end of file +MockPdoOperTitulacaoContratos = [ + "***********************************************************************\n", + "* *\n", + "* CEPEL - CENTRO DE PESQUISAS DE ENERGIA ELETRICA *\n", + "* MODELO DESSEM - VERSAO 20.0.11 - Setembro de 2024 (CPLEX) *\n", + "* *\n", + "***********************************************************************\n", + "\n", + "\n", + " PROGRAMA LICENCIADO PARA ONS \n", + "\n", + "\n", + "____________________________________________________________________\n", + "\n", + " TE PMO - JANEIRO/25 - FEVEREIRO/25 - REV 3 - FCF COM CVAR - 12 REE - VALOR ESP- Data do Caso: 24/01/2025 \n", + "____________________________________________________________________\n", + "\n", + "--------------------------------------------------\n", + "Titulacao dos contrataos de importacao de energia. \n", + "--------------------------------------------------\n", + "-----------------------------------------------------------------------------------\n", + "IPER: Indice do periodo. \n", + "TIPO: Tipo de contrato: \n", + " CI: Contrato de importacao de energia \n", + " CE: Contrato de exportacao de energia \n", + "CONTR: Numero do contrato de imp/exp de energia \n", + "NomeContr: Nome do contrato de imp/exp de energia \n", + "Barra: Barra da rede eletrica \n", + "Sist: Numero do subsistema \n", + "Inflexibilidade: Titulacao do contrato da UTE por parcelas devido a inflexibilidade \n", + "CustContr: Custo (Preco) da energia imp/exp \n", + "Geracao: Geracao do contrato da UTE por parcelas \n", + "CMO: Custo marginal de operacao \n", + "CMB: Custo marginal de operacao da barra \n", + "ORD.MER.TOTAL: Indica que a usina esta na ordem de merito gerando o maximo . \n", + "Titulacao: Titulacao das unidades termicas. \n", + "-----------------------------------------------------------------------------------\n", + "\n", + "-----;----;-----;-----------;------;----;-----------------;---------;-----------------;----------;------------;-------------;------------------------------;\n", + "IPER ;TIPO;CONTR; NomeContr ;Barra ;Sist; Inflexibilidade ;CustContr; Geracao ; CMO ; CMB ;ORD.MER.TOTAL; Titulacao ;\n", + " - ; - ; - ; - ; - ; - ; MW ; (MW) ; MW ; (R$/MWh) ; (R$/MWh) ; - ; - ;\n", + "-----;----;-----;-----------;------;----;-----------------;---------;-----------------;----------;------------;-------------;------------------------------;\n", + " 1 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 59.93 ; 63.42 ; ; Inflexibilidade ;\n", + " 1 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 59.93 ; 63.42 ; ; Inflexibilidade ;\n", + " 2 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 40.98 ; 43.36 ; ; Inflexibilidade ;\n", + " 2 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 40.98 ; 43.36 ; ; Inflexibilidade ;\n", + " 3 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 37.22 ; 39.25 ; ; Inflexibilidade ;\n", + " 3 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 37.22 ; 39.25 ; ; Inflexibilidade ;\n", + " 4 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 35.52 ; 37.59 ; ; Inflexibilidade ;\n", + " 4 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 35.52 ; 37.59 ; ; Inflexibilidade ;\n", + " 5 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 35.31 ; 37.35 ; ; Inflexibilidade ;\n", + " 5 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 35.31 ; 37.35 ; ; Inflexibilidade ;\n", + " 6 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.98 ; 36.98 ; ; Inflexibilidade ;\n", + " 6 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.98 ; 36.98 ; ; Inflexibilidade ;\n", + " 7 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.51 ; 36.59 ; ; Inflexibilidade ;\n", + " 7 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.51 ; 36.59 ; ; Inflexibilidade ;\n", + " 8 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.35 ; 36.42 ; ; Inflexibilidade ;\n", + " 8 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.35 ; 36.42 ; ; Inflexibilidade ;\n", + " 9 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.42 ; 36.47 ; ; Inflexibilidade ;\n", + " 9 ; CI ; 183 ; TKUTAT-I ; - ; - ; 219.00 ; 250.89; 219.00 ; 34.42 ; 36.47 ; ; Inflexibilidade ;\n", + " 10 ; CI ; 65 ; TKUTA2-I ; - ; - ; 146.00 ; 0.00; 146.00 ; 34.26 ; 36.33 ; ; Inflexibilidade ;\n", +] diff --git a/tests/mocks/arquivos/respot.py b/tests/mocks/arquivos/respot.py index 1756cc19..19e9348b 100644 --- a/tests/mocks/arquivos/respot.py +++ b/tests/mocks/arquivos/respot.py @@ -1,3 +1,60 @@ -MockRespot = ['&\n', 'RP 1 11 0 0 F 5% CARGA DO SIN NO CAG SECO\n', '&\n', 'LM 1 11 0 0 F 3285\n', 'LM 1 11 0 1 F 3195\n', 'LM 1 11 1 0 F 3113\n', 'LM 1 11 1 1 F 3053\n', 'LM 1 11 2 0 F 3002\n', 'LM 1 11 2 1 F 2970\n', 'LM 1 11 3 0 F 2949\n', 'LM 1 11 3 1 F 2939\n', 'LM 1 11 4 0 F 2944\n', 'LM 1 11 4 1 F 2961\n', 'LM 1 11 5 0 F 3022\n', 'LM 1 11 5 1 F 3083\n', 'LM 1 11 6 0 F 3191\n', 'LM 1 11 6 1 F 3239\n', 'LM 1 11 7 0 F 3316\n', 'LM 1 11 7 1 F 3395\n', 'LM 1 11 8 0 F 3462\n', 'LM 1 11 8 1 F 3490\n', 'LM 1 11 9 0 F 3488\n', 'LM 1 11 9 1 F 3482\n', 'LM 1 11 10 0 F 3496\n', 'LM 1 11 10 1 F 3501\n', 'LM 1 11 11 0 F 3492\n', 'LM 1 11 11 1 F 3458\n', 'LM 1 11 12 0 F 3385\n', 'LM 1 11 12 1 F 3369\n', 'LM 1 11 13 0 F 3449\n', 'LM 1 11 13 1 F 3525\n', 'LM 1 11 14 0 F 3583\n', 'LM 1 11 14 1 F 3640\n', 'LM 1 11 15 0 F 3689\n', 'LM 1 11 15 1 F 3740\n', 'LM 1 11 16 0 F 3793\n', 'LM 1 11 16 1 F 3828\n', 'LM 1 11 17 0 F 3820\n', 'LM 1 11 17 1 F 3919\n', 'LM 1 11 18 0 F 4023\n', 'LM 1 11 18 1 F 4075\n', 'LM 1 11 19 0 F 4045\n', 'LM 1 11 19 1 F 4006\n', 'LM 1 11 20 0 F 3964\n', 'LM 1 11 20 1 F 3938\n', 'LM 1 11 21 0 F 3916\n', 'LM 1 11 21 1 F 3841\n', 'LM 1 11 22 0 F 3743\n', 'LM 1 11 22 1 F 3651\n', 'LM 1 11 23 0 F 3534\n', 'LM 1 11 23 1 F 3457\n', 'LM 1 12 0 0 F 3029\n', 'LM 1 12 7 0 F 3380\n', 'LM 1 12 10 0 F 3668\n', 'LM 1 12 22 0 F 3557\n', '9999'] -MockRP= 'RP 1 11 0 0 F 5% CARGA DO SIN NO CAG SECO\n' -MockLM = 'LM 1 11 0 0 F 3285\n' \ No newline at end of file +MockRespot = [ + "&\n", + "RP 1 11 0 0 F 5% CARGA DO SIN NO CAG SECO\n", + "&\n", + "LM 1 11 0 0 F 3285\n", + "LM 1 11 0 1 F 3195\n", + "LM 1 11 1 0 F 3113\n", + "LM 1 11 1 1 F 3053\n", + "LM 1 11 2 0 F 3002\n", + "LM 1 11 2 1 F 2970\n", + "LM 1 11 3 0 F 2949\n", + "LM 1 11 3 1 F 2939\n", + "LM 1 11 4 0 F 2944\n", + "LM 1 11 4 1 F 2961\n", + "LM 1 11 5 0 F 3022\n", + "LM 1 11 5 1 F 3083\n", + "LM 1 11 6 0 F 3191\n", + "LM 1 11 6 1 F 3239\n", + "LM 1 11 7 0 F 3316\n", + "LM 1 11 7 1 F 3395\n", + "LM 1 11 8 0 F 3462\n", + "LM 1 11 8 1 F 3490\n", + "LM 1 11 9 0 F 3488\n", + "LM 1 11 9 1 F 3482\n", + "LM 1 11 10 0 F 3496\n", + "LM 1 11 10 1 F 3501\n", + "LM 1 11 11 0 F 3492\n", + "LM 1 11 11 1 F 3458\n", + "LM 1 11 12 0 F 3385\n", + "LM 1 11 12 1 F 3369\n", + "LM 1 11 13 0 F 3449\n", + "LM 1 11 13 1 F 3525\n", + "LM 1 11 14 0 F 3583\n", + "LM 1 11 14 1 F 3640\n", + "LM 1 11 15 0 F 3689\n", + "LM 1 11 15 1 F 3740\n", + "LM 1 11 16 0 F 3793\n", + "LM 1 11 16 1 F 3828\n", + "LM 1 11 17 0 F 3820\n", + "LM 1 11 17 1 F 3919\n", + "LM 1 11 18 0 F 4023\n", + "LM 1 11 18 1 F 4075\n", + "LM 1 11 19 0 F 4045\n", + "LM 1 11 19 1 F 4006\n", + "LM 1 11 20 0 F 3964\n", + "LM 1 11 20 1 F 3938\n", + "LM 1 11 21 0 F 3916\n", + "LM 1 11 21 1 F 3841\n", + "LM 1 11 22 0 F 3743\n", + "LM 1 11 22 1 F 3651\n", + "LM 1 11 23 0 F 3534\n", + "LM 1 11 23 1 F 3457\n", + "LM 1 12 0 0 F 3029\n", + "LM 1 12 7 0 F 3380\n", + "LM 1 12 10 0 F 3668\n", + "LM 1 12 22 0 F 3557\n", + "9999", +] +MockRP = "RP 1 11 0 0 F 5% CARGA DO SIN NO CAG SECO\n" +MockLM = "LM 1 11 0 0 F 3285\n" diff --git a/tests/mocks/arquivos/uch.py b/tests/mocks/arquivos/uch.py index d6b47025..88e21c15 100644 --- a/tests/mocks/arquivos/uch.py +++ b/tests/mocks/arquivos/uch.py @@ -102,8 +102,6 @@ MockUchCustoPartidaUnidade = "UCH-CUSTO-PARTIDA-UNIDADE;1;2;2;300.50" MockUchCustoPartidaConjunto = "UCH-CUSTO-PARTIDA-UNIDADE;1;2;300.50" MockUchCustoPartidaUsina = "UCH-CUSTO-PARTIDA-UNIDADE;1;300.50" -MockUchCustoPartidaVazioUnidade = ( - "UCH-CUSTO-PARTIDA-VAZIO-UNIDADE;1;2;2;100.50" -) +MockUchCustoPartidaVazioUnidade = "UCH-CUSTO-PARTIDA-VAZIO-UNIDADE;1;2;2;100.50" MockUchCustoPartidaVazioConjunto = "UCH-CUSTO-PARTIDA-VAZIO-UNIDADE;1;2;100.50" MockUchCustoPartidaVazioUsina = "UCH-CUSTO-PARTIDA-VAZIO-UNIDADE;1;100.50" From c58192e0d33aaeb2c7d97094e9319122769e8fbb Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Sun, 8 Mar 2026 17:44:11 -0300 Subject: [PATCH 2/7] feat: complete epic-02 Sphinx modernization - Migrate Sphinx theme from sphinx-rtd-theme to Furo - Clean up layout.html template (remove RTD CSS overrides) - Add dark mode support (pygments_dark_style = monokai) - Review sphinx-gallery config (already correct, no changes needed) Co-Authored-By: Claude Opus 4.6 --- docs/source/_templates/layout.html | 25 +------------------- docs/source/conf.py | 15 ++++-------- docs/source/sg_execution_times.rst | 37 ++++++++++++++++++++++++++++++ pyproject.toml | 2 +- 4 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 docs/source/sg_execution_times.rst diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html index 072f1f9e..37b9d3df 100644 --- a/docs/source/_templates/layout.html +++ b/docs/source/_templates/layout.html @@ -1,24 +1 @@ -{% extends "!layout.html" %} {% block footer %} {{ super() }} - - -{% endblock %} +{% extends "!layout.html" %} diff --git a/docs/source/conf.py b/docs/source/conf.py index a13d2be3..71c72028 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -46,7 +46,6 @@ "sphinx.ext.githubpages", "sphinx_gallery.gen_gallery", "numpydoc", - "sphinx_rtd_theme", ] # generate autosummary pages @@ -77,7 +76,8 @@ exclude_patterns: List[str] = [] add_module_names = False -pygments_style = "sphinx" +pygments_style = "friendly" +pygments_dark_style = "monokai" modindex_common_prefix = ["idessem."] # -- Options for HTML output ------------------------------------------------- @@ -85,15 +85,10 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_rtd_theme" +html_theme = "furo" html_theme_options = { - "logo_only": True, - # Toc options - "collapse_navigation": False, - "sticky_navigation": True, - "navigation_depth": 4, - "includehidden": True, - "titles_only": False, + "sidebar_hide_name": True, + "navigation_with_keys": True, } diff --git a/docs/source/sg_execution_times.rst b/docs/source/sg_execution_times.rst new file mode 100644 index 00000000..78433a96 --- /dev/null +++ b/docs/source/sg_execution_times.rst @@ -0,0 +1,37 @@ + +:orphan: + +.. _sphx_glr_sg_execution_times: + + +Computation times +================= +**00:00.000** total execution time for 0 files **from all galleries**: + +.. container:: + + .. raw:: html + + + + + + + + .. list-table:: + :header-rows: 1 + :class: table table-striped sg-datatable + + * - Example + - Time + - Mem (MB) + * - N/A + - N/A + - N/A diff --git a/pyproject.toml b/pyproject.toml index 0d185d92..5d3077a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ docs = [ "plotly", "sphinx", "sphinx-gallery", - "sphinx-rtd-theme", + "furo", ] dev = [ "idessem[test,lint,docs]", From ef89a2f94306213e11a55023625579a3fcdff57c Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Mon, 9 Mar 2026 22:04:42 -0300 Subject: [PATCH 3/7] feat: complete epic-03 documentation content expansion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create architecture page (arquitetura.rst) with 6 sections - Create FAQ page (faq.rst) with 16 questions across 5 categories - Create performance guide (desempenho.rst) with optimization tips - Improve API reference with autosummary tables (43 dessem + 1 libs) - Update index.rst toctree with new "Guias" section - Fix inewave→idessem typo in index.rst master file comment Co-Authored-By: Claude Opus 4.6 --- docs/source/geral/arquitetura.rst | 250 ++++++++++++++++++++ docs/source/geral/desempenho.rst | 125 ++++++++++ docs/source/geral/faq.rst | 302 ++++++++++++++++++++++++ docs/source/index.rst | 14 +- docs/source/referencia/dessem/index.rst | 58 ++++- docs/source/referencia/libs/index.rst | 12 +- 6 files changed, 755 insertions(+), 6 deletions(-) create mode 100644 docs/source/geral/arquitetura.rst create mode 100644 docs/source/geral/desempenho.rst create mode 100644 docs/source/geral/faq.rst diff --git a/docs/source/geral/arquitetura.rst b/docs/source/geral/arquitetura.rst new file mode 100644 index 00000000..42eab4c7 --- /dev/null +++ b/docs/source/geral/arquitetura.rst @@ -0,0 +1,250 @@ +.. _arquitetura: + +Arquitetura do idessem +====================== + +Esta página descreve a estrutura interna do *idessem*, explicando como o módulo é +organizado, como os arquivos do modelo DESSEM são mapeados para classes Python e +qual é o fluxo típico de leitura e escrita de dados. + +Visão Geral da Arquitetura +-------------------------- + +O *idessem* é uma biblioteca Python que fornece uma interface de alto nível para +leitura e escrita dos arquivos do modelo DESSEM, utilizado pelo Operador Nacional +do Sistema Elétrico (ONS) para o planejamento da operação de curtíssimo prazo do +Sistema Interligado Nacional (SIN). O modelo DESSEM processa dezenas de arquivos +de entrada e produz dezenas de arquivos de saída, todos com formatos textuais +proprietários e bem definidos. + +A responsabilidade central do *idessem* é abstrair o formato textual de cada +arquivo em uma classe Python, expondo os dados como propriedades tipadas — +principalmente como :obj:`~pandas.DataFrame` para dados tabulares — e permitindo +que o usuário leia, inspecione, modifique e reescreva esses arquivos sem precisar +conhecer a sintaxe interna de cada formato. + +O *idessem* é construído sobre o framework :obj:`cfinterface `, que +fornece as abstrações de nível mais baixo para leitura e escrita de arquivos +estruturados. A relação entre os dois módulos está descrita em detalhes na seção +:doc:`Como contribuir? `. + +Framework cfinterface +--------------------- + +O framework `cfinterface `_ classifica os arquivos +processados em três categorias, de acordo com a sua estrutura interna: + +- :obj:`~cfinterface.files.blockfile.BlockFile`: arquivos compostos por blocos com + padrão de início bem definido, que podem aparecer múltiplas vezes e em qualquer + ordem. +- :obj:`~cfinterface.files.sectionfile.SectionFile`: arquivos compostos por seções + fixas que aparecem sempre na mesma ordem. +- :obj:`~cfinterface.files.registerfile.RegisterFile`: arquivos compostos por + registros de linha única e formato constante. + +.. note:: + + No *idessem*, **não são utilizados arquivos do tipo** + :obj:`~cfinterface.files.sectionfile.SectionFile`. Todos os arquivos do modelo + DESSEM suportados são implementados como + :obj:`~cfinterface.files.blockfile.BlockFile` ou + :obj:`~cfinterface.files.registerfile.RegisterFile`. + +.. seealso:: + + A seção :doc:`Como contribuir? ` contém uma explicação detalhada das três classes + de arquivos do *cfinterface*, com exemplos concretos de arquivos do *idessem* + que seguem cada abordagem. + +Estrutura de Módulos +-------------------- + +O *idessem* expõe duas subpacotes públicas: + +**idessem.dessem** + +Contém as classes que modelam os arquivos de entrada e de saída do modelo DESSEM. +É o módulo principal da biblioteca, com 43 classes no total. + +*Arquivos de entrada* (suportam leitura e escrita): + +- :obj:`Areacont ` +- :obj:`Dadvaz ` +- :obj:`Deflant ` +- :obj:`DessemArq ` +- :obj:`Desselet ` +- :obj:`Dessopc ` +- :obj:`Entdados ` +- :obj:`Hidr ` +- :obj:`Operuh ` +- :obj:`Operut ` +- :obj:`Renovaveis ` +- :obj:`Respot ` +- :obj:`Term ` +- :obj:`Uch ` + +*Arquivos de saída — avaliação de FPHA* (somente leitura): + +- :obj:`AvlAltQueda ` +- :obj:`AvlDesvFpha ` +- :obj:`AvlEstatFpha ` +- :obj:`AvlFpha1 ` +- :obj:`AvlFpha2 ` +- :obj:`AvlFpha3 ` + +*Arquivos de saída — pdo_* (somente leitura): + +- :obj:`PdoAvalQmaxUsih ` +- :obj:`PdoCmoBar ` +- :obj:`PdoEcoFcfCortes ` +- :obj:`PdoEcoUsih ` +- :obj:`PdoEcoUsihConj ` +- :obj:`PdoEcoUsihPolin ` +- :obj:`PdoEolica ` +- :obj:`PdoHidr ` +- :obj:`PdoInter ` +- :obj:`PdoOperLpp ` +- :obj:`PdoOperTerm ` +- :obj:`PdoOperTitulacaoContratos ` +- :obj:`PdoOperTitulacaoUsinas ` +- :obj:`PdoOperTviagCalha ` +- :obj:`PdoOperUct ` +- :obj:`PdoOperacao ` +- :obj:`PdoReserva ` +- :obj:`PdoSist ` +- :obj:`PdoSomFlux ` +- :obj:`PdoTerm ` + +*Arquivos de log — saída de diagnóstico* (somente leitura): + +- :obj:`DesLogRelato ` +- :obj:`LogInviab ` +- :obj:`LogMatriz ` + +**idessem.libs** + +Contém entidades compartilhadas que podem ser referenciadas por múltiplos arquivos +do modelo. Atualmente possui uma única classe: + +- :obj:`UsinasHidreletricas `: + representação consolidada dos dados de usinas hidrelétricas do SIN. + +Convenções de Nomeação +----------------------- + +Cada arquivo do modelo DESSEM é mapeado para uma classe Python com nome em +``PascalCase``, derivado do nome de arquivo mais comum encontrado nos decks de +PMO publicados pelo ONS ou nos casos de exemplo distribuídos pelo desenvolvedor +do modelo. A regra geral é: + +1. Remover a extensão do arquivo (``*.dat``, ``*.DAT``). +2. Separar as partes do nome pelo delimitador ``_`` (sublinhado). +3. Converter cada parte para ``PascalCase``, ignorando a capitalização original. + +.. note:: + + Abreviações presentes nos nomes dos arquivos são ignoradas na mudança de + capitalização. Por exemplo, ``PDO`` se torna ``Pdo`` e não ``PDO``. + +Exemplos de mapeamento: + ++------------------------+-------------------------------------+ +| Nome do arquivo | Classe Python | ++========================+=====================================+ +| ``entdados.dat`` | :ref:`Entdados ` | ++------------------------+-------------------------------------+ +| ``dessemarq.dat`` | :ref:`DessemArq ` | ++------------------------+-------------------------------------+ +| ``DES_LOG_RELATO.DAT`` | :ref:`DesLogRelato `| ++------------------------+-------------------------------------+ +| ``PDO_SIST.DAT`` | :ref:`PdoSist ` | ++------------------------+-------------------------------------+ + +Fluxo de Dados +-------------- + +O *idessem* fornece uma interface uniforme para todos os arquivos. O padrão +de uso é sempre o mesmo: o método de classe ``read()`` recebe o caminho do +arquivo e retorna uma instância da classe correspondente, com os dados +já parseados e disponíveis como propriedades. + +**Arquivos de entrada** — leitura, modificação e escrita + +Os arquivos de entrada do modelo DESSEM (como ``entdados.dat``) suportam tanto +leitura quanto escrita. O fluxo típico é: ler o arquivo original, modificar os +dados desejados através das propriedades da instância e gravar o resultado de +volta com o método ``write()``. + +.. code-block:: python + + from idessem.dessem.entdados import Entdados + + # Leitura do arquivo de entrada + arq = Entdados.read("./entdados.dat") + + # Acesso e modificação de uma propriedade + arq.uh(codigo_usina=6).volume_inicial + # 69.51 + + arq.uh(codigo_usina=6).volume_inicial *= 1.1 + arq.uh(codigo_usina=6).volume_inicial + # 76.461 + + # Escrita do arquivo modificado + arq.write("./entdados.dat") + +.. seealso:: + + O :doc:`Tutorial ` contém exemplos adicionais do ciclo de leitura e escrita, + incluindo o tratamento de versões de arquivo com ``set_version()``. + +**Arquivos de saída** — somente leitura + +Os arquivos de saída do modelo DESSEM (com prefixo ``pdo_``, ``avl_``, ``log_`` +ou ``des_log_``) não implementam o método ``write()``. O fluxo de uso é apenas +de leitura e análise dos resultados: + +.. code-block:: python + + from idessem.dessem.pdo_sist import PdoSist + + # Leitura do arquivo de saída + arq = PdoSist.read("./PDO_SIST.DAT") + + # Acesso à tabela de resultados como DataFrame + arq.tabela + # estagio patamar submercado cmo demanda ... + # 0 1 LEVE SE 71.48 36935.91 ... + # ... + +.. important:: + + Tentar chamar ``write()`` em um arquivo de saída levanta ``NotImplementedError``. + Arquivos de saída são identificados pelo prefixo do nome da classe: + ``Pdo*``, ``Avl*``, ``DesLogRelato``, ``LogInviab`` e ``LogMatriz``. + +Importações Diretas +------------------- + +O submódulo ``idessem.dessem`` utiliza importações diretas (não lazy) em seu +``__init__.py``. Isso significa que ao executar ``import idessem.dessem``, +todas as 43 classes são carregadas imediatamente na memória, incluindo suas +dependências. + +.. warning:: + + Evite importar o submódulo inteiro em código de produção ou em scripts que + exigem tempo de inicialização reduzido. Prefira importar diretamente a classe + que será utilizada: + + .. code-block:: python + + # Recomendado: importa apenas a classe necessária + from idessem.dessem.entdados import Entdados + + # Evitar em contextos sensíveis a desempenho: carrega todas as 43 classes + import idessem.dessem + +O carregamento completo do módulo pode ser aceitável em sessões interativas +(Jupyter, IPython) ou em aplicações de longa duração onde o custo de +inicialização é pago uma única vez. diff --git a/docs/source/geral/desempenho.rst b/docs/source/geral/desempenho.rst new file mode 100644 index 00000000..2d0645c6 --- /dev/null +++ b/docs/source/geral/desempenho.rst @@ -0,0 +1,125 @@ +.. _desempenho: + +Guia de Desempenho +================== + +Esta página apresenta orientações qualitativas para uso eficiente do *idessem*, +cobrindo otimização de importações, leitura em lote de arquivos, considerações +de memória e um resumo das boas práticas. + +Otimizacao de Importacoes +-------------------------- + +Ao executar ``import idessem.dessem``, o interpretador Python carrega +imediatamente todas as 43 classes de arquivos definidas em +``idessem/dessem/__init__.py``. Em scripts rápidos ou em ambientes com +restrição de tempo de inicialização — como funções AWS Lambda — esse carregamento +completo pode introduzir latência desnecessária. + +.. code-block:: python + :caption: Anti-padrão: importação completa do módulo + + import idessem.dessem # carrega todas as 43 classes + +O padrão recomendado é importar apenas a classe necessária diretamente do módulo +que a define: + +.. code-block:: python + :caption: Recomendado: importação específica + + from idessem.dessem.entdados import Entdados + +.. note:: + + As importações diretas em ``idessem/dessem/__init__.py`` são intencionais e + fazem parte do design da biblioteca. Esta orientação aplica-se ao código do + *usuário*, não à estrutura interna do *idessem*. + +Ao importar apenas as classes utilizadas, o tempo de inicialização do script é +reduzido proporcionalmente ao número de módulos não carregados. Para scripts que +utilizam apenas um ou dois arquivos DESSEM, a diferença pode ser perceptível em +ambientes com restrições de CPU ou disco. + +Leitura de Arquivos em Lote +---------------------------- + +Ao processar múltiplos arquivos de saída do DESSEM (arquivos ``PDO_*``) de forma +independente, é possível explorar paralelismo para reduzir o tempo total de +processamento. Como a leitura de arquivos é predominantemente limitada pela +entrada/saída (I/O-bound), o uso de processos separados evita a contenção do GIL +do CPython. + +.. code-block:: python + + from concurrent.futures import ProcessPoolExecutor + from idessem.dessem.pdo_sist import PdoSist + from idessem.dessem.pdo_hidr import PdoHidr + + arquivos = {"pdo_sist": PdoSist, "pdo_hidr": PdoHidr} + + def ler_arquivo(nome, classe): + return classe.read(f"./{nome.upper()}.DAT") + + with ProcessPoolExecutor() as executor: + resultados = { + nome: executor.submit(ler_arquivo, nome, cls) + for nome, cls in arquivos.items() + } + +.. warning:: + + Cada arquivo deve ser lido em um processo ou thread separado. O estado + interno das classes de arquivo do *idessem* não é compartilhado entre + processos, o que torna o ``ProcessPoolExecutor`` mais adequado do que o + ``ThreadPoolExecutor`` para operações de leitura intensiva. + +A abordagem com ``ProcessPoolExecutor`` é indicada para cenários em que vários +arquivos ``PDO_*`` independentes precisam ser lidos antes de análises +combinadas. Para um único arquivo ou para fluxos sequenciais simples, a leitura +direta com ``Classe.read(caminho)`` é suficiente e mais simples. + +Consideracoes de Memoria +------------------------- + +Arquivos de saída como ``PDO_HIDR.DAT`` e ``PDO_OPERACAO.DAT`` podem conter +grandes volumes de dados tabulares, especialmente em simulações DESSEM de +múltiplas semanas com muitos estágios e patamares. As propriedades dessas classes +retornam :obj:`~pandas.DataFrame` que residem inteiramente em memória após a +leitura. + +.. tip:: + + Após extrair as informações necessárias de um objeto de arquivo, libere a + referência com ``del`` para que o coletor de lixo do Python possa recuperar + a memória: + + .. code-block:: python + + from idessem.dessem.pdo_hidr import PdoHidr + + arq_pdo_hidr = PdoHidr.read("./PDO_HIDR.DAT") + tabela_hidr = arq_pdo_hidr.tabela # extrai o DataFrame necessário + + del arq_pdo_hidr # libera a memória do objeto de arquivo + +Recomenda-se carregar apenas os arquivos estritamente necessários para a análise +em andamento, evitando manter múltiplos objetos de arquivo grandes em memória +simultaneamente quando não são mais utilizados. + +Boas Praticas +-------------- + +A seguir, um resumo das recomendações desta página: + +**Recomendado:** + +- Importar apenas as classes utilizadas com ``from idessem.dessem. import `` +- Usar ``ProcessPoolExecutor`` para leitura paralela de múltiplos arquivos ``PDO_*`` independentes +- Extrair os dados necessários para variáveis locais e liberar o objeto de arquivo com ``del`` após o uso +- Carregar apenas os arquivos necessários para a análise em andamento + +**Evitar:** + +- ``import idessem.dessem`` em scripts sensíveis à latência de inicialização quando apenas uma ou duas classes são necessárias +- Manter múltiplos objetos de arquivo grandes (como ``PDO_HIDR`` e ``PDO_OPERACAO``) carregados simultaneamente sem necessidade +- Compartilhar instâncias de classes de arquivo entre threads sem sincronização adequada diff --git a/docs/source/geral/faq.rst b/docs/source/geral/faq.rst new file mode 100644 index 00000000..f216326e --- /dev/null +++ b/docs/source/geral/faq.rst @@ -0,0 +1,302 @@ +.. _faq: + +Perguntas Frequentes (FAQ) +========================== + +Esta página reúne as dúvidas mais comuns dos usuários do *idessem*, organizadas +por tema. Se a sua dúvida não estiver listada aqui, consulte o :doc:`Tutorial `, +a :ref:`Arquitetura ` ou abra uma issue no repositório do projeto. + +.. contents:: Índice + :local: + :depth: 1 + + +Instalação +---------- + +**Como instalar o idessem?** + +A forma mais simples é instalar via ``pip``:: + + $ pip install idessem + +Alternativamente, se você utiliza o ``uv`` como gerenciador de ambientes:: + + $ uv pip install idessem + +Recomenda-se sempre instalar o pacote dentro de um ambiente virtual. Consulte a +:doc:`página de instalação ` para instruções detalhadas. + +**Qual versão do Python é necessária?** + +O *idessem* requer **Python >= 3.10**. As versões 3.10, 3.11 e 3.12 são testadas +continuamente pela integração contínua (CI) do projeto. + +.. note:: + + Versões anteriores do Python (3.8 e 3.9) não são suportadas. Se você encontrar + referências a ``>= 3.8`` em documentação mais antiga, considere-as desatualizadas + — o requisito correto é ``>= 3.10``. + +**Como instalar a versão de desenvolvimento (última versão do repositório)?** + +Utilize o ``pip`` apontando diretamente para o repositório Git: + +.. code-block:: shell + + $ pip install git+https://github.com/rjmalves/idessem + +Para selecionar um branch ou tag específico:: + + $ pip install git+https://github.com/rjmalves/idessem@v1.0.0 + +**Como instalar as dependências de desenvolvimento?** + +O *idessem* utiliza o ``pyproject.toml`` com extras nomeados. Para instalar as +dependências de desenvolvimento, execute: + +.. code-block:: shell + + $ git clone https://github.com/rjmalves/idessem.git + $ cd idessem + $ pip install -e ".[dev]" + + +Uso Geral +--------- + +**Como ler um arquivo do DESSEM?** + +Cada arquivo do DESSEM é representado por uma classe Python. Para ler um arquivo, +utilize o método de classe ``read()``, passando o caminho do arquivo: + +.. code-block:: python + + from idessem.dessem.entdados import Entdados + + arq = Entdados.read("./entdados.dat") + +O método retorna uma instância da classe com todos os dados já parseados e +disponíveis como propriedades. Consulte o :doc:`Tutorial ` para exemplos +adicionais. + +**Como acessar os dados em formato DataFrame?** + +As propriedades das classes do *idessem* expõem os dados tabulares como objetos +:obj:`~pandas.DataFrame`. Basta acessar a propriedade correspondente na instância +retornada pelo ``read()``: + +.. code-block:: python + + from idessem.dessem.pdo_sist import PdoSist + + arq = PdoSist.read("./PDO_SIST.DAT") + df = arq.tabela + print(df.head()) + +Cada classe documenta as propriedades disponíveis e o significado de cada coluna. + +**Quais arquivos suportam escrita?** + +Apenas os **arquivos de entrada** do modelo DESSEM implementam o método ``write()``. +Os arquivos de saída são somente leitura. + +- **Arquivos de entrada** (suportam ``read()`` e ``write()``): ``entdados.dat``, + ``dessemarq.dat``, ``hidr.dat``, ``operuh.dat``, entre outros — são as classes + sem prefixo ``Pdo``, ``Avl``, ``Log`` ou ``Des``. +- **Arquivos de saída** (apenas ``read()``): todos os arquivos com prefixo ``pdo_``, + ``avl_``, ``log_`` ou ``des_log_`` — como ``PDO_SIST.DAT``, ``AVL_FPHA1.DAT``, + ``DES_LOG_RELATO.DAT``. + +.. warning:: + + Tentar chamar ``write()`` em um arquivo de saída levanta ``NotImplementedError``. + Consulte a :ref:`Arquitetura ` para a lista completa de classes por + categoria. + +**Como usar o versionamento com ``set_version()``?** + +Alguns arquivos do DESSEM tiveram alterações de sintaxe entre versões do modelo. +O método de classe ``set_version()`` informa ao *idessem* qual versão do formato +deve ser usada na leitura: + +.. code-block:: python + + from idessem.dessem.avl_fpha1 import AvlFpha1 + + # Especifica a versão antes de ler o arquivo + AvlFpha1.set_version("19.3") + arq = AvlFpha1.read("./AVL_FPHA1.DAT") + +Quando ``set_version()`` não é chamado, o *idessem* assume a versão mais recente +do arquivo. Isso pode causar erros de parsing se o arquivo foi gerado por uma +versão mais antiga do modelo DESSEM. + + +Compatibilidade com Versões do DESSEM +-------------------------------------- + +**Quais versões do DESSEM são suportadas?** + +O *idessem* suporta as versões do modelo DESSEM para as quais as classes foram +implementadas e testadas. O versionamento é tratado individualmente por arquivo: +quando um arquivo possui variações de formato entre versões do modelo, o +*idessem* disponibiliza suporte às versões mais comuns por meio do método +``set_version()``. + +Se você precisar ler um arquivo gerado por uma versão específica do DESSEM, +verifique a documentação da classe correspondente na :doc:`Referência da API <../referencia/dessem/index>` +para consultar quais versões são aceitas pelo ``set_version()``. + +**O que acontece se eu não especificar a versão com ``set_version()``?** + +Se ``set_version()`` não for chamado, será utilizada a versão mais recente +disponível para aquele arquivo. Isso é adequado para a maioria dos casos, mas +pode resultar em erros de parsing quando o arquivo foi produzido por uma versão +antiga do DESSEM cujo formato é diferente do atual. + +.. code-block:: python + + from idessem.dessem.avl_fpha1 import AvlFpha1 + + # Versão padrão (mais recente) — use quando o arquivo for recente + arq_recente = AvlFpha1.read("./AVL_FPHA1.DAT") + + # Versão explícita — necessária para arquivos de versões antigas do DESSEM + AvlFpha1.set_version("19.3") + arq_antigo = AvlFpha1.read("./AVL_FPHA1_v19_3.DAT") + + +Resolução de Problemas +----------------------- + +**Erro de importação do ``cfinterface`` — o que fazer?** + +O *idessem* depende do framework ``cfinterface`` na faixa de versão +``>=1.8.0,<=1.8.3``. Esta faixa é fixada intencionalmente porque versões +posteriores introduziram mudanças de API incompatíveis com o *idessem*. + +Se você encontrar um erro como: + +.. code-block:: text + + ImportError: cannot import name 'X' from 'cfinterface' + +ou mensagens de incompatibilidade de versão durante a instalação, verifique +se a versão instalada do ``cfinterface`` está dentro da faixa suportada: + +.. code-block:: shell + + $ pip show cfinterface + +Se necessário, force a reinstalação dentro da faixa correta: + +.. code-block:: shell + + $ pip install "cfinterface>=1.8.0,<=1.8.3" + +.. note:: + + O ``pip install idessem`` instala automaticamente o ``cfinterface`` dentro + da faixa compatível. O problema costuma ocorrer quando outras bibliotecas + do ambiente atualizam o ``cfinterface`` para uma versão incompatível. + Nesses casos, considere usar um ambiente virtual isolado. + +**O pip não consegue resolver as dependências — o que fazer?** + +Se o ``pip`` apresentar conflito de dependências envolvendo o ``cfinterface``, +a causa mais comum é que outro pacote no ambiente exige uma versão incompatível. +A solução recomendada é criar um ambiente virtual isolado para o *idessem*: + +.. code-block:: shell + + $ python -m venv .venv + $ source .venv/bin/activate # Linux/macOS + $ .venv\Scripts\activate # Windows + $ pip install idessem + +**Erro de codificação ao ler arquivos — como resolver?** + +Alguns arquivos do modelo DESSEM são gerados com codificações diferentes de +UTF-8 (por exemplo, Latin-1 / ISO-8859-1), especialmente quando contêm +caracteres especiais do português (ã, ç, é, etc.). + +Se você encontrar um ``UnicodeDecodeError`` ao ler um arquivo, verifique a +documentação da classe para saber qual codificação ela espera. Em geral, os +arquivos de texto do DESSEM utilizam Latin-1. + +Se o problema persistir, inspecione o arquivo com um editor hexadecimal ou +utilize o Python para detectar a codificação: + +.. code-block:: python + + import chardet + + with open("./arquivo.dat", "rb") as f: + resultado = chardet.detect(f.read()) + print(resultado) + +**``AttributeError`` ao acessar uma propriedade — por quê?** + +Um ``AttributeError`` ao acessar uma propriedade normalmente indica uma de +duas situações: + +1. **A propriedade não existe para a versão especificada do arquivo.** Algumas + propriedades foram adicionadas em versões mais recentes do formato. Verifique + se você está usando a versão correta com ``set_version()``. + +2. **O arquivo não foi lido com sucesso.** Se o parsing falhou silenciosamente, + a instância pode estar em estado inconsistente. Verifique se não há erros + ou avisos no console durante o ``read()``. + +.. code-block:: python + + from idessem.dessem.entdados import Entdados + + arq = Entdados.read("./entdados.dat") + + # Se arq.uh(...) retornar None, a usina não existe no arquivo + resultado = arq.uh(codigo_usina=999) + if resultado is None: + print("Usina não encontrada no arquivo.") + else: + print(resultado.volume_inicial) + + +Desempenho +----------- + +**Por que ``import idessem.dessem`` é lento?** + +O submódulo ``idessem.dessem`` utiliza importações diretas (eager) em seu +``__init__.py``. Isso significa que ao executar ``import idessem.dessem``, +todas as 43 classes do módulo são carregadas imediatamente na memória, +juntamente com todas as suas dependências transitivas. + +O custo de inicialização pode ser perceptível em scripts de curta duração ou +em ambientes com recursos limitados. + +**Como otimizar importações para scripts de alto desempenho?** + +Importe diretamente a classe que você precisa, em vez de importar o submódulo +inteiro: + +.. code-block:: python + + # Recomendado: carrega apenas a classe necessária + from idessem.dessem.entdados import Entdados + from idessem.dessem.pdo_sist import PdoSist + + # Evitar em scripts sensíveis a tempo de inicialização: + import idessem.dessem # carrega todas as 43 classes + +Ao importar apenas as classes necessárias, o tempo de inicialização é +reduzido significativamente, pois apenas os módulos envolvidos na cadeia +de dependências daquela classe específica serão carregados. + +.. note:: + + O custo de importação é pago uma única vez por processo. Em aplicações + de longa duração (como servidores ou sessões interativas Jupyter/IPython), + o impacto é mínimo e o ``import idessem.dessem`` pode ser conveniente. diff --git a/docs/source/index.rst b/docs/source/index.rst index 7f3b02bf..f042cca7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,4 +1,4 @@ -.. inewave documentation master file, created by +.. idessem documentation master file, created by sphinx-quickstart on Mon Jan 18 09:33:19 2021. Interface de Programação para o DESSEM @@ -9,13 +9,13 @@ Interface de Programação para o DESSEM **Data:** |today| .. toctree:: - :caption: Apresentação + :caption: Apresentação :maxdepth: 3 apresentacao/apresentacao.rst .. toctree:: - :caption: Geral + :caption: Geral :maxdepth: 3 geral/instalacao @@ -23,6 +23,14 @@ Interface de Programação para o DESSEM examples/index.rst geral/contribuicao +.. toctree:: + :caption: Guias + :maxdepth: 2 + + geral/arquitetura + geral/desempenho + geral/faq + .. toctree:: :caption: Referência :maxdepth: 2 diff --git a/docs/source/referencia/dessem/index.rst b/docs/source/referencia/dessem/index.rst index 9c1978ca..30a6e394 100644 --- a/docs/source/referencia/dessem/index.rst +++ b/docs/source/referencia/dessem/index.rst @@ -3,6 +3,60 @@ DESSEM ======= +O módulo ``idessem.dessem`` contém classes para leitura e escrita dos arquivos de entrada e saída +do modelo DESSEM, utilizado no planejamento da operação de curto prazo do sistema elétrico +brasileiro. Cada classe corresponde a um arquivo específico do modelo e oferece métodos para +leitura, manipulação e escrita dos dados. + +.. currentmodule:: idessem.dessem + +.. autosummary:: + :nosignatures: + + Areacont + AvlAltQueda + AvlDesvFpha + AvlEstatFpha + AvlFpha1 + AvlFpha2 + AvlFpha3 + Dadvaz + Deflant + DesLogRelato + Desselet + DessemArq + Dessopc + Entdados + Hidr + LogInviab + LogMatriz + Operuh + Operut + PdoAvalQmaxUsih + PdoCmoBar + PdoEcoFcfCortes + PdoEcoUsih + PdoEcoUsihConj + PdoEcoUsihPolin + PdoEolica + PdoHidr + PdoInter + PdoOperLpp + PdoOperTerm + PdoOperTitulacaoContratos + PdoOperTitulacaoUsinas + PdoOperTviagCalha + PdoOperUct + PdoOperacao + PdoReserva + PdoSist + PdoSomFlux + PdoTerm + Renovaveis + Respot + Term + Uch + .. toctree:: :maxdepth: 2 @@ -49,5 +103,5 @@ DESSEM arquivos/pdo_term arquivos/renovaveis arquivos/respot - arquivos/termdat - arquivos/uch \ No newline at end of file + arquivos/termdat + arquivos/uch diff --git a/docs/source/referencia/libs/index.rst b/docs/source/referencia/libs/index.rst index 2aaae83a..475b6b89 100644 --- a/docs/source/referencia/libs/index.rst +++ b/docs/source/referencia/libs/index.rst @@ -3,7 +3,17 @@ LIBS ======= +O módulo ``idessem.libs`` contém classes utilitárias compartilhadas utilizadas no processamento +dos arquivos do modelo DESSEM. + +.. currentmodule:: idessem.libs + +.. autosummary:: + :nosignatures: + + UsinasHidreletricas + .. toctree:: :maxdepth: 2 - arquivos/usinas_hidreletricas \ No newline at end of file + arquivos/usinas_hidreletricas From 98005b5df675d75ce51193768cec54ac1205e6ed Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Mon, 9 Mar 2026 22:28:02 -0300 Subject: [PATCH 4/7] feat: complete epic-04 repository polish Co-Authored-By: Claude Opus 4.6 --- CHANGELOG.md | 32 +++++++- CONTRIBUTING.md | 86 +++++++++++++++++++ README.md | 52 +++++++++--- docs/source/geral/contribuicao.rst | 127 +++++++++-------------------- docs/source/geral/instalacao.rst | 54 ++++++------ 5 files changed, 224 insertions(+), 127 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec34789..155ddd9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,47 @@ -# v1.1.1 +# Changelog + +O formato é baseado em [Keep a Changelog](https://keepachangelog.com/pt-BR/1.1.0/), +e este projeto adere ao [Versionamento Semântico](https://semver.org/lang/pt-BR/). + +## [Nao Publicado] + +### Corrigido - Versão da dependência cfinterface fixada para `>=1.8.0,<=1.8.3` -# v1.1.0 +## [1.1.0] - 2026-02-02 + +### Adicionado - Inclusão de suporte aos arquivos `PDO_CMOSIST`, `PDO_ELEV` e `PDO_OPER_USIH` (@rdlobato) + +### Modificado + - Ajustes de testes e documentação para suporte a pandas `>= 3.0.0` -# v1.0.0 +## [1.0.0] - 2025-02-21 + +### Adicionado - Primeira major release - Suporte à leitura da maioria dos arquivos de entrada do modelo DESSEM - Inclusão de suporte aos arquivos de entrada: `respot.dat` [#77](https://github.com/rjmalves/idessem/issues/77), `deflant.dat` [#76](https://github.com/rjmalves/idessem/issues/76), `areacont.dat` [#75](https://github.com/rjmalves/idessem/issues/75), `dadvaz.dat` [#44](https://github.com/rjmalves/idessem/issues/44) e `desselet.dat` [#41](https://github.com/rjmalves/idessem/issues/41) - Inclusão de suporte aos arquivos de saída: `log_inviab.dat` [#79](https://github.com/rjmalves/idessem/issues/79), `pdo_cmobar.dat` [#78](https://github.com/rjmalves/idessem/issues/78), `pdo_oper_titulacao_contratos` e `pdo_oper_titulacao_usinas` [#80](https://github.com/rjmalves/idessem/issues/80), `pdo_somflux.dat` [#81](https://github.com/rjmalves/idessem/issues/81) -- Correção na leitura do arquivo de entrada `renovaveis.dat` [#73](https://github.com/rjmalves/idessem/issues/73) - Inclusão de suporte aos novos campos do arquivo de entrada `operuh.dat` + +### Modificado + - Métodos le_arquivo e escreve_arquivo deprecados - Gestão do projeto através de arquivo `pyproject.toml` em substituição ao par `setup.py` + `requirements.txt` - Requisito de versão de Python atualizado para `>=3.10` - Dependência da cfinterface atualizada para [v1.8.0](https://github.com/rjmalves/cfi/releases/tag/v1.8.0) - Refactor da modelagem utilizada para dados provenientes das LIBS: criado o submódulo `libs`, de forma que o usuário possa realizar a importação com `from idessem.libs import ...`. - Modelagem de entidades das LIBS não é feita baseada nos arquivos fornecidos nos casos de exemplo das versões do modelo, mas sim baseado nas entidades envolvidas na informação, semelhante à divisão feita no site da documentação oficial [LIBS](https://see.cepel.br/manual/libs/latest/index.html) + +### Corrigido + +- Correção na leitura do arquivo de entrada `renovaveis.dat` [#73](https://github.com/rjmalves/idessem/issues/73) + +[Nao Publicado]: https://github.com/rjmalves/idessem/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/rjmalves/idessem/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/rjmalves/idessem/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..047e26a4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,86 @@ +# Como Contribuir + +## Setup + +1. Fork e clone: + +```bash +git clone https://github.com//idessem.git +cd idessem +``` + +2. Instale dependências (com `uv` ou `pip`): + +```bash +uv sync --extra dev +# ou: pip install -e ".[dev]" +``` + +3. Instale pre-commit hooks: + +```bash +pre-commit install +``` + +## Ferramentas de Qualidade de Código + +- **ruff**: Lint e formatação automática (executados via pre-commit hooks) +- **mypy**: Verificação de tipagem (configurado como hook manual; execute com `uv run mypy ./idessem`) +- **pre-commit**: Orquestra ruff antes de cada commit + +Executar todos os hooks manualmente: + +```bash +pre-commit run --all-files +``` + +## Testes + +Execute testes com: + +```bash +pytest ./tests +# ou com uv: uv run pytest ./tests +# paralelo: pytest ./tests -n auto +``` + +## Convenções de Modelagem + +- Arquivos DESSEM são mapeados para classes `PascalCase` (ex: `entdados.dat` → `Entdados`) +- Propriedades em `snake_case` +- Dados tabulares como `pandas.DataFrame`, normalizados conforme normas relacionais +- Coluna padrão para usinas: `nome_usina`, `codigo_usina`; submercados: `nome_submercado`, `codigo_submercado` + +Consulte a [página de arquitetura](https://rjmalves.github.io/idessem/geral/arquitetura.html) para detalhes completos. + +## Pull Requests + +1. Crie um branch descritivo: + +```bash +git checkout -b feat/nome-da-funcionalidade +``` + +2. Teste e verifique qualidade: + +```bash +pytest ./tests +pre-commit run --all-files +``` + +3. Push e abra PR contra `main`: + +```bash +git push origin feat/nome-da-funcionalidade +``` + +## Convenções de Commits + +Siga [commits convencionais](https://www.conventionalcommits.org/): + +- `feat:` — nova funcionalidade +- `fix:` — correção de bug +- `refactor:` — refatoração sem mudança de comportamento +- `test:` — adição ou correção de testes +- `docs:` — alterações na documentação +- `chore:` — manutenção (dependências, CI, configurações) diff --git a/README.md b/README.md index 3f355833..1f56d20c 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,60 @@ # idessem -![tests](https://github.com/rjmalves/idessem/workflows/tests/badge.svg) +[![CI](https://github.com/rjmalves/idessem/actions/workflows/main.yml/badge.svg)](https://github.com/rjmalves/idessem/actions/workflows/main.yml) [![codecov](https://codecov.io/gh/rjmalves/idessem/branch/main/graph/badge.svg?token=HA31U1FWM4)](https://codecov.io/gh/rjmalves/idessem) +[![PyPI](https://img.shields.io/pypi/v/idessem)](https://pypi.org/project/idessem/) +![Python](https://img.shields.io/pypi/pyversions/idessem) +![License](https://img.shields.io/pypi/l/idessem) +[![Docs](https://img.shields.io/badge/docs-online-blue)](https://rjmalves.github.io/idessem/) -O `idessem` é um pacote Python para manipulação dos arquivos de entrada e saída do programa [DESSEM](https://www.cepel.br/linhas-de-pesquisa/dessem/). O DESSEM é desenvolvido pelo [CEPEL](http://www.cepel.br) e utilizado para a programação da operação do Sistema Interligado Nacional (SIN). +O `idessem` é um pacote Python para manipulação dos arquivos de entrada e saída do modelo [DESSEM](https://www.cepel.br/linhas-de-pesquisa/dessem/), desenvolvido pelo CEPEL e utilizado para a programação da operação do Sistema Interligado Nacional (SIN). -O idessem oferece: +## Funcionalidades -- Meios para leitura dos arquivos de entrada e saída do DESSEM +- Leitura e escrita dos arquivos de entrada e saída do DESSEM, com suporte a mais de 43 classes de arquivos no módulo `dessem` e utilitários no módulo `libs` +- Acesso facilitado aos dados por meio de DataFrames do pandas, permitindo análise e visualização imediatas +- Modelos estruturados com tipagem estática (OOP), compatíveis com ferramentas de análise estática e autocompletar em IDEs +- Construído sobre o framework [cfinterface](https://github.com/rjmalves/cfi), que fornece a infraestrutura de leitura e escrita de arquivos de formato fixo -- Facilidades para estudo e análise dos dados utilizando DataFrames do pandas +## Exemplo Rápido -- Dados estruturados em modelos com o uso do paradigma de orientação a objetos (OOP) +```python +from idessem.dessem.entdados import Entdados + +arq = Entdados.read("./entdados.dat") +df_uh = arq.uh(df=True) +``` ## Instalação -O idessem é compatível com versões de Python >= 3.10 e é construído com base no framework [cfinterface](https://github.com/rjmalves/cfi). +O `idessem` requer Python >= 3.10 e [cfinterface](https://github.com/rjmalves/cfi). -É possível instalar a versão distribuída oficialmente com pip: +Via pip: -``` -python -m pip install idessem +```bash +pip install idessem ``` -É possível realizar a instalação da versão de desenvolvimento fazendo o uso do git: +Via uv: +```bash +uv add idessem ``` -pip install git+https://github.com/rjmalves/idessem + +Desenvolvimento: + +```bash +pip install -e ".[dev]" ``` ## Documentação -Guias, tutoriais e as referências podem ser encontrados no site oficial do pacote: https://rjmalves.github.io/idessem +Acesse https://rjmalves.github.io/idessem/ para guias, tutoriais e referência da API. + +## Contribuição + +Contribuições são bem-vindas. Veja [CONTRIBUTING.md](CONTRIBUTING.md) para diretrizes de desenvolvimento, configuração do ambiente e fluxo de pull requests. + +## Licenca + +Distribuido sob a licenca MIT. Autores: Rogerio Alves e Mariana Noel. diff --git a/docs/source/geral/contribuicao.rst b/docs/source/geral/contribuicao.rst index 09960e24..23fc371d 100644 --- a/docs/source/geral/contribuicao.rst +++ b/docs/source/geral/contribuicao.rst @@ -1,120 +1,73 @@ Como contribuir? ================= -O framework `cfinterface` e dependências de desenvolvimento ------------------------------------------------------------- +Setup de Desenvolvimento +------------------------ -O módulo *idessem* é desenvolvido considerando o framework proposto no módulo `cfinterface `_. +O *idessem* é desenvolvido sobre o framework `cfinterface `_, que fornece as abstrações para modelagem de arquivos em formato fixo (BlockFile, SectionFile e RegisterFile). Para detalhes sobre a arquitetura interna, consulte a `documentação do cfinterface `_. -A abordagem proposta no framework consiste em classificar os arquivos processados com relação à sua construção. São definidas três classes de arquvos: -- :obj:`~cfinterface.files.blockfile.BlockFile` -- :obj:`~cfinterface.files.sectionfile.SectionFile` -- :obj:`~cfinterface.files.registerfile.RegisterFile` -Esta classificação independe do arquivo ser constituído de armazenamento no formato texto ou binário, sendo que -esta informação é fornecida na declaração da classe que modela o arquivo em questão. Também é possível fornecer -informações sobre a codificação padrão utilizada em casos de arquivos gerados com caracteres especiais. +Instale as dependências de desenvolvimento: -A modelagem de arquivos como :obj:`~cfinterface.files.blockfile.BlockFile` se baseia na definição de blocos do arquivo que -possuem um padrão específico, binário ou textual, que indica o início de um conjunto de informações que seja -autocontido e bem definido. Opcionalmente, também pode haver um padrão de terminação, ou o bloco pode determinar -a sua terminação seguindo outros critérios. Um bloco é definido como um elemento da classe :obj:`~cfinterface.components.block.Block`. -Exemplos de arquivos do módulo *idessem* que são implementados através deste modelo são o :ref:`operut.dat ` e :ref:`DES_LOG_RELATO.DAT `. +.. code-block:: bash -O uso dos modelos da :obj:`~cfinterface.files.sectionfile.SectionFile` se baseia na definição de seções do arquivo que -sempre aparecem em uma mesma ordem e são obrigatórias. Da mesma forma, o arquivo pode ser binário ou textual. Diferentemente da modelagem -por :obj:`~cfinterface.files.blockfile.BlockFile`, que permite que um mesmo bloco apareça diversas vezes no arquivo, a abordagem -por seções não permite flexibilidade na definição de quais conteúdos aparecem e na ordem que aparecem. Podem, cada objeto -:obj:`~cfinterface.components.section.Section` pode definir o seu critério de fim, permitindo uma certa flexibilidade dentro de cada -seção. No *idessem*, não são modelados arquivos seguindo esta abordagem. + git clone https://github.com/rjmalves/idessem.git + cd idessem + pip install -e ".[dev]" -Por fim, a abordagem por :obj:`~cfinterface.files.registerfile.RegisterFile` se baseia na definição de unidades mínimas de conteúdo -que ocupam sempre uma única linha e tem formato constante, que são chamadas de registros. Da mesma forma, o arquivo pode ser binário ou textual. -Registros podem ser vistos como blocos de uma só linha mas, devido à sua simplicidade, são de mais fácil definição, através da classe -:obj:`~cfinterface.components.register.Register`. A implementação de um registro consiste apenas na sua definição, visto que -a leitura e a escrita deste são inteiramente obtidas do formato dos seus campos. No *idessem*, a maioria dos arquivos são modelados -seguindo esta abordagem, como por exemplo o :ref:`entdados.dat `. +Ou com ``uv``: +.. code-block:: bash - -Para instalar as dependências de desenvolvimento, incluindo as necessárias para a geração automática do site:: - - $ git clone https://github.com/rjmalves/idessem.git - $ cd idessem - $ pip install -r dev-requirements.txt + uv sync --extra dev .. warning:: - O conteúdo da documentação não deve ser movido para o repositório. Isto é feito - automaticamente pelos scripts de CI no caso de qualquer modificação no branch `main`. - + Não envie mudanças de documentação para o repositório. A documentação é gerada automaticamente pelos scripts de CI. -Diretrizes de modelagem para o módulo `idessem` ------------------------------------------------- -A principal diretriz para o desenvolvimento do *idessem* é a relação entre arquivos do modelo DESSEM e as classes -disponíveis para uso. Cada arquivo de entrada do modelo é mapeado para uma classe do módulo, que segue -o nome geralmente utilizado para o arquivo nos casos de exemplo que são fornecidos junto com o modelo pelo desenvolvedor -ou pelo ONS para publicação dos decks de PMO. É utilizado sempre `PascalCase` para determinação dos nomes -das classes, sendo que abreviações que possivelmente se encontram nos nomes dos arquivos são ignoradas na mudança de caso, -podendo haver exceções em arquivos que contém caracteres especiais. Por exemplo: +Diretrizes de Modelagem +----------------------- -- `dessemarq.dat` é modelado na classe :ref:`DessemArq ` -- `entdados.dat` é modelado na classe :ref:`Entdados ` -- `DES_LOG_RELATO.DAT` é modelado na classe :ref:`DesLogRelato ` -- `PDO_SIST.DAT` é modelado na classe :ref:`PdoSist ` +Cada arquivo DESSEM é mapeado para uma classe em `PascalCase`: -É convencionado, sempre que possível, que as propriedades das classes que contém os dados processados dos arquivos -lidem com objetos do tipo :obj:`~pandas.DataFrame` para a representação de dados tabulares. Além disso, se possível, -é recomendado processar a informação contida nos arquivos para que esteja seguindo as formas normais -para dados tabulares, mesmo quando há divergência na representação textual nos arquivos de entrada do DESSEM. +- `dessemarq.dat` → :ref:`DessemArq ` +- `entdados.dat` → :ref:`Entdados ` +- `DES_LOG_RELATO.DAT` → :ref:`DesLogRelato ` +- `PDO_SIST.DAT` → :ref:`PdoSist ` +Dados tabulares são representados como :obj:`~pandas.DataFrame` (normalizados quando possível). -As propriedades das classes e também as colunas dos :obj:`~pandas.DataFrame` que são produzidos são convencionados de -serem nomeados em `snake_case`. Além disso, deve-se evitar ao máximo ambiguidades na escolha dos nomes das propriedades e -das colunas. Alguns pontos recorrentes onde são encontradas ambiguidades e deve-se adotar um termo único são: +Propriedades e colunas em `snake_case`. Nomenclatura padrão para evitar ambiguidades: -- Propriedade ou :obj:`~pandas.DataFrame` que contenha informações de usinas (hidrelétricas, termelétricas, etc.) e venham e conter atributos - como código (`int`) e nome (`str`) convenciona-se chamar de *nome_usina* e *codigo_usina*, para garantir o único sentido possível. -- Propriedade ou :obj:`~pandas.DataFrame` que contenha informações relativas aos submercados de energia, que ora são - mencionados como subsistemas de energia, adota-se o termo único *submercado*. De modo semelhante, locais onde apareçam - informações desta entendidade são denominados *codigo_submercado* e *nome_submercado*. O mesmo raciocínio se aplica - ao se referir a REE. +- Usinas: `nome_usina`, `codigo_usina` +- Submercados: `nome_submercado`, `codigo_submercado` +- REE: análogo a submercados -Convenções de código ---------------------- +Convenções de Código +-------------------- -O *idessem* considera critérios de qualidade de código em seus scripts de Integração Contínua (CI), além de uma bateria de testes unitários. -Desta forma, não é possível realizar uma *release* de uma versão que não passe em todos os testes estabelecidos ou não -atenda aos critérios de qualidade de código impostos. +O *idessem* requer conformidade com qualidade de código e testes em CI para releases. -A primeira convenção é que sejam seguidas as diretrizes de sintaxe `PEP8 `_, provenientes do guia de estilo -do autor da linguagem. Além disso, não é recomendado que existam funções muito complexas, com uma quantidade -excessiva de *branches* e *loops*, o que piora e legibilidade do código. Isto pode ser garantido através de módulos -específicos para análise de qualidade de código, como será mencionado a seguir. A única exceção é a regra `E203 `_. +**PEP8 e Formatação**: Siga `PEP8 `_ (exceção: `E203 `_). Use `ruff-format `_ para formatação automática. -Para garantir a formatação é recomendado utilizar o módulo `black `_, que realiza formatação automática e possui -integração nativa com alguns editores de texto no formato de *plugins* ou extensões. +**Tipagem Estática**: Todas as variáveis devem ter tipos inferíveis. Não use tipos que mudem em tempo de execução. -A segunda convenção é que seja utilizada tipagem estática. Isto é, não deve ser uitilizada uma variável em código a qual possua -tipo de dados que possa mudar durante a execução do mesmo. Além disso, não deve ser declarada uma variável cujo tipo não é possível de -ser inferido em qualquer situação, permanencendo incerto para o leitor o tipo de dados da variável a menos que seja feita uma -execução de teste do programa. +Testes +------ -Procedimentos de teste ------------------------ +Execute antes de ``git push``: -O *idessem* realiza testes utilizando o pacote de testes de Python `pytest `_ -e controle da qualidade de código com `pylama `_. -A tipagem estática é garantida através do uso de `mypy `_ -, que é sempre executado nos scripts de Integração Contínua (CI). +.. code-block:: bash -Antes de realizar um ``git push`` é recomendado que se realize estes três procedimentos -descritos, que serão novamente executados pelo ambiente de CI:: + pytest ./tests + mypy ./idessem + ruff check ./idessem - $ pytest ./tests - $ mypy ./idessem - $ pylama ./idessem --ignore E203 +O *idessem* usa: +- `pytest `_ para testes +- `ruff check `_ para lint +- `mypy `_ para tipagem estática (CI) diff --git a/docs/source/geral/instalacao.rst b/docs/source/geral/instalacao.rst index d210b6f9..f3986c62 100644 --- a/docs/source/geral/instalacao.rst +++ b/docs/source/geral/instalacao.rst @@ -1,43 +1,51 @@ +.. _instalacao: + Instalação -============ +========== + +O *idessem* requer Python >= 3.10. Use um `ambiente virtual `_. -O *idessem* é compatível com versões de Python >= 3.8. +.. note:: -Em posse de uma instalação local de Python, é recomendado que se use um ambiente virtual para instalação de módulos de terceiros, sendo que o *idessem* não é uma exceção. -Para mais detalhes sobre o uso de ambientes virtuais, recomenda-se a leitura do recurso oficial de Python para ambientes virtuais: `venv `_. + O *idessem* depende de ``cfinterface>=1.8.0,<=1.8.3`` para compatibilidade com a API interna. -Antes de prosseguir, é necessário verificar se está instalada a última versão do ``pip``, o gerenciador de pacotes de Python. Isso pode ser feito com, por exemplo:: +Versão Oficial +-------------- - $ python -m pip install ---upgrade pip +.. code-block:: bash + pip install idessem + pip install --upgrade idessem # atualizar + pip install --upgrade idessem==x.y.z # versão específica -Instalando a versão distribuída oficialmente ---------------------------------------------- +Com uv: -É possível instalar a versão distribuída oficialmente com ``pip``:: +.. code-block:: bash - $ pip install idessem + uv add idessem -Para atualizar para uma versão mais recente, basta adicionar a flag ``--upgrade``:: +Desenvolvimento +--------------- - $ pip install --upgrade idessem +Clone e instale dependências: -Para instalar uma versão específica:: +.. code-block:: bash - $ pip install --upgrade idessem==x.y.z + git clone https://github.com/rjmalves/idessem.git + cd idessem + pip install -e ".[dev]" -Instalando a versão de desenvolvimento ---------------------------------------- +Ou com ``uv``: -É possível realizar a instalação desta versão fazendo o uso do `Git `_. Para instalar a versão de desenvolvimento, é necessário -primeiramente desinstalar a versão instalada (se houve), com:: +.. code-block:: bash - $ pip uninstall idessem + uv sync --extra dev -Em seguida, basta fazer:: +Consulte `CONTRIBUTING.md `_ para setup completo e fluxo de contribuição. - $ pip install git+https://github.com/rjmalves/idessem +Verificar Instalação +-------------------- -Também é possível selecionar um branch ou release específicos:: +.. code-block:: bash - $ pip install git+https://github.com/rjmalves/idessem@v1.0.0 + python -c "import idessem; print(idessem.__version__)" From f3a7d0d4ff068a76cce95c9aa36729e07c7d1ab3 Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Mon, 9 Mar 2026 22:40:56 -0300 Subject: [PATCH 5/7] fix: address code review findings and align with inewave - Add test gate to release workflow before PyPI publish - Use Python-based version extraction (portable, matches inewave) - Make GitHub Release creation idempotent (matches inewave) - Add 3 missing classes (PdoCmosist, PdoElev, PdoOperUsih) to autosummary and architecture docs - Create missing pdo_oper_term.rst API page - Fix class count from 43 to 46 across all documentation - Fix misleading contribuicao.rst warning about documentation - Add sg_execution_times.rst to .gitignore and remove from repo Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 15 ++++++-- .gitignore | 1 + docs/source/geral/arquitetura.rst | 9 +++-- docs/source/geral/contribuicao.rst | 3 +- docs/source/geral/desempenho.rst | 4 +- docs/source/geral/faq.rst | 4 +- .../dessem/arquivos/pdo_oper_term.rst | 13 +++++++ docs/source/referencia/dessem/index.rst | 4 ++ docs/source/sg_execution_times.rst | 37 ------------------- 9 files changed, 41 insertions(+), 49 deletions(-) create mode 100644 docs/source/referencia/dessem/arquivos/pdo_oper_term.rst delete mode 100644 docs/source/sg_execution_times.rst diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9938609..18faeeca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,18 +23,25 @@ jobs: - name: Validate version matches tag run: | TAG_VERSION="${GITHUB_REF#refs/tags/v}" - PKG_VERSION=$(grep -oP '__version__\s*=\s*"\K[^"]+' idessem/__init__.py) + PKG_VERSION=$(uv run python -c "import re; print(re.search(r'__version__ = \"(.+?)\"', open('idessem/__init__.py').read()).group(1))") if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then echo "::error::Tag version ($TAG_VERSION) does not match package version ($PKG_VERSION)" exit 1 fi - name: Install the project - run: uv sync + run: uv sync --extra test + - name: Run tests + run: uv run pytest ./tests - name: Build package run: uv build - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - - name: Create GitHub Release + - name: Upload assets to GitHub Release env: GH_TOKEN: ${{ github.token }} - run: gh release create "$GITHUB_REF_NAME" dist/* --generate-notes + run: | + if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then + gh release upload "$GITHUB_REF_NAME" dist/* --clobber + else + gh release create "$GITHUB_REF_NAME" dist/* --generate-notes + fi diff --git a/.gitignore b/.gitignore index 532061e6..0c9f79fc 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ instance/ docs/_build/ docs/source/gen_modules/** docs/source/examples/** +docs/source/sg_execution_times.rst # PyBuilder target/ diff --git a/docs/source/geral/arquitetura.rst b/docs/source/geral/arquitetura.rst index 42eab4c7..4f703e3a 100644 --- a/docs/source/geral/arquitetura.rst +++ b/docs/source/geral/arquitetura.rst @@ -64,7 +64,7 @@ O *idessem* expõe duas subpacotes públicas: **idessem.dessem** Contém as classes que modelam os arquivos de entrada e de saída do modelo DESSEM. -É o módulo principal da biblioteca, com 43 classes no total. +É o módulo principal da biblioteca, com 46 classes no total. *Arquivos de entrada* (suportam leitura e escrita): @@ -96,15 +96,18 @@ Contém as classes que modelam os arquivos de entrada e de saída do modelo DESS - :obj:`PdoAvalQmaxUsih ` - :obj:`PdoCmoBar ` +- :obj:`PdoCmosist ` - :obj:`PdoEcoFcfCortes ` - :obj:`PdoEcoUsih ` - :obj:`PdoEcoUsihConj ` - :obj:`PdoEcoUsihPolin ` +- :obj:`PdoElev ` - :obj:`PdoEolica ` - :obj:`PdoHidr ` - :obj:`PdoInter ` - :obj:`PdoOperLpp ` - :obj:`PdoOperTerm ` +- :obj:`PdoOperUsih ` - :obj:`PdoOperTitulacaoContratos ` - :obj:`PdoOperTitulacaoUsinas ` - :obj:`PdoOperTviagCalha ` @@ -228,7 +231,7 @@ Importações Diretas O submódulo ``idessem.dessem`` utiliza importações diretas (não lazy) em seu ``__init__.py``. Isso significa que ao executar ``import idessem.dessem``, -todas as 43 classes são carregadas imediatamente na memória, incluindo suas +todas as 46 classes são carregadas imediatamente na memória, incluindo suas dependências. .. warning:: @@ -242,7 +245,7 @@ dependências. # Recomendado: importa apenas a classe necessária from idessem.dessem.entdados import Entdados - # Evitar em contextos sensíveis a desempenho: carrega todas as 43 classes + # Evitar em contextos sensíveis a desempenho: carrega todas as 46 classes import idessem.dessem O carregamento completo do módulo pode ser aceitável em sessões interativas diff --git a/docs/source/geral/contribuicao.rst b/docs/source/geral/contribuicao.rst index 23fc371d..9bcf63c0 100644 --- a/docs/source/geral/contribuicao.rst +++ b/docs/source/geral/contribuicao.rst @@ -24,7 +24,8 @@ Ou com ``uv``: .. warning:: - Não envie mudanças de documentação para o repositório. A documentação é gerada automaticamente pelos scripts de CI. + O conteúdo da documentação gerada (HTML em ``docs/build/``) não deve ser enviado para o repositório. Isto é feito + automaticamente pelos scripts de CI no caso de qualquer modificação no branch ``main``. Diretrizes de Modelagem diff --git a/docs/source/geral/desempenho.rst b/docs/source/geral/desempenho.rst index 2d0645c6..9a34da82 100644 --- a/docs/source/geral/desempenho.rst +++ b/docs/source/geral/desempenho.rst @@ -11,7 +11,7 @@ Otimizacao de Importacoes -------------------------- Ao executar ``import idessem.dessem``, o interpretador Python carrega -imediatamente todas as 43 classes de arquivos definidas em +imediatamente todas as 46 classes de arquivos definidas em ``idessem/dessem/__init__.py``. Em scripts rápidos ou em ambientes com restrição de tempo de inicialização — como funções AWS Lambda — esse carregamento completo pode introduzir latência desnecessária. @@ -19,7 +19,7 @@ completo pode introduzir latência desnecessária. .. code-block:: python :caption: Anti-padrão: importação completa do módulo - import idessem.dessem # carrega todas as 43 classes + import idessem.dessem # carrega todas as 46 classes O padrão recomendado é importar apenas a classe necessária diretamente do módulo que a define: diff --git a/docs/source/geral/faq.rst b/docs/source/geral/faq.rst index f216326e..329a5482 100644 --- a/docs/source/geral/faq.rst +++ b/docs/source/geral/faq.rst @@ -271,7 +271,7 @@ Desempenho O submódulo ``idessem.dessem`` utiliza importações diretas (eager) em seu ``__init__.py``. Isso significa que ao executar ``import idessem.dessem``, -todas as 43 classes do módulo são carregadas imediatamente na memória, +todas as 46 classes do módulo são carregadas imediatamente na memória, juntamente com todas as suas dependências transitivas. O custo de inicialização pode ser perceptível em scripts de curta duração ou @@ -289,7 +289,7 @@ inteiro: from idessem.dessem.pdo_sist import PdoSist # Evitar em scripts sensíveis a tempo de inicialização: - import idessem.dessem # carrega todas as 43 classes + import idessem.dessem # carrega todas as 46 classes Ao importar apenas as classes necessárias, o tempo de inicialização é reduzido significativamente, pois apenas os módulos envolvidos na cadeia diff --git a/docs/source/referencia/dessem/arquivos/pdo_oper_term.rst b/docs/source/referencia/dessem/arquivos/pdo_oper_term.rst new file mode 100644 index 00000000..662e14f5 --- /dev/null +++ b/docs/source/referencia/dessem/arquivos/pdo_oper_term.rst @@ -0,0 +1,13 @@ +.. _pdo_oper_term: + +========================================================================= +Operação de Usinas Termelétricas (PDO_OPER_TERM.DAT) +========================================================================= + +.. currentmodule:: idessem.dessem.pdo_oper_term + +Os dados da operação de usinas termelétricas do DESSEM +são armazenados na classe: + +.. autoclass:: PdoOperTerm + :members: diff --git a/docs/source/referencia/dessem/index.rst b/docs/source/referencia/dessem/index.rst index 30a6e394..40ae022a 100644 --- a/docs/source/referencia/dessem/index.rst +++ b/docs/source/referencia/dessem/index.rst @@ -34,15 +34,18 @@ leitura, manipulação e escrita dos dados. Operut PdoAvalQmaxUsih PdoCmoBar + pdo_cmosist.PdoCmosist PdoEcoFcfCortes PdoEcoUsih PdoEcoUsihConj PdoEcoUsihPolin + pdo_elev.PdoElev PdoEolica PdoHidr PdoInter PdoOperLpp PdoOperTerm + pdo_oper_usih.PdoOperUsih PdoOperTitulacaoContratos PdoOperTitulacaoUsinas PdoOperTviagCalha @@ -92,6 +95,7 @@ leitura, manipulação e escrita dos dados. arquivos/pdo_inter arquivos/pdo_operacao arquivos/pdo_oper_lpp + arquivos/pdo_oper_term arquivos/pdo_oper_titulacao_contratos arquivos/pdo_oper_titulacao_usinas arquivos/pdo_oper_tviag_calha diff --git a/docs/source/sg_execution_times.rst b/docs/source/sg_execution_times.rst deleted file mode 100644 index 78433a96..00000000 --- a/docs/source/sg_execution_times.rst +++ /dev/null @@ -1,37 +0,0 @@ - -:orphan: - -.. _sphx_glr_sg_execution_times: - - -Computation times -================= -**00:00.000** total execution time for 0 files **from all galleries**: - -.. container:: - - .. raw:: html - - - - - - - - .. list-table:: - :header-rows: 1 - :class: table table-striped sg-datatable - - * - Example - - Time - - Mem (MB) - * - N/A - - N/A - - N/A From 0a2d8e26a244014cdcec04d2f554e5e511ddec35 Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Mon, 9 Mar 2026 22:50:11 -0300 Subject: [PATCH 6/7] refactor: align idessem infrastructure with inewave conventions - Add mypy config (warn_return_any, warn_unused_ignores), pytest testpaths, and ruff per-file-ignores to pyproject.toml - Add ruff format --check step to CI lint job - Use descriptive step names in all CI jobs (matching inewave) - Add --no-sync flag to pre-commit mypy hook - Use pygments_style "default" in Sphinx conf (matching inewave) - Rewrite CONTRIBUTING.md with full inewave-level detail: prerequisites, linting, formatting, mypy, testing, code conventions, cfinterface modeling, and structured PR flow - Rewrite instalacao.rst with proper section structure, $ prefixes, uv pip install alternative, and descriptive prose - Rewrite contribuicao.rst with CONTRIBUTING.md link and full cfinterface framework documentation with intersphinx references Co-Authored-By: Claude Opus 4.6 --- .github/workflows/main.yml | 20 +-- .pre-commit-config.yaml | 2 +- CONTRIBUTING.md | 201 +++++++++++++++++++++-------- docs/source/conf.py | 3 +- docs/source/geral/contribuicao.rst | 114 +++++++++------- docs/source/geral/instalacao.rst | 68 +++++++--- pyproject.toml | 10 ++ 7 files changed, 289 insertions(+), 129 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 469c0bf7..4fcbc4ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,12 +15,14 @@ jobs: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v3 - - name: Set up Python + - name: Set up Python 3.12 run: uv python install 3.12 - - name: Install dependencies + - name: Install lint dependencies run: uv sync --extra lint - name: Run ruff linter run: uv run ruff check ./idessem + - name: Run ruff formatter (check only) + run: uv run ruff format --check ./idessem typecheck: runs-on: ubuntu-latest @@ -28,11 +30,11 @@ jobs: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v3 - - name: Set up Python + - name: Set up Python 3.12 run: uv python install 3.12 - - name: Install dependencies + - name: Install lint dependencies run: uv sync --extra lint - - name: Run mypy + - name: Run mypy type checker run: uv run mypy ./idessem test: @@ -46,7 +48,7 @@ jobs: uses: astral-sh/setup-uv@v3 - name: Set up Python ${{ matrix.python-version }} run: uv python install ${{ matrix.python-version }} - - name: Install dependencies + - name: Install test dependencies run: uv sync --extra test - name: Run tests run: uv run pytest --cov-report=xml --cov=idessem ./tests @@ -66,9 +68,9 @@ jobs: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v3 - - name: Set up Python + - name: Set up Python 3.12 run: uv python install 3.12 - - name: Install dependencies + - name: Install docs dependencies run: uv sync --extra docs - - name: Sphinx build + - name: Build Sphinx documentation run: uv run sphinx-build -M html docs/source docs/build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77a303b1..ef920f9d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: hooks: - id: mypy name: mypy - entry: uv run mypy ./idessem + entry: uv run --no-sync mypy ./idessem language: system types: [python] pass_filenames: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 047e26a4..b5e7d228 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,86 +1,185 @@ -# Como Contribuir +# Contribuindo para o idessem -## Setup +Obrigado pelo interesse em contribuir com o _idessem_! Este guia descreve o fluxo de trabalho esperado, as ferramentas utilizadas e as convenções adotadas no projeto. -1. Fork e clone: +## Configuracao do Ambiente de Desenvolvimento -```bash -git clone https://github.com//idessem.git -cd idessem +### Pré-requisitos + +- Python 3.10 ou superior +- [uv](https://docs.astral.sh/uv/) (gerenciador de pacotes e ambientes) +- Git + +### Instalacao + +Clone o repositório e instale todas as dependências de desenvolvimento (testes, lint, tipagem e documentação): + +```sh +$ git clone https://github.com/rjmalves/idessem.git +$ cd idessem +$ uv sync --extra dev +``` + +O grupo `dev` é um meta-grupo que instala automaticamente os grupos `test`, `lint` e `docs`. + +### Configuracao dos hooks de pre-commit + +Após instalar as dependências, ative os hooks de pre-commit para garantir que linting e formatação sejam verificados automaticamente a cada commit: + +```sh +$ uv run pre-commit install +``` + +Os hooks configurados em `.pre-commit-config.yaml` executam `ruff` (lint + formatação) e `mypy` (tipagem) automaticamente no momento do commit. + +--- + +## Ferramentas de Qualidade de Codigo + +O projeto utiliza `ruff` para linting e formatação, e `mypy` para verificação de tipos estáticos. Todos esses passos são executados no CI em jobs paralelos. + +### Linting + +```sh +$ uv run ruff check ./idessem ``` -2. Instale dependências (com `uv` ou `pip`): +Para corrigir automaticamente os problemas que o ruff consegue resolver: -```bash -uv sync --extra dev -# ou: pip install -e ".[dev]" +```sh +$ uv run ruff check --fix ./idessem ``` -3. Instale pre-commit hooks: +### Formatacao -```bash -pre-commit install +```sh +$ uv run ruff format ./idessem ``` -## Ferramentas de Qualidade de Código +Para verificar sem aplicar mudanças: -- **ruff**: Lint e formatação automática (executados via pre-commit hooks) -- **mypy**: Verificação de tipagem (configurado como hook manual; execute com `uv run mypy ./idessem`) -- **pre-commit**: Orquestra ruff antes de cada commit +```sh +$ uv run ruff format --check ./idessem +``` -Executar todos os hooks manualmente: +### Verificacao de tipos (mypy) -```bash -pre-commit run --all-files +O projeto usa mypy em modo estrito para todos os submódulos de `idessem`. Para executar a verificação de tipos: + +```sh +$ uv run mypy ./idessem ``` -## Testes +### Execucao completa antes de um push -Execute testes com: +Antes de abrir um pull request, execute os três passos de qualidade para garantir que o CI passará: -```bash -pytest ./tests -# ou com uv: uv run pytest ./tests -# paralelo: pytest ./tests -n auto +```sh +$ uv run ruff check ./idessem +$ uv run ruff format ./idessem +$ uv run mypy ./idessem ``` -## Convenções de Modelagem +--- + +## Executando Testes -- Arquivos DESSEM são mapeados para classes `PascalCase` (ex: `entdados.dat` → `Entdados`) -- Propriedades em `snake_case` -- Dados tabulares como `pandas.DataFrame`, normalizados conforme normas relacionais -- Coluna padrão para usinas: `nome_usina`, `codigo_usina`; submercados: `nome_submercado`, `codigo_submercado` +O projeto usa `pytest` com `pytest-xdist` para execução paralela e `pytest-cov` para cobertura de código. -Consulte a [página de arquitetura](https://rjmalves.github.io/idessem/geral/arquitetura.html) para detalhes completos. +### Execucao básica -## Pull Requests +```sh +$ uv run pytest ./tests +``` -1. Crie um branch descritivo: +### Execucao paralela -```bash -git checkout -b feat/nome-da-funcionalidade +Para acelerar a execução dos testes usando todos os núcleos disponíveis: + +```sh +$ uv run pytest -n auto ./tests ``` -2. Teste e verifique qualidade: +### Execucao com cobertura -```bash -pytest ./tests -pre-commit run --all-files +```sh +$ uv run pytest --cov=idessem ./tests ``` -3. Push e abra PR contra `main`: +Para gerar um relatório XML (formato utilizado no CI para envio ao Codecov): -```bash -git push origin feat/nome-da-funcionalidade +```sh +$ uv run pytest --cov-report=xml --cov=idessem ./tests ``` -## Convenções de Commits +O CI executa os testes em matriz para Python 3.10, 3.11 e 3.12. Recomenda-se testar localmente na versão mais antiga suportada (3.10) caso haja dúvidas sobre compatibilidade. + +--- + +## Convencoes de Codigo + +### Nomenclatura de classes + +Cada arquivo de entrada ou saída do modelo DESSEM é mapeado para uma classe Python. O nome da classe segue o nome do arquivo correspondente, convertido para `PascalCase`. Abreviações presentes nos nomes dos arquivos são preservadas na conversão. Exemplos: + +- `entdados.dat` → classe `Entdados` +- `dessemarq.dat` → classe `DessemArq` +- `PDO_SIST.DAT` → classe `PdoSist` + +### Nomenclatura de propriedades e colunas + +Propriedades das classes e colunas de `DataFrame` devem ser nomeadas em `snake_case`. Evite ambiguidades: + +- Atributos de usinas: use `nome_usina` e `codigo_usina` +- Atributos de submercados: use `nome_submercado` e `codigo_submercado` +- Atributos de REE: use `nome_ree` e `codigo_ree` + +### Tipagem estatica + +Toda variável deve ter tipo inferível ou anotado explicitamente. Não use `Any` sem justificativa. O mypy é executado em modo estrito (`strict = true`) para todos os submódulos do `idessem`. + +### Docstrings e comentarios + +Docstrings e comentários devem ser escritos em **português brasileiro**. + +### Formatacao de dados tabulares + +Sempre que possível, os dados lidos dos arquivos devem ser retornados em `DataFrame` no formato normal: uma coluna para cada dimensão (por exemplo, `data`, `patamar`, `serie`, `valor`), mesmo quando o arquivo original apresenta o dado em formato pivotado. + +--- + +## Modelagem de Arquivos com cfinterface + +O _idessem_ é desenvolvido sobre o framework [cfinterface](https://github.com/rjmalves/cfi), que classifica os arquivos processados em três tipos: + +- **BlockFile**: arquivos estruturados em blocos com padrão de início identificável (e opcionalmente de fim). Um mesmo bloco pode aparecer múltiplas vezes. Exemplos: `entdados.dat`, `desselet.dat`. +- **SectionFile**: arquivos com seções fixas que sempre aparecem na mesma ordem e são obrigatórias. Exemplos: `dessopc.dat`, `operuh.dat`. +- **RegisterFile**: arquivos estruturados em registros de linha única com formato constante. Exemplo: `dessemarq.dat`. + +Cada tipo pode ser textual ou binário — essa informação é declarada na classe que modela o arquivo. + +Para uma descrição completa do framework com referências cruzadas à API do cfinterface, consulte a [documentação Sphinx do projeto](https://rjmalves.github.io/idessem/). + +--- + +## Fluxo de Pull Request -Siga [commits convencionais](https://www.conventionalcommits.org/): +1. **Fork** o repositório para sua conta no GitHub. +2. **Crie uma branch** a partir de `main` com um nome descritivo: + ```sh + $ git checkout -b minha-contribuicao + ``` +3. **Implemente** as alterações seguindo as convenções deste guia. +4. **Execute** os passos de qualidade e testes localmente (veja seções acima). +5. **Commit** as alterações com uma mensagem descritiva: + ```sh + $ git commit -m "fix: corrige leitura do campo X no arquivo Y" + ``` +6. **Push** para o seu fork: + ```sh + $ git push origin minha-contribuicao + ``` +7. **Abra um Pull Request** para a branch `main` do repositório original. +8. **Aguarde o CI**: os jobs de lint, typecheck, test (Python 3.10–3.12) e docs devem passar antes da revisão. -- `feat:` — nova funcionalidade -- `fix:` — correção de bug -- `refactor:` — refatoração sem mudança de comportamento -- `test:` — adição ou correção de testes -- `docs:` — alterações na documentação -- `chore:` — manutenção (dependências, CI, configurações) +Dúvidas ou sugestões podem ser abertas como [Issues](https://github.com/rjmalves/idessem/issues) no repositório. diff --git a/docs/source/conf.py b/docs/source/conf.py index 71c72028..9b391a56 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -76,7 +76,7 @@ exclude_patterns: List[str] = [] add_module_names = False -pygments_style = "friendly" +pygments_style = "default" pygments_dark_style = "monokai" modindex_common_prefix = ["idessem."] @@ -97,7 +97,6 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static/"] html_logo = "_static/logo_idessem_svg.svg" -html_show_sourcelink = True # The reST default role (used for this markup: `text`) to use for all # documents. diff --git a/docs/source/geral/contribuicao.rst b/docs/source/geral/contribuicao.rst index 9bcf63c0..8c9ee1fd 100644 --- a/docs/source/geral/contribuicao.rst +++ b/docs/source/geral/contribuicao.rst @@ -1,74 +1,98 @@ Como contribuir? ================= -Setup de Desenvolvimento ------------------------- +.. note:: -O *idessem* é desenvolvido sobre o framework `cfinterface `_, que fornece as abstrações para modelagem de arquivos em formato fixo (BlockFile, SectionFile e RegisterFile). Para detalhes sobre a arquitetura interna, consulte a `documentação do cfinterface `_. + O guia completo para contribuidores — incluindo configuração do ambiente, ferramentas de qualidade de código, execução de testes e fluxo de pull request — está disponível no arquivo `CONTRIBUTING.md `_ na raiz do repositório. + Esta página descreve as convenções de modelagem específicas do *idessem* e as referências ao framework *cfinterface*, que utilizam recursos de marcação próprios do Sphinx. -Instale as dependências de desenvolvimento: +O framework `cfinterface` e a modelagem de arquivos +---------------------------------------------------- -.. code-block:: bash +O módulo *idessem* é desenvolvido considerando o framework proposto no módulo `cfinterface `_. - git clone https://github.com/rjmalves/idessem.git - cd idessem - pip install -e ".[dev]" +A abordagem proposta no framework consiste em classificar os arquivos processados com relação à sua construção. São definidas três classes de arquivos: -Ou com ``uv``: +- :obj:`~cfinterface.files.blockfile.BlockFile` +- :obj:`~cfinterface.files.sectionfile.SectionFile` +- :obj:`~cfinterface.files.registerfile.RegisterFile` -.. code-block:: bash +Esta classificação independe do arquivo ser constituído de armazenamento no formato texto ou binário, sendo que +esta informação é fornecida na declaração da classe que modela o arquivo em questão. Também é possível fornecer +informações sobre a codificação padrão utilizada em casos de arquivos gerados com caracteres especiais. - uv sync --extra dev - -.. warning:: - - O conteúdo da documentação gerada (HTML em ``docs/build/``) não deve ser enviado para o repositório. Isto é feito - automaticamente pelos scripts de CI no caso de qualquer modificação no branch ``main``. +A modelagem de arquivos como :obj:`~cfinterface.files.blockfile.BlockFile` se baseia na definição de blocos do arquivo que +possuem um padrão específico, binário ou textual, que indica o início de um conjunto de informações que seja +autocontido e bem definido. Opcionalmente, também pode haver um padrão de terminação, ou o bloco pode determinar +a sua terminação seguindo outros critérios. Um bloco é definido como um elemento da classe :obj:`~cfinterface.components.block.Block`. +Exemplos de arquivos do módulo *idessem* que são implementados através deste modelo são o :ref:`entdados.dat ` e :ref:`desselet.dat `. +O uso dos modelos da :obj:`~cfinterface.files.sectionfile.SectionFile` se baseia na definição de seções do arquivo que +sempre aparecem em uma mesma ordem e são obrigatórias. Da mesma forma, o arquivo pode ser binário ou textual. Diferentemente da modelagem +por :obj:`~cfinterface.files.blockfile.BlockFile`, que permite que um mesmo bloco apareça diversas vezes no arquivo, a abordagem +por seções não permite flexibilidade na definição de quais conteúdos aparecem e na ordem que aparecem. Podem, cada objeto +:obj:`~cfinterface.components.section.Section` pode definir o seu critério de fim, permitindo uma certa flexibilidade dentro de cada +seção. Exemplos de arquivos do módulo *idessem* que são implementados através deste modelo são o :ref:`dessopc.dat ` e :ref:`operuh.dat `. -Diretrizes de Modelagem ------------------------ +Por fim, a abordagem por :obj:`~cfinterface.files.registerfile.RegisterFile` se baseia na definição de unidades mínimas de conteúdo +que ocupam sempre uma única linha e tem formato constante, que são chamadas de registros. Da mesma forma, o arquivo pode ser binário ou textual. +Registros podem ser vistos como blocos de uma só linha mas, devido à sua simplicidade, são de mais fácil definição, através da classe +:obj:`~cfinterface.components.register.Register`. A implementação de um registro consiste apenas na sua definição, visto que +a leitura e a escrita deste são inteiramente obtidas do formato dos seus campos. No *idessem*, o arquivo :ref:`dessemarq.dat ` é modelado +seguindo esta abordagem. -Cada arquivo DESSEM é mapeado para uma classe em `PascalCase`: -- `dessemarq.dat` → :ref:`DessemArq ` -- `entdados.dat` → :ref:`Entdados ` -- `DES_LOG_RELATO.DAT` → :ref:`DesLogRelato ` -- `PDO_SIST.DAT` → :ref:`PdoSist ` +Diretrizes de modelagem para o módulo `idessem` +------------------------------------------------ -Dados tabulares são representados como :obj:`~pandas.DataFrame` (normalizados quando possível). +A principal diretriz para o desenvolvimento do *idessem* é a relação entre arquivos do modelo DESSEM e as classes +disponíveis para uso. Cada arquivo de entrada do modelo é mapeado para uma classe do módulo, que segue +o nome geralmente utilizado para o arquivo nos casos de exemplo que são fornecidos junto com o modelo pelo desenvolvedor +ou pelo ONS para publicação dos decks de PMO. É utilizado sempre `PascalCase` para determinação dos nomes +das classes, sendo que abreviações que possivelmente se encontram nos nomes dos arquivos são ignoradas na mudança de caso. Por exemplo: -Propriedades e colunas em `snake_case`. Nomenclatura padrão para evitar ambiguidades: +- `entdados.dat` é modelado na classe :ref:`Entdados ` +- `dessemarq.dat` é modelado na classe :ref:`DessemArq ` +- `DES_LOG_RELATO.DAT` é modelado na classe :ref:`DesLogRelato ` +- `PDO_SIST.DAT` é modelado na classe :ref:`PdoSist ` -- Usinas: `nome_usina`, `codigo_usina` -- Submercados: `nome_submercado`, `codigo_submercado` -- REE: análogo a submercados +É convencionado, sempre que possível, que as propriedades das classes que contém os dados processados dos arquivos +lidem com objetos do tipo :obj:`~pandas.DataFrame` para a representação de dados tabulares. Além disso, se possível, +é recomendado processar a informação contida nos arquivos para que esteja na seguindo as formas normais +para dados tabulares, mesmo quando há divergência na representação textual nos arquivos de entrada do DESSEM. +As propriedades das classes e também as colunas dos :obj:`~pandas.DataFrame` que são produzidos são convencionados de +serem nomeados em `snake_case`. Além disso, deve-se evitar ao máximo ambiguidades na escolha dos nomes das propriedades e +das colunas. Alguns pontos recorrentes onde são encontradas ambiguidades e deve-se adotar um termo único são: -Convenções de Código --------------------- +- Propriedade ou :obj:`~pandas.DataFrame` que contenha informações de usinas (hidrelétricas, termelétricas, etc.) e venham e conter atributos + como código (`int`) e nome (`str`) convenciona-se chamar de *nome_usina* e *codigo_usina*, para garantir o único sentido possível. +- Propriedade ou :obj:`~pandas.DataFrame` que contenha informações relativas aos submercados de energia, que ora são + mencionados como subsistemas de energia, adota-se o termo único *submercado*. De modo semelhante, locais onde apareçam + informações desta entendidade são denominados *codigo_submercado* e *nome_submercado*. O mesmo raciocínio se aplica + ao se referir a REE. -O *idessem* requer conformidade com qualidade de código e testes em CI para releases. -**PEP8 e Formatação**: Siga `PEP8 `_ (exceção: `E203 `_). Use `ruff-format `_ para formatação automática. +Configuracao do ambiente e procedimentos de qualidade +------------------------------------------------------ -**Tipagem Estática**: Todas as variáveis devem ter tipos inferíveis. Não use tipos que mudem em tempo de execução. +Para instalar as dependências de desenvolvimento:: + $ git clone https://github.com/rjmalves/idessem.git + $ cd idessem + $ uv sync --extra dev + $ uv run pre-commit install -Testes ------- - -Execute antes de ``git push``: +.. warning:: -.. code-block:: bash + O conteúdo da documentação gerada (HTML em ``docs/build/``) não deve ser enviado para o repositório. Isto é feito + automaticamente pelos scripts de CI no caso de qualquer modificação no branch ``main``. - pytest ./tests - mypy ./idessem - ruff check ./idessem +Antes de realizar um ``git push`` é recomendado executar os procedimentos de qualidade que serão novamente executados pelo ambiente de CI:: -O *idessem* usa: -- `pytest `_ para testes -- `ruff check `_ para lint -- `mypy `_ para tipagem estática (CI) + $ uv run ruff check ./idessem + $ uv run ruff format ./idessem + $ uv run mypy ./idessem + $ uv run pytest ./tests diff --git a/docs/source/geral/instalacao.rst b/docs/source/geral/instalacao.rst index f3986c62..1a147417 100644 --- a/docs/source/geral/instalacao.rst +++ b/docs/source/geral/instalacao.rst @@ -1,51 +1,77 @@ .. _instalacao: Instalação -========== +============ -O *idessem* requer Python >= 3.10. Use um `ambiente virtual `_. +O *idessem* é compatível com versões de Python >= 3.10 (testado em 3.10, 3.11 e 3.12). + +Em posse de uma instalação local de Python, é recomendado que se use um ambiente virtual para instalação de módulos de terceiros, sendo que o *idessem* não é uma exceção. +Para mais detalhes sobre o uso de ambientes virtuais, recomenda-se a leitura do recurso oficial de Python para ambientes virtuais: `venv `_. .. note:: O *idessem* depende de ``cfinterface>=1.8.0,<=1.8.3`` para compatibilidade com a API interna. -Versão Oficial --------------- +Instalando com pip +------------------ + +É possível instalar a versão distribuída oficialmente com ``pip``: + +.. code-block:: bash + + $ pip install idessem + +Para atualizar para uma versão mais recente, basta adicionar a flag ``--upgrade``: .. code-block:: bash - pip install idessem - pip install --upgrade idessem # atualizar - pip install --upgrade idessem==x.y.z # versão específica + $ pip install --upgrade idessem -Com uv: +Para instalar uma versão específica: .. code-block:: bash - uv add idessem + $ pip install idessem==x.y.z -Desenvolvimento ---------------- +Instalando com uv +----------------- -Clone e instale dependências: +Caso utilize o `uv `_ como gerenciador de pacotes, é possível adicionar o *idessem* a um projeto com: .. code-block:: bash - git clone https://github.com/rjmalves/idessem.git - cd idessem - pip install -e ".[dev]" + $ uv add idessem -Ou com ``uv``: +Ou instalar diretamente no ambiente ativo com: .. code-block:: bash - uv sync --extra dev + $ uv pip install idessem -Consulte `CONTRIBUTING.md `_ para setup completo e fluxo de contribuição. +Instalando a versão de desenvolvimento +--------------------------------------- -Verificar Instalação --------------------- +Para contribuir com o projeto ou experimentar funcionalidades ainda não distribuídas, é possível instalar a partir do repositório. Primeiro, clone o repositório com `Git `_: .. code-block:: bash - python -c "import idessem; print(idessem.__version__)" + $ git clone https://github.com/rjmalves/idessem + $ cd idessem + +Em seguida, instale as dependências de desenvolvimento com ``uv``: + +.. code-block:: bash + + $ uv sync --extra dev + +Para o guia completo de configuração do ambiente de desenvolvimento, consulte o `CONTRIBUTING.md `_. + +Verificando a instalação +------------------------ + +Para confirmar que a instalação foi realizada com sucesso, execute: + +.. code-block:: python + + import idessem + print(idessem.__version__) diff --git a/pyproject.toml b/pyproject.toml index 5d3077a9..0afd7a1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,5 +64,15 @@ include = [ "idessem/", ] +[tool.mypy] +warn_return_any = false +warn_unused_ignores = true + +[tool.pytest.ini_options] +testpaths = ["tests"] + [tool.ruff] line-length = 80 + +[tool.ruff.lint] +per-file-ignores = { "examples/*.py" = ["E402"] } From 2033d0f1c764586d565526d6fdb1e8cfa81f2b7f Mon Sep 17 00:00:00 2001 From: Rogerio Alves Date: Mon, 9 Mar 2026 23:09:49 -0300 Subject: [PATCH 7/7] refactor: align idessem infrastructure with inewave conventions - Enable strict mypy for all idessem submodules (pyproject.toml) - Add type annotations to all 71 source files (1152 errors fixed) - Bump cfinterface from >=1.8.0,<=1.8.3 to >=1.9.0 - Bump pandas from >=2.2.3 to >=3.0.0 - Bump requires-python from >=3.10 to >=3.11 - Update classifiers: drop 3.10, add 3.13 and 3.14 - Update CI test matrix to [3.11, 3.12, 3.13, 3.14] - Update all docs/CONTRIBUTING references to new Python versions Co-Authored-By: Claude Opus 4.6 --- .github/workflows/main.yml | 2 +- CONTRIBUTING.md | 6 +- docs/source/geral/instalacao.rst | 5 +- idessem/dessem/areacont.py | 8 +- idessem/dessem/avl_altqueda.py | 4 +- idessem/dessem/avl_desvfpha.py | 4 +- idessem/dessem/avl_fpha1.py | 4 +- idessem/dessem/avl_fpha2.py | 6 +- idessem/dessem/avl_fpha3.py | 6 +- idessem/dessem/dadvaz.py | 12 +- idessem/dessem/deflant.py | 6 +- idessem/dessem/des_log_relato.py | 4 +- idessem/dessem/desselet.py | 4 +- idessem/dessem/dessemarq.py | 4 +- idessem/dessem/dessopc.py | 26 +- idessem/dessem/entdados.py | 6 +- idessem/dessem/hidr.py | 14 +- idessem/dessem/log_inviab.py | 4 +- idessem/dessem/log_matriz.py | 4 +- idessem/dessem/modelos/areacont.py | 26 +- idessem/dessem/modelos/arquivos/arquivocsv.py | 2 + idessem/dessem/modelos/avl_estatfpha.py | 4 +- idessem/dessem/modelos/avl_fpha2.py | 10 +- idessem/dessem/modelos/avl_fpha3.py | 10 +- idessem/dessem/modelos/blocos/dataestudo.py | 4 +- idessem/dessem/modelos/blocos/tabelacsv.py | 10 +- idessem/dessem/modelos/blocos/versaomodelo.py | 4 +- .../modelos/componentes/stagedatefield.py | 6 +- idessem/dessem/modelos/dadvaz.py | 42 +- idessem/dessem/modelos/deflant.py | 20 +- idessem/dessem/modelos/des_log_relato.py | 6 +- idessem/dessem/modelos/desselet.py | 38 +- idessem/dessem/modelos/dessemarq.py | 128 ++-- idessem/dessem/modelos/dessopc.py | 114 +-- idessem/dessem/modelos/entdados.py | 696 +++++++++--------- idessem/dessem/modelos/hidr.py | 78 +- idessem/dessem/modelos/operuh.py | 64 +- idessem/dessem/modelos/operut.py | 138 ++-- idessem/dessem/modelos/pdo_operacao.py | 8 +- idessem/dessem/modelos/renovaveis.py | 34 +- idessem/dessem/modelos/respot.py | 32 +- idessem/dessem/modelos/termdat.py | 68 +- idessem/dessem/modelos/uch.py | 166 ++--- idessem/dessem/operuh.py | 6 +- idessem/dessem/operut.py | 30 +- idessem/dessem/pdo_aval_qmaxusih.py | 4 +- idessem/dessem/pdo_cmobar.py | 4 +- idessem/dessem/pdo_cmosist.py | 4 +- idessem/dessem/pdo_eco_fcfcortes.py | 4 +- idessem/dessem/pdo_eco_usih.py | 4 +- idessem/dessem/pdo_eco_usih_conj.py | 4 +- idessem/dessem/pdo_eco_usih_polin.py | 4 +- idessem/dessem/pdo_elev.py | 4 +- idessem/dessem/pdo_eolica.py | 4 +- idessem/dessem/pdo_hidr.py | 4 +- idessem/dessem/pdo_inter.py | 4 +- idessem/dessem/pdo_oper_lpp.py | 4 +- idessem/dessem/pdo_oper_term.py | 4 +- .../dessem/pdo_oper_titulacao_contratos.py | 4 +- idessem/dessem/pdo_oper_titulacao_usinas.py | 4 +- idessem/dessem/pdo_oper_tviag_calha.py | 4 +- idessem/dessem/pdo_oper_uct.py | 4 +- idessem/dessem/pdo_oper_usih.py | 4 +- idessem/dessem/pdo_operacao.py | 4 +- idessem/dessem/pdo_reserva.py | 4 +- idessem/dessem/pdo_sist.py | 4 +- idessem/dessem/pdo_somflux.py | 4 +- idessem/dessem/pdo_term.py | 4 +- idessem/dessem/renovaveis.py | 6 +- idessem/dessem/respot.py | 6 +- idessem/dessem/termdat.py | 6 +- idessem/dessem/uch.py | 4 +- idessem/libs/modelos/usinas_hidreletricas.py | 56 +- idessem/libs/usinas_hidreletricas.py | 4 +- pyproject.toml | 14 +- 75 files changed, 1120 insertions(+), 941 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4fcbc4ee..da085ada 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Install uv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5e7d228..4b3da660 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Obrigado pelo interesse em contribuir com o _idessem_! Este guia descreve o flux ### Pré-requisitos -- Python 3.10 ou superior +- Python 3.11 ou superior - [uv](https://docs.astral.sh/uv/) (gerenciador de pacotes e ambientes) - Git @@ -112,7 +112,7 @@ Para gerar um relatório XML (formato utilizado no CI para envio ao Codecov): $ uv run pytest --cov-report=xml --cov=idessem ./tests ``` -O CI executa os testes em matriz para Python 3.10, 3.11 e 3.12. Recomenda-se testar localmente na versão mais antiga suportada (3.10) caso haja dúvidas sobre compatibilidade. +O CI executa os testes em matriz para Python 3.11, 3.12, 3.13 e 3.14. Recomenda-se testar localmente na versão mais antiga suportada (3.11) caso haja dúvidas sobre compatibilidade. --- @@ -180,6 +180,6 @@ Para uma descrição completa do framework com referências cruzadas à API do c $ git push origin minha-contribuicao ``` 7. **Abra um Pull Request** para a branch `main` do repositório original. -8. **Aguarde o CI**: os jobs de lint, typecheck, test (Python 3.10–3.12) e docs devem passar antes da revisão. +8. **Aguarde o CI**: os jobs de lint, typecheck, test (Python 3.11–3.14) e docs devem passar antes da revisão. Dúvidas ou sugestões podem ser abertas como [Issues](https://github.com/rjmalves/idessem/issues) no repositório. diff --git a/docs/source/geral/instalacao.rst b/docs/source/geral/instalacao.rst index 1a147417..d51c7fe4 100644 --- a/docs/source/geral/instalacao.rst +++ b/docs/source/geral/instalacao.rst @@ -3,14 +3,11 @@ Instalação ============ -O *idessem* é compatível com versões de Python >= 3.10 (testado em 3.10, 3.11 e 3.12). +O *idessem* é compatível com versões de Python >= 3.11 (testado em 3.11, 3.12, 3.13 e 3.14). Em posse de uma instalação local de Python, é recomendado que se use um ambiente virtual para instalação de módulos de terceiros, sendo que o *idessem* não é uma exceção. Para mais detalhes sobre o uso de ambientes virtuais, recomenda-se a leitura do recurso oficial de Python para ambientes virtuais: `venv `_. -.. note:: - - O *idessem* depende de ``cfinterface>=1.8.0,<=1.8.3`` para compatibilidade com a API interna. Instalando com pip ------------------ diff --git a/idessem/dessem/areacont.py b/idessem/dessem/areacont.py index 2bf384f2..376c0d64 100644 --- a/idessem/dessem/areacont.py +++ b/idessem/dessem/areacont.py @@ -1,4 +1,4 @@ -from typing import Optional, TypeVar +from typing import Any, Optional, TypeVar import pandas as pd # type: ignore from cfinterface.files.blockfile import BlockFile @@ -17,7 +17,7 @@ class Areacont(BlockFile): BLOCKS = [BlocoArea, BlocoUsina] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) @property @@ -37,7 +37,7 @@ def area(self) -> Optional[pd.DataFrame]: return None @area.setter - def area(self, valor: pd.DataFrame): + def area(self, valor: pd.DataFrame) -> None: b = self.data.get_blocks_of_type(BlocoArea) if isinstance(b, BlocoArea): b.data[1] = valor @@ -64,7 +64,7 @@ def usina(self) -> Optional[pd.DataFrame]: return None @usina.setter - def usina(self, valor: pd.DataFrame): + def usina(self, valor: pd.DataFrame) -> None: b = self.data.get_blocks_of_type(BlocoUsina) if isinstance(b, BlocoUsina): b.data[1] = valor diff --git a/idessem/dessem/avl_altqueda.py b/idessem/dessem/avl_altqueda.py index c6569a3b..c93d170e 100644 --- a/idessem/dessem/avl_altqueda.py +++ b/idessem/dessem/avl_altqueda.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class AvlAltQueda(ArquivoCSV): @@ -17,7 +19,7 @@ class AvlAltQueda(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a altura de queda. diff --git a/idessem/dessem/avl_desvfpha.py b/idessem/dessem/avl_desvfpha.py index a1672964..eabd02cc 100644 --- a/idessem/dessem/avl_desvfpha.py +++ b/idessem/dessem/avl_desvfpha.py @@ -7,6 +7,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class AvlDesvFpha(ArquivoCSV): @@ -24,7 +26,7 @@ class AvlDesvFpha(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente aos desvios da função de produção. diff --git a/idessem/dessem/avl_fpha1.py b/idessem/dessem/avl_fpha1.py index 68875c58..05a30fb9 100644 --- a/idessem/dessem/avl_fpha1.py +++ b/idessem/dessem/avl_fpha1.py @@ -7,6 +7,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class AvlFpha1(ArquivoCSV): @@ -24,7 +26,7 @@ class AvlFpha1(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente aos coeficientes da função de produção. diff --git a/idessem/dessem/avl_fpha2.py b/idessem/dessem/avl_fpha2.py index f89f2bd2..f578be0a 100644 --- a/idessem/dessem/avl_fpha2.py +++ b/idessem/dessem/avl_fpha2.py @@ -4,7 +4,7 @@ VersaoModelo, ) from cfinterface.files.blockfile import BlockFile -from typing import Optional, TypeVar +from typing import Any, Optional, TypeVar import pandas as pd # type: ignore from datetime import datetime @@ -22,12 +22,12 @@ class AvlFpha2(BlockFile): T = TypeVar("T") - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) self.__df_completo: Optional[pd.DataFrame] = None @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações de desvios da função de produção contida no arquivo AVL_FPHA2. diff --git a/idessem/dessem/avl_fpha3.py b/idessem/dessem/avl_fpha3.py index 66f7e69c..5ffe540c 100644 --- a/idessem/dessem/avl_fpha3.py +++ b/idessem/dessem/avl_fpha3.py @@ -4,7 +4,7 @@ VersaoModelo, ) from cfinterface.files.blockfile import BlockFile -from typing import Optional, TypeVar +from typing import Any, Optional, TypeVar import pandas as pd # type: ignore from datetime import datetime @@ -22,12 +22,12 @@ class AvlFpha3(BlockFile): T = TypeVar("T") - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) self.__df_completo: Optional[pd.DataFrame] = None @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações de desvios da função de produção contida no arquivo AVL_FPHA3. diff --git a/idessem/dessem/dadvaz.py b/idessem/dessem/dadvaz.py index 874ba1aa..8f67c0b9 100644 --- a/idessem/dessem/dadvaz.py +++ b/idessem/dessem/dadvaz.py @@ -39,7 +39,7 @@ def data_inicio(self) -> Optional[datetime]: return None @data_inicio.setter - def data_inicio(self, n: datetime): + def data_inicio(self, n: datetime) -> None: b = self.data.get_sections_of_type(BlocoDataInicioEstudo) if isinstance(b, BlocoDataInicioEstudo): b.data_inicio = n @@ -58,7 +58,7 @@ def dia_semana_inicial(self) -> Optional[int]: return None @dia_semana_inicial.setter - def dia_semana_inicial(self, n: int): + def dia_semana_inicial(self, n: int) -> None: b = self.data.get_sections_of_type(BlocoDadosHorizonte) if isinstance(b, BlocoDadosHorizonte): b.dia_semana_inicial = n @@ -77,7 +77,7 @@ def semana_acoplamento_fcf(self) -> Optional[int]: return None @semana_acoplamento_fcf.setter - def semana_acoplamento_fcf(self, n: int): + def semana_acoplamento_fcf(self, n: int) -> None: b = self.data.get_sections_of_type(BlocoDadosHorizonte) if isinstance(b, BlocoDadosHorizonte): b.semana_acoplamento_fcf = n @@ -96,7 +96,7 @@ def numero_semanas(self) -> Optional[int]: return None @numero_semanas.setter - def numero_semanas(self, n: int): + def numero_semanas(self, n: int) -> None: b = self.data.get_sections_of_type(BlocoDadosHorizonte) if isinstance(b, BlocoDadosHorizonte): b.numero_semanas = n @@ -115,7 +115,7 @@ def considera_periodo_simulacao(self) -> Optional[int]: return None @considera_periodo_simulacao.setter - def considera_periodo_simulacao(self, n: int): + def considera_periodo_simulacao(self, n: int) -> None: b = self.data.get_sections_of_type(BlocoDadosHorizonte) if isinstance(b, BlocoDadosHorizonte): b.considera_periodo_simulacao = n @@ -145,7 +145,7 @@ def vazoes(self) -> Optional[pd.DataFrame]: return None @vazoes.setter - def vazoes(self, valor: pd.DataFrame): + def vazoes(self, valor: pd.DataFrame) -> None: b = self.data.get_sections_of_type(BlocoVazoes) if isinstance(b, BlocoVazoes): b.data = valor diff --git a/idessem/dessem/deflant.py b/idessem/dessem/deflant.py index 7f874aed..2b2081e0 100644 --- a/idessem/dessem/deflant.py +++ b/idessem/dessem/deflant.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Type, TypeVar, Union +from typing import Any, List, Optional, Type, TypeVar, Union import pandas as pd # type: ignore from cfinterface.components.register import Register @@ -22,11 +22,11 @@ class Deflant(RegisterFile): REGISTERS = [DEFANT] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/dessem/des_log_relato.py b/idessem/dessem/des_log_relato.py index 6568304b..30370231 100644 --- a/idessem/dessem/des_log_relato.py +++ b/idessem/dessem/des_log_relato.py @@ -8,7 +8,7 @@ ) from cfinterface.files.blockfile import BlockFile from typing import Optional, TypeVar -from datetime import datetime +from datetime import datetime, timedelta import pandas as pd # type: ignore @@ -55,7 +55,7 @@ def data_estudo(self) -> Optional[datetime]: return None @property - def tempo_processamento(self): + def tempo_processamento(self) -> Optional[timedelta]: """ O tempo de processamento do estudo. diff --git a/idessem/dessem/desselet.py b/idessem/dessem/desselet.py index 5eef0be1..eddf36d0 100644 --- a/idessem/dessem/desselet.py +++ b/idessem/dessem/desselet.py @@ -40,7 +40,7 @@ def dados_casos_base(self) -> Optional[pd.DataFrame]: return None @dados_casos_base.setter - def dados_casos_base(self, valor: pd.DataFrame): + def dados_casos_base(self, valor: pd.DataFrame) -> None: b = self.data.get_sections_of_type(BlocoCasosBase) if isinstance(b, BlocoCasosBase): b.data = valor @@ -72,7 +72,7 @@ def dados_modificacao(self) -> Optional[pd.DataFrame]: return None @dados_modificacao.setter - def dados_modificacao(self, valor: pd.DataFrame): + def dados_modificacao(self, valor: pd.DataFrame) -> None: b = self.data.get_sections_of_type(BlocoCasosModificacao) if isinstance(b, BlocoCasosModificacao): b.data = valor diff --git a/idessem/dessem/dessemarq.py b/idessem/dessem/dessemarq.py index 86da4663..913c6189 100644 --- a/idessem/dessem/dessemarq.py +++ b/idessem/dessem/dessemarq.py @@ -34,7 +34,7 @@ ) from cfinterface.files.registerfile import RegisterFile -from typing import Optional, TypeVar +from typing import Any, Optional, TypeVar class DessemArq(RegisterFile): @@ -85,7 +85,7 @@ class DessemArq(RegisterFile): RegistroDessopc, ] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) @property diff --git a/idessem/dessem/dessopc.py b/idessem/dessem/dessopc.py index f9bbd3b2..5bf6a931 100644 --- a/idessem/dessem/dessopc.py +++ b/idessem/dessem/dessopc.py @@ -16,7 +16,7 @@ ) from cfinterface.files.blockfile import BlockFile -from typing import TypeVar, Optional, List +from typing import Any, TypeVar, Optional, List class Dessopc(BlockFile): @@ -44,7 +44,7 @@ class Dessopc(BlockFile): BlocoEngolimento, ] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) @property @@ -61,7 +61,7 @@ def uctpar(self) -> Optional[int]: return None @uctpar.setter - def uctpar(self, valor: int): + def uctpar(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoUctPar) if isinstance(b, BlocoUctPar): b.data = valor @@ -82,7 +82,7 @@ def ucterm(self) -> Optional[int]: return None @ucterm.setter - def ucterm(self, valor: int): + def ucterm(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoUcTerm) if isinstance(b, BlocoUcTerm): b.data = valor @@ -117,7 +117,7 @@ def regranptv(self) -> Optional[List[int]]: return None @regranptv.setter - def regranptv(self, valor: List[int]): + def regranptv(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoRegraNPTV) if isinstance(b, BlocoRegraNPTV): b.data = valor @@ -138,7 +138,7 @@ def avlcmo(self) -> Optional[int]: return None @avlcmo.setter - def avlcmo(self, valor: int): + def avlcmo(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoAvlCmo) if isinstance(b, BlocoAvlCmo): b.data = valor @@ -186,7 +186,7 @@ def uctheurfp(self) -> Optional[List[int]]: return None @uctheurfp.setter - def uctheurfp(self, valor: List[int]): + def uctheurfp(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoUctHeurFp) if isinstance(b, BlocoUctHeurFp): b.data = valor @@ -207,7 +207,7 @@ def constdados(self) -> Optional[List[int]]: return None @constdados.setter - def constdados(self, valor: List[int]): + def constdados(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoConstDados) if isinstance(b, BlocoConstDados): b.data = valor @@ -228,7 +228,7 @@ def ajustefcf(self) -> Optional[List[int]]: return None @ajustefcf.setter - def ajustefcf(self, valor: List[int]): + def ajustefcf(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoAjusteFcf) if isinstance(b, BlocoAjusteFcf): b.data = valor @@ -249,7 +249,7 @@ def tolerilh(self) -> Optional[int]: return None @tolerilh.setter - def tolerilh(self, valor: int): + def tolerilh(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoTolerIlh) if isinstance(b, BlocoTolerIlh): b.data = valor @@ -271,7 +271,7 @@ def crossover(self) -> Optional[List[int]]: return None @crossover.setter - def crossover(self, valor: List[int]): + def crossover(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoCrossover) if isinstance(b, BlocoCrossover): b.data = valor @@ -292,7 +292,7 @@ def engolimento(self) -> Optional[int]: return None @engolimento.setter - def engolimento(self, valor: int): + def engolimento(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoEngolimento) if isinstance(b, BlocoEngolimento): b.data = valor @@ -313,7 +313,7 @@ def tratainviabilha(self) -> Optional[int]: return None @tratainviabilha.setter - def tratainviabilha(self, valor: int): + def tratainviabilha(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoTrataInviabIlha) if isinstance(b, BlocoTrataInviabIlha): b.data = valor diff --git a/idessem/dessem/entdados.py b/idessem/dessem/entdados.py index f20bbf26..f82b6d7e 100644 --- a/idessem/dessem/entdados.py +++ b/idessem/dessem/entdados.py @@ -151,7 +151,7 @@ class Entdados(RegisterFile): ACPOTEFE, ] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __expande_colunas_df(self, df: pd.DataFrame) -> pd.DataFrame: @@ -173,7 +173,7 @@ def __expande_colunas_df(self, df: pd.DataFrame) -> pd.DataFrame: return df def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self.__expande_colunas_df(self._as_df(t)) @@ -673,7 +673,7 @@ def ac( codigo_usina: int, modificacao: Any, df: bool = False, - **kwargs, + **kwargs: Any, ) -> Optional[Union[AC, List[AC], pd.DataFrame]]: """ Obtém um registro que define modificações nos parâmetros diff --git a/idessem/dessem/hidr.py b/idessem/dessem/hidr.py index de80d7d2..648c50a4 100644 --- a/idessem/dessem/hidr.py +++ b/idessem/dessem/hidr.py @@ -4,7 +4,7 @@ import pandas as pd # type: ignore -from typing import TypeVar, List, Optional, IO, Union +from typing import Any, TypeVar, List, Optional, IO, Union class Hidr(RegisterFile): @@ -18,11 +18,11 @@ class Hidr(RegisterFile): REGISTERS = [RegistroUHEHidr] STORAGE = "BINARY" - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) self.__df: Optional[pd.DataFrame] = None - def write(self, to: Union[str, IO], *args, **kwargs): + def write(self, to: Union[str, IO[Any]], *args: Any, **kwargs: Any) -> None: self.__atualiza_registros() super().write(to, *args, **kwargs) @@ -160,8 +160,10 @@ def __monta_df_de_registros(self) -> Optional[pd.DataFrame]: ) return df - def __atualiza_registros(self): - registros: List[RegistroUHEHidr] = [r for r in self.data][1:] + def __atualiza_registros(self) -> None: + registros: List[RegistroUHEHidr] = [ + r for r in self.data if isinstance(r, RegistroUHEHidr) + ] for (_, linha), r in zip(self.cadastro.iterrows(), registros): r.nome = linha["nome_usina"] r.posto = linha["posto"] @@ -279,5 +281,5 @@ def cadastro(self) -> pd.DataFrame: return self.__df @cadastro.setter - def cadastro(self, df: pd.DataFrame): + def cadastro(self, df: pd.DataFrame) -> None: self.__df = df diff --git a/idessem/dessem/log_inviab.py b/idessem/dessem/log_inviab.py index efb459f2..3061782a 100644 --- a/idessem/dessem/log_inviab.py +++ b/idessem/dessem/log_inviab.py @@ -4,6 +4,8 @@ VersaoModelo, ) from idessem.dessem.modelos.log_inviab import TabelaLogInviab +import pandas as pd # type: ignore +from typing import Optional class LogInviab(ArquivoCSV): @@ -17,7 +19,7 @@ class LogInviab(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referentes aos custos marginais de operação por barra. diff --git a/idessem/dessem/log_matriz.py b/idessem/dessem/log_matriz.py index aa59553b..f6caedf7 100644 --- a/idessem/dessem/log_matriz.py +++ b/idessem/dessem/log_matriz.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class LogMatriz(ArquivoCSV): @@ -17,7 +19,7 @@ class LogMatriz(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente ao processo iterativo de convergência. diff --git a/idessem/dessem/modelos/areacont.py b/idessem/dessem/modelos/areacont.py index 680bcad3..bdbeadd2 100644 --- a/idessem/dessem/modelos/areacont.py +++ b/idessem/dessem/modelos/areacont.py @@ -1,4 +1,4 @@ -from typing import IO, Dict, List +from typing import Any, IO, Dict, List import pandas as pd # type: ignore from cfinterface.components.block import Block @@ -16,7 +16,9 @@ class BlocoArea(Block): BEGIN_PATTERN = r"^AREA" END_PATTERN = r"FIM" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -57,9 +59,9 @@ def __eq__(self, o: object) -> bool: self.data[1].equals(bloco.data[1]) ) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] - def _monta_df(dados: dict, cols: list) -> pd.DataFrame: + def _monta_df(dados: dict[str, Any], cols: List[Any]) -> pd.DataFrame: return pd.DataFrame(data=dados, columns=cols) cols = [ @@ -71,7 +73,7 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: linha = file.readline() indice_linha = 0 comentarios: Dict[int, List[str]] = {} - dados: Dict[str, List] = {c: [] for c in cols} + dados: Dict[str, List[Any]] = {c: [] for c in cols} while True: linha = file.readline() @@ -93,7 +95,7 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: dados[c].append(dados_linha[i]) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] if not isinstance(self.data, list): raise ValueError( "Dados do areacont.dat não foram lidos com sucesso" @@ -120,7 +122,9 @@ class BlocoUsina(Block): BEGIN_PATTERN = r"^USINA" END_PATTERN = r"FIM" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -165,9 +169,9 @@ def __eq__(self, o: object) -> bool: ) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] - def _monta_df(dados: dict, cols: list) -> pd.DataFrame: + def _monta_df(dados: dict[str, Any], cols: List[Any]) -> pd.DataFrame: return pd.DataFrame(data=dados, columns=cols) cols = [ @@ -182,7 +186,7 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: linha = file.readline() indice_linha = 0 comentarios: Dict[int, List[str]] = {} - dados: Dict[str, List] = {c: [] for c in cols} + dados: Dict[str, List[Any]] = {c: [] for c in cols} while True: linha = file.readline() @@ -204,7 +208,7 @@ def _monta_df(dados: dict, cols: list) -> pd.DataFrame: dados[c].append(dados_linha[i]) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] if not isinstance(self.data, list): raise ValueError( "Dados do areacont.dat não foram lidos com sucesso" diff --git a/idessem/dessem/modelos/arquivos/arquivocsv.py b/idessem/dessem/modelos/arquivos/arquivocsv.py index c03ae186..92cf4823 100644 --- a/idessem/dessem/modelos/arquivos/arquivocsv.py +++ b/idessem/dessem/modelos/arquivos/arquivocsv.py @@ -7,6 +7,8 @@ import pandas as pd # type: ignore from typing import TypeVar, Optional +__all__ = ["ArquivoCSV", "VersaoModelo", "DataEstudo", "TabelaCSV"] + class ArquivoCSV(BlockFile): """ diff --git a/idessem/dessem/modelos/avl_estatfpha.py b/idessem/dessem/modelos/avl_estatfpha.py index a80ba8e3..6ad1e324 100644 --- a/idessem/dessem/modelos/avl_estatfpha.py +++ b/idessem/dessem/modelos/avl_estatfpha.py @@ -1,5 +1,5 @@ from cfinterface.components.block import Block -from typing import List, IO +from typing import Any, List, IO import pandas as pd # type: ignore @@ -27,7 +27,7 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: df = pd.DataFrame(data={"variavel": variavel, "valor": valores}) return df diff --git a/idessem/dessem/modelos/avl_fpha2.py b/idessem/dessem/modelos/avl_fpha2.py index ce3ca55c..8ca35039 100644 --- a/idessem/dessem/modelos/avl_fpha2.py +++ b/idessem/dessem/modelos/avl_fpha2.py @@ -4,7 +4,7 @@ from cfinterface.components.floatfield import FloatField from cfinterface.components.line import Line import pandas as pd # type: ignore -from typing import IO, Dict, List +from typing import Any, IO, Dict, List class TabelaAvlFpha2(Block): @@ -25,7 +25,7 @@ class TabelaAvlFpha2(Block): ] END_PATTERN = "" - def _monta_df(self, dados: dict) -> pd.DataFrame: + def _monta_df(self, dados: dict[str, Any]) -> pd.DataFrame: return pd.DataFrame(data=dados, columns=self.__class__.COLUMN_NAMES) def __eq__(self, o: object) -> bool: @@ -39,7 +39,7 @@ def __eq__(self, o: object) -> bool: else: return self.data.equals(o.data) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] # Espera o fim do cabeçalho linha = file.readline() while True: @@ -70,7 +70,9 @@ def read(self, file: IO, *args, **kwargs): # Ignora a segunda linha de cabeçalho file.readline() # Lê a tabela - dados: Dict[str, List] = {c: [] for c in self.__class__.COLUMN_NAMES} + dados: Dict[str, List[Any]] = { + c: [] for c in self.__class__.COLUMN_NAMES + } while True: linha = file.readline() if len(linha) < 3 or "-----;--------------;------;" in linha: diff --git a/idessem/dessem/modelos/avl_fpha3.py b/idessem/dessem/modelos/avl_fpha3.py index 84acd656..c96d0efc 100644 --- a/idessem/dessem/modelos/avl_fpha3.py +++ b/idessem/dessem/modelos/avl_fpha3.py @@ -4,7 +4,7 @@ from cfinterface.components.floatfield import FloatField from cfinterface.components.line import Line import pandas as pd # type: ignore -from typing import IO, Dict, List +from typing import Any, IO, Dict, List class TabelaAvlFpha3(Block): @@ -25,7 +25,7 @@ class TabelaAvlFpha3(Block): ] END_PATTERN = "" - def _monta_df(self, dados: dict) -> pd.DataFrame: + def _monta_df(self, dados: dict[str, Any]) -> pd.DataFrame: return pd.DataFrame(data=dados, columns=self.__class__.COLUMN_NAMES) def __eq__(self, o: object) -> bool: @@ -39,7 +39,7 @@ def __eq__(self, o: object) -> bool: else: return self.data.equals(o.data) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] # Espera o fim do cabeçalho linha = file.readline() while True: @@ -70,7 +70,9 @@ def read(self, file: IO, *args, **kwargs): # Ignora a segunda linha de cabeçalho file.readline() # Lê a tabela - dados: Dict[str, List] = {c: [] for c in self.__class__.COLUMN_NAMES} + dados: Dict[str, List[Any]] = { + c: [] for c in self.__class__.COLUMN_NAMES + } while True: linha = file.readline() if ( diff --git a/idessem/dessem/modelos/blocos/dataestudo.py b/idessem/dessem/modelos/blocos/dataestudo.py index c52e3156..b99a76e9 100644 --- a/idessem/dessem/modelos/blocos/dataestudo.py +++ b/idessem/dessem/modelos/blocos/dataestudo.py @@ -1,7 +1,7 @@ from cfinterface.components.block import Block from cfinterface.components.datetimefield import DatetimeField from datetime import datetime -from typing import IO +from typing import Any, IO class DataEstudo(Block): @@ -21,7 +21,7 @@ def __eq__(self, o: object) -> bool: return False return self.data == o.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] linha = file.readline() dados = linha.split(DataEstudo.BEGIN_PATTERN) campo = DatetimeField(size=10, starting_position=0, format="%d/%m/%Y") diff --git a/idessem/dessem/modelos/blocos/tabelacsv.py b/idessem/dessem/modelos/blocos/tabelacsv.py index 8f11f87d..37349902 100644 --- a/idessem/dessem/modelos/blocos/tabelacsv.py +++ b/idessem/dessem/modelos/blocos/tabelacsv.py @@ -2,7 +2,7 @@ from cfinterface.components.line import Line import pandas as pd # type: ignore -from typing import IO, List, Dict +from typing import Any, IO, List, Dict class TabelaCSV(Block): @@ -28,10 +28,10 @@ def __eq__(self, o: object) -> bool: else: return self.data.equals(o.data) - def _monta_df(self, dados: dict) -> pd.DataFrame: + def _monta_df(self, dados: dict[str, Any]) -> pd.DataFrame: return pd.DataFrame(data=dados, columns=self.__class__.COLUMN_NAMES) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] if len(self.__class__.LINE_MODEL.fields) != len( self.__class__.COLUMN_NAMES ): @@ -50,7 +50,9 @@ def read(self, file: IO, *args, **kwargs): elif len(linha) < 3: return # Lê a tabela - dados: Dict[str, list] = {c: [] for c in self.__class__.COLUMN_NAMES} + dados: Dict[str, List[Any]] = { + c: [] for c in self.__class__.COLUMN_NAMES + } while True: linha = file.readline() if (len(linha) < 3) or self.__class__.BEGIN_PATTERN in linha: diff --git a/idessem/dessem/modelos/blocos/versaomodelo.py b/idessem/dessem/modelos/blocos/versaomodelo.py index 2d9699b5..1895ea2f 100644 --- a/idessem/dessem/modelos/blocos/versaomodelo.py +++ b/idessem/dessem/modelos/blocos/versaomodelo.py @@ -1,5 +1,5 @@ from cfinterface.components.block import Block -from typing import IO +from typing import Any, IO class VersaoModelo(Block): @@ -19,6 +19,6 @@ def __eq__(self, o: object) -> bool: return False return self.data == o.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] linha = file.readline() self.data = linha.split("VERSAO")[1].split("-")[0].strip() diff --git a/idessem/dessem/modelos/componentes/stagedatefield.py b/idessem/dessem/modelos/componentes/stagedatefield.py index fe7c504a..a5dc8057 100644 --- a/idessem/dessem/modelos/componentes/stagedatefield.py +++ b/idessem/dessem/modelos/componentes/stagedatefield.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Tuple, Union +from typing import Any, List, Optional, Tuple, Union from cfinterface.components.field import Field from cfinterface.components.integerfield import IntegerField @@ -31,7 +31,7 @@ def _binary_read(self, line: bytes) -> int: raise NotImplementedError("Binary files not supported for this field") # Override - def _textual_read(self, line: str) -> list: + def _textual_read(self, line: str) -> List[Any]: values: List[Optional[Union[str, int]]] = [] try: for f in self.__subfields: @@ -65,5 +65,5 @@ def value( def value( self, val: List[Optional[Union[str, int]]], - ): + ) -> None: self._value = val diff --git a/idessem/dessem/modelos/dadvaz.py b/idessem/dessem/modelos/dadvaz.py index e05264c3..17beac17 100644 --- a/idessem/dessem/modelos/dadvaz.py +++ b/idessem/dessem/modelos/dadvaz.py @@ -1,5 +1,5 @@ from datetime import datetime -from typing import IO, List, Optional +from typing import Any, IO, List, Optional import pandas as pd # type: ignore from cfinterface.components.datetimefield import DatetimeField @@ -19,7 +19,9 @@ class BlocoDataInicioEstudo(Section): __slots__ = ["__linha", "__cabecalhos"] - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -42,13 +44,13 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for _ in range(9): self.__cabecalhos.append(file.readline()) self.data = self.__linha.read(file.readline()) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for linha in self.__cabecalhos: file.write(linha) if not isinstance(self.data, list): @@ -66,7 +68,7 @@ def data_inicio(self) -> Optional[datetime]: return self.data[0] @data_inicio.setter - def data_inicio(self, d: datetime): + def data_inicio(self, d: datetime) -> None: self.data[0] = d @@ -77,7 +79,9 @@ class BlocoDadosHorizonte(Section): __slots__ = ["__linha", "__cabecalhos"] - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -103,13 +107,13 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for _ in range(2): self.__cabecalhos.append(file.readline()) self.data = self.__linha.read(file.readline()) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for linha in self.__cabecalhos: file.write(linha) if not isinstance(self.data, list): @@ -127,7 +131,7 @@ def dia_semana_inicial(self) -> Optional[int]: return self.data[0] @dia_semana_inicial.setter - def dia_semana_inicial(self, d: int): + def dia_semana_inicial(self, d: int) -> None: self.data[0] = d @property @@ -141,7 +145,7 @@ def semana_acoplamento_fcf(self) -> Optional[int]: return self.data[1] @semana_acoplamento_fcf.setter - def semana_acoplamento_fcf(self, d: int): + def semana_acoplamento_fcf(self, d: int) -> None: self.data[1] = d @property @@ -155,7 +159,7 @@ def numero_semanas(self) -> Optional[int]: return self.data[2] @numero_semanas.setter - def numero_semanas(self, d: int): + def numero_semanas(self, d: int) -> None: self.data[2] = d @property @@ -169,7 +173,7 @@ def considera_periodo_simulacao(self) -> Optional[int]: return self.data[3] @considera_periodo_simulacao.setter - def considera_periodo_simulacao(self, d: int): + def considera_periodo_simulacao(self, d: int) -> None: self.data[3] = d @@ -180,7 +184,9 @@ class BlocoVazoes(Section): __slots__ = ["__linha", "__cabecalhos"] - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -209,10 +215,10 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def extrai_coluna_de_listas( - listas: List[list], coluna: int, elemento: int | None = None - ) -> list: + listas: List[List[Any]], coluna: int, elemento: int | None = None + ) -> List[Any]: if elemento is None: return [lista[coluna] for lista in listas] else: @@ -250,7 +256,7 @@ def transforma_uhes_em_df() -> pd.DataFrame: self.__cabecalhos.append(file.readline()) # Para cada usina, lê e processa as informações - dados_uhes: List[list] = [] + dados_uhes: List[List[Any]] = [] while True: linha = file.readline() # Confere se terminaram as usinas @@ -263,7 +269,7 @@ def transforma_uhes_em_df() -> pd.DataFrame: dados_uhes.append(dados_uhe) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for linha in self.__cabecalhos: file.write(linha) if not isinstance(self.data, pd.DataFrame): diff --git a/idessem/dessem/modelos/deflant.py b/idessem/dessem/modelos/deflant.py index d3b92d34..3af6c344 100644 --- a/idessem/dessem/modelos/deflant.py +++ b/idessem/dessem/modelos/deflant.py @@ -37,7 +37,7 @@ def codigo_usina_montante(self) -> Optional[int]: return self.data[0] @codigo_usina_montante.setter - def codigo_usina_montante(self, u: int): + def codigo_usina_montante(self, u: int) -> None: self.data[0] = u @property @@ -51,7 +51,7 @@ def codigo_elemento_jusante(self) -> Optional[int]: return self.data[1] @codigo_elemento_jusante.setter - def codigo_elemento_jusante(self, u: int): + def codigo_elemento_jusante(self, u: int) -> None: self.data[1] = u @property @@ -65,7 +65,7 @@ def tipo_elemento_jusante(self) -> Optional[str]: return self.data[2] @tipo_elemento_jusante.setter - def tipo_elemento_jusante(self, u: str): + def tipo_elemento_jusante(self, u: str) -> None: self.data[2] = u @property @@ -80,7 +80,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[3][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[3][0] = n @property @@ -94,7 +94,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[3][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[3][1] = n @property @@ -108,7 +108,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[3][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[3][2] = n @property @@ -123,7 +123,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[4][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[4][0] = n @property @@ -137,7 +137,7 @@ def hora_final(self) -> Optional[int]: return self.data[4][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[4][1] = n @property @@ -151,7 +151,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[4][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[4][2] = n @property @@ -165,5 +165,5 @@ def defluencia(self) -> Optional[float]: return self.data[5] @defluencia.setter - def defluencia(self, cod: float): + def defluencia(self, cod: float) -> None: self.data[5] = cod diff --git a/idessem/dessem/modelos/des_log_relato.py b/idessem/dessem/modelos/des_log_relato.py index 303e89e0..cef4375c 100644 --- a/idessem/dessem/modelos/des_log_relato.py +++ b/idessem/dessem/modelos/des_log_relato.py @@ -1,5 +1,5 @@ from cfinterface.components.block import Block -from typing import List, IO +from typing import Any, List, IO import pandas as pd # type: ignore from datetime import timedelta from cfinterface.components.floatfield import FloatField @@ -29,7 +29,7 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: df = pd.DataFrame(data={"variavel": variavel, "valor": valores}) return df @@ -72,7 +72,7 @@ def __eq__(self, o: object) -> bool: return self.data == o.data # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] linha = file.readline() dados = linha.split(":") self.data = timedelta( diff --git a/idessem/dessem/modelos/desselet.py b/idessem/dessem/modelos/desselet.py index 7a34d0d2..e0b39ed4 100644 --- a/idessem/dessem/modelos/desselet.py +++ b/idessem/dessem/modelos/desselet.py @@ -1,4 +1,4 @@ -from typing import IO, List +from typing import Any, IO, List import pandas as pd # type: ignore from cfinterface.components.floatfield import FloatField @@ -17,7 +17,9 @@ class BlocoCasosBase(Section): FIM_BLOCO = "99999" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [IntegerField(5, 0), LiteralField(12, 5), LiteralField(40, 19)] @@ -38,15 +40,17 @@ def __eq__(self, o: object) -> bool: else: return self.data.equals(bloco.data) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def extrai_coluna_de_listas( - listas: List[list], + listas: List[List[Any]], coluna: int, - ) -> list: + ) -> List[Any]: return [lista[coluna] for lista in listas] - def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: + def transforma_em_df( + dados: List[Any], mapa: dict[str, Any] + ) -> pd.DataFrame | None: if len(dados) == 0: return None dados_df = {} @@ -58,7 +62,7 @@ def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: mapa = {"indice_caso_base": 0, "nome_caso_base": 1, "arquivo": 2} # Para cada caso, lê e processa as informações - dados: List[list] = [] + dados: List[List[Any]] = [] while True: linha = file.readline() # Converte para df @@ -72,7 +76,7 @@ def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: dados.append(self.__linha.read(linha)) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for linha in self.__comentarios: file.write(linha) if not isinstance(self.data, pd.DataFrame): @@ -94,7 +98,9 @@ class BlocoCasosModificacao(Section): FIM_BLOCO = "99999" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -128,15 +134,17 @@ def __eq__(self, o: object) -> bool: # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def extrai_coluna_de_listas( - listas: List[list], + listas: List[List[Any]], coluna: int, - ) -> list: + ) -> List[Any]: return [lista[coluna] for lista in listas] - def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: + def transforma_em_df( + dados: List[Any], mapa: dict[str, Any] + ) -> pd.DataFrame | None: if len(dados) == 0: return None dados_df = {} @@ -159,7 +167,7 @@ def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: } # Para cada caso, lê e processa as informações - dados: List[list] = [] + dados: List[List[Any]] = [] while True: linha = file.readline() # Converte para df @@ -173,7 +181,7 @@ def transforma_em_df(dados: list, mapa: dict) -> pd.DataFrame | None: dados.append(self.__linha.read(linha)) # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] for linha in self.__comentarios: file.write(linha) if not isinstance(self.data, pd.DataFrame): diff --git a/idessem/dessem/modelos/dessemarq.py b/idessem/dessem/modelos/dessemarq.py index 7b6da7cd..63ea5928 100644 --- a/idessem/dessem/modelos/dessemarq.py +++ b/idessem/dessem/modelos/dessemarq.py @@ -30,7 +30,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -44,7 +44,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -74,7 +74,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -88,7 +88,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -118,7 +118,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -132,7 +132,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -162,7 +162,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -176,7 +176,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -206,7 +206,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -220,7 +220,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -250,7 +250,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -264,7 +264,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -294,7 +294,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -308,7 +308,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -338,7 +338,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -352,7 +352,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -382,7 +382,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -396,7 +396,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -426,7 +426,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -440,7 +440,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -470,7 +470,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -484,7 +484,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -514,7 +514,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -528,7 +528,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -558,7 +558,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -572,7 +572,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -602,7 +602,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -616,7 +616,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -646,7 +646,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -660,7 +660,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -690,7 +690,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -704,7 +704,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -734,7 +734,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -748,7 +748,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -778,7 +778,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -792,7 +792,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -822,7 +822,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -836,7 +836,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -866,7 +866,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -880,7 +880,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -910,7 +910,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -924,7 +924,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -954,7 +954,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -968,7 +968,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -998,7 +998,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1012,7 +1012,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1042,7 +1042,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1056,7 +1056,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1086,7 +1086,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1100,7 +1100,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1130,7 +1130,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1144,7 +1144,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1174,7 +1174,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1188,7 +1188,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1218,7 +1218,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1232,7 +1232,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1262,7 +1262,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1276,7 +1276,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1306,7 +1306,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1320,7 +1320,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1350,7 +1350,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1364,7 +1364,7 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c @@ -1394,7 +1394,7 @@ def descricao(self) -> Optional[str]: return self.data[0].strip() @descricao.setter - def descricao(self, c: str): + def descricao(self, c: str) -> None: self.data[0] = c @property @@ -1408,5 +1408,5 @@ def valor(self) -> Optional[str]: return self.data[1].strip() @valor.setter - def valor(self, c: str): + def valor(self, c: str) -> None: self.data[1] = c diff --git a/idessem/dessem/modelos/dessopc.py b/idessem/dessem/modelos/dessopc.py index 32b20793..ee99378a 100644 --- a/idessem/dessem/modelos/dessopc.py +++ b/idessem/dessem/modelos/dessopc.py @@ -2,7 +2,7 @@ from cfinterface.components.line import Line from cfinterface.components.integerfield import IntegerField from cfinterface.components.literalfield import LiteralField -from typing import IO +from typing import Any, IO class BlocoUctPar(Block): @@ -14,7 +14,9 @@ class BlocoUctPar(Block): BEGIN_PATTERN = r"^UCTPAR" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -37,10 +39,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTPAR", self.data])) @@ -54,7 +56,9 @@ class BlocoUcTerm(Block): BEGIN_PATTERN = r"^UCTERM" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -77,10 +81,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTERM", self.data])) @@ -93,17 +97,19 @@ class BlocoPint(Block): BEGIN_PATTERN = r"^PINT" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(4, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoPint) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["PINT"])) @@ -116,7 +122,9 @@ class BlocoRegraNPTV(Block): BEGIN_PATTERN = r"^REGRANPTV" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -140,10 +148,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["REGRANPTV"] + self.data)) @@ -156,7 +164,9 @@ class BlocoAvlCmo(Block): BEGIN_PATTERN = r"^AVLCMO" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -179,10 +189,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["AVLCMO", self.data])) @@ -195,17 +205,19 @@ class BlocoCplexLog(Block): BEGIN_PATTERN = r"^CPLEXLOG" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(8, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoCplexLog) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CPLEXLOG"])) @@ -218,17 +230,19 @@ class BlocoUctBusLoc(Block): BEGIN_PATTERN = r"^UCTBUSLOC" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(9, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoUctBusLoc) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTBUSLOC"])) @@ -241,7 +255,9 @@ class BlocoUctHeurFp(Block): BEGIN_PATTERN = r"^UCTHEURFP" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -265,10 +281,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTHEURFP"] + self.data)) @@ -281,7 +297,9 @@ class BlocoConstDados(Block): BEGIN_PATTERN = r"^CONSTDADOS" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -304,10 +322,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CONSTDADOS"] + self.data)) @@ -320,7 +338,9 @@ class BlocoAjusteFcf(Block): BEGIN_PATTERN = r"^AJUSTEFCF" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -344,10 +364,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["AJUSTEFCF"] + self.data)) @@ -360,7 +380,9 @@ class BlocoTolerIlh(Block): BEGIN_PATTERN = r"^TOLERILH" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -383,10 +405,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["TOLERILH", self.data])) @@ -399,7 +421,9 @@ class BlocoCrossover(Block): BEGIN_PATTERN = r"^CROSSOVER" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -425,10 +449,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CROSSOVER"] + self.data)) @@ -441,7 +465,9 @@ class BlocoEngolimento(Block): BEGIN_PATTERN = r"^ENGOLIMENTO" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -464,10 +490,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["ENGOLIMENTO", self.data])) @@ -481,7 +507,9 @@ class BlocoTrataInviabIlha(Block): BEGIN_PATTERN = r"^TRATA_INVIAB_ILHA" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -504,8 +532,8 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["TRATA_INVIAB_ILHA", self.data])) diff --git a/idessem/dessem/modelos/entdados.py b/idessem/dessem/modelos/entdados.py index 687cd996..1fc24bce 100644 --- a/idessem/dessem/modelos/entdados.py +++ b/idessem/dessem/modelos/entdados.py @@ -4,7 +4,7 @@ from cfinterface.components.literalfield import LiteralField from cfinterface.components.floatfield import FloatField from idessem.dessem.modelos.componentes.stagedatefield import StageDateField -from typing import Optional, Union, IO +from typing import Any, Optional, Union, IO class RD(Register): @@ -38,7 +38,7 @@ def variaveis_de_folga(self) -> Optional[int]: return self.data[0] @variaveis_de_folga.setter - def variaveis_de_folga(self, cod: int): + def variaveis_de_folga(self, cod: int) -> None: self.data[0] = cod @property @@ -53,7 +53,7 @@ def maximo_circuitos_violados(self) -> Optional[int]: return self.data[1] @maximo_circuitos_violados.setter - def maximo_circuitos_violados(self, cod: int): + def maximo_circuitos_violados(self, cod: int) -> None: self.data[1] = cod @property @@ -69,7 +69,7 @@ def carga_registro_dbar(self) -> Optional[int]: return self.data[2] @carga_registro_dbar.setter - def carga_registro_dbar(self, cod: int): + def carga_registro_dbar(self, cod: int) -> None: self.data[2] = cod @property @@ -84,7 +84,7 @@ def limites_circuitos_transformadores_elevadores(self) -> Optional[int]: return self.data[3] @limites_circuitos_transformadores_elevadores.setter - def limites_circuitos_transformadores_elevadores(self, cod: int): + def limites_circuitos_transformadores_elevadores(self, cod: int) -> None: self.data[3] = cod @property @@ -100,7 +100,7 @@ def limites_circuitos_e_drefs(self) -> Optional[int]: return self.data[4] @limites_circuitos_e_drefs.setter - def limites_circuitos_e_drefs(self, cod: int): + def limites_circuitos_e_drefs(self, cod: int) -> None: self.data[4] = cod @property @@ -115,7 +115,7 @@ def consideracao_perdas(self) -> Optional[int]: return self.data[5] @consideracao_perdas.setter - def consideracao_perdas(self, cod: int): + def consideracao_perdas(self, cod: int) -> None: self.data[5] = cod @property @@ -130,7 +130,7 @@ def formato_arquivos_rede(self) -> Optional[int]: return self.data[6] @formato_arquivos_rede.setter - def formato_arquivos_rede(self, cod: int): + def formato_arquivos_rede(self, cod: int) -> None: self.data[6] = cod @@ -163,7 +163,7 @@ def codigo_entidade(self) -> Optional[int]: return self.data[0] @codigo_entidade.setter - def codigo_entidade(self, cod: int): + def codigo_entidade(self, cod: int) -> None: self.data[0] = cod @property @@ -177,7 +177,7 @@ def sistema_para(self) -> Optional[int]: return self.data[1] @sistema_para.setter - def sistema_para(self, cod: int): + def sistema_para(self, cod: int) -> None: self.data[1] = cod @property @@ -191,7 +191,7 @@ def tipo_variavel(self) -> Optional[int]: return self.data[2] @tipo_variavel.setter - def tipo_variavel(self, cod: int): + def tipo_variavel(self, cod: int) -> None: self.data[2] = cod @property @@ -205,7 +205,7 @@ def penalidade(self) -> Optional[float]: return self.data[3] @penalidade.setter - def penalidade(self, cod: float): + def penalidade(self, cod: float) -> None: self.data[3] = cod @@ -239,7 +239,7 @@ def dia_inicial(self) -> Optional[int]: return self.data[0] @dia_inicial.setter - def dia_inicial(self, cod: int): + def dia_inicial(self, cod: int) -> None: self.data[0] = cod @property @@ -253,7 +253,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1] @hora_inicial.setter - def hora_inicial(self, cod: int): + def hora_inicial(self, cod: int) -> None: self.data[1] = cod @property @@ -267,7 +267,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[2] @meia_hora_inicial.setter - def meia_hora_inicial(self, cod: int): + def meia_hora_inicial(self, cod: int) -> None: self.data[2] = cod @property @@ -281,7 +281,7 @@ def duracao(self) -> Optional[float]: return self.data[3] @duracao.setter - def duracao(self, cod: float): + def duracao(self, cod: float) -> None: self.data[3] = cod @property @@ -295,7 +295,7 @@ def consideracao_rede_eletrica(self) -> Optional[int]: return self.data[4] @consideracao_rede_eletrica.setter - def consideracao_rede_eletrica(self, cod: int): + def consideracao_rede_eletrica(self, cod: int) -> None: self.data[4] = cod @property @@ -309,7 +309,7 @@ def nome_patamar(self) -> Optional[str]: return self.data[5] @nome_patamar.setter - def nome_patamar(self, n: str): + def nome_patamar(self, n: str) -> None: self.data[5] = n @@ -340,7 +340,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[0] @codigo_submercado.setter - def codigo_submercado(self, cod: int): + def codigo_submercado(self, cod: int) -> None: self.data[0] = cod @property @@ -354,7 +354,7 @@ def mnemonico_submercado(self) -> Optional[str]: return self.data[1] @mnemonico_submercado.setter - def mnemonico_submercado(self, n: str): + def mnemonico_submercado(self, n: str) -> None: self.data[1] = n @property @@ -368,7 +368,7 @@ def ficticio(self) -> Optional[int]: return self.data[2] @ficticio.setter - def ficticio(self, cod: int): + def ficticio(self, cod: int) -> None: self.data[2] = cod @property @@ -382,7 +382,7 @@ def nome_submercado(self) -> Optional[str]: return self.data[3] @nome_submercado.setter - def nome_submercado(self, n: str): + def nome_submercado(self, n: str) -> None: self.data[3] = n @@ -413,7 +413,7 @@ def codigo_ree(self) -> Optional[int]: return self.data[0] @codigo_ree.setter - def codigo_ree(self, cod: int): + def codigo_ree(self, cod: int) -> None: self.data[0] = cod @property @@ -427,7 +427,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[1] @codigo_submercado.setter - def codigo_submercado(self, cod: int): + def codigo_submercado(self, cod: int) -> None: self.data[1] = cod @property @@ -441,7 +441,7 @@ def nome_ree(self) -> Optional[str]: return self.data[2] @nome_ree.setter - def nome_ree(self, n: str): + def nome_ree(self, n: str) -> None: self.data[2] = n @@ -478,7 +478,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -492,7 +492,7 @@ def nome_usina(self) -> Optional[str]: return self.data[1] @nome_usina.setter - def nome_usina(self, n: str): + def nome_usina(self, n: str) -> None: self.data[1] = n @property @@ -506,7 +506,7 @@ def codigo_ree(self) -> Optional[int]: return self.data[2] @codigo_ree.setter - def codigo_ree(self, n: int): + def codigo_ree(self, n: int) -> None: self.data[2] = n @property @@ -520,7 +520,7 @@ def volume_inicial(self) -> Optional[float]: return self.data[3] @volume_inicial.setter - def volume_inicial(self, v: float): + def volume_inicial(self, v: float) -> None: self.data[3] = v @property @@ -534,7 +534,7 @@ def evaporacao(self) -> Optional[int]: return self.data[4] @evaporacao.setter - def evaporacao(self, e: int): + def evaporacao(self, e: int) -> None: self.data[4] = e @property @@ -549,7 +549,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[5][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[5][0] = n @property @@ -563,7 +563,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[5][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[5][1] = n @property @@ -577,7 +577,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[5][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[5][2] = n @property @@ -591,7 +591,7 @@ def volume_morto_inicial(self) -> Optional[float]: return self.data[6] @volume_morto_inicial.setter - def volume_morto_inicial(self, e: float): + def volume_morto_inicial(self, e: float) -> None: self.data[6] = e @property @@ -605,7 +605,7 @@ def produtividade(self) -> Optional[int]: return self.data[7] @produtividade.setter - def produtividade(self, n: int): + def produtividade(self, n: int) -> None: self.data[7] = n @property @@ -619,7 +619,7 @@ def penaliza_restricao_geracao(self) -> Optional[int]: return self.data[8] @penaliza_restricao_geracao.setter - def penaliza_restricao_geracao(self, n: int): + def penaliza_restricao_geracao(self, n: int) -> None: self.data[8] = n @@ -652,7 +652,7 @@ def codigo_usina_montante(self) -> Optional[int]: return self.data[0] @codigo_usina_montante.setter - def codigo_usina_montante(self, u: int): + def codigo_usina_montante(self, u: int) -> None: self.data[0] = u @property @@ -667,7 +667,7 @@ def codigo_elemento_jusante(self) -> Optional[int]: return self.data[1] @codigo_elemento_jusante.setter - def codigo_elemento_jusante(self, u: int): + def codigo_elemento_jusante(self, u: int) -> None: self.data[1] = u @property @@ -681,7 +681,7 @@ def tipo_elemento_jusante(self) -> Optional[str]: return self.data[2] @tipo_elemento_jusante.setter - def tipo_elemento_jusante(self, u: str): + def tipo_elemento_jusante(self, u: str) -> None: self.data[2] = u @property @@ -696,7 +696,7 @@ def duracao(self) -> Optional[int]: return self.data[3] @duracao.setter - def duracao(self, d: int): + def duracao(self, d: int) -> None: self.data[3] = d @property @@ -711,7 +711,7 @@ def tipo_tempo_viagem(self) -> Optional[int]: return self.data[4] @tipo_tempo_viagem.setter - def tipo_tempo_viagem(self, d: int): + def tipo_tempo_viagem(self, d: int) -> None: self.data[4] = d @@ -749,7 +749,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, codigo: int): + def codigo_usina(self, codigo: int) -> None: self.data[0] = codigo @property @@ -763,7 +763,7 @@ def nome_usina(self) -> Optional[str]: return self.data[1] @nome_usina.setter - def nome_usina(self, nome: str): + def nome_usina(self, nome: str) -> None: self.data[1] = nome @property @@ -777,7 +777,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[2] @codigo_submercado.setter - def codigo_submercado(self, submercado: int): + def codigo_submercado(self, submercado: int) -> None: self.data[2] = submercado @property @@ -791,7 +791,7 @@ def tipo_restricao(self) -> Optional[int]: return self.data[3] @tipo_restricao.setter - def tipo_restricao(self, tipo_restricao: int): + def tipo_restricao(self, tipo_restricao: int) -> None: self.data[3] = tipo_restricao @property @@ -806,7 +806,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[4][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[4][0] = n @property @@ -820,7 +820,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[4][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[4][1] = n @property @@ -834,7 +834,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[4][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[4][2] = n @property @@ -849,7 +849,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[5][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[5][0] = n @property @@ -863,7 +863,7 @@ def hora_final(self) -> Optional[int]: return self.data[5][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[5][1] = n @property @@ -877,7 +877,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[5][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[5][2] = n @property @@ -891,7 +891,7 @@ def unidade_restricao(self) -> Optional[int]: return self.data[6] @unidade_restricao.setter - def unidade_restricao(self, unidade_restricao: int): + def unidade_restricao(self, unidade_restricao: int) -> None: self.data[6] = unidade_restricao @property @@ -907,7 +907,7 @@ def geracao_minima(self) -> Optional[float]: return self.data[7] @geracao_minima.setter - def geracao_minima(self, geracao_minima: float): + def geracao_minima(self, geracao_minima: float) -> None: self.data[7] = geracao_minima @property @@ -923,7 +923,7 @@ def geracao_maxima(self) -> Optional[float]: return self.data[8] @geracao_maxima.setter - def geracao_maxima(self, geracao_maxima: float): + def geracao_maxima(self, geracao_maxima: float) -> None: self.data[8] = geracao_maxima @@ -958,7 +958,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -972,7 +972,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[1] @codigo_submercado.setter - def codigo_submercado(self, n: int): + def codigo_submercado(self, n: int) -> None: self.data[1] = n @property @@ -986,7 +986,7 @@ def nome_usina(self) -> Optional[str]: return self.data[2] @nome_usina.setter - def nome_usina(self, v: str): + def nome_usina(self, v: str) -> None: self.data[2] = v @property @@ -1000,7 +1000,7 @@ def codigo_usina_montante(self) -> Optional[int]: return self.data[3] @codigo_usina_montante.setter - def codigo_usina_montante(self, v: int): + def codigo_usina_montante(self, v: int) -> None: self.data[3] = v @property @@ -1014,7 +1014,7 @@ def codigo_usina_jusante(self) -> Optional[int]: return self.data[4] @codigo_usina_jusante.setter - def codigo_usina_jusante(self, e: int): + def codigo_usina_jusante(self, e: int) -> None: self.data[4] = e @property @@ -1028,7 +1028,7 @@ def vazao_minima_bombeavel(self) -> Optional[float]: return self.data[5] @vazao_minima_bombeavel.setter - def vazao_minima_bombeavel(self, e: float): + def vazao_minima_bombeavel(self, e: float) -> None: self.data[5] = e @property @@ -1042,7 +1042,7 @@ def vazao_maxima_bombeavel(self) -> Optional[float]: return self.data[6] @vazao_maxima_bombeavel.setter - def vazao_maxima_bombeavel(self, e: float): + def vazao_maxima_bombeavel(self, e: float) -> None: self.data[6] = e @property @@ -1056,7 +1056,7 @@ def taxa_consumo(self) -> Optional[float]: return self.data[7] @taxa_consumo.setter - def taxa_consumo(self, e: float): + def taxa_consumo(self, e: float) -> None: self.data[7] = e @@ -1089,7 +1089,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[0] @codigo_submercado.setter - def codigo_submercado(self, sub: int): + def codigo_submercado(self, sub: int) -> None: self.data[0] = sub @property @@ -1104,7 +1104,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -1118,7 +1118,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -1132,7 +1132,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -1147,7 +1147,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -1161,7 +1161,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -1175,7 +1175,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -1189,7 +1189,7 @@ def demanda(self) -> Optional[float]: return self.data[3] @demanda.setter - def demanda(self, demanda: float): + def demanda(self, demanda: float) -> None: self.data[3] = demanda @@ -1223,7 +1223,7 @@ def codigo_demanda_especial(self) -> Optional[int]: return self.data[0] @codigo_demanda_especial.setter - def codigo_demanda_especial(self, sub: int): + def codigo_demanda_especial(self, sub: int) -> None: self.data[0] = sub @property @@ -1237,7 +1237,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -1251,7 +1251,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -1265,7 +1265,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -1279,7 +1279,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -1293,7 +1293,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -1307,7 +1307,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -1321,7 +1321,7 @@ def demanda(self) -> Optional[float]: return self.data[3] @demanda.setter - def demanda(self, demanda: float): + def demanda(self, demanda: float) -> None: self.data[3] = demanda @property @@ -1335,7 +1335,7 @@ def justificativa(self) -> Optional[str]: return self.data[4] @justificativa.setter - def justificativa(self, justificativa: str): + def justificativa(self, justificativa: str) -> None: self.data[4] = justificativa @@ -1369,7 +1369,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[0] @codigo_submercado.setter - def codigo_submercado(self, s: int): + def codigo_submercado(self, s: int) -> None: self.data[0] = s @property @@ -1383,7 +1383,7 @@ def numero_curva(self) -> Optional[int]: return self.data[1] @numero_curva.setter - def numero_curva(self, n: int): + def numero_curva(self, n: int) -> None: self.data[1] = n @property @@ -1398,7 +1398,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -1412,7 +1412,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[2][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[2][1] = n @property @@ -1426,7 +1426,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[2][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[2][2] = n @property @@ -1441,7 +1441,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[3][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[3][0] = n @property @@ -1455,7 +1455,7 @@ def hora_final(self) -> Optional[int]: return self.data[3][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[3][1] = n @property @@ -1469,7 +1469,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[3][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[3][2] = n @property @@ -1483,7 +1483,7 @@ def custo(self) -> Optional[float]: return self.data[4] @custo.setter - def custo(self, cus: float): + def custo(self, cus: float) -> None: self.data[4] = cus @property @@ -1497,7 +1497,7 @@ def limite_superior(self) -> Optional[float]: return self.data[5] @limite_superior.setter - def limite_superior(self, lim: float): + def limite_superior(self, lim: float) -> None: self.data[5] = lim @@ -1531,7 +1531,7 @@ def codigo_usina(self) -> Optional[str]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, nome: str): + def codigo_usina(self, nome: str) -> None: self.data[0] = nome @property @@ -1545,7 +1545,7 @@ def nome_usina(self) -> Optional[str]: return self.data[1] @nome_usina.setter - def nome_usina(self, nome: str): + def nome_usina(self, nome: str) -> None: self.data[1] = nome @property @@ -1559,7 +1559,7 @@ def localizacao(self) -> Optional[int]: return self.data[2] @localizacao.setter - def localizacao(self, sub: int): + def localizacao(self, sub: int) -> None: self.data[2] = sub @property @@ -1574,7 +1574,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[3][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[3][0] = n @property @@ -1588,7 +1588,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[3][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[3][1] = n @property @@ -1602,7 +1602,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[3][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[3][2] = n @property @@ -1617,7 +1617,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[4][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[4][0] = n @property @@ -1631,7 +1631,7 @@ def hora_final(self) -> Optional[int]: return self.data[4][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[4][1] = n @property @@ -1645,7 +1645,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[4][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[4][2] = n @property @@ -1659,7 +1659,7 @@ def geracao(self) -> Optional[float]: return self.data[5] @geracao.setter - def geracao(self, ger: float): + def geracao(self, ger: float) -> None: self.data[5] = ger @@ -1695,7 +1695,7 @@ def codigo_ree(self) -> Optional[int]: return self.data[0] @codigo_ree.setter - def codigo_ree(self, n: int): + def codigo_ree(self, n: int) -> None: self.data[0] = n @property @@ -1710,7 +1710,7 @@ def coeficiente_a0(self) -> Optional[float]: return self.data[1] @coeficiente_a0.setter - def coeficiente_a0(self, c: float): + def coeficiente_a0(self, c: float) -> None: self.data[1] = c @property @@ -1725,7 +1725,7 @@ def coeficiente_a1(self) -> Optional[float]: return self.data[2] @coeficiente_a1.setter - def coeficiente_a1(self, c: float): + def coeficiente_a1(self, c: float) -> None: self.data[2] = c @property @@ -1740,7 +1740,7 @@ def coeficiente_a2(self) -> Optional[float]: return self.data[3] @coeficiente_a2.setter - def coeficiente_a2(self, c: float): + def coeficiente_a2(self, c: float) -> None: self.data[3] = c @property @@ -1755,7 +1755,7 @@ def coeficiente_a3(self) -> Optional[float]: return self.data[4] @coeficiente_a3.setter - def coeficiente_a3(self, c: float): + def coeficiente_a3(self, c: float) -> None: self.data[4] = c @property @@ -1770,7 +1770,7 @@ def coeficiente_a4(self) -> Optional[float]: return self.data[5] @coeficiente_a4.setter - def coeficiente_a4(self, c: float): + def coeficiente_a4(self, c: float) -> None: self.data[5] = c @@ -1806,7 +1806,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[0][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[0][0] = n @property @@ -1820,7 +1820,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[0][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[0][1] = n @property @@ -1834,7 +1834,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[0][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[0][2] = n @property @@ -1849,7 +1849,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -1863,7 +1863,7 @@ def hora_final(self) -> Optional[int]: return self.data[1][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[1][1] = n @property @@ -1877,7 +1877,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[1][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[1][2] = n @property @@ -1891,7 +1891,7 @@ def geracao_minima_50hz(self) -> Optional[float]: return self.data[2] @geracao_minima_50hz.setter - def geracao_minima_50hz(self, n: float): + def geracao_minima_50hz(self, n: float) -> None: self.data[2] = n @property @@ -1905,7 +1905,7 @@ def geracao_maxima_50hz(self) -> Optional[float]: return self.data[3] @geracao_maxima_50hz.setter - def geracao_maxima_50hz(self, n: float): + def geracao_maxima_50hz(self, n: float) -> None: self.data[3] = n @property @@ -1919,7 +1919,7 @@ def geracao_minima_60hz(self) -> Optional[float]: return self.data[4] @geracao_minima_60hz.setter - def geracao_minima_60hz(self, n: float): + def geracao_minima_60hz(self, n: float) -> None: self.data[4] = n @property @@ -1933,7 +1933,7 @@ def geracao_maxima_60hz(self) -> Optional[float]: return self.data[5] @geracao_maxima_60hz.setter - def geracao_maxima_60hz(self, n: float): + def geracao_maxima_60hz(self, n: float) -> None: self.data[5] = n @property @@ -1947,7 +1947,7 @@ def carga_ande(self) -> Optional[float]: return self.data[6] @carga_ande.setter - def carga_ande(self, n: float): + def carga_ande(self, n: float) -> None: self.data[6] = n @@ -1982,7 +1982,7 @@ def nome_submercado_de(self) -> Optional[str]: return self.data[0] @nome_submercado_de.setter - def nome_submercado_de(self, n: str): + def nome_submercado_de(self, n: str) -> None: self.data[0] = n @property @@ -1997,7 +1997,7 @@ def nome_submercado_para(self) -> Optional[str]: return self.data[1] @nome_submercado_para.setter - def nome_submercado_para(self, n: str): + def nome_submercado_para(self, n: str) -> None: self.data[1] = n @property @@ -2012,7 +2012,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -2026,7 +2026,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[2][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[2][1] = n @property @@ -2040,7 +2040,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[2][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[2][2] = n @property @@ -2055,7 +2055,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[3][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[3][0] = n @property @@ -2069,7 +2069,7 @@ def hora_final(self) -> Optional[int]: return self.data[3][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[3][1] = n @property @@ -2083,7 +2083,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[3][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[3][2] = n @property @@ -2097,7 +2097,7 @@ def capacidade_de(self) -> Optional[float]: return self.data[4] @capacidade_de.setter - def capacidade_de(self, n: float): + def capacidade_de(self, n: float) -> None: self.data[4] = n @property @@ -2111,7 +2111,7 @@ def capacidade_para(self) -> Optional[float]: return self.data[5] @capacidade_para.setter - def capacidade_para(self, n: float): + def capacidade_para(self, n: float) -> None: self.data[5] = n @@ -2138,7 +2138,7 @@ def gap_pdd(self) -> Optional[float]: return self.data[0] @gap_pdd.setter - def gap_pdd(self, n: float): + def gap_pdd(self, n: float) -> None: self.data[0] = n @property @@ -2154,7 +2154,7 @@ def gap_milp(self) -> Optional[float]: return self.data[1] @gap_milp.setter - def gap_milp(self, n: float): + def gap_milp(self, n: float) -> None: self.data[1] = n @@ -2174,7 +2174,9 @@ class ACVTFUGA(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2190,7 +2192,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2198,7 +2200,7 @@ def influi(self) -> Optional[int]: return self.data[1] @influi.setter - def influi(self, u: int): + def influi(self, u: int) -> None: self.data[1] = u @@ -2217,7 +2219,9 @@ class ACVOLMAX(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2233,7 +2237,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2241,7 +2245,7 @@ def volume(self) -> Optional[float]: return self.data[1] @volume.setter - def volume(self, u: float): + def volume(self, u: float) -> None: self.data[1] = u @@ -2260,7 +2264,9 @@ class ACVOLMIN(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2276,7 +2282,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2284,7 +2290,7 @@ def volume(self) -> Optional[float]: return self.data[1] @volume.setter - def volume(self, u: float): + def volume(self, u: float) -> None: self.data[1] = u @@ -2304,7 +2310,9 @@ class ACVSVERT(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2320,7 +2328,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2328,7 +2336,7 @@ def volume(self) -> Optional[float]: return self.data[1] @volume.setter - def volume(self, u: float): + def volume(self, u: float) -> None: self.data[1] = u @@ -2348,7 +2356,9 @@ class ACVMDESV(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2364,7 +2374,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2372,7 +2382,7 @@ def volume(self) -> Optional[float]: return self.data[1] @volume.setter - def volume(self, u: float): + def volume(self, u: float) -> None: self.data[1] = u @@ -2394,7 +2404,9 @@ class ACCOTVAZ(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2410,7 +2422,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2418,7 +2430,7 @@ def ordem(self) -> Optional[int]: return self.data[1] @ordem.setter - def ordem(self, u: int): + def ordem(self, u: int) -> None: self.data[1] = u @property @@ -2426,7 +2438,7 @@ def coeficiente(self) -> Optional[float]: return self.data[2] @coeficiente.setter - def coeficiente(self, u: float): + def coeficiente(self, u: float) -> None: self.data[2] = u @property @@ -2434,7 +2446,7 @@ def polimonio(self) -> Optional[int]: return self.data[3] @polimonio.setter - def polimonio(self, u: int): + def polimonio(self, u: int) -> None: self.data[3] = u @@ -2455,7 +2467,9 @@ class ACCOTVOL(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2471,7 +2485,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2479,7 +2493,7 @@ def ordem(self) -> Optional[int]: return self.data[1] @ordem.setter - def ordem(self, u: int): + def ordem(self, u: int) -> None: self.data[1] = u @property @@ -2487,7 +2501,7 @@ def coeficiente(self) -> Optional[float]: return self.data[2] @coeficiente.setter - def coeficiente(self, u: float): + def coeficiente(self, u: float) -> None: self.data[2] = u @@ -2508,7 +2522,9 @@ class ACCOTTAR(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2524,7 +2540,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2532,7 +2548,7 @@ def ordem(self) -> Optional[int]: return self.data[1] @ordem.setter - def ordem(self, u: int): + def ordem(self, u: int) -> None: self.data[1] = u @property @@ -2540,7 +2556,7 @@ def coeficiente(self) -> Optional[float]: return self.data[2] @coeficiente.setter - def coeficiente(self, u: float): + def coeficiente(self, u: float) -> None: self.data[2] = u @@ -2559,7 +2575,9 @@ class ACNUMCON(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2575,7 +2593,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2583,7 +2601,7 @@ def numero_conjuntos(self) -> Optional[int]: return self.data[1] @numero_conjuntos.setter - def numero_conjuntos(self, u: int): + def numero_conjuntos(self, u: int) -> None: self.data[1] = u @@ -2602,7 +2620,9 @@ class ACNUMJUS(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2618,7 +2638,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2626,7 +2646,7 @@ def jusante(self) -> Optional[int]: return self.data[1] @jusante.setter - def jusante(self, u: int): + def jusante(self, u: int) -> None: self.data[1] = u @@ -2645,7 +2665,9 @@ class ACNUMPOS(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2661,7 +2683,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2669,7 +2691,7 @@ def codigo_posto(self) -> Optional[int]: return self.data[1] @codigo_posto.setter - def codigo_posto(self, u: int): + def codigo_posto(self, u: int) -> None: self.data[1] = u @@ -2689,7 +2711,9 @@ class ACJUSENA(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2705,7 +2729,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2713,7 +2737,7 @@ def aproveitamento(self) -> Optional[int]: return self.data[1] @aproveitamento.setter - def aproveitamento(self, u: int): + def aproveitamento(self, u: int) -> None: self.data[1] = u @@ -2732,7 +2756,9 @@ class ACJUSMED(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2748,7 +2774,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2756,7 +2782,7 @@ def cota(self) -> Optional[float]: return self.data[1] @cota.setter - def cota(self, u: float): + def cota(self, u: float) -> None: self.data[1] = u @@ -2777,7 +2803,9 @@ class ACCOFEVA(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2793,7 +2821,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2801,7 +2829,7 @@ def mes_coeficiente(self) -> Optional[int]: return self.data[1] @mes_coeficiente.setter - def mes_coeficiente(self, u: int): + def mes_coeficiente(self, u: int) -> None: self.data[1] = u @property @@ -2809,7 +2837,7 @@ def coeficiente(self) -> Optional[int]: return self.data[2] @coeficiente.setter - def coeficiente(self, u: int): + def coeficiente(self, u: int) -> None: self.data[2] = u @@ -2830,7 +2858,9 @@ class ACNUMMAQ(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2846,7 +2876,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2854,7 +2884,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, u: int): + def codigo_conjunto(self, u: int) -> None: self.data[1] = u @property @@ -2862,7 +2892,7 @@ def numero_maquinas(self) -> Optional[int]: return self.data[2] @numero_maquinas.setter - def numero_maquinas(self, u: int): + def numero_maquinas(self, u: int) -> None: self.data[2] = u @@ -2883,7 +2913,9 @@ class ACPOTEFE(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2899,7 +2931,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2907,7 +2939,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, u: int): + def codigo_conjunto(self, u: int) -> None: self.data[1] = u @property @@ -2915,7 +2947,7 @@ def potencia(self) -> Optional[float]: return self.data[2] @potencia.setter - def potencia(self, u: float): + def potencia(self, u: float) -> None: self.data[2] = u @@ -2936,7 +2968,9 @@ class ACDESVIO(Register): ) # Override - def write(self, file: IO, storage: str = "", *args, **kwargs) -> bool: + def write( + self, file: IO[Any], storage: str = "", *args: Any, **kwargs: Any + ) -> bool: line = self.__class__.LINE.write(self.data) line = ( self.__class__.IDENTIFIER[:2] # type: ignore @@ -2952,7 +2986,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -2960,7 +2994,7 @@ def jusante(self) -> Optional[int]: return self.data[1] @jusante.setter - def jusante(self, u: int): + def jusante(self, u: int) -> None: self.data[1] = u @property @@ -2968,7 +3002,7 @@ def limite_vazao(self) -> Optional[float]: return self.data[2] @limite_vazao.setter - def limite_vazao(self, u: float): + def limite_vazao(self, u: float) -> None: self.data[2] = u @@ -2995,7 +3029,7 @@ def tipo_limite(self) -> Optional[int]: return self.data[0] @tipo_limite.setter - def tipo_limite(self, n: int): + def tipo_limite(self, n: int) -> None: self.data[0] = n @property @@ -3010,7 +3044,7 @@ def iteracoes(self) -> Optional[int]: return self.data[1] @iteracoes.setter - def iteracoes(self, n: int): + def iteracoes(self, n: int) -> None: self.data[1] = n @@ -3042,7 +3076,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -3057,7 +3091,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -3071,7 +3105,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -3085,7 +3119,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -3100,7 +3134,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -3114,7 +3148,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -3128,7 +3162,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -3142,7 +3176,7 @@ def volume(self) -> Optional[float]: return self.data[3] @volume.setter - def volume(self, v: float): + def volume(self, v: float) -> None: self.data[3] = v @@ -3178,7 +3212,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -3193,7 +3227,7 @@ def tipo_tratamento_volume(self) -> Optional[int]: return self.data[1] @tipo_tratamento_volume.setter - def tipo_tratamento_volume(self, t: int): + def tipo_tratamento_volume(self, t: int) -> None: self.data[1] = t @property @@ -3208,7 +3242,7 @@ def numero_pontos_turbinamento(self) -> Optional[int]: return self.data[2] @numero_pontos_turbinamento.setter - def numero_pontos_turbinamento(self, n: int): + def numero_pontos_turbinamento(self, n: int) -> None: self.data[2] = n @property @@ -3223,7 +3257,7 @@ def numero_pontos_volume(self) -> Optional[int]: return self.data[3] @numero_pontos_volume.setter - def numero_pontos_volume(self, n: int): + def numero_pontos_volume(self, n: int) -> None: self.data[3] = n @property @@ -3238,7 +3272,7 @@ def verifica_concavidade(self) -> Optional[int]: return self.data[4] @verifica_concavidade.setter - def verifica_concavidade(self, n: int): + def verifica_concavidade(self, n: int) -> None: self.data[4] = n @property @@ -3252,7 +3286,7 @@ def ajuste_minimos_quadrados(self) -> Optional[int]: return self.data[5] @ajuste_minimos_quadrados.setter - def ajuste_minimos_quadrados(self, n: int): + def ajuste_minimos_quadrados(self, n: int) -> None: self.data[5] = n @property @@ -3267,7 +3301,7 @@ def comprimento_janela_volume(self) -> Optional[float]: return self.data[6] @comprimento_janela_volume.setter - def comprimento_janela_volume(self, lim: float): + def comprimento_janela_volume(self, lim: float) -> None: self.data[6] = lim @property @@ -3281,7 +3315,7 @@ def tolerancia_desvio(self) -> Optional[float]: return self.data[7] @tolerancia_desvio.setter - def tolerancia_desvio(self, lim: float): + def tolerancia_desvio(self, lim: float) -> None: self.data[7] = lim @@ -3310,7 +3344,7 @@ def taxa(self) -> Optional[float]: return self.data[0] @taxa.setter - def taxa(self, t: float): + def taxa(self, t: float) -> None: self.data[0] = t @@ -3340,7 +3374,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, u: int): + def codigo_usina(self, u: int) -> None: self.data[0] = u @property @@ -3354,7 +3388,7 @@ def volume(self) -> Optional[float]: return self.data[1] @volume.setter - def volume(self, u: float): + def volume(self, u: float) -> None: self.data[1] = u @@ -3388,7 +3422,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[0][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[0][0] = n @property @@ -3402,7 +3436,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[0][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[0][1] = n @property @@ -3416,7 +3450,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[0][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[0][2] = n @property @@ -3431,7 +3465,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -3445,7 +3479,7 @@ def hora_final(self) -> Optional[int]: return self.data[1][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[1][1] = n @property @@ -3459,7 +3493,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[1][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[1][2] = n @property @@ -3474,7 +3508,7 @@ def cota_inicial(self) -> Optional[float]: return self.data[2] @cota_inicial.setter - def cota_inicial(self, n: float): + def cota_inicial(self, n: float) -> None: self.data[2] = n @property @@ -3489,7 +3523,7 @@ def variacao_maxima_horaria(self) -> Optional[float]: return self.data[3] @variacao_maxima_horaria.setter - def variacao_maxima_horaria(self, n: float): + def variacao_maxima_horaria(self, n: float) -> None: self.data[3] = n @property @@ -3504,7 +3538,7 @@ def variacao_maxima_diaria(self) -> Optional[float]: return self.data[4] @variacao_maxima_diaria.setter - def variacao_maxima_diaria(self, n: float): + def variacao_maxima_diaria(self, n: float) -> None: self.data[4] = n @@ -3544,7 +3578,7 @@ def codigo_secao(self) -> Optional[int]: return self.data[0] @codigo_secao.setter - def codigo_secao(self, n: int): + def codigo_secao(self, n: int) -> None: self.data[0] = n @property @@ -3559,7 +3593,7 @@ def nome_secao(self) -> Optional[str]: return self.data[1] @nome_secao.setter - def nome_secao(self, n: str): + def nome_secao(self, n: str) -> None: self.data[1] = n @property @@ -3574,7 +3608,7 @@ def grau(self) -> Optional[int]: return self.data[2] @grau.setter - def grau(self, n: int): + def grau(self, n: int) -> None: self.data[2] = n @property @@ -3589,7 +3623,7 @@ def coeficiente_a0(self) -> Optional[float]: return self.data[3] @coeficiente_a0.setter - def coeficiente_a0(self, c: float): + def coeficiente_a0(self, c: float) -> None: self.data[3] = c @property @@ -3604,7 +3638,7 @@ def coeficiente_a1(self) -> Optional[float]: return self.data[4] @coeficiente_a1.setter - def coeficiente_a1(self, c: float): + def coeficiente_a1(self, c: float) -> None: self.data[4] = c @property @@ -3619,7 +3653,7 @@ def coeficiente_a2(self) -> Optional[float]: return self.data[5] @coeficiente_a2.setter - def coeficiente_a2(self, c: float): + def coeficiente_a2(self, c: float) -> None: self.data[5] = c @property @@ -3634,7 +3668,7 @@ def coeficiente_a3(self) -> Optional[float]: return self.data[6] @coeficiente_a3.setter - def coeficiente_a3(self, c: float): + def coeficiente_a3(self, c: float) -> None: self.data[6] = c @property @@ -3649,7 +3683,7 @@ def coeficiente_a4(self) -> Optional[float]: return self.data[7] @coeficiente_a4.setter - def coeficiente_a4(self, c: float): + def coeficiente_a4(self, c: float) -> None: self.data[7] = c @property @@ -3664,7 +3698,7 @@ def coeficiente_a5(self) -> Optional[float]: return self.data[8] @coeficiente_a5.setter - def coeficiente_a5(self, c: float): + def coeficiente_a5(self, c: float) -> None: self.data[8] = c @property @@ -3679,7 +3713,7 @@ def coeficiente_a6(self) -> Optional[float]: return self.data[9] @coeficiente_a6.setter - def coeficiente_a6(self, c: float): + def coeficiente_a6(self, c: float) -> None: self.data[9] = c @@ -3719,7 +3753,7 @@ def codigo_secao(self) -> Optional[int]: return self.data[0] @codigo_secao.setter - def codigo_secao(self, n: int): + def codigo_secao(self, n: int) -> None: self.data[0] = n @property @@ -3734,7 +3768,7 @@ def nome_secao(self) -> Optional[str]: return self.data[1] @nome_secao.setter - def nome_secao(self, n: str): + def nome_secao(self, n: str) -> None: self.data[1] = n @property @@ -3748,7 +3782,7 @@ def codigo_usina_montante_1(self) -> Optional[int]: return self.data[2] @codigo_usina_montante_1.setter - def codigo_usina_montante_1(self, n: int): + def codigo_usina_montante_1(self, n: int) -> None: self.data[2] = n @property @@ -3762,7 +3796,7 @@ def fator_participacao_1(self) -> Optional[float]: return self.data[3] @fator_participacao_1.setter - def fator_participacao_1(self, n: float): + def fator_participacao_1(self, n: float) -> None: self.data[3] = n @property @@ -3776,7 +3810,7 @@ def codigo_usina_montante_2(self) -> Optional[int]: return self.data[4] @codigo_usina_montante_2.setter - def codigo_usina_montante_2(self, n: int): + def codigo_usina_montante_2(self, n: int) -> None: self.data[4] = n @property @@ -3790,7 +3824,7 @@ def fator_participacao_2(self) -> Optional[float]: return self.data[5] @fator_participacao_2.setter - def fator_participacao_2(self, n: float): + def fator_participacao_2(self, n: float) -> None: self.data[5] = n @property @@ -3804,7 +3838,7 @@ def codigo_usina_montante_3(self) -> Optional[int]: return self.data[6] @codigo_usina_montante_3.setter - def codigo_usina_montante_3(self, n: int): + def codigo_usina_montante_3(self, n: int) -> None: self.data[6] = n @property @@ -3818,7 +3852,7 @@ def fator_participacao_3(self) -> Optional[float]: return self.data[7] @fator_participacao_3.setter - def fator_participacao_3(self, n: float): + def fator_participacao_3(self, n: float) -> None: self.data[7] = n @property @@ -3832,7 +3866,7 @@ def codigo_usina_montante_4(self) -> Optional[int]: return self.data[8] @codigo_usina_montante_4.setter - def codigo_usina_montante_4(self, n: int): + def codigo_usina_montante_4(self, n: int) -> None: self.data[8] = n @property @@ -3846,7 +3880,7 @@ def fator_participacao_4(self) -> Optional[float]: return self.data[9] @fator_participacao_4.setter - def fator_participacao_4(self, n: float): + def fator_participacao_4(self, n: float) -> None: self.data[9] = n @property @@ -3860,7 +3894,7 @@ def codigo_usina_montante_5(self) -> Optional[int]: return self.data[10] @codigo_usina_montante_5.setter - def codigo_usina_montante_5(self, n: int): + def codigo_usina_montante_5(self, n: int) -> None: self.data[10] = n @property @@ -3874,7 +3908,7 @@ def fator_participacao_5(self) -> Optional[float]: return self.data[11] @fator_participacao_5.setter - def fator_participacao_5(self, n: float): + def fator_participacao_5(self, n: float) -> None: self.data[11] = n @@ -3905,7 +3939,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -3920,7 +3954,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -3934,7 +3968,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -3948,7 +3982,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -3963,7 +3997,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -3977,7 +4011,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -3991,7 +4025,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4005,7 +4039,7 @@ def taxa(self) -> Optional[float]: return self.data[3] @taxa.setter - def taxa(self, c: float): + def taxa(self, c: float) -> None: self.data[3] = c @@ -4035,7 +4069,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4050,7 +4084,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4064,7 +4098,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4078,7 +4112,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4093,7 +4127,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4107,7 +4141,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4121,7 +4155,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @@ -4154,7 +4188,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4169,7 +4203,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4183,7 +4217,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4197,7 +4231,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4212,7 +4246,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4226,7 +4260,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4240,7 +4274,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4254,7 +4288,7 @@ def limite_inferior(self) -> Optional[float]: return self.data[3] @limite_inferior.setter - def limite_inferior(self, lim: float): + def limite_inferior(self, lim: float) -> None: self.data[3] = lim @property @@ -4268,7 +4302,7 @@ def limite_superior(self) -> Optional[float]: return self.data[4] @limite_superior.setter - def limite_superior(self, lim: float): + def limite_superior(self, lim: float) -> None: self.data[4] = lim @@ -4302,7 +4336,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4317,7 +4351,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4331,7 +4365,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4345,7 +4379,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4360,7 +4394,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4374,7 +4408,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4388,7 +4422,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4402,7 +4436,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[3] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[3] = c @property @@ -4416,7 +4450,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[4] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[4] = c @property @@ -4430,7 +4464,7 @@ def coeficiente(self) -> Optional[float]: return self.data[5] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[5] = f @@ -4463,7 +4497,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4478,7 +4512,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4492,7 +4526,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4506,7 +4540,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4521,7 +4555,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4535,7 +4569,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4549,7 +4583,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4563,7 +4597,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[3] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[3] = c @property @@ -4577,7 +4611,7 @@ def coeficiente(self) -> Optional[float]: return self.data[4] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[4] = f @@ -4611,7 +4645,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4626,7 +4660,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4640,7 +4674,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4654,7 +4688,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4669,7 +4703,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4683,7 +4717,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4697,7 +4731,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4711,7 +4745,7 @@ def nome_submercado_de(self) -> Optional[str]: return self.data[3] @nome_submercado_de.setter - def nome_submercado_de(self, s: str): + def nome_submercado_de(self, s: str) -> None: self.data[3] = s @property @@ -4725,7 +4759,7 @@ def nome_submercado_para(self) -> Optional[str]: return self.data[4] @nome_submercado_para.setter - def nome_submercado_para(self, s: str): + def nome_submercado_para(self, s: str) -> None: self.data[4] = s @property @@ -4739,7 +4773,7 @@ def coeficiente(self) -> Optional[float]: return self.data[5] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[5] = f @@ -4773,7 +4807,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4788,7 +4822,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4802,7 +4836,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4816,7 +4850,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4831,7 +4865,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4845,7 +4879,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -4859,7 +4893,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -4873,7 +4907,7 @@ def codigo_contrato(self) -> Optional[int]: return self.data[3] @codigo_contrato.setter - def codigo_contrato(self, c: int): + def codigo_contrato(self, c: int) -> None: self.data[3] = c @property @@ -4887,7 +4921,7 @@ def coeficiente(self) -> Optional[float]: return self.data[4] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[4] = f @@ -4920,7 +4954,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -4935,7 +4969,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -4949,7 +4983,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -4963,7 +4997,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -4978,7 +5012,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -4992,7 +5026,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -5006,7 +5040,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -5020,7 +5054,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[3] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[3] = c @property @@ -5034,7 +5068,7 @@ def coeficiente(self) -> Optional[float]: return self.data[4] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[4] = f @@ -5067,7 +5101,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -5082,7 +5116,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -5096,7 +5130,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -5110,7 +5144,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -5125,7 +5159,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -5139,7 +5173,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -5153,7 +5187,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -5167,7 +5201,7 @@ def codigo_demanda_especial(self) -> Optional[int]: return self.data[3] @codigo_demanda_especial.setter - def codigo_demanda_especial(self, c: int): + def codigo_demanda_especial(self, c: int) -> None: self.data[3] = c @property @@ -5182,7 +5216,7 @@ def coeficiente(self) -> Optional[float]: return self.data[4] @coeficiente.setter - def coeficiente(self, f: float): + def coeficiente(self, f: float) -> None: self.data[4] = f @@ -5269,7 +5303,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -5283,7 +5317,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -5297,7 +5331,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -5312,7 +5346,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[3][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[3][0] = n @property @@ -5326,7 +5360,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[3][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[3][1] = n @property @@ -5340,7 +5374,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[3][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[3][2] = n @property @@ -5355,7 +5389,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[4][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[4][0] = n @property @@ -5369,7 +5403,7 @@ def hora_final(self) -> Optional[int]: return self.data[4][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[4][1] = n @property @@ -5383,7 +5417,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[4][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[4][2] = n @property @@ -5398,7 +5432,7 @@ def disponivel(self) -> Optional[int]: return self.data[5] @disponivel.setter - def disponivel(self, n: int): + def disponivel(self, n: int) -> None: self.data[5] = n @@ -5424,7 +5458,7 @@ def penalidade_vertimento(self) -> Optional[float]: return self.data[0] @penalidade_vertimento.setter - def penalidade_vertimento(self, n: float): + def penalidade_vertimento(self, n: float) -> None: self.data[0] = n @property @@ -5440,5 +5474,5 @@ def fator_penalidade_violacao(self) -> Optional[float]: return self.data[1] @fator_penalidade_violacao.setter - def fator_penalidade_violacao(self, n: float): + def fator_penalidade_violacao(self, n: float) -> None: self.data[1] = n diff --git a/idessem/dessem/modelos/hidr.py b/idessem/dessem/modelos/hidr.py index cc76c370..5443bec6 100644 --- a/idessem/dessem/modelos/hidr.py +++ b/idessem/dessem/modelos/hidr.py @@ -144,7 +144,7 @@ def nome(self) -> str: return self.data[0] @nome.setter - def nome(self, v: str): + def nome(self, v: str) -> None: self.data[0] = v @property @@ -152,7 +152,7 @@ def posto(self) -> int: return self.data[1] @posto.setter - def posto(self, v: int): + def posto(self, v: int) -> None: self.data[1] = v @property @@ -160,7 +160,7 @@ def subsistema(self) -> int: return self.data[3] @subsistema.setter - def subsistema(self, v: int): + def subsistema(self, v: int) -> None: self.data[3] = v @property @@ -168,7 +168,7 @@ def empresa(self) -> int: return self.data[4] @empresa.setter - def empresa(self, v: int): + def empresa(self, v: int) -> None: self.data[4] = v @property @@ -176,7 +176,7 @@ def jusante(self) -> int: return self.data[5] @jusante.setter - def jusante(self, v: int): + def jusante(self, v: int) -> None: self.data[5] = v @property @@ -184,7 +184,7 @@ def desvio(self) -> int: return self.data[6] @desvio.setter - def desvio(self, v: int): + def desvio(self, v: int) -> None: self.data[6] = v @property @@ -192,7 +192,7 @@ def volume_minimo(self) -> float: return self.data[7] @volume_minimo.setter - def volume_minimo(self, v: float): + def volume_minimo(self, v: float) -> None: self.data[7] = v @property @@ -200,7 +200,7 @@ def volume_maximo(self) -> float: return self.data[8] @volume_maximo.setter - def volume_maximo(self, v: float): + def volume_maximo(self, v: float) -> None: self.data[8] = v @property @@ -208,7 +208,7 @@ def volume_vertedouro(self) -> float: return self.data[9] @volume_vertedouro.setter - def volume_vertedouro(self, v: float): + def volume_vertedouro(self, v: float) -> None: self.data[9] = v @property @@ -216,7 +216,7 @@ def volume_desvio(self) -> float: return self.data[10] @volume_desvio.setter - def volume_desvio(self, v: float): + def volume_desvio(self, v: float) -> None: self.data[10] = v @property @@ -224,7 +224,7 @@ def cota_minima(self) -> float: return self.data[11] @cota_minima.setter - def cota_minima(self, v: float): + def cota_minima(self, v: float) -> None: self.data[11] = v @property @@ -232,7 +232,7 @@ def cota_maxima(self) -> float: return self.data[12] @cota_maxima.setter - def cota_maxima(self, v: float): + def cota_maxima(self, v: float) -> None: self.data[12] = v @property @@ -240,7 +240,7 @@ def polinomio_volume_cota(self) -> List[float]: return self.data[13:18] @polinomio_volume_cota.setter - def polinomio_volume_cota(self, v: List[float]): + def polinomio_volume_cota(self, v: List[float]) -> None: self.data[13:18] = v @property @@ -248,7 +248,7 @@ def polinomio_cota_area(self) -> List[float]: return self.data[18:23] @polinomio_cota_area.setter - def polinomio_cota_area(self, v: List[float]): + def polinomio_cota_area(self, v: List[float]) -> None: self.data[18:23] = v @property @@ -256,7 +256,7 @@ def evaporacao(self) -> List[float]: return self.data[23:35] @evaporacao.setter - def evaporacao(self, v: List[float]): + def evaporacao(self, v: List[float]) -> None: self.data[23:35] = v @property @@ -264,7 +264,7 @@ def numero_conjuntos_maquinas(self) -> int: return self.data[35] @numero_conjuntos_maquinas.setter - def numero_conjuntos_maquinas(self, v: int): + def numero_conjuntos_maquinas(self, v: int) -> None: self.data[35] = v @property @@ -272,7 +272,7 @@ def numero_maquinas_conjunto(self) -> List[int]: return self.data[36:41] @numero_maquinas_conjunto.setter - def numero_maquinas_conjunto(self, v: List[int]): + def numero_maquinas_conjunto(self, v: List[int]) -> None: self.data[36:41] = v @property @@ -280,7 +280,7 @@ def potef_conjunto(self) -> List[float]: return self.data[41:46] @potef_conjunto.setter - def potef_conjunto(self, v: List[float]): + def potef_conjunto(self, v: List[float]) -> None: self.data[41:46] = v @property @@ -288,7 +288,7 @@ def hef_conjunto(self) -> List[float]: return self.data[47:52] @hef_conjunto.setter - def hef_conjunto(self, v: List[float]): + def hef_conjunto(self, v: List[float]) -> None: self.data[47:52] = v @property @@ -296,7 +296,7 @@ def qef_conjunto(self) -> List[float]: return self.data[52:57] @qef_conjunto.setter - def qef_conjunto(self, v: List[float]): + def qef_conjunto(self, v: List[float]) -> None: self.data[52:57] = v @property @@ -304,7 +304,7 @@ def produtibilidade_especifica(self) -> float: return self.data[57] @produtibilidade_especifica.setter - def produtibilidade_especifica(self, v: float): + def produtibilidade_especifica(self, v: float) -> None: self.data[57] = v @property @@ -312,7 +312,7 @@ def perdas(self) -> float: return self.data[58] @perdas.setter - def perdas(self, v: float): + def perdas(self, v: float) -> None: self.data[58] = v @property @@ -320,7 +320,7 @@ def numero_polinomios_jusante(self) -> int: return self.data[59] @numero_polinomios_jusante.setter - def numero_polinomios_jusante(self, v: int): + def numero_polinomios_jusante(self, v: int) -> None: self.data[59] = v @property @@ -328,7 +328,7 @@ def polinomios_jusante(self) -> List[float]: return self.data[60:96] @polinomios_jusante.setter - def polinomios_jusante(self, v: List[float]): + def polinomios_jusante(self, v: List[float]) -> None: self.data[60:96] = v @property @@ -336,7 +336,7 @@ def canal_fuga_medio(self) -> float: return self.data[96] @canal_fuga_medio.setter - def canal_fuga_medio(self, v: float): + def canal_fuga_medio(self, v: float) -> None: self.data[96] = v @property @@ -344,7 +344,7 @@ def influencia_vertimento_canal_fuga(self) -> int: return self.data[97] @influencia_vertimento_canal_fuga.setter - def influencia_vertimento_canal_fuga(self, v: int): + def influencia_vertimento_canal_fuga(self, v: int) -> None: self.data[97] = v @property @@ -352,7 +352,7 @@ def fator_carga_maximo(self) -> float: return self.data[98] @fator_carga_maximo.setter - def fator_carga_maximo(self, v: float): + def fator_carga_maximo(self, v: float) -> None: self.data[98] = v @property @@ -360,7 +360,7 @@ def fator_carga_minimo(self) -> float: return self.data[99] @fator_carga_minimo.setter - def fator_carga_minimo(self, v: float): + def fator_carga_minimo(self, v: float) -> None: self.data[99] = v @property @@ -368,7 +368,7 @@ def vazao_minima_historica(self) -> int: return self.data[100] @vazao_minima_historica.setter - def vazao_minima_historica(self, v: int): + def vazao_minima_historica(self, v: int) -> None: self.data[100] = v @property @@ -376,7 +376,7 @@ def numero_unidades_base(self) -> int: return self.data[101] @numero_unidades_base.setter - def numero_unidades_base(self, v: int): + def numero_unidades_base(self, v: int) -> None: self.data[101] = v @property @@ -384,7 +384,7 @@ def tipo_turbina(self) -> int: return self.data[102] @tipo_turbina.setter - def tipo_turbina(self, v: int): + def tipo_turbina(self, v: int) -> None: self.data[102] = v @property @@ -392,7 +392,7 @@ def representacao_conjunto(self) -> int: return self.data[103] @representacao_conjunto.setter - def representacao_conjunto(self, v: int): + def representacao_conjunto(self, v: int) -> None: self.data[103] = v @property @@ -400,7 +400,7 @@ def teif(self) -> float: return self.data[104] @teif.setter - def teif(self, v: float): + def teif(self, v: float) -> None: self.data[104] = v @property @@ -408,7 +408,7 @@ def ip(self) -> float: return self.data[105] @ip.setter - def ip(self, v: float): + def ip(self, v: float) -> None: self.data[105] = v @property @@ -416,7 +416,7 @@ def tipo_perda(self) -> int: return self.data[106] @tipo_perda.setter - def tipo_perda(self, v: int): + def tipo_perda(self, v: int) -> None: self.data[106] = v @property @@ -424,7 +424,7 @@ def data_referencia(self) -> str: return self.data[107] @data_referencia.setter - def data_referencia(self, v: str): + def data_referencia(self, v: str) -> None: self.data[107] = v @property @@ -432,7 +432,7 @@ def observacao(self) -> str: return self.data[108] @observacao.setter - def observacao(self, v: str): + def observacao(self, v: str) -> None: self.data[108] = v @property @@ -440,7 +440,7 @@ def volume_referencia(self) -> float: return self.data[109] @volume_referencia.setter - def volume_referencia(self, v: float): + def volume_referencia(self, v: float) -> None: self.data[109] = v @property @@ -448,5 +448,5 @@ def tipo_regulacao(self) -> str: return self.data[110] @tipo_regulacao.setter - def tipo_regulacao(self, v: str): + def tipo_regulacao(self, v: str) -> None: self.data[110] = v diff --git a/idessem/dessem/modelos/operuh.py b/idessem/dessem/modelos/operuh.py index 8d2e0a8c..10ec9a9f 100644 --- a/idessem/dessem/modelos/operuh.py +++ b/idessem/dessem/modelos/operuh.py @@ -39,7 +39,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -53,7 +53,7 @@ def tipo_restricao(self) -> Optional[str]: return self.data[1] @tipo_restricao.setter - def tipo_restricao(self, c: str): + def tipo_restricao(self, c: str) -> None: self.data[1] = c @property @@ -67,7 +67,7 @@ def intervalo_aplicacao(self) -> Optional[str]: return self.data[2] @intervalo_aplicacao.setter - def intervalo_aplicacao(self, c: str): + def intervalo_aplicacao(self, c: str) -> None: self.data[2] = c @property @@ -81,7 +81,7 @@ def justificativa(self) -> Optional[str]: return self.data[3] @justificativa.setter - def justificativa(self, c: str): + def justificativa(self, c: str) -> None: self.data[3] = c @property @@ -96,7 +96,7 @@ def valor_inicial(self) -> Optional[float]: return self.data[4] @valor_inicial.setter - def valor_inicial(self, c: float): + def valor_inicial(self, c: float) -> None: self.data[4] = c @property @@ -110,7 +110,7 @@ def tipo_restricao_variacao(self) -> Optional[int]: return self.data[5] @tipo_restricao_variacao.setter - def tipo_restricao_variacao(self, c: int): + def tipo_restricao_variacao(self, c: int) -> None: self.data[5] = c @property @@ -124,7 +124,7 @@ def duracao_janela(self) -> Optional[float]: return self.data[6] @duracao_janela.setter - def duracao_janela(self, c: float): + def duracao_janela(self, c: float) -> None: self.data[6] = c @@ -157,7 +157,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -171,7 +171,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[1] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[1] = c @property @@ -185,7 +185,7 @@ def nome_usina(self) -> Optional[str]: return self.data[2] @nome_usina.setter - def nome_usina(self, c: str): + def nome_usina(self, c: str) -> None: self.data[2] = c @property @@ -199,7 +199,7 @@ def tipo(self) -> Optional[int]: return self.data[3] @tipo.setter - def tipo(self, c: int): + def tipo(self, c: int) -> None: self.data[3] = c @property @@ -213,7 +213,7 @@ def coeficiente(self) -> Optional[float]: return self.data[4] @coeficiente.setter - def coeficiente(self, c: float): + def coeficiente(self, c: float) -> None: self.data[4] = c @@ -246,7 +246,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -261,7 +261,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -275,7 +275,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -289,7 +289,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -304,7 +304,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -318,7 +318,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -332,7 +332,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -346,7 +346,7 @@ def limite_inferior(self) -> Optional[float]: return self.data[3] @limite_inferior.setter - def limite_inferior(self, lim: float): + def limite_inferior(self, lim: float) -> None: self.data[3] = lim @property @@ -360,7 +360,7 @@ def limite_superior(self) -> Optional[float]: return self.data[4] @limite_superior.setter - def limite_superior(self, lim: float): + def limite_superior(self, lim: float) -> None: self.data[4] = lim @@ -396,7 +396,7 @@ def codigo_restricao(self) -> Optional[int]: return self.data[0] @codigo_restricao.setter - def codigo_restricao(self, c: int): + def codigo_restricao(self, c: int) -> None: self.data[0] = c @property @@ -411,7 +411,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -425,7 +425,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -439,7 +439,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -454,7 +454,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -468,7 +468,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -482,7 +482,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -497,7 +497,7 @@ def rampa_maxima_decrescimo_percentual(self) -> Optional[float]: return self.data[3] @rampa_maxima_decrescimo_percentual.setter - def rampa_maxima_decrescimo_percentual(self, lim: float): + def rampa_maxima_decrescimo_percentual(self, lim: float) -> None: self.data[3] = lim @property @@ -512,7 +512,7 @@ def rampa_maxima_acrescimo_percentual(self) -> Optional[float]: return self.data[4] @rampa_maxima_acrescimo_percentual.setter - def rampa_maxima_acrescimo_percentual(self, lim: float): + def rampa_maxima_acrescimo_percentual(self, lim: float) -> None: self.data[4] = lim @property @@ -527,7 +527,7 @@ def rampa_maxima_decrescimo_absoluta(self) -> Optional[float]: return self.data[5] @rampa_maxima_decrescimo_absoluta.setter - def rampa_maxima_decrescimo_absoluta(self, lim: float): + def rampa_maxima_decrescimo_absoluta(self, lim: float) -> None: self.data[5] = lim @property @@ -542,5 +542,5 @@ def rampa_maxima_acrescimo_absoluta(self) -> Optional[float]: return self.data[6] @rampa_maxima_acrescimo_absoluta.setter - def rampa_maxima_acrescimo_absoluta(self, lim: float): + def rampa_maxima_acrescimo_absoluta(self, lim: float) -> None: self.data[6] = lim diff --git a/idessem/dessem/modelos/operut.py b/idessem/dessem/modelos/operut.py index 4e8e4724..433945b8 100644 --- a/idessem/dessem/modelos/operut.py +++ b/idessem/dessem/modelos/operut.py @@ -1,7 +1,7 @@ -from typing import IO, Dict, List +from typing import Any, IO, Dict, List -import numpy as np # type: ignore -import pandas as pd # type: ignore +import numpy as np +import pandas as pd # type: ignore[import-untyped] from cfinterface.components.block import Block from cfinterface.components.floatfield import FloatField from cfinterface.components.integerfield import IntegerField @@ -20,7 +20,9 @@ class BlocoInitUT(Block): BEGIN_PATTERN = r"^INIT" END_PATTERN = r"FIM" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -70,7 +72,7 @@ def __eq__(self, o: object) -> bool: ) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: cols = [ "codigo_usina", @@ -110,7 +112,7 @@ def converte_tabela_em_df() -> pd.DataFrame: linha = file.readline() # Confere se terminou o bloco if BlocoInitUT.END_PATTERN in linha[:4]: - tabela = tabela[:indice_linha, :] # type: ignore + tabela = tabela[:indice_linha, :] df = converte_tabela_em_df() self.data = [comentarios, df] break @@ -127,7 +129,7 @@ def converte_tabela_em_df() -> pd.DataFrame: indice_linha += 1 # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] if not isinstance(self.data, list): raise ValueError("Dados do operut.dat não foram lidos com sucesso") @@ -152,7 +154,9 @@ class BlocoOper(Block): BEGIN_PATTERN = r"^OPER" END_PATTERN = r"FIM" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -220,7 +224,7 @@ def __eq__(self, o: object) -> bool: ) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: cols = [ "codigo_usina", @@ -260,7 +264,7 @@ def converte_tabela_em_df() -> pd.DataFrame: linha = file.readline() # Confere se terminou o bloco if BlocoOper.END_PATTERN in linha[:4]: - tabela = tabela[:indice_linha, :] # type: ignore + tabela = tabela[:indice_linha, :] df = converte_tabela_em_df() self.data = [comentarios, df] break @@ -277,7 +281,7 @@ def converte_tabela_em_df() -> pd.DataFrame: indice_linha += 1 # Override - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] if not isinstance(self.data, list): raise ValueError("Dados do operut.dat não foram lidos com sucesso") @@ -308,7 +312,9 @@ class BlocoUctPar(Block): BEGIN_PATTERN = r"^UCTPAR" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -331,10 +337,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTPAR", self.data])) @@ -348,7 +354,9 @@ class BlocoUcTerm(Block): BEGIN_PATTERN = r"^UCTERM" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -371,10 +379,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTERM", self.data])) @@ -387,17 +395,19 @@ class BlocoPint(Block): BEGIN_PATTERN = r"^PINT" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(4, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoPint) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["PINT"])) @@ -410,7 +420,9 @@ class BlocoRegraNPTV(Block): BEGIN_PATTERN = r"^REGRANPTV" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -434,10 +446,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["REGRANPTV"] + self.data)) @@ -450,7 +462,9 @@ class BlocoAvlCmo(Block): BEGIN_PATTERN = r"^AVLCMO" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -473,10 +487,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["AVLCMO", self.data])) @@ -489,17 +503,19 @@ class BlocoCplexLog(Block): BEGIN_PATTERN = r"^CPLEXLOG" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(8, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoCplexLog) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CPLEXLOG"])) @@ -512,17 +528,19 @@ class BlocoUctBusLoc(Block): BEGIN_PATTERN = r"^UCTBUSLOC" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line([LiteralField(9, 0)]) def __eq__(self, o: object) -> bool: return isinstance(o, BlocoUctBusLoc) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[0] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTBUSLOC"])) @@ -535,7 +553,9 @@ class BlocoUctHeurFp(Block): BEGIN_PATTERN = r"^UCTHEURFP" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -559,10 +579,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["UCTHEURFP"] + self.data)) @@ -575,7 +595,9 @@ class BlocoConstDados(Block): BEGIN_PATTERN = r"^CONSTDADOS" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -598,10 +620,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CONSTDADOS"] + self.data)) @@ -614,7 +636,9 @@ class BlocoAjusteFcf(Block): BEGIN_PATTERN = r"^AJUSTEFCF" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -638,10 +662,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["AJUSTEFCF"] + self.data)) @@ -654,7 +678,9 @@ class BlocoTolerIlh(Block): BEGIN_PATTERN = r"^TOLERILH" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -677,10 +703,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["TOLERILH", self.data])) @@ -693,7 +719,9 @@ class BlocoCrossover(Block): BEGIN_PATTERN = r"^CROSSOVER" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -719,10 +747,10 @@ def __eq__(self, o: object) -> bool: else: return all([x == y for x, y in zip(self.data, o.data)]) - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1:] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["CROSSOVER"] + self.data)) @@ -735,7 +763,9 @@ class BlocoEngolimento(Block): BEGIN_PATTERN = r"^ENGOLIMENTO" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -758,10 +788,10 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["ENGOLIMENTO", self.data])) @@ -775,7 +805,9 @@ class BlocoTrataInviabIlha(Block): BEGIN_PATTERN = r"^TRATA_INVIAB_ILHA" END_PATTERN = "" - def __init__(self, previous=None, next=None, data=None) -> None: + def __init__( + self, previous: Any = None, next: Any = None, data: Any = None + ) -> None: super().__init__(previous, next, data) self.__linha = Line( [ @@ -798,8 +830,8 @@ def __eq__(self, o: object) -> bool: else: return self.data == bloco.data - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] self.data = self.__linha.read(file.readline())[1] - def write(self, file: IO, *args, **kwargs): + def write(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] file.write(self.__linha.write(["TRATA_INVIAB_ILHA", self.data])) diff --git a/idessem/dessem/modelos/pdo_operacao.py b/idessem/dessem/modelos/pdo_operacao.py index 9f3c2448..ea5199c1 100644 --- a/idessem/dessem/modelos/pdo_operacao.py +++ b/idessem/dessem/modelos/pdo_operacao.py @@ -1,5 +1,5 @@ from cfinterface.components.block import Block -from typing import IO +from typing import Any, IO import pandas as pd # type: ignore from datetime import datetime from cfinterface.components.floatfield import FloatField @@ -30,7 +30,7 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: df = pd.DataFrame( data={ @@ -99,7 +99,7 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: df = pd.DataFrame( data={ @@ -162,7 +162,7 @@ def __eq__(self, o: object) -> bool: return self.data.equals(bloco.data) # Override - def read(self, file: IO, *args, **kwargs): + def read(self, file: IO[Any], *args: Any, **kwargs: Any) -> None: # type: ignore[override] def converte_tabela_em_df() -> pd.DataFrame: df = pd.DataFrame( data={ diff --git a/idessem/dessem/modelos/renovaveis.py b/idessem/dessem/modelos/renovaveis.py index 9d51d4a9..2e75ea99 100644 --- a/idessem/dessem/modelos/renovaveis.py +++ b/idessem/dessem/modelos/renovaveis.py @@ -38,7 +38,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -52,7 +52,7 @@ def nome_usina(self) -> Optional[str]: return self.data[1] @nome_usina.setter - def nome_usina(self, n: str): + def nome_usina(self, n: str) -> None: self.data[1] = n @property @@ -66,7 +66,7 @@ def potencia_maxima(self) -> Optional[float]: return self.data[2] @potencia_maxima.setter - def potencia_maxima(self, p: float): + def potencia_maxima(self, p: float) -> None: self.data[2] = p @property @@ -80,7 +80,7 @@ def fator_capacidade(self) -> Optional[float]: return self.data[3] @fator_capacidade.setter - def fator_capacidade(self, p: float): + def fator_capacidade(self, p: float) -> None: self.data[3] = p @property @@ -95,7 +95,7 @@ def constrained_off(self) -> Optional[int]: return self.data[4] @constrained_off.setter - def constrained_off(self, p: int): + def constrained_off(self, p: int) -> None: self.data[4] = p @@ -127,7 +127,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -142,7 +142,7 @@ def codigo_barra(self) -> Optional[int]: return self.data[1] @codigo_barra.setter - def codigo_barra(self, n: int): + def codigo_barra(self, n: int) -> None: self.data[1] = n @@ -173,7 +173,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -187,7 +187,7 @@ def submercado(self) -> Optional[str]: return self.data[1] @submercado.setter - def submercado(self, n: str): + def submercado(self, n: str) -> None: self.data[1] = n @@ -225,7 +225,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, cod: int): + def codigo_usina(self, cod: int) -> None: self.data[0] = cod @property @@ -239,7 +239,7 @@ def dia_inicio(self) -> Optional[int]: return self.data[1] @dia_inicio.setter - def dia_inicio(self, n: int): + def dia_inicio(self, n: int) -> None: self.data[1] = n @property @@ -253,7 +253,7 @@ def hora_inicio(self) -> Optional[int]: return self.data[2] @hora_inicio.setter - def hora_inicio(self, n: int): + def hora_inicio(self, n: int) -> None: self.data[2] = n @property @@ -268,7 +268,7 @@ def meia_hora_inicio(self) -> Optional[int]: return self.data[3] @meia_hora_inicio.setter - def meia_hora_inicio(self, n: int): + def meia_hora_inicio(self, n: int) -> None: self.data[3] = n @property @@ -282,7 +282,7 @@ def dia_fim(self) -> Optional[int]: return self.data[4] @dia_fim.setter - def dia_fim(self, n: int): + def dia_fim(self, n: int) -> None: self.data[4] = n @property @@ -296,7 +296,7 @@ def hora_fim(self) -> Optional[int]: return self.data[5] @hora_fim.setter - def hora_fim(self, n: int): + def hora_fim(self, n: int) -> None: self.data[5] = n @property @@ -311,7 +311,7 @@ def meia_hora_fim(self) -> Optional[int]: return self.data[6] @meia_hora_fim.setter - def meia_hora_fim(self, n: int): + def meia_hora_fim(self, n: int) -> None: self.data[6] = n @property @@ -326,5 +326,5 @@ def geracao(self) -> Optional[float]: return self.data[7] @geracao.setter - def geracao(self, n: float): + def geracao(self, n: float) -> None: self.data[7] = n diff --git a/idessem/dessem/modelos/respot.py b/idessem/dessem/modelos/respot.py index ff17947f..a5f62603 100644 --- a/idessem/dessem/modelos/respot.py +++ b/idessem/dessem/modelos/respot.py @@ -35,7 +35,7 @@ def codigo_area(self) -> Optional[int]: return self.data[0] @codigo_area.setter - def codigo_area(self, u: int): + def codigo_area(self, u: int) -> None: self.data[0] = u @property @@ -50,7 +50,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -64,7 +64,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -78,7 +78,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -93,7 +93,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -107,7 +107,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -121,7 +121,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -135,7 +135,7 @@ def descricao(self) -> Optional[str]: return self.data[3] @descricao.setter - def descricao(self, cod: str): + def descricao(self, cod: str) -> None: self.data[3] = cod @@ -166,7 +166,7 @@ def codigo_area(self) -> Optional[int]: return self.data[0] @codigo_area.setter - def codigo_area(self, u: int): + def codigo_area(self, u: int) -> None: self.data[0] = u @property @@ -181,7 +181,7 @@ def dia_inicial(self) -> Optional[Union[str, int]]: return self.data[1][0] @dia_inicial.setter - def dia_inicial(self, n: Union[str, int]): + def dia_inicial(self, n: Union[str, int]) -> None: self.data[1][0] = n @property @@ -195,7 +195,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1][1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1][1] = n @property @@ -209,7 +209,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[1][2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[1][2] = n @property @@ -224,7 +224,7 @@ def dia_final(self) -> Optional[Union[str, int]]: return self.data[2][0] @dia_final.setter - def dia_final(self, n: Union[str, int]): + def dia_final(self, n: Union[str, int]) -> None: self.data[2][0] = n @property @@ -238,7 +238,7 @@ def hora_final(self) -> Optional[int]: return self.data[2][1] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[2][1] = n @property @@ -252,7 +252,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[2][2] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[2][2] = n @property @@ -266,5 +266,5 @@ def limite_inferior(self) -> Optional[float]: return self.data[3] @limite_inferior.setter - def limite_inferior(self, cod: float): + def limite_inferior(self, cod: float) -> None: self.data[3] = cod diff --git a/idessem/dessem/modelos/termdat.py b/idessem/dessem/modelos/termdat.py index c6f9c39f..62baf7f5 100644 --- a/idessem/dessem/modelos/termdat.py +++ b/idessem/dessem/modelos/termdat.py @@ -38,7 +38,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -52,7 +52,7 @@ def nome_usina(self) -> Optional[str]: return self.data[1] @nome_usina.setter - def nome_usina(self, c: str): + def nome_usina(self, c: str) -> None: self.data[1] = c @property @@ -66,7 +66,7 @@ def codigo_submercado(self) -> Optional[int]: return self.data[2] @codigo_submercado.setter - def codigo_submercado(self, c: int): + def codigo_submercado(self, c: int) -> None: self.data[2] = c @property @@ -80,7 +80,7 @@ def ano_operacao(self) -> Optional[int]: return self.data[3] @ano_operacao.setter - def ano_operacao(self, c: int): + def ano_operacao(self, c: int) -> None: self.data[3] = c @property @@ -94,7 +94,7 @@ def mes_operacao(self) -> Optional[int]: return self.data[4] @mes_operacao.setter - def mes_operacao(self, c: int): + def mes_operacao(self, c: int) -> None: self.data[4] = c @property @@ -108,7 +108,7 @@ def dia_operacao(self) -> Optional[int]: return self.data[5] @dia_operacao.setter - def dia_operacao(self, c: int): + def dia_operacao(self, c: int) -> None: self.data[5] = c @property @@ -122,7 +122,7 @@ def hora_operacao(self) -> Optional[int]: return self.data[6] @hora_operacao.setter - def hora_operacao(self, c: int): + def hora_operacao(self, c: int) -> None: self.data[6] = c @property @@ -136,7 +136,7 @@ def meia_hora_operacao(self) -> Optional[int]: return self.data[7] @meia_hora_operacao.setter - def meia_hora_operacao(self, c: int): + def meia_hora_operacao(self, c: int) -> None: self.data[7] = c @property @@ -150,7 +150,7 @@ def numero_unidades(self) -> Optional[int]: return self.data[8] @numero_unidades.setter - def numero_unidades(self, c: int): + def numero_unidades(self, c: int) -> None: self.data[8] = c @@ -197,7 +197,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -211,7 +211,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[1] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[1] = c @property @@ -225,7 +225,7 @@ def ano_operacao(self) -> Optional[int]: return self.data[2] @ano_operacao.setter - def ano_operacao(self, c: int): + def ano_operacao(self, c: int) -> None: self.data[2] = c @property @@ -239,7 +239,7 @@ def mes_operacao(self) -> Optional[int]: return self.data[3] @mes_operacao.setter - def mes_operacao(self, c: int): + def mes_operacao(self, c: int) -> None: self.data[3] = c @property @@ -253,7 +253,7 @@ def dia_operacao(self) -> Optional[int]: return self.data[4] @dia_operacao.setter - def dia_operacao(self, c: int): + def dia_operacao(self, c: int) -> None: self.data[4] = c @property @@ -267,7 +267,7 @@ def hora_operacao(self) -> Optional[int]: return self.data[5] @hora_operacao.setter - def hora_operacao(self, c: int): + def hora_operacao(self, c: int) -> None: self.data[5] = c @property @@ -281,7 +281,7 @@ def meia_hora_operacao(self) -> Optional[int]: return self.data[6] @meia_hora_operacao.setter - def meia_hora_operacao(self, c: int): + def meia_hora_operacao(self, c: int) -> None: self.data[6] = c @property @@ -295,7 +295,7 @@ def capacidade_geracao(self) -> Optional[float]: return self.data[7] @capacidade_geracao.setter - def capacidade_geracao(self, c: float): + def capacidade_geracao(self, c: float) -> None: self.data[7] = c @property @@ -309,7 +309,7 @@ def geracao_minima(self) -> Optional[float]: return self.data[8] @geracao_minima.setter - def geracao_minima(self, c: float): + def geracao_minima(self, c: float) -> None: self.data[8] = c @property @@ -323,7 +323,7 @@ def tempo_on(self) -> Optional[int]: return self.data[9] @tempo_on.setter - def tempo_on(self, c: int): + def tempo_on(self, c: int) -> None: self.data[9] = c @property @@ -337,7 +337,7 @@ def tempo_off(self) -> Optional[int]: return self.data[10] @tempo_off.setter - def tempo_off(self, c: int): + def tempo_off(self, c: int) -> None: self.data[10] = c @property @@ -351,7 +351,7 @@ def custo_acionamento_frio(self) -> Optional[float]: return self.data[11] @custo_acionamento_frio.setter - def custo_acionamento_frio(self, c: float): + def custo_acionamento_frio(self, c: float) -> None: self.data[11] = c @property @@ -365,7 +365,7 @@ def custo_acionamento_quente(self) -> Optional[float]: return self.data[12] @custo_acionamento_quente.setter - def custo_acionamento_quente(self, c: float): + def custo_acionamento_quente(self, c: float) -> None: self.data[12] = c @property @@ -379,7 +379,7 @@ def rampa_subida(self) -> Optional[float]: return self.data[13] @rampa_subida.setter - def rampa_subida(self, c: float): + def rampa_subida(self, c: float) -> None: self.data[13] = c @property @@ -393,7 +393,7 @@ def rampa_descida(self) -> Optional[float]: return self.data[14] @rampa_descida.setter - def rampa_descida(self, c: float): + def rampa_descida(self, c: float) -> None: self.data[14] = c @property @@ -408,7 +408,7 @@ def geracao_maxima_ou_minima(self) -> Optional[int]: return self.data[15] @geracao_maxima_ou_minima.setter - def geracao_maxima_ou_minima(self, c: int): + def geracao_maxima_ou_minima(self, c: int) -> None: self.data[15] = c @property @@ -423,7 +423,7 @@ def numero_maximo_oscilacoes(self) -> Optional[int]: return self.data[16] @numero_maximo_oscilacoes.setter - def numero_maximo_oscilacoes(self, c: int): + def numero_maximo_oscilacoes(self, c: int) -> None: self.data[16] = c @property @@ -438,7 +438,7 @@ def unidades_equivalentes(self) -> Optional[int]: return self.data[17] @unidades_equivalentes.setter - def unidades_equivalentes(self, c: int): + def unidades_equivalentes(self, c: int) -> None: self.data[17] = c @property @@ -452,7 +452,7 @@ def rampa_transicao(self) -> Optional[float]: return self.data[18] @rampa_transicao.setter - def rampa_transicao(self, c: float): + def rampa_transicao(self, c: float) -> None: self.data[18] = c @@ -482,7 +482,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -496,7 +496,7 @@ def codigo_unidade_equivalente(self) -> Optional[int]: return self.data[1] @codigo_unidade_equivalente.setter - def codigo_unidade_equivalente(self, c: int): + def codigo_unidade_equivalente(self, c: int) -> None: self.data[1] = c @property @@ -511,7 +511,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @@ -542,7 +542,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -556,7 +556,7 @@ def codigo_unidade_equivalente(self) -> Optional[int]: return self.data[1] @codigo_unidade_equivalente.setter - def codigo_unidade_equivalente(self, c: int): + def codigo_unidade_equivalente(self, c: int) -> None: self.data[1] = c @property @@ -571,5 +571,5 @@ def numero_minimo_unidades(self) -> Optional[int]: return self.data[2] @numero_minimo_unidades.setter - def numero_minimo_unidades(self, c: int): + def numero_minimo_unidades(self, c: int) -> None: self.data[2] = c diff --git a/idessem/dessem/modelos/uch.py b/idessem/dessem/modelos/uch.py index 87288cb8..c86d6ab9 100644 --- a/idessem/dessem/modelos/uch.py +++ b/idessem/dessem/modelos/uch.py @@ -29,7 +29,7 @@ def considera_uch(self) -> Optional[int]: return self.data[0] @considera_uch.setter - def considera_uch(self, c: int): + def considera_uch(self, c: int) -> None: self.data[0] = c @@ -57,7 +57,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -71,7 +71,7 @@ def considera_uch_usina(self) -> Optional[int]: return self.data[1] @considera_uch_usina.setter - def considera_uch_usina(self, c: int): + def considera_uch_usina(self, c: int) -> None: self.data[1] = c @@ -104,7 +104,7 @@ def dia_inicial(self) -> Optional[int]: return self.data[0] @dia_inicial.setter - def dia_inicial(self, n: int): + def dia_inicial(self, n: int) -> None: self.data[0] = n @property @@ -118,7 +118,7 @@ def hora_inicial(self) -> Optional[int]: return self.data[1] @hora_inicial.setter - def hora_inicial(self, n: int): + def hora_inicial(self, n: int) -> None: self.data[1] = n @property @@ -132,7 +132,7 @@ def meia_hora_inicial(self) -> Optional[int]: return self.data[2] @meia_hora_inicial.setter - def meia_hora_inicial(self, n: int): + def meia_hora_inicial(self, n: int) -> None: self.data[2] = n @property @@ -147,7 +147,7 @@ def dia_final(self) -> Optional[int]: return self.data[3] @dia_final.setter - def dia_final(self, n: int): + def dia_final(self, n: int) -> None: self.data[3] = n @property @@ -161,7 +161,7 @@ def hora_final(self) -> Optional[int]: return self.data[4] @hora_final.setter - def hora_final(self, n: int): + def hora_final(self, n: int) -> None: self.data[4] = n @property @@ -175,7 +175,7 @@ def meia_hora_final(self) -> Optional[int]: return self.data[5] @meia_hora_final.setter - def meia_hora_final(self, n: int): + def meia_hora_final(self, n: int) -> None: self.data[5] = n @@ -205,7 +205,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -219,7 +219,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -234,7 +234,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -248,7 +248,7 @@ def considera_operacao_vazio(self) -> Optional[int]: return self.data[3] @considera_operacao_vazio.setter - def considera_operacao_vazio(self, c: int): + def considera_operacao_vazio(self, c: int) -> None: self.data[3] = c @@ -277,7 +277,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -291,7 +291,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -305,7 +305,7 @@ def considera_operacao_vazio(self) -> Optional[int]: return self.data[2] @considera_operacao_vazio.setter - def considera_operacao_vazio(self, c: int): + def considera_operacao_vazio(self, c: int) -> None: self.data[2] = c @@ -333,7 +333,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -347,7 +347,7 @@ def considera_operacao_vazio(self) -> Optional[int]: return self.data[1] @considera_operacao_vazio.setter - def considera_operacao_vazio(self, c: int): + def considera_operacao_vazio(self, c: int) -> None: self.data[1] = c @@ -378,7 +378,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -392,7 +392,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -407,7 +407,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -421,7 +421,7 @@ def tempo_minimo_ligada(self) -> Optional[int]: return self.data[3] @tempo_minimo_ligada.setter - def tempo_minimo_ligada(self, c: int): + def tempo_minimo_ligada(self, c: int) -> None: self.data[3] = c @property @@ -435,7 +435,7 @@ def tempo_minimo_desligada(self) -> Optional[int]: return self.data[4] @tempo_minimo_desligada.setter - def tempo_minimo_desligada(self, c: int): + def tempo_minimo_desligada(self, c: int) -> None: self.data[4] = c @@ -465,7 +465,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -479,7 +479,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -493,7 +493,7 @@ def tempo_minimo_ligada(self) -> Optional[int]: return self.data[2] @tempo_minimo_ligada.setter - def tempo_minimo_ligada(self, c: int): + def tempo_minimo_ligada(self, c: int) -> None: self.data[2] = c @property @@ -507,7 +507,7 @@ def tempo_minimo_desligada(self) -> Optional[int]: return self.data[3] @tempo_minimo_desligada.setter - def tempo_minimo_desligada(self, c: int): + def tempo_minimo_desligada(self, c: int) -> None: self.data[3] = c @@ -536,7 +536,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -550,7 +550,7 @@ def tempo_minimo_ligada(self) -> Optional[int]: return self.data[1] @tempo_minimo_ligada.setter - def tempo_minimo_ligada(self, c: int): + def tempo_minimo_ligada(self, c: int) -> None: self.data[1] = c @property @@ -564,7 +564,7 @@ def tempo_minimo_desligada(self) -> Optional[int]: return self.data[2] @tempo_minimo_desligada.setter - def tempo_minimo_desligada(self, c: int): + def tempo_minimo_desligada(self, c: int) -> None: self.data[2] = c @@ -595,7 +595,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -609,7 +609,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -624,7 +624,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -638,7 +638,7 @@ def geracao_minima_unidade(self) -> Optional[float]: return self.data[3] @geracao_minima_unidade.setter - def geracao_minima_unidade(self, c: float): + def geracao_minima_unidade(self, c: float) -> None: self.data[3] = c @property @@ -652,7 +652,7 @@ def geracao_maxima_unidade(self) -> Optional[float]: return self.data[4] @geracao_maxima_unidade.setter - def geracao_maxima_unidade(self, c: float): + def geracao_maxima_unidade(self, c: float) -> None: self.data[4] = c @@ -683,7 +683,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -697,7 +697,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -712,7 +712,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -726,7 +726,7 @@ def turbinamento_minimo_unidade(self) -> Optional[float]: return self.data[3] @turbinamento_minimo_unidade.setter - def turbinamento_minimo_unidade(self, c: float): + def turbinamento_minimo_unidade(self, c: float) -> None: self.data[3] = c @property @@ -740,7 +740,7 @@ def turbinamento_maximo_unidade(self) -> Optional[float]: return self.data[4] @turbinamento_maximo_unidade.setter - def turbinamento_maximo_unidade(self, c: float): + def turbinamento_maximo_unidade(self, c: float) -> None: self.data[4] = c @@ -773,7 +773,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -787,7 +787,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -802,7 +802,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -816,7 +816,7 @@ def status_inicial(self) -> Optional[int]: return self.data[3] @status_inicial.setter - def status_inicial(self, c: int): + def status_inicial(self, c: int) -> None: self.data[3] = c @property @@ -830,7 +830,7 @@ def tempo_permanencia_unidade(self) -> Optional[int]: return self.data[4] @tempo_permanencia_unidade.setter - def tempo_permanencia_unidade(self, c: int): + def tempo_permanencia_unidade(self, c: int) -> None: self.data[4] = c @property @@ -844,7 +844,7 @@ def geracao_inicial_unidade(self) -> Optional[float]: return self.data[5] @geracao_inicial_unidade.setter - def geracao_inicial_unidade(self, c: float): + def geracao_inicial_unidade(self, c: float) -> None: self.data[5] = c @property @@ -858,7 +858,7 @@ def turbinamento_inicial_unidade(self) -> Optional[float]: return self.data[6] @turbinamento_inicial_unidade.setter - def turbinamento_inicial_unidade(self, c: float): + def turbinamento_inicial_unidade(self, c: float) -> None: self.data[6] = c @@ -888,7 +888,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -902,7 +902,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -917,7 +917,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -931,7 +931,7 @@ def consumo_agua(self) -> Optional[float]: return self.data[3] @consumo_agua.setter - def consumo_agua(self, c: float): + def consumo_agua(self, c: float) -> None: self.data[3] = c @@ -960,7 +960,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -974,7 +974,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -988,7 +988,7 @@ def consumo_agua(self) -> Optional[float]: return self.data[2] @consumo_agua.setter - def consumo_agua(self, c: float): + def consumo_agua(self, c: float) -> None: self.data[2] = c @@ -1016,7 +1016,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1030,7 +1030,7 @@ def consumo_agua(self) -> Optional[float]: return self.data[1] @consumo_agua.setter - def consumo_agua(self, c: float): + def consumo_agua(self, c: float) -> None: self.data[1] = c @@ -1060,7 +1060,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1074,7 +1074,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1089,7 +1089,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -1103,7 +1103,7 @@ def limite_maximo_mudancas(self) -> Optional[int]: return self.data[3] @limite_maximo_mudancas.setter - def limite_maximo_mudancas(self, c: int): + def limite_maximo_mudancas(self, c: int) -> None: self.data[3] = c @@ -1132,7 +1132,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1146,7 +1146,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1160,7 +1160,7 @@ def limite_maximo_mudancas(self) -> Optional[int]: return self.data[2] @limite_maximo_mudancas.setter - def limite_maximo_mudancas(self, c: int): + def limite_maximo_mudancas(self, c: int) -> None: self.data[2] = c @@ -1188,7 +1188,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1202,7 +1202,7 @@ def limite_maximo_mudancas(self) -> Optional[int]: return self.data[1] @limite_maximo_mudancas.setter - def limite_maximo_mudancas(self, c: int): + def limite_maximo_mudancas(self, c: int) -> None: self.data[1] = c @@ -1232,7 +1232,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1246,7 +1246,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1261,7 +1261,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -1275,7 +1275,7 @@ def custo_partida(self) -> Optional[float]: return self.data[3] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[3] = c @@ -1304,7 +1304,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1318,7 +1318,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1332,7 +1332,7 @@ def custo_partida(self) -> Optional[float]: return self.data[2] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[2] = c @@ -1360,7 +1360,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1374,7 +1374,7 @@ def custo_partida(self) -> Optional[float]: return self.data[1] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[1] = c @@ -1404,7 +1404,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1418,7 +1418,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1433,7 +1433,7 @@ def codigo_unidade(self) -> Optional[int]: return self.data[2] @codigo_unidade.setter - def codigo_unidade(self, c: int): + def codigo_unidade(self, c: int) -> None: self.data[2] = c @property @@ -1447,7 +1447,7 @@ def custo_partida(self) -> Optional[float]: return self.data[3] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[3] = c @@ -1476,7 +1476,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1490,7 +1490,7 @@ def codigo_conjunto(self) -> Optional[int]: return self.data[1] @codigo_conjunto.setter - def codigo_conjunto(self, c: int): + def codigo_conjunto(self, c: int) -> None: self.data[1] = c @property @@ -1504,7 +1504,7 @@ def custo_partida(self) -> Optional[float]: return self.data[2] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[2] = c @@ -1532,7 +1532,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -1546,5 +1546,5 @@ def custo_partida(self) -> Optional[float]: return self.data[1] @custo_partida.setter - def custo_partida(self, c: float): + def custo_partida(self, c: float) -> None: self.data[1] = c diff --git a/idessem/dessem/operuh.py b/idessem/dessem/operuh.py index 6e96bb30..46038ad9 100644 --- a/idessem/dessem/operuh.py +++ b/idessem/dessem/operuh.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Type, TypeVar, Union +from typing import Any, List, Optional, Type, TypeVar, Union import pandas as pd # type: ignore from cfinterface.files.registerfile import RegisterFile @@ -27,11 +27,11 @@ class Operuh(RegisterFile): VAR, ] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/dessem/operut.py b/idessem/dessem/operut.py index 563045cb..9b6cfa27 100644 --- a/idessem/dessem/operut.py +++ b/idessem/dessem/operut.py @@ -18,7 +18,7 @@ ) from cfinterface.files.blockfile import BlockFile -from typing import TypeVar, Optional, List +from typing import Any, TypeVar, Optional, List import pandas as pd # type: ignore @@ -49,7 +49,7 @@ class Operut(BlockFile): BlocoOper, ] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) @property @@ -77,7 +77,7 @@ def condicoes_iniciais(self) -> Optional[pd.DataFrame]: return None @condicoes_iniciais.setter - def condicoes_iniciais(self, valor: pd.DataFrame): + def condicoes_iniciais(self, valor: pd.DataFrame) -> None: b = self.data.get_blocks_of_type(BlocoInitUT) if isinstance(b, BlocoInitUT): b.data[1] = valor @@ -111,7 +111,7 @@ def limites_e_condicoes_operativas(self) -> Optional[pd.DataFrame]: return None @limites_e_condicoes_operativas.setter - def limites_e_condicoes_operativas(self, valor: pd.DataFrame): + def limites_e_condicoes_operativas(self, valor: pd.DataFrame) -> None: b = self.data.get_blocks_of_type(BlocoOper) if isinstance(b, BlocoOper): b.data[1] = valor @@ -132,7 +132,7 @@ def uctpar(self) -> Optional[int]: return None @uctpar.setter - def uctpar(self, valor: int): + def uctpar(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoUctPar) if isinstance(b, BlocoUctPar): b.data = valor @@ -153,7 +153,7 @@ def ucterm(self) -> Optional[int]: return None @ucterm.setter - def ucterm(self, valor: int): + def ucterm(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoUcTerm) if isinstance(b, BlocoUcTerm): b.data = valor @@ -188,7 +188,7 @@ def regranptv(self) -> Optional[List[int]]: return None @regranptv.setter - def regranptv(self, valor: List[int]): + def regranptv(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoRegraNPTV) if isinstance(b, BlocoRegraNPTV): b.data = valor @@ -209,7 +209,7 @@ def avlcmo(self) -> Optional[int]: return None @avlcmo.setter - def avlcmo(self, valor: int): + def avlcmo(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoAvlCmo) if isinstance(b, BlocoAvlCmo): b.data = valor @@ -257,7 +257,7 @@ def uctheurfp(self) -> Optional[List[int]]: return None @uctheurfp.setter - def uctheurfp(self, valor: List[int]): + def uctheurfp(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoUctHeurFp) if isinstance(b, BlocoUctHeurFp): b.data = valor @@ -278,7 +278,7 @@ def constdados(self) -> Optional[List[int]]: return None @constdados.setter - def constdados(self, valor: List[int]): + def constdados(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoConstDados) if isinstance(b, BlocoConstDados): b.data = valor @@ -299,7 +299,7 @@ def ajustefcf(self) -> Optional[List[int]]: return None @ajustefcf.setter - def ajustefcf(self, valor: List[int]): + def ajustefcf(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoAjusteFcf) if isinstance(b, BlocoAjusteFcf): b.data = valor @@ -320,7 +320,7 @@ def tolerilh(self) -> Optional[int]: return None @tolerilh.setter - def tolerilh(self, valor: int): + def tolerilh(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoTolerIlh) if isinstance(b, BlocoTolerIlh): b.data = valor @@ -342,7 +342,7 @@ def crossover(self) -> Optional[List[int]]: return None @crossover.setter - def crossover(self, valor: List[int]): + def crossover(self, valor: List[int]) -> None: b = self.data.get_blocks_of_type(BlocoCrossover) if isinstance(b, BlocoCrossover): b.data = valor @@ -363,7 +363,7 @@ def engolimento(self) -> Optional[int]: return None @engolimento.setter - def engolimento(self, valor: int): + def engolimento(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoEngolimento) if isinstance(b, BlocoEngolimento): b.data = valor @@ -384,7 +384,7 @@ def tratainviabilha(self) -> Optional[int]: return None @tratainviabilha.setter - def tratainviabilha(self, valor: int): + def tratainviabilha(self, valor: int) -> None: b = self.data.get_blocks_of_type(BlocoTrataInviabIlha) if isinstance(b, BlocoTrataInviabIlha): b.data = valor diff --git a/idessem/dessem/pdo_aval_qmaxusih.py b/idessem/dessem/pdo_aval_qmaxusih.py index f6f949e0..6dc72c40 100644 --- a/idessem/dessem/pdo_aval_qmaxusih.py +++ b/idessem/dessem/pdo_aval_qmaxusih.py @@ -7,6 +7,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoAvalQmaxUsih(ArquivoCSV): @@ -25,7 +27,7 @@ class PdoAvalQmaxUsih(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades hidráulicas. diff --git a/idessem/dessem/pdo_cmobar.py b/idessem/dessem/pdo_cmobar.py index 999fc5c9..00180f02 100644 --- a/idessem/dessem/pdo_cmobar.py +++ b/idessem/dessem/pdo_cmobar.py @@ -4,6 +4,8 @@ VersaoModelo, ) from idessem.dessem.modelos.pdo_cmobar import TabelaPdoCmoBar +import pandas as pd # type: ignore +from typing import Optional class PdoCmoBar(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoCmoBar(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referentes aos custos marginais de operação por barra. diff --git a/idessem/dessem/pdo_cmosist.py b/idessem/dessem/pdo_cmosist.py index b1b4626c..f1676275 100644 --- a/idessem/dessem/pdo_cmosist.py +++ b/idessem/dessem/pdo_cmosist.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoCmosist(ArquivoCSV): @@ -19,7 +21,7 @@ class PdoCmosist(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com o custo marginal da operação (CMO) e o valor da variável dual associada à equação de atendimento à demanda diff --git a/idessem/dessem/pdo_eco_fcfcortes.py b/idessem/dessem/pdo_eco_fcfcortes.py index 85c536d8..6c12d87a 100644 --- a/idessem/dessem/pdo_eco_fcfcortes.py +++ b/idessem/dessem/pdo_eco_fcfcortes.py @@ -7,6 +7,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoEcoFcfCortes(ArquivoCSV): @@ -24,7 +26,7 @@ class PdoEcoFcfCortes(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações dos cortes da FCF. diff --git a/idessem/dessem/pdo_eco_usih.py b/idessem/dessem/pdo_eco_usih.py index 168a7323..e424bdd0 100644 --- a/idessem/dessem/pdo_eco_usih.py +++ b/idessem/dessem/pdo_eco_usih.py @@ -8,6 +8,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoEcoUsih(ArquivoCSV): @@ -26,7 +28,7 @@ class PdoEcoUsih(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a caracaterísticas das usinas hidrelétricas e topologia das cascatas. diff --git a/idessem/dessem/pdo_eco_usih_conj.py b/idessem/dessem/pdo_eco_usih_conj.py index 3f3ed129..79fac0d1 100644 --- a/idessem/dessem/pdo_eco_usih_conj.py +++ b/idessem/dessem/pdo_eco_usih_conj.py @@ -6,6 +6,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoEcoUsihConj(ArquivoCSV): @@ -19,7 +21,7 @@ class PdoEcoUsihConj(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente aos conjuntos de unidades geradoras das usinas hidrelétricas. diff --git a/idessem/dessem/pdo_eco_usih_polin.py b/idessem/dessem/pdo_eco_usih_polin.py index 3bd7db84..6d1d867d 100644 --- a/idessem/dessem/pdo_eco_usih_polin.py +++ b/idessem/dessem/pdo_eco_usih_polin.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoEcoUsihPolin(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoEcoUsihPolin(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente aos polinômios utilizados para cálculo das grandezas das usinas hidrelétricas. diff --git a/idessem/dessem/pdo_elev.py b/idessem/dessem/pdo_elev.py index 0377563b..92e4ef59 100644 --- a/idessem/dessem/pdo_elev.py +++ b/idessem/dessem/pdo_elev.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoElev(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoElev(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referentes à operação das usinas elevatórias. diff --git a/idessem/dessem/pdo_eolica.py b/idessem/dessem/pdo_eolica.py index 7a958b72..6f79c29c 100644 --- a/idessem/dessem/pdo_eolica.py +++ b/idessem/dessem/pdo_eolica.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoEolica(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoEolica(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das usinas renováveis. diff --git a/idessem/dessem/pdo_hidr.py b/idessem/dessem/pdo_hidr.py index 4bae17bb..f87e081e 100644 --- a/idessem/dessem/pdo_hidr.py +++ b/idessem/dessem/pdo_hidr.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoHidr(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoHidr(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades hidráulicas. diff --git a/idessem/dessem/pdo_inter.py b/idessem/dessem/pdo_inter.py index ff5fdce7..8524d790 100644 --- a/idessem/dessem/pdo_inter.py +++ b/idessem/dessem/pdo_inter.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoInter(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoInter(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente aos intercâmbios. diff --git a/idessem/dessem/pdo_oper_lpp.py b/idessem/dessem/pdo_oper_lpp.py index 3286e47f..ef8b5726 100644 --- a/idessem/dessem/pdo_oper_lpp.py +++ b/idessem/dessem/pdo_oper_lpp.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperLpp(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoOperLpp(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades térmicas. diff --git a/idessem/dessem/pdo_oper_term.py b/idessem/dessem/pdo_oper_term.py index 5194c430..5122c0a2 100644 --- a/idessem/dessem/pdo_oper_term.py +++ b/idessem/dessem/pdo_oper_term.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperTerm(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoOperTerm(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades térmicas. diff --git a/idessem/dessem/pdo_oper_titulacao_contratos.py b/idessem/dessem/pdo_oper_titulacao_contratos.py index a4f7b520..0594579b 100644 --- a/idessem/dessem/pdo_oper_titulacao_contratos.py +++ b/idessem/dessem/pdo_oper_titulacao_contratos.py @@ -6,6 +6,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperTitulacaoContratos(ArquivoCSV): @@ -21,7 +23,7 @@ class PdoOperTitulacaoContratos(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a titulação dos contratos de energia. diff --git a/idessem/dessem/pdo_oper_titulacao_usinas.py b/idessem/dessem/pdo_oper_titulacao_usinas.py index a2710ef9..8641993f 100644 --- a/idessem/dessem/pdo_oper_titulacao_usinas.py +++ b/idessem/dessem/pdo_oper_titulacao_usinas.py @@ -6,6 +6,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperTitulacaoUsinas(ArquivoCSV): @@ -20,7 +22,7 @@ class PdoOperTitulacaoUsinas(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a titulação das usinas térmicas. diff --git a/idessem/dessem/pdo_oper_tviag_calha.py b/idessem/dessem/pdo_oper_tviag_calha.py index 60089f54..1af87281 100644 --- a/idessem/dessem/pdo_oper_tviag_calha.py +++ b/idessem/dessem/pdo_oper_tviag_calha.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperTviagCalha(ArquivoCSV): @@ -18,7 +20,7 @@ class PdoOperTviagCalha(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação dos volumes na calha do rio no fim do horizonte de estudo. diff --git a/idessem/dessem/pdo_oper_uct.py b/idessem/dessem/pdo_oper_uct.py index 969553cb..221d6617 100644 --- a/idessem/dessem/pdo_oper_uct.py +++ b/idessem/dessem/pdo_oper_uct.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperUct(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoOperUct(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades térmicas. diff --git a/idessem/dessem/pdo_oper_usih.py b/idessem/dessem/pdo_oper_usih.py index a8bfa7d7..6501b776 100644 --- a/idessem/dessem/pdo_oper_usih.py +++ b/idessem/dessem/pdo_oper_usih.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoOperUsih(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoOperUsih(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referentes à operação das usinas hidrelétricas. diff --git a/idessem/dessem/pdo_operacao.py b/idessem/dessem/pdo_operacao.py index 238d422e..4bbdb1cf 100644 --- a/idessem/dessem/pdo_operacao.py +++ b/idessem/dessem/pdo_operacao.py @@ -8,7 +8,7 @@ VersaoModelo, ) from cfinterface.files.blockfile import BlockFile -from typing import Optional, Type, TypeVar +from typing import Any, Optional, Type, TypeVar from datetime import datetime import pandas as pd # type: ignore from cfinterface.components.block import Block @@ -31,7 +31,7 @@ class PdoOperacao(BlockFile): ENCODING = "iso-8859-1" T = TypeVar("T") - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) self.__custos_operacao = None diff --git a/idessem/dessem/pdo_reserva.py b/idessem/dessem/pdo_reserva.py index 262904c7..b5f848af 100644 --- a/idessem/dessem/pdo_reserva.py +++ b/idessem/dessem/pdo_reserva.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoReserva(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoReserva(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a reserva de potência operativa. diff --git a/idessem/dessem/pdo_sist.py b/idessem/dessem/pdo_sist.py index 2ba33731..c588a5fe 100644 --- a/idessem/dessem/pdo_sist.py +++ b/idessem/dessem/pdo_sist.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoSist(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoSist(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação por submercado. diff --git a/idessem/dessem/pdo_somflux.py b/idessem/dessem/pdo_somflux.py index bd528f7f..0b09d340 100644 --- a/idessem/dessem/pdo_somflux.py +++ b/idessem/dessem/pdo_somflux.py @@ -4,6 +4,8 @@ VersaoModelo, ) from idessem.dessem.modelos.pdo_somflux import TabelaPdoSomFlux +import pandas as pd # type: ignore +from typing import Optional class PdoSomFlux(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoSomFlux(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referentes as restrições de somatório de fluxos. diff --git a/idessem/dessem/pdo_term.py b/idessem/dessem/pdo_term.py index aa0e9dbe..2adda10e 100644 --- a/idessem/dessem/pdo_term.py +++ b/idessem/dessem/pdo_term.py @@ -4,6 +4,8 @@ VersaoModelo, ArquivoCSV, ) +import pandas as pd # type: ignore +from typing import Optional class PdoTerm(ArquivoCSV): @@ -17,7 +19,7 @@ class PdoTerm(ArquivoCSV): ENCODING = "iso-8859-1" @property - def tabela(self): + def tabela(self) -> Optional[pd.DataFrame]: """ Obtém a tabela com informações referente a operação das unidades térmicas. diff --git a/idessem/dessem/renovaveis.py b/idessem/dessem/renovaveis.py index a268b68c..8132cba3 100644 --- a/idessem/dessem/renovaveis.py +++ b/idessem/dessem/renovaveis.py @@ -6,7 +6,7 @@ ) import pandas as pd # type: ignore from cfinterface.files.registerfile import RegisterFile -from typing import Type, List, Optional, TypeVar, Union +from typing import Any, Type, List, Optional, TypeVar, Union from cfinterface.components.register import Register @@ -25,11 +25,11 @@ class Renovaveis(RegisterFile): REGISTERS = [EOLICAGERACAO, EOLICASUBM, EOLICABARRA, EOLICA] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/dessem/respot.py b/idessem/dessem/respot.py index 0c5fd511..1b26b14f 100644 --- a/idessem/dessem/respot.py +++ b/idessem/dessem/respot.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Type, TypeVar, Union +from typing import Any, List, Optional, Type, TypeVar, Union import pandas as pd # type: ignore from cfinterface.components.register import Register @@ -22,11 +22,11 @@ class Respot(RegisterFile): REGISTERS = [RP, LM] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/dessem/termdat.py b/idessem/dessem/termdat.py index f89c4d43..4fce96f1 100644 --- a/idessem/dessem/termdat.py +++ b/idessem/dessem/termdat.py @@ -1,7 +1,7 @@ from idessem.dessem.modelos.termdat import CADUSIT, CADUNIDT, CADCONF, CADMIN import pandas as pd # type: ignore from cfinterface.files.registerfile import RegisterFile -from typing import Type, List, Optional, TypeVar, Union +from typing import Any, Type, List, Optional, TypeVar, Union from cfinterface.components.register import Register @@ -20,11 +20,11 @@ class Term(RegisterFile): REGISTERS = [CADUSIT, CADUNIDT, CADCONF, CADMIN] - def __init__(self, data=...) -> None: + def __init__(self, data: Any = ...) -> None: super().__init__(data) def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/dessem/uch.py b/idessem/dessem/uch.py index ebc3e7c2..e636b90b 100644 --- a/idessem/dessem/uch.py +++ b/idessem/dessem/uch.py @@ -1,4 +1,4 @@ -from typing import Type, TypeVar, Optional, List, Union +from typing import Any, Type, TypeVar, Optional, List, Union from cfinterface.files.registerfile import RegisterFile import pandas as pd # type: ignore from idessem.dessem.modelos.uch import ( @@ -64,7 +64,7 @@ class Uch(RegisterFile): ] def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/idessem/libs/modelos/usinas_hidreletricas.py b/idessem/libs/modelos/usinas_hidreletricas.py index c3eac802..7a7c49fa 100644 --- a/idessem/libs/modelos/usinas_hidreletricas.py +++ b/idessem/libs/modelos/usinas_hidreletricas.py @@ -34,7 +34,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -48,7 +48,7 @@ def indice_familia(self) -> Optional[int]: return self.data[1] @indice_familia.setter - def indice_familia(self, c: int): + def indice_familia(self, c: int) -> None: self.data[1] = c @property @@ -63,7 +63,7 @@ def nivel_montante_referencia(self) -> Optional[float]: return self.data[2] @nivel_montante_referencia.setter - def nivel_montante_referencia(self, c: float): + def nivel_montante_referencia(self, c: float) -> None: self.data[2] = c @@ -94,7 +94,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -108,7 +108,7 @@ def indice_familia(self) -> Optional[int]: return self.data[1] @indice_familia.setter - def indice_familia(self, c: int): + def indice_familia(self, c: int) -> None: self.data[1] = c @property @@ -122,7 +122,7 @@ def numero_polinomios(self) -> Optional[int]: return self.data[2] @numero_polinomios.setter - def numero_polinomios(self, c: int): + def numero_polinomios(self, c: int) -> None: self.data[2] = c @@ -160,7 +160,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -174,7 +174,7 @@ def indice_familia(self) -> Optional[int]: return self.data[1] @indice_familia.setter - def indice_familia(self, c: int): + def indice_familia(self, c: int) -> None: self.data[1] = c @property @@ -188,7 +188,7 @@ def indice_polinomio(self) -> Optional[int]: return self.data[2] @indice_polinomio.setter - def indice_polinomio(self, c: int): + def indice_polinomio(self, c: int) -> None: self.data[2] = c @property @@ -203,7 +203,7 @@ def limite_inferior_vazao_jusante(self) -> Optional[float]: return self.data[3] @limite_inferior_vazao_jusante.setter - def limite_inferior_vazao_jusante(self, c: float): + def limite_inferior_vazao_jusante(self, c: float) -> None: self.data[3] = c @property @@ -218,7 +218,7 @@ def limite_superior_vazao_jusante(self) -> Optional[float]: return self.data[4] @limite_superior_vazao_jusante.setter - def limite_superior_vazao_jusante(self, c: float): + def limite_superior_vazao_jusante(self, c: float) -> None: self.data[4] = c @property @@ -232,7 +232,7 @@ def coeficiente_a0(self) -> Optional[float]: return self.data[5] @coeficiente_a0.setter - def coeficiente_a0(self, c: float): + def coeficiente_a0(self, c: float) -> None: self.data[5] = c @property @@ -246,7 +246,7 @@ def coeficiente_a1(self) -> Optional[float]: return self.data[6] @coeficiente_a1.setter - def coeficiente_a1(self, c: float): + def coeficiente_a1(self, c: float) -> None: self.data[6] = c @property @@ -260,7 +260,7 @@ def coeficiente_a2(self) -> Optional[float]: return self.data[7] @coeficiente_a2.setter - def coeficiente_a2(self, c: float): + def coeficiente_a2(self, c: float) -> None: self.data[7] = c @property @@ -274,7 +274,7 @@ def coeficiente_a3(self) -> Optional[float]: return self.data[8] @coeficiente_a3.setter - def coeficiente_a3(self, c: float): + def coeficiente_a3(self, c: float) -> None: self.data[8] = c @property @@ -288,7 +288,7 @@ def coeficiente_a4(self) -> Optional[float]: return self.data[9] @coeficiente_a4.setter - def coeficiente_a4(self, c: float): + def coeficiente_a4(self, c: float) -> None: self.data[9] = c @@ -318,7 +318,7 @@ def codigo_usina(self) -> Optional[int]: return self.data[0] @codigo_usina.setter - def codigo_usina(self, c: int): + def codigo_usina(self, c: int) -> None: self.data[0] = c @property @@ -332,7 +332,7 @@ def considera_afogamento(self) -> Optional[str]: return self.data[1] @considera_afogamento.setter - def considera_afogamento(self, c: str): + def considera_afogamento(self, c: str) -> None: self.data[1] = c @@ -361,7 +361,7 @@ def considera_afogamento(self) -> Optional[str]: return self.data[0] @considera_afogamento.setter - def considera_afogamento(self, c: str): + def considera_afogamento(self, c: str) -> None: self.data[0] = c @@ -390,7 +390,7 @@ def codigo_usina_influenciada(self) -> Optional[int]: return self.data[0] @codigo_usina_influenciada.setter - def codigo_usina_influenciada(self, c: int): + def codigo_usina_influenciada(self, c: int) -> None: self.data[0] = c @property @@ -404,7 +404,7 @@ def fator_impacto_turbinamento(self) -> Optional[float]: return self.data[1] @fator_impacto_turbinamento.setter - def fator_impacto_turbinamento(self, c: float): + def fator_impacto_turbinamento(self, c: float) -> None: self.data[1] = c @property @@ -418,7 +418,7 @@ def fator_impacto_vertimento(self) -> Optional[float]: return self.data[2] @fator_impacto_vertimento.setter - def fator_impacto_vertimento(self, c: float): + def fator_impacto_vertimento(self, c: float) -> None: self.data[2] = c @@ -447,7 +447,7 @@ def codigo_usina_influenciada(self) -> Optional[int]: return self.data[0] @codigo_usina_influenciada.setter - def codigo_usina_influenciada(self, c: int): + def codigo_usina_influenciada(self, c: int) -> None: self.data[0] = c @property @@ -462,7 +462,7 @@ def codigo_usina_influenciadora(self) -> Optional[float]: return self.data[1] @codigo_usina_influenciadora.setter - def codigo_usina_influenciadora(self, c: float): + def codigo_usina_influenciadora(self, c: float) -> None: self.data[1] = c @property @@ -476,7 +476,7 @@ def fator_impacto(self) -> Optional[float]: return self.data[2] @fator_impacto.setter - def fator_impacto(self, c: float): + def fator_impacto(self, c: float) -> None: self.data[2] = c @@ -505,7 +505,7 @@ def codigo_usina_influenciada(self) -> Optional[int]: return self.data[0] @codigo_usina_influenciada.setter - def codigo_usina_influenciada(self, c: int): + def codigo_usina_influenciada(self, c: int) -> None: self.data[0] = c @property @@ -520,7 +520,7 @@ def codigo_usina_influenciadora(self) -> Optional[float]: return self.data[1] @codigo_usina_influenciadora.setter - def codigo_usina_influenciadora(self, c: float): + def codigo_usina_influenciadora(self, c: float) -> None: self.data[1] = c @property @@ -534,5 +534,5 @@ def fator_impacto(self) -> Optional[float]: return self.data[2] @fator_impacto.setter - def fator_impacto(self, c: float): + def fator_impacto(self, c: float) -> None: self.data[2] = c diff --git a/idessem/libs/usinas_hidreletricas.py b/idessem/libs/usinas_hidreletricas.py index 0c523fe7..90486adf 100644 --- a/idessem/libs/usinas_hidreletricas.py +++ b/idessem/libs/usinas_hidreletricas.py @@ -1,4 +1,4 @@ -from typing import Type, TypeVar, Optional, List, Union +from typing import Any, Type, TypeVar, Optional, List, Union from cfinterface.components.register import Register from cfinterface.files.registerfile import RegisterFile import pandas as pd # type: ignore @@ -34,7 +34,7 @@ class UsinasHidreletricas(RegisterFile): ] def __registros_ou_df( - self, t: Type[T], **kwargs + self, t: Type[T], **kwargs: Any ) -> Optional[Union[T, List[T], pd.DataFrame]]: if kwargs.get("df"): return self._as_df(t) diff --git a/pyproject.toml b/pyproject.toml index 0afd7a1d..7492e857 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,11 +6,11 @@ build-backend = "hatchling.build" name = "idessem" dynamic = ["version"] dependencies = [ - "cfinterface>=1.8.0,<=1.8.3", + "cfinterface>=1.9.0", "numpy>=2.2.1", - "pandas>=2.2.3", + "pandas>=3.0.0", ] -requires-python = ">= 3.10" +requires-python = ">= 3.11" authors = [ {name = "Rogerio Alves", email = "rogerioalves.ee@gmail.com"}, {name = "Mariana Noel", email = "marianasimoesnoel@gmail.com"}, @@ -22,9 +22,10 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Typing :: Typed", ] @@ -68,6 +69,11 @@ include = [ warn_return_any = false warn_unused_ignores = true +[[tool.mypy.overrides]] +module = ["idessem", "idessem.dessem", "idessem.dessem.*", "idessem._utils.*", "idessem.libs.*"] +strict = true +warn_return_any = false + [tool.pytest.ini_options] testpaths = ["tests"]