Skip to content

Commit acb46d8

Browse files
authored
Merge branch 'master' into improved-typing
2 parents 3b6926e + 35889f7 commit acb46d8

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ jobs:
5050
5151
- name: Upload to Codecov
5252
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.11
53-
uses: codecov/codecov-action@v4
53+
uses: codecov/codecov-action@v5
5454
with:
55-
name: pytests-py3.11
56-
flags: pytests
57-
file: ./coverage.xml
5855
fail_ci_if_error: true
59-
env:
60-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
56+
files: ./coverage.xml
57+
flags: pytests
58+
name: pytests-py3.11
59+
token: ${{ secrets.CODECOV_TOKEN }}
6160

6261
pre-commit-hook:
6362
runs-on: ubuntu-latest

mdformat_pyproject/plugin.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Main plugin module."""
22

3-
import functools
43
import pathlib
54
import sys
65
from typing import MutableMapping, Optional, Sequence, Union
@@ -14,11 +13,18 @@
1413
else:
1514
import tomli as tomllib
1615

16+
if sys.version_info >= (3, 9):
17+
from functools import cache
18+
else:
19+
from functools import lru_cache
20+
21+
cache = lru_cache()
22+
1723

1824
_ConfigOptions = MutableMapping[str, Union[int, str, Sequence[str]]]
1925

2026

21-
@functools.lru_cache()
27+
@cache
2228
def _find_pyproject_toml_path(search_path: str) -> Optional[pathlib.Path]:
2329
"""Find the pyproject.toml file that corresponds to the search path.
2430
@@ -41,7 +47,7 @@ def _find_pyproject_toml_path(search_path: str) -> Optional[pathlib.Path]:
4147
return None
4248

4349

44-
@functools.lru_cache()
50+
@cache
4551
def _parse_pyproject(pyproject_path: pathlib.Path) -> Optional[_ConfigOptions]:
4652
"""Extract and validate the mdformat options from the pyproject.toml file.
4753
@@ -57,7 +63,7 @@ def _parse_pyproject(pyproject_path: pathlib.Path) -> Optional[_ConfigOptions]:
5763
return options
5864

5965

60-
@functools.lru_cache()
66+
@cache
6167
def _reload_cli_opts() -> _ConfigOptions:
6268
"""Re-parse the sys.argv array to deduce which arguments were used in the CLI.
6369

mdformat_pyproject/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)