sphinxnotes-project 1.0a47__tar.gz → 1.0a49__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinxnotes_project-1.0a47/src/sphinxnotes_project.egg-info → sphinxnotes_project-1.0a49}/PKG-INFO +2 -1
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/pyproject.toml +1 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/sphinxnotes_render_ext.py +16 -2
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49/src/sphinxnotes_project.egg-info}/PKG-INFO +2 -1
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes_project.egg-info/SOURCES.txt +2 -1
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes_project.egg-info/requires.txt +1 -0
- sphinxnotes_project-1.0a49/tests/test_render_ext.py +49 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.cruft.json +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/lint.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/pages.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/pypi.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/release.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/tag.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.github/workflows/test.yml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.gitignore +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/.pre-commit-config.yaml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/AGENTS.md +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/LICENSE +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/MANIFEST.in +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/Makefile +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/README.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/Makefile +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/_images/.gitkeep +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/_static/.gitkeep +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/_static/custom.css +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/_static/sphinx-notes.png +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/changelog.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/conf.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/conf.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/index.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/make.bat +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/requirements.txt +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/docs/sphinxnotes_any.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/ruff.toml +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/setup.cfg +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/__init__.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/meta.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/py.typed +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/sphinxnotes_any.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/templates/autoconfval.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/templates/autoobj.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/templates/example.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/templates/internal-only.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/templates/version.rst +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/utils/__init__.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes_project.egg-info/dependency_links.txt +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes_project.egg-info/top_level.txt +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/tests/__init__.py +0 -0
- {sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/tests/test_always_pass.py +0 -0
{sphinxnotes_project-1.0a47/src/sphinxnotes_project.egg-info → sphinxnotes_project-1.0a49}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sphinxnotes-project
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.0a49
|
|
4
4
|
Summary: A Sphinx extension that provides useful directives for creating project documentation
|
|
5
5
|
Author: Shengyu Zhang
|
|
6
6
|
Maintainer: Shengyu Zhang
|
|
@@ -25,6 +25,7 @@ Description-Content-Type: text/x-rst
|
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: Sphinx>=7.0
|
|
27
27
|
Requires-Dist: sphinxnotes-any>=3.0b0
|
|
28
|
+
Requires-Dist: sphinxnotes-render
|
|
28
29
|
Requires-Dist: sphinx_design
|
|
29
30
|
Provides-Extra: dev
|
|
30
31
|
Requires-Dist: build; extra == "dev"
|
|
@@ -11,7 +11,8 @@ See also https://sphinx.silverrainz.me/render/.
|
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
from __future__ import annotations
|
|
14
|
-
from typing import TYPE_CHECKING
|
|
14
|
+
from typing import TYPE_CHECKING, get_args, get_origin
|
|
15
|
+
import types as pytypes
|
|
15
16
|
|
|
16
17
|
from sphinx.config import ENUM
|
|
17
18
|
from sphinxnotes.render import filter
|
|
@@ -25,10 +26,23 @@ if TYPE_CHECKING:
|
|
|
25
26
|
from sphinx.environment import BuildEnvironment
|
|
26
27
|
|
|
27
28
|
|
|
29
|
+
def _fmt_type(t) -> str:
|
|
30
|
+
origin = get_origin(t)
|
|
31
|
+
args = get_args(t)
|
|
32
|
+
if origin is pytypes.UnionType:
|
|
33
|
+
return ' | '.join(_fmt_type(a) for a in args)
|
|
34
|
+
if t is type(None):
|
|
35
|
+
return 'None'
|
|
36
|
+
if origin is not None:
|
|
37
|
+
args_str = ', '.join(_fmt_type(a) for a in args)
|
|
38
|
+
return f'{_fmt_type(origin)}[{args_str}]'
|
|
39
|
+
return t.__name__
|
|
40
|
+
|
|
41
|
+
|
|
28
42
|
def _format_autoconfval_types(valid_types) -> list[str]:
|
|
29
43
|
if isinstance(valid_types, ENUM):
|
|
30
44
|
return [f'``{c!r}``' for c in sorted(valid_types._candidates)] # pyright: ignore[reportPrivateUsage]
|
|
31
|
-
return [f':py:`{t
|
|
45
|
+
return [f':py:`{_fmt_type(t)}`' for t in valid_types]
|
|
32
46
|
|
|
33
47
|
|
|
34
48
|
@filter('autoconfval_types')
|
{sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49/src/sphinxnotes_project.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sphinxnotes-project
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.0a49
|
|
4
4
|
Summary: A Sphinx extension that provides useful directives for creating project documentation
|
|
5
5
|
Author: Shengyu Zhang
|
|
6
6
|
Maintainer: Shengyu Zhang
|
|
@@ -25,6 +25,7 @@ Description-Content-Type: text/x-rst
|
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
Requires-Dist: Sphinx>=7.0
|
|
27
27
|
Requires-Dist: sphinxnotes-any>=3.0b0
|
|
28
|
+
Requires-Dist: sphinxnotes-render
|
|
28
29
|
Requires-Dist: sphinx_design
|
|
29
30
|
Provides-Extra: dev
|
|
30
31
|
Requires-Dist: build; extra == "dev"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Tests for sphinxnotes_render_ext."""
|
|
2
|
+
|
|
3
|
+
from sphinxnotes.project.sphinxnotes_render_ext import _fmt_type, _format_autoconfval_types
|
|
4
|
+
from sphinx.config import ENUM
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TestFmtType:
|
|
8
|
+
def test_simple_type(self):
|
|
9
|
+
assert _fmt_type(str) == 'str'
|
|
10
|
+
assert _fmt_type(int) == 'int'
|
|
11
|
+
assert _fmt_type(float) == 'float'
|
|
12
|
+
assert _fmt_type(bool) == 'bool'
|
|
13
|
+
|
|
14
|
+
def test_none_type(self):
|
|
15
|
+
assert _fmt_type(type(None)) == 'None'
|
|
16
|
+
|
|
17
|
+
def test_bare_generic(self):
|
|
18
|
+
assert _fmt_type(list) == 'list'
|
|
19
|
+
assert _fmt_type(dict) == 'dict'
|
|
20
|
+
|
|
21
|
+
def test_generic_alias(self):
|
|
22
|
+
assert _fmt_type(list[str]) == 'list[str]'
|
|
23
|
+
assert _fmt_type(dict[str, int]) == 'dict[str, int]'
|
|
24
|
+
assert _fmt_type(set[int]) == 'set[int]'
|
|
25
|
+
|
|
26
|
+
def test_nested_generic(self):
|
|
27
|
+
assert _fmt_type(dict[str, list[int]]) == 'dict[str, list[int]]'
|
|
28
|
+
|
|
29
|
+
def test_union_type(self):
|
|
30
|
+
assert _fmt_type(str | None) == 'str | None'
|
|
31
|
+
assert _fmt_type(int | str) == 'int | str'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class TestFormatAutoconfvalTypes:
|
|
35
|
+
def test_enum(self):
|
|
36
|
+
result = _format_autoconfval_types(ENUM('tab', 'grid'))
|
|
37
|
+
assert result == ["``'grid'``", "``'tab'``"]
|
|
38
|
+
|
|
39
|
+
def test_simple_types(self):
|
|
40
|
+
result = _format_autoconfval_types(frozenset({str, int}))
|
|
41
|
+
assert set(result) == {':py:`str`', ':py:`int`'}
|
|
42
|
+
|
|
43
|
+
def test_generic_alias(self):
|
|
44
|
+
result = _format_autoconfval_types(frozenset({list[str]}))
|
|
45
|
+
assert result == [':py:`list[str]`']
|
|
46
|
+
|
|
47
|
+
def test_mixed_types(self):
|
|
48
|
+
result = _format_autoconfval_types(frozenset({list[str], str}))
|
|
49
|
+
assert set(result) == {':py:`list[str]`', ':py:`str`'}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/sphinxnotes_any.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sphinxnotes_project-1.0a47 → sphinxnotes_project-1.0a49}/src/sphinxnotes/project/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|