passagemath-docbuild 10.4.60__tar.gz → 10.4.62__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.
Files changed (27) hide show
  1. {passagemath_docbuild-10.4.60/passagemath_docbuild.egg-info → passagemath_docbuild-10.4.62}/PKG-INFO +1 -1
  2. passagemath_docbuild-10.4.62/VERSION.txt +1 -0
  3. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62/passagemath_docbuild.egg-info}/PKG-INFO +1 -1
  4. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/ext/sage_autodoc.py +67 -29
  5. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/utils.py +2 -1
  6. passagemath_docbuild-10.4.60/VERSION.txt +0 -1
  7. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/MANIFEST.in +0 -0
  8. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/README.rst +0 -0
  9. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/passagemath_docbuild.egg-info/SOURCES.txt +0 -0
  10. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/passagemath_docbuild.egg-info/dependency_links.txt +0 -0
  11. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/passagemath_docbuild.egg-info/requires.txt +0 -0
  12. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/passagemath_docbuild.egg-info/top_level.txt +0 -0
  13. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/pyproject.toml +0 -0
  14. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/requirements.txt +0 -0
  15. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/__init__.py +0 -0
  16. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/__main__.py +0 -0
  17. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/build_options.py +0 -0
  18. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/builders.py +0 -0
  19. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/conf.py +0 -0
  20. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/ext/__init__.py +0 -0
  21. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/ext/inventory_builder.py +0 -0
  22. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/ext/multidocs.py +0 -0
  23. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/sphinxbuild.py +0 -0
  24. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/sage_docbuild/vendor.py +0 -0
  25. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/setup.cfg +0 -0
  26. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/setup.py +0 -0
  27. {passagemath_docbuild-10.4.60 → passagemath_docbuild-10.4.62}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: passagemath-docbuild
3
- Version: 10.4.60
3
+ Version: 10.4.62
4
4
  Summary: passagemath: Build system of the Sage documentation
5
5
  Author-email: The Sage Developers <sage-support@googlegroups.com>
6
6
  License: GNU General Public License (GPL) v2 or later
@@ -0,0 +1 @@
1
+ 10.4.62
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: passagemath-docbuild
3
- Version: 10.4.60
3
+ Version: 10.4.62
4
4
  Summary: passagemath: Build system of the Sage documentation
5
5
  Author-email: The Sage Developers <sage-support@googlegroups.com>
6
6
  License: GNU General Public License (GPL) v2 or later
@@ -35,6 +35,8 @@ AUTHORS:
35
35
  - François Bissey (2024-08-24): rebased on Sphinx 8.0.2
36
36
 
37
37
  - François Bissey (2024-09-10): Tweaks to support python 3.9 (and older sphinx) as well
38
+
39
+ - François Bissey (2024-11-12): rebased on Sphinx 8.1.3 (while trying to keep python 3.9 compatibility)
38
40
  """
39
41
 
40
42
  from __future__ import annotations
@@ -44,7 +46,7 @@ import operator
44
46
  import sys
45
47
  import re
46
48
  from inspect import Parameter, Signature
47
- from typing import TYPE_CHECKING, Any, ClassVar, NewType, TypeVar
49
+ from typing import TYPE_CHECKING, Any, NewType, TypeVar
48
50
 
49
51
  from docutils.statemachine import StringList
50
52
 
@@ -86,11 +88,19 @@ def getdoc(obj, *args, **kwargs):
86
88
  if TYPE_CHECKING:
87
89
  from collections.abc import Callable, Iterator, Sequence
88
90
  from types import ModuleType
91
+ from typing import ClassVar, Literal, TypeAlias
89
92
 
90
93
  from sphinx.application import Sphinx
91
94
  from sphinx.environment import BuildEnvironment
92
95
  from sphinx.ext.autodoc.directive import DocumenterBridge
93
96
 
97
+ _AutodocObjType = Literal[
98
+ 'module', 'class', 'exception', 'function', 'method', 'attribute'
99
+ ]
100
+ _AutodocProcessDocstringListener: TypeAlias = Callable[
101
+ [Sphinx, _AutodocObjType, str, Any, dict[str, bool], list[str]], None
102
+ ]
103
+
94
104
  logger = logging.getLogger(__name__)
95
105
 
96
106
 
@@ -225,7 +235,9 @@ def merge_members_option(options: dict) -> None:
225
235
 
226
236
  # Some useful event listener factories for autodoc-process-docstring.
227
237
 
228
- def cut_lines(pre: int, post: int = 0, what: str | None = None) -> Callable:
238
+ def cut_lines(
239
+ pre: int, post: int = 0, what: Sequence[str] | None = None
240
+ ) -> _AutodocProcessDocstringListener:
229
241
  """Return a listener that removes the first *pre* and last *post*
230
242
  lines of every docstring. If *what* is a sequence of strings,
231
243
  only docstrings of a type in *what* will be processed.
