|
9 | 9 | import os
|
10 | 10 | import sys
|
11 | 11 | import time
|
| 12 | + |
12 | 13 | sys.path.append(os.path.abspath('tools/extensions'))
|
13 | 14 | sys.path.append(os.path.abspath('includes'))
|
14 | 15 |
|
|
30 | 31 |
|
31 | 32 | # Skip if downstream redistributors haven't installed it
|
32 | 33 | try:
|
33 |
| - import sphinxext.opengraph |
| 34 | + import sphinxext.opengraph # noqa: F401 |
34 | 35 | except ImportError:
|
35 | 36 | pass
|
36 | 37 | else:
|
|
57 | 58 |
|
58 | 59 | # We look for the Include/patchlevel.h file in the current Python source tree
|
59 | 60 | # and replace the values accordingly.
|
60 |
| -import patchlevel |
| 61 | +import patchlevel # noqa: E402 |
| 62 | + |
61 | 63 | version, release = patchlevel.get_version_info()
|
62 | 64 |
|
63 | 65 | rst_epilog = f"""
|
|
282 | 284 |
|
283 | 285 | # Disable Docutils smartquotes for several translations
|
284 | 286 | smartquotes_excludes = {
|
285 |
| - 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'], |
| 287 | + 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], |
| 288 | + 'builders': ['man', 'text'], |
286 | 289 | }
|
287 | 290 |
|
288 | 291 | # Avoid a warning with Sphinx >= 4.0
|
|
303 | 306 | 'collapsiblesidebar': True,
|
304 | 307 | 'issues_url': '/bugs.html',
|
305 | 308 | 'license_url': '/license.html',
|
306 |
| - 'root_include_title': False # We use the version switcher instead. |
| 309 | + 'root_include_title': False, # We use the version switcher instead. |
307 | 310 | }
|
308 | 311 |
|
309 | 312 | if os.getenv("READTHEDOCS"):
|
310 |
| - html_theme_options["hosted_on"] = '<a href="https://about.readthedocs.com/">Read the Docs</a>' |
| 313 | + html_theme_options["hosted_on"] = ( |
| 314 | + '<a href="https://about.readthedocs.com/">Read the Docs</a>' |
| 315 | + ) |
311 | 316 |
|
312 | 317 | # Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
|
313 | 318 | # https://github.com/python/cpython/issues/91207
|
|
321 | 326 |
|
322 | 327 | # Deployment preview information
|
323 | 328 | # (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
|
324 |
| -repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL") |
| 329 | +is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external" |
| 330 | +repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL", "") |
| 331 | +repository_url = repository_url.removesuffix(".git") |
325 | 332 | html_context = {
|
326 |
| - "is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external", |
327 |
| - "repository_url": repository_url.removesuffix(".git") if repository_url else None, |
| 333 | + "is_deployment_preview": is_deployment_preview, |
| 334 | + "repository_url": repository_url or None, |
328 | 335 | "pr_id": os.getenv("READTHEDOCS_VERSION"),
|
329 | 336 | "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
|
330 | 337 | }
|
331 | 338 |
|
332 | 339 | # This 'Last updated on:' timestamp is inserted at the bottom of every page.
|
333 | 340 | html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
|
334 |
| -html_last_updated_fmt = time.strftime('%b %d, %Y (%H:%M UTC)', time.gmtime(html_time)) |
| 341 | +html_last_updated_fmt = time.strftime( |
| 342 | + '%b %d, %Y (%H:%M UTC)', time.gmtime(html_time) |
| 343 | +) |
335 | 344 |
|
336 | 345 | # Path to find HTML templates.
|
337 | 346 | templates_path = ['tools/templates']
|
|
391 | 400 | # (source start file, target name, title, author, document class [howto/manual]).
|
392 | 401 | _stdauthor = 'Guido van Rossum and the Python development team'
|
393 | 402 | latex_documents = [
|
394 |
| - ('c-api/index', 'c-api.tex', |
395 |
| - 'The Python/C API', _stdauthor, 'manual'), |
396 |
| - ('extending/index', 'extending.tex', |
397 |
| - 'Extending and Embedding Python', _stdauthor, 'manual'), |
398 |
| - ('installing/index', 'installing.tex', |
399 |
| - 'Installing Python Modules', _stdauthor, 'manual'), |
400 |
| - ('library/index', 'library.tex', |
401 |
| - 'The Python Library Reference', _stdauthor, 'manual'), |
402 |
| - ('reference/index', 'reference.tex', |
403 |
| - 'The Python Language Reference', _stdauthor, 'manual'), |
404 |
| - ('tutorial/index', 'tutorial.tex', |
405 |
| - 'Python Tutorial', _stdauthor, 'manual'), |
406 |
| - ('using/index', 'using.tex', |
407 |
| - 'Python Setup and Usage', _stdauthor, 'manual'), |
408 |
| - ('faq/index', 'faq.tex', |
409 |
| - 'Python Frequently Asked Questions', _stdauthor, 'manual'), |
410 |
| - ('whatsnew/' + version, 'whatsnew.tex', |
411 |
| - 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
| 403 | + ('c-api/index', 'c-api.tex', 'The Python/C API', _stdauthor, 'manual'), |
| 404 | + ( |
| 405 | + 'extending/index', |
| 406 | + 'extending.tex', |
| 407 | + 'Extending and Embedding Python', |
| 408 | + _stdauthor, |
| 409 | + 'manual', |
| 410 | + ), |
| 411 | + ( |
| 412 | + 'installing/index', |
| 413 | + 'installing.tex', |
| 414 | + 'Installing Python Modules', |
| 415 | + _stdauthor, |
| 416 | + 'manual', |
| 417 | + ), |
| 418 | + ( |
| 419 | + 'library/index', |
| 420 | + 'library.tex', |
| 421 | + 'The Python Library Reference', |
| 422 | + _stdauthor, |
| 423 | + 'manual', |
| 424 | + ), |
| 425 | + ( |
| 426 | + 'reference/index', |
| 427 | + 'reference.tex', |
| 428 | + 'The Python Language Reference', |
| 429 | + _stdauthor, |
| 430 | + 'manual', |
| 431 | + ), |
| 432 | + ( |
| 433 | + 'tutorial/index', |
| 434 | + 'tutorial.tex', |
| 435 | + 'Python Tutorial', |
| 436 | + _stdauthor, |
| 437 | + 'manual', |
| 438 | + ), |
| 439 | + ( |
| 440 | + 'using/index', |
| 441 | + 'using.tex', |
| 442 | + 'Python Setup and Usage', |
| 443 | + _stdauthor, |
| 444 | + 'manual', |
| 445 | + ), |
| 446 | + ( |
| 447 | + 'faq/index', |
| 448 | + 'faq.tex', |
| 449 | + 'Python Frequently Asked Questions', |
| 450 | + _stdauthor, |
| 451 | + 'manual', |
| 452 | + ), |
| 453 | + ( |
| 454 | + 'whatsnew/' + version, |
| 455 | + 'whatsnew.tex', |
| 456 | + 'What\'s New in Python', |
| 457 | + 'A. M. Kuchling', |
| 458 | + 'howto', |
| 459 | + ), |
412 | 460 | ]
|
413 | 461 | # Collect all HOWTOs individually
|
414 |
| -latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
415 |
| - '', _stdauthor, 'howto') |
416 |
| - for fn in os.listdir('howto') |
417 |
| - if fn.endswith('.rst') and fn != 'index.rst') |
| 462 | +latex_documents.extend( |
| 463 | + ('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', '', _stdauthor, 'howto') |
| 464 | + for fn in os.listdir('howto') |
| 465 | + if fn.endswith('.rst') and fn != 'index.rst' |
| 466 | +) |
418 | 467 |
|
419 | 468 | # Documents to append as an appendix to all manuals.
|
420 | 469 | latex_appendices = ['glossary', 'about', 'license', 'copyright']
|
|
443 | 492 | 'test($|_)',
|
444 | 493 | ]
|
445 | 494 |
|
446 |
| -coverage_ignore_classes = [ |
447 |
| -] |
| 495 | +coverage_ignore_classes = [] |
448 | 496 |
|
449 | 497 | # Glob patterns for C source files for C API coverage, relative to this directory.
|
450 | 498 | coverage_c_path = [
|
|
461 | 509 | # The coverage checker will ignore all C items whose names match these regexes
|
462 | 510 | # (using re.match) -- the keys must be the same as in coverage_c_regexes.
|
463 | 511 | coverage_ignore_c_items = {
|
464 |
| -# 'cfunction': [...] |
| 512 | + # 'cfunction': [...] |
465 | 513 | }
|
466 | 514 |
|
467 | 515 |
|
|
0 commit comments