Skip to content

Commit b67ac34

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bep038
2 parents d088e6d + 3e69085 commit b67ac34

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

.github/workflows/schemacode_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
fetch-depth: 0
3535
- name: Install the latest version of uv
36-
uses: astral-sh/setup-uv@v6
36+
uses: astral-sh/setup-uv@v7
3737
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
3838
- name: "Build archive on tag"
3939
run: |
@@ -65,7 +65,7 @@ jobs:
6565
- uses: actions/checkout@v5
6666

6767
- name: Set up Python ${{ matrix.python-version }} (uv)
68-
uses: astral-sh/setup-uv@v6
68+
uses: astral-sh/setup-uv@v7
6969
with:
7070
python-version: ${{ matrix.python-version }}
7171
activate-environment: true

.github/workflows/validation.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
steps:
3939
- uses: actions/checkout@v5
40-
- uses: astral-sh/setup-uv@v6
40+
- uses: astral-sh/setup-uv@v7
4141
- name: Lint yml files in src/schema
4242
run: uvx yamllint -f standard src/schema/ -c .yamllint.yml
4343

@@ -46,7 +46,7 @@ jobs:
4646
runs-on: ubuntu-latest
4747
steps:
4848
- uses: actions/checkout@v5
49-
- uses: astral-sh/setup-uv@v6
49+
- uses: astral-sh/setup-uv@v7
5050
- run: uvx ruff format --diff
5151
- run: uvx ruff check
5252

@@ -55,7 +55,7 @@ jobs:
5555
runs-on: ubuntu-latest
5656
steps:
5757
- uses: actions/checkout@v5
58-
- uses: astral-sh/setup-uv@v6
58+
- uses: astral-sh/setup-uv@v7
5959
- name: Check for Latin phrases
6060
run: uv run tools/no-bad-latin.py
6161

@@ -64,7 +64,7 @@ jobs:
6464
runs-on: ubuntu-latest
6565
steps:
6666
- uses: actions/checkout@v5
67-
- uses: astral-sh/setup-uv@v6
67+
- uses: astral-sh/setup-uv@v7
6868
- name: Validate CITATION.cff
6969
run: uvx cffconvert --validate
7070
- name: Check for Zenodo compatibility

tools/schemacode/src/bidsschematools/render/tsv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
from markdown_it import MarkdownIt
88
from tabulate import tabulate
99

10-
from ..utils import filter_warnings, in_context
10+
from ..utils import WarningsFilter, in_context
1111
from .utils import propagate_fence_exception
1212

1313

14-
@in_context(filter_warnings(["error"]))
1514
@propagate_fence_exception
15+
@in_context(WarningsFilter(["error"]))
1616
def fence(
1717
source: str,
1818
language: str,

tools/schemacode/src/bidsschematools/utils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,19 @@ def wrapper(*args, **kwargs):
179179
return decorator
180180

181181

182-
@contextmanager
183-
def filter_warnings(*filters):
182+
class WarningsFilter:
184183
"""Context manager to apply warning filters.
185184
186185
Arguments are lists of positional arguments to :func:`warnings.filterwarnings`.
187186
"""
187+
def __init__(self, *filters):
188+
self.filters = filters
188189

189-
with warnings.catch_warnings():
190-
for filt in filters:
190+
def __enter__(self):
191+
self.catcher = warnings.catch_warnings()
192+
self.catcher.__enter__()
193+
for filt in self.filters:
191194
warnings.filterwarnings(*filt)
192-
yield
195+
196+
def __exit__(self, exc_type, exc_value, traceback):
197+
self.catcher.__exit__(exc_type, exc_value, traceback)

0 commit comments

Comments
 (0)