@@ -233,7 +245,7 @@ def cut_lines(pre: int, post: int = 0, what: str | None = None) -> Callable:
233
245
  Use like this (e.g. in the ``setup()`` function of :file:`conf.py`)::
234
246
 
235
247
  from sphinx.ext.autodoc import cut_lines
236
- app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
248
+ app.connect('autodoc-process-docstring', cut_lines(4, what={'module'}))
237
249
 
238
250
  This can (and should) be used in place of ``automodule_skip_lines``.
239
251
  """
@@ -250,9 +262,22 @@ def cut_lines(pre: int, post: int = 0, what: str | None = None) -> Callable:
250
262
  #
251
263
  # ... in place of ``automodule_skip_lines``.
252
264
  # -------------------------------------------------------------------------
253
- def process(app: Sphinx, what_: str, name: str, obj: Any, options: Any, lines: list[str],
254
- ) -> None:
255
- if what and what_ not in what:
265
+ if not what:
266
+ what_unique: frozenset[str] = frozenset()
267
+ elif isinstance(what, str): # strongly discouraged
268
+ what_unique = frozenset({what})
269
+ else:
270
+ what_unique = frozenset(what)
271
+
272
+ def process(
273
+ app: Sphinx,
274
+ what_: _AutodocObjType,
275
+ name: str,
276
+ obj: Any,
277
+ options: dict[str, bool],
278
+ lines: list[str],
279
+ ) -> None:
280
+ if what_unique and what_ not in what_unique:
256
281
  return
257
282
  del lines[:pre]
258
283
  if post:
@@ -271,7 +296,7 @@ def between(
271
296
  what: Sequence[str] | None = None,
272
297
  keepempty: bool = False,
273
298
  exclude: bool = False,
274
- ) -> Callable:
299
+ ) -> _AutodocProcessDocstringListener:
275
300
  """Return a listener that either keeps, or if *exclude* is True excludes,
276
301
  lines between lines that match the *marker* regular expression. If no line
277
302
  matches, the resulting docstring would be empty, so no change will be made
@@ -282,8 +307,14 @@ def between(
282
307
  """
283
308
  marker_re = re.compile(marker)
284
309
 
285
- def process(app: Sphinx, what_: str, name: str, obj: Any, options: Any, lines: list[str],
286
- ) -> None:
310
+ def process(
311
+ app: Sphinx,
312
+ what_: _AutodocObjType,
313
+ name: str,
314
+ obj: Any,
315
+ options: dict[str, bool],
316
+ lines: list[str],
317
+ ) -> None:
287
318
  if what and what_ not in what:
288
319
  return
289
320
  deleted = 0
@@ -308,7 +339,7 @@ def between(
308
339
 
309
340
  # This class is used only in ``sphinx.ext.autodoc.directive``,
310
341
  # But we define this class here to keep compatibility (see #4538)
311
- class Options(dict):
342
+ class Options(dict[str, Any]):
312
343
  """A dict/attribute hybrid that returns None on nonexisting keys."""
313
344
 
314
345
  def copy(self) -> Options:
@@ -476,9 +507,10 @@ class Documenter:
476
507
  """
477
508
  with mock(self.config.autodoc_mock_imports):
478
509
  try:
479
- ret = import_object(self.modname, self.objpath, self.objtype,
480
- attrgetter=self.get_attr,
481
- warningiserror=self.config.autodoc_warningiserror)
510
+ ret = import_object(
511
+ self.modname, self.objpath, self.objtype,
512
+ attrgetter=self.get_attr,
513
+ )
482
514
  self.module, self.parent, self.object_name, self.object = ret
483
515
  if ismock(self.object):
484
516
  self.object = undecorate(self.object)
@@ -1145,7 +1177,8 @@ class ModuleDocumenter(Documenter):
1145
1177
  else:
1146
1178
  logger.warning(__('missing attribute mentioned in :members: option: '
1147
1179
  'module %s, attribute %s'),
1148
- safe_getattr(self.object, '__name__', '???', name),
1180
+ safe_getattr(self.object, '__name__', '???'),
1181
+ name,
1149
1182
  type='autodoc')
1150
1183
  return False, ret
1151
1184
 
@@ -2179,7 +2212,7 @@ class UninitializedGlobalVariableMixin(DataDocumenterMixinBase):
2179
2212
  # annotation only instance variable (PEP-526)
2180
2213
  try:
2181
2214
  with mock(self.config.autodoc_mock_imports):
2182
- parent = import_module(self.modname, self.config.autodoc_warningiserror)
2215
+ parent = import_module(self.modname)
2183
2216
  annotations = get_type_hints(parent, None,
2184
2217
  self.config.autodoc_type_aliases,
2185
2218
  include_extras=True)
@@ -2629,9 +2662,10 @@ class RuntimeInstanceAttributeMixin(DataDocumenterMixinBase):
2629
2662
  except ImportError as exc:
2630
2663
  try:
2631
2664
  with mock(self.config.autodoc_mock_imports):
2632
- ret = import_object(self.modname, self.objpath[:-1], 'class',
2633
- attrgetter=self.get_attr, # type: ignore[attr-defined]
2634
- warningiserror=self.config.autodoc_warningiserror)
2665
+ ret = import_object(
2666
+ self.modname, self.objpath[:-1], 'class',
2667
+ attrgetter=self.get_attr, # type: ignore[attr-defined]
2668
+ )
2635
2669
  parent = ret[3]
2636
2670
  if self.is_runtime_instance_attribute(parent):
2637
2671
  self.object = self.RUNTIME_INSTANCE_ATTRIBUTE
@@ -2676,16 +2710,17 @@ class UninitializedInstanceAttributeMixin(DataDocumenterMixinBase):
2676
2710
  return self.objpath[-1] in annotations
2677
2711
 
2678
2712
  def import_object(self, raiseerror: bool = False) -> bool:
2679
- """Check the exisitence of uninitialized instance attribute when failed to import
2713
+ """Check the existence of uninitialized instance attribute when failed to import
2680
2714
  the attribute.
2681
2715
  """
2682
2716
  try:
2683
2717
  return super().import_object(raiseerror=True) # type: ignore[misc]
2684
2718
  except ImportError as exc:
2685
2719
  try:
2686
- ret = import_object(self.modname, self.objpath[:-1], 'class',
2687
- attrgetter=self.get_attr, # type: ignore[attr-defined]
2688
- warningiserror=self.config.autodoc_warningiserror)
2720
+ ret = import_object(
2721
+ self.modname, self.objpath[:-1], 'class',
2722
+ attrgetter=self.get_attr, # type: ignore[attr-defined]
2723
+ )
2689
2724
  parent = ret[3]
2690
2725
  if self.is_uninitialized_instance_attribute(parent):
2691
2726
  self.object = UNINITIALIZED_ATTR
@@ -2760,9 +2795,7 @@ class AttributeDocumenter(GenericAliasMixin, SlotsMixin, # type: ignore[misc]
2760
2795
  if isinstance(type(member), ClasscallMetaclass):
2761
2796
  return True
2762
2797
  # ---------------------------------------------------------------------
2763
- if not inspect.isroutine(member) and not isinstance(member, type):
2764
- return True
2765
- return False
2798
+ return not inspect.isroutine(member) and not isinstance(member, type)
2766
2799
 
2767
2800
  def document_members(self, all_members: bool = False) -> None:
2768
2801
  pass
@@ -2918,7 +2951,7 @@ class PropertyDocumenter(DocstringStripSignatureMixin, # type: ignore[misc]
2918
2951
  return False
2919
2952
 
2920
2953
  def import_object(self, raiseerror: bool = False) -> bool:
2921
- """Check the exisitence of uninitialized instance attribute when failed to import
2954
+ """Check the existence of uninitialized instance attribute when failed to import
2922
2955
  the attribute.
2923
2956
  """
2924
2957
  ret = super().import_object(raiseerror)
@@ -2991,9 +3024,14 @@ class PropertyDocumenter(DocstringStripSignatureMixin, # type: ignore[misc]
2991
3024
 
2992
3025
  def autodoc_attrgetter(app: Sphinx, obj: Any, name: str, *defargs: Any) -> Any:
2993
3026
  """Alternative getattr() for types"""
2994
- for typ, func in app.registry.autodoc_attrgettrs.items():
2995
- if isinstance(obj, typ):
2996
- return func(obj, name, *defargs)
3027
+ try:
3028
+ for typ, func in app.registry.autodoc_attrgetters.items():
3029
+ if isinstance(obj, typ):
3030
+ return func(obj, name, *defargs)
3031
+ except AttributeError:
3032
+ for typ, func in app.registry.autodoc_attrgettrs.items():
3033
+ if isinstance(obj, typ):
3034
+ return func(obj, name, *defargs)
2997
3035
 
2998
3036
  return safe_getattr(obj, name, *defargs)
2999
3037
 
@@ -4,6 +4,7 @@ Utilities
4
4
 
5
5
  import errno
6
6
  import os
7
+ import platform
7
8
  import traceback
8
9
  from typing import Optional
9
10
 
@@ -193,7 +194,7 @@ def build_many(target, args, processes=None):
193
194
  # With OS X, Python 3.8 defaults to use 'spawn' instead of 'fork'
194
195
  # in multiprocessing, and Sage docbuilding doesn't work with
195
196
  # 'spawn'. See trac #27754.
196
- if os.uname().sysname == "Darwin":
197
+ if platform.system() == "Darwin":
197
198
  set_start_method("fork", force=True)
198
199
  from queue import Empty
199
200
 
@@ -1 +0,0 @@
1
- 10.4.60