Skip to content

Commit 57036aa

Browse files
authored
Bump the optional group with 14 updates (#837)
Updates the requirements on [pydoclint](https://github.com/jsh9/pydoclint), [polars](https://github.com/pola-rs/polars), [black](https://github.com/psf/black), [isort](https://github.com/pycqa/isort), [markdown](https://github.com/Python-Markdown/markdown), [mkdocs-macros-plugin](https://github.com/fralau/mkdocs_macros_plugin), [mkdocs-material](https://github.com/squidfunk/mkdocs-material), [mkdocstrings[python]](https://github.com/mkdocstrings/mkdocstrings), [mypy](https://github.com/python/mypy), [types-markdown](https://github.com/python/typeshed), [types-pygments](https://github.com/python/typeshed), [pytest](https://github.com/pytest-dev/pytest), [pytest-mock](https://github.com/pytest-dev/pytest-mock) and [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) to permit the latest version. Updates `pydoclint` from 0.3.3 to 0.3.8 - [Release notes](https://github.com/jsh9/pydoclint/releases) - [Changelog](https://github.com/jsh9/pydoclint/blob/main/CHANGELOG.md) - [Commits](jsh9/pydoclint@0.3.3...0.3.8) Updates `polars` from 0.19.3 to 0.20.2 - [Release notes](https://github.com/pola-rs/polars/releases) - [Commits](pola-rs/polars@py-0.19.3...py-0.20.2) Updates `black` from 23.9.1 to 23.12.1 - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](psf/black@23.9.1...23.12.1) Updates `isort` from 5.12.0 to 5.13.2 - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](PyCQA/isort@5.12.0...5.13.2) Updates `markdown` from 3.4.4 to 3.5.1 - [Release notes](https://github.com/Python-Markdown/markdown/releases) - [Changelog](https://github.com/Python-Markdown/markdown/blob/master/docs/changelog.md) - [Commits](Python-Markdown/markdown@3.4.4...3.5.1) Updates `mkdocs-macros-plugin` from 1.0.4 to 1.0.5 - [Release notes](https://github.com/fralau/mkdocs_macros_plugin/releases) - [Changelog](https://github.com/fralau/mkdocs_macros_plugin/blob/master/CHANGELOG.md) - [Commits](fralau/mkdocs-macros-plugin@v1.0.4...v1.0.5) Updates `mkdocs-material` from 9.3.1 to 9.5.3 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](squidfunk/mkdocs-material@9.3.1...9.5.3) Updates `mkdocstrings[python]` from 0.23.0 to 0.24.0 - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/mkdocstrings@0.23.0...0.24.0) Updates `mypy` from 1.5.1 to 1.8.0 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](python/mypy@v1.5.1...v1.8.0) Updates `types-markdown` from 3.4.2.10 to 3.5.0.3 - [Commits](https://github.com/python/typeshed/commits) Updates `types-pygments` from 2.16.0.0 to 2.17.0.0 - [Commits](https://github.com/python/typeshed/commits) Updates `pytest` from 7.4.2 to 7.4.4 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@7.4.2...7.4.4) Updates `pytest-mock` from 3.11.1 to 3.12.0 - [Release notes](https://github.com/pytest-dev/pytest-mock/releases) - [Changelog](https://github.com/pytest-dev/pytest-mock/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest-mock@v3.11.1...v3.12.0) Updates `pytest-asyncio` from 0.21.1 to 0.23.3 - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](pytest-dev/pytest-asyncio@v0.21.1...v0.23.3)
2 parents 3774461 + 66ff241 commit 57036aa

File tree

6 files changed

+49
-44
lines changed

6 files changed

+49
-44
lines changed

docs/_scripts/macros.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ def _slugify(text: str) -> str:
2929
Returns:
3030
The slugified text.
3131
"""
32-
# The type of the return value is not defined for the markdown library.
33-
# Also for some reason `mypy` thinks the `toc` module doesn't have a
34-
# `slugify_unicode` function, but it definitely does.
35-
return toc.slugify_unicode(text, "-") # type: ignore[attr-defined,no-any-return]
32+
return toc.slugify_unicode(text, "-")
3633

3734

3835
def _hook_macros_plugin(env: macros.MacrosPlugin) -> None:

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ plugins:
9696
alias_type: redirect
9797
canonical_version: latest
9898
- mkdocstrings:
99-
custom_templates: templates
10099
default_handler: python
101100
handlers:
102101
python:

pyproject.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,28 @@ dev-flake8 = [
5454
"flake8 == 6.1.0",
5555
"flake8-docstrings == 1.7.0",
5656
"flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
57-
"pydoclint == 0.3.3",
57+
"pydoclint == 0.3.8",
5858
"pydocstyle == 6.3.0",
5959
]
60-
dev-examples = ["polars == 0.19.3"]
61-
dev-formatting = ["black == 23.9.1", "isort == 5.12.0"]
60+
dev-examples = ["polars == 0.20.2"]
61+
dev-formatting = ["black == 23.12.1", "isort == 5.13.2"]
6262
dev-mkdocs = [
63-
"black == 23.9.1",
64-
"Markdown==3.4.4",
63+
"black == 23.12.1",
64+
"Markdown==3.5.1",
6565
"mike == 2.0.0",
6666
"mkdocs-gen-files == 0.5.0",
6767
"mkdocs-literate-nav == 0.6.1",
68-
"mkdocs-macros-plugin == 1.0.4",
69-
"mkdocs-material == 9.3.1",
70-
"mkdocstrings[python] == 0.23.0",
68+
"mkdocs-macros-plugin == 1.0.5",
69+
"mkdocs-material == 9.5.3",
70+
"mkdocstrings[python] == 0.24.0",
7171
"frequenz-repo-config[lib] == 0.7.4",
7272
]
7373
dev-mypy = [
74-
"mypy == 1.5.1",
74+
"mypy == 1.8.0",
7575
"grpc-stubs == 1.24.12", # This dependency introduces breaking changes in patch releases
76-
"types-Markdown == 3.4.2.10",
76+
"types-Markdown == 3.5.0.3",
7777
"types-PyYAML == 6.0.12.12",
78-
"types-Pygments == 2.16.0.0",
78+
"types-Pygments == 2.17.0.0",
7979
"types-colorama == 0.4.15.12",
8080
"types-protobuf == 4.24.0.4",
8181
"types-python-dateutil == 2.8.19.14",
@@ -91,10 +91,10 @@ dev-pylint = [
9191
"frequenz-sdk[dev-mkdocs,dev-noxfile,dev-pytest]",
9292
]
9393
dev-pytest = [
94-
"pytest == 7.4.2",
94+
"pytest == 7.4.4",
9595
"frequenz-repo-config[extra-lint-examples] == 0.7.4",
96-
"pytest-mock == 3.11.1",
97-
"pytest-asyncio == 0.21.1",
96+
"pytest-mock == 3.12.0",
97+
"pytest-asyncio == 0.23.3",
9898
"time-machine == 2.12.0",
9999
"async-solipsism == 0.5",
100100
# For checking docstring code examples

src/frequenz/sdk/timeseries/_resampling.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from collections.abc import AsyncIterator, Callable, Coroutine, Sequence
1515
from dataclasses import dataclass
1616
from datetime import datetime, timedelta, timezone
17+
from typing import cast
1718

1819
from frequenz.channels.util import Timer
1920
from frequenz.channels.util._timer import _to_microseconds
@@ -501,13 +502,19 @@ async def resample(self, *, one_shot: bool = False) -> None:
501502
)
502503

503504
self._window_end += self._config.resampling_period
504-
exceptions = {
505-
source: results[i]
506-
for i, source in enumerate(self._resamplers)
507-
# CancelledError inherits from BaseException, but we don't want
508-
# to catch *all* BaseExceptions here.
509-
if isinstance(results[i], (Exception, asyncio.CancelledError))
510-
}
505+
# We need the cast because mypy is not able to infer that this can only
506+
# contain Exception | CancelledError because of the condition in the list
507+
# comprehension below.
508+
exceptions = cast(
509+
dict[Source, Exception | asyncio.CancelledError],
510+
{
511+
source: results[i]
512+
for i, source in enumerate(self._resamplers)
513+
# CancelledError inherits from BaseException, but we don't want
514+
# to catch *all* BaseExceptions here.
515+
if isinstance(results[i], (Exception, asyncio.CancelledError))
516+
},
517+
)
511518
if exceptions:
512519
raise ResamplingError(exceptions)
513520
if one_shot:

src/frequenz/sdk/timeseries/formula_engine/_formula_engine.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,34 +54,36 @@
5454
}
5555
"""The dictionary of operator precedence for the shunting yard algorithm."""
5656

57+
58+
# The `FormulaEngine*` and `HigherOrderFormulaBuilder*` classes are generic, but
59+
# `TypeVar`s can't be defined on generic types, so we need to use `# type: ignore` to
60+
# avoid mypy errors, and they get treated as `FormulaEngine[Any]`, etc.
61+
#
62+
# This is not ideal, but it's the best we can do until mypy supports generic types with
63+
# `TypeVar`s.
5764
_CompositionType = Union[
58-
"FormulaEngine",
59-
"HigherOrderFormulaBuilder",
60-
"FormulaEngine3Phase",
61-
"HigherOrderFormulaBuilder3Phase",
65+
"FormulaEngine", # type: ignore[type-arg]
66+
"HigherOrderFormulaBuilder", # type: ignore[type-arg]
67+
"FormulaEngine3Phase", # type: ignore[type-arg]
68+
"HigherOrderFormulaBuilder3Phase", # type: ignore[type-arg]
6269
]
6370

6471
_CompositionType1Phase = Union[
65-
"FormulaEngine",
66-
"HigherOrderFormulaBuilder",
72+
"FormulaEngine", # type: ignore[type-arg]
73+
"HigherOrderFormulaBuilder", # type: ignore[type-arg]
6774
]
6875

6976
_CompositionType3Phase = Union[
70-
"FormulaEngine3Phase",
71-
"HigherOrderFormulaBuilder3Phase",
77+
"FormulaEngine3Phase", # type: ignore[type-arg]
78+
"HigherOrderFormulaBuilder3Phase", # type: ignore[type-arg]
7279
]
7380

74-
# The `FormulaEngine*` and `HigherOrderFormulaBuilder*` classes are generic, but
75-
# `TypeVar`s can't be defined on generic types, so we need to use `# type: ignore` to
76-
# avoid mypy errors, and they get treated as `FormulaEngine[Any]`, etc.
77-
#
78-
# This is not ideal, but it's the best we can do until mypy supports generic types with
79-
# `TypeVar`s.
8081
_GenericEngine = TypeVar(
8182
"_GenericEngine",
8283
"FormulaEngine", # type: ignore
8384
"FormulaEngine3Phase", # type: ignore
8485
)
86+
8587
_GenericHigherOrderBuilder = TypeVar(
8688
"_GenericHigherOrderBuilder",
8789
"HigherOrderFormulaBuilder", # type: ignore

tests/microgrid/test_microgrid_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ def metadata(self) -> meta.Metadata:
102102
@mock.patch("grpc.aio.insecure_channel")
103103
async def test_connection_manager(
104104
self,
105-
_: MagicMock,
105+
_insecure_channel_mock: MagicMock,
106106
components: list[list[Component]],
107107
connections: list[list[Connection]],
108108
metadata: meta.Metadata,
109109
) -> None:
110110
"""Test microgrid api.
111111
112112
Args:
113-
_: insecure channel mock from `mock.patch`
113+
_insecure_channel_mock: insecure channel mock from `mock.patch`
114114
components: components
115115
connections: connections
116116
metadata: the metadata of the microgrid
@@ -179,15 +179,15 @@ async def test_connection_manager(
179179
@mock.patch("grpc.aio.insecure_channel")
180180
async def test_connection_manager_another_method(
181181
self,
182-
_: MagicMock,
182+
_insecure_channel_mock: MagicMock,
183183
components: list[list[Component]],
184184
connections: list[list[Connection]],
185185
metadata: meta.Metadata,
186186
) -> None:
187187
"""Test if the api was not deallocated.
188188
189189
Args:
190-
_: insecure channel mock
190+
_insecure_channel_mock: insecure channel mock
191191
components: components
192192
connections: connections
193193
metadata: the metadata of the microgrid

0 commit comments

Comments
 (0)