Skip to content

Commit 02e3d95

Browse files
0.16 (#17)
1 parent a491775 commit 02e3d95

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: trailing-whitespace
1414

1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.7.4
16+
rev: v0.11.2
1717
hooks:
1818
- id: ruff
1919
name: ruff unused imports

.ruff.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ ignore = [
3434
"UP038", # Use X | Y in {} call instead of (X, Y)
3535

3636
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
37-
"ANN101", # Missing type annotation for {name} in method
38-
"ANN102", # Missing type annotation for {name} in classmethod
3937
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
4038

4139
# https://docs.astral.sh/ruff/rules/#flake8-blind-except-ble

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ This code will be executed
3636
```
3737

3838
# Changelog
39+
#### 0.16 (2025-04-01)
40+
- Fixed an issue where the ``hide`` and ``hide_output`` options were not working correctly
41+
3942
#### 0.15 (2024-12-10)
4043
- Removed confusing log output
4144

src/sphinx_exec_code/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.15'
1+
__version__ = '0.16'

src/sphinx_exec_code/sphinx_spec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def post_process_spec(spec: Dict[str, Any], options: Dict[str, Any]) -> None:
2424
raise NotImplementedError()
2525

2626
def __init__(self, spec: Dict[str, Any]) -> None:
27-
self.hide: Final = spec.pop('hide')
27+
self.hide: Final = spec.pop('hide', '<IS_FLAG>') is None
2828
self.language: Final = spec.pop('language')
2929
self.spec: Final = spec
3030

@@ -110,7 +110,7 @@ def name_to_alias(name: str) -> str:
110110
return name
111111

112112
@staticmethod
113-
def post_process_spec(spec: Dict[str, Any], options :Dict[str, Any]) -> None:
113+
def post_process_spec(spec: Dict[str, Any], options: Dict[str, Any]) -> None:
114114
return None
115115

116116
def __init__(self, **kwargs: Dict[str, Any]) -> None:

tests/test_sphinx_spec.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@ def test_spec_code() -> None:
1616
assert obj.filename == 'filename'
1717
assert obj.spec == {'caption': 'my_header', 'linenos': True}
1818

19+
obj = SpecCode.from_options({'hide_code': None})
20+
assert obj.hide is True
21+
22+
obj = SpecCode.from_options({'hide': None})
23+
assert obj.hide is True
24+
1925

2026
def test_spec_output() -> None:
21-
obj = SpecOutput.from_options({'hide_output': True, 'caption_output': 'my_header_out'})
27+
obj = SpecOutput.from_options({'hide_output': None, 'caption_output': 'my_header_out'})
2228
assert obj.hide is True
2329
assert obj.spec == {'caption': 'my_header_out'}
2430

31+
obj = SpecOutput.from_options({'caption_output': 'my_header_out'})
32+
assert obj.hide is False
33+
assert obj.spec == {'caption': 'my_header_out'}
34+
2535

2636
def test_invalid_options() -> None:
2737
with pytest.raises(ValueError) as e: # noqa: PT011

0 commit comments

Comments
 (0)