|
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 them
|
32 | 33 | try:
|
33 |
| - import notfound.extension |
| 34 | + import notfound.extension # noqa: F401 |
34 | 35 | except ImportError:
|
35 | 36 | pass
|
36 | 37 | else:
|
37 | 38 | extensions.append('notfound.extension')
|
38 | 39 | try:
|
39 |
| - import sphinxext.opengraph |
| 40 | + import sphinxext.opengraph # noqa: F401 |
40 | 41 | except ImportError:
|
41 | 42 | pass
|
42 | 43 | else:
|
|
63 | 64 |
|
64 | 65 | # We look for the Include/patchlevel.h file in the current Python source tree
|
65 | 66 | # and replace the values accordingly.
|
66 |
| -import patchlevel |
| 67 | +import patchlevel # noqa: E402 |
| 68 | + |
67 | 69 | version, release = patchlevel.get_version_info()
|
68 | 70 |
|
69 | 71 | rst_epilog = f"""
|
|
298 | 300 |
|
299 | 301 | # Disable Docutils smartquotes for several translations
|
300 | 302 | smartquotes_excludes = {
|
301 |
| - 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], 'builders': ['man', 'text'], |
| 303 | + 'languages': ['ja', 'fr', 'zh_TW', 'zh_CN'], |
| 304 | + 'builders': ['man', 'text'], |
302 | 305 | }
|
303 | 306 |
|
304 | 307 | # Avoid a warning with Sphinx >= 4.0
|
|
319 | 322 | 'collapsiblesidebar': True,
|
320 | 323 | 'issues_url': '/bugs.html',
|
321 | 324 | 'license_url': '/license.html',
|
322 |
| - 'root_include_title': False # We use the version switcher instead. |
| 325 | + 'root_include_title': False, # We use the version switcher instead. |
323 | 326 | }
|
324 | 327 |
|
325 | 328 | if os.getenv("READTHEDOCS"):
|
326 |
| - html_theme_options["hosted_on"] = '<a href="https://about.readthedocs.com/">Read the Docs</a>' |
| 329 | + html_theme_options["hosted_on"] = ( |
| 330 | + '<a href="https://about.readthedocs.com/">Read the Docs</a>' |
| 331 | + ) |
327 | 332 |
|
328 | 333 | # Override stylesheet fingerprinting for Windows CHM htmlhelp to fix GH-91207
|
329 | 334 | # https://github.com/python/cpython/issues/91207
|
|
337 | 342 |
|
338 | 343 | # Deployment preview information
|
339 | 344 | # (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html)
|
340 |
| -repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL") |
| 345 | +is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external" |
| 346 | +repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL", "") |
| 347 | +repository_url = repository_url.removesuffix(".git") |
341 | 348 | html_context = {
|
342 |
| - "is_deployment_preview": os.getenv("READTHEDOCS_VERSION_TYPE") == "external", |
343 |
| - "repository_url": repository_url.removesuffix(".git") if repository_url else None, |
| 349 | + "is_deployment_preview": is_deployment_preview, |
| 350 | + "repository_url": repository_url or None, |
344 | 351 | "pr_id": os.getenv("READTHEDOCS_VERSION"),
|
345 | 352 | "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"),
|
346 | 353 | }
|
347 | 354 |
|
348 | 355 | # This 'Last updated on:' timestamp is inserted at the bottom of every page.
|
349 | 356 | html_time = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
|
350 |
| -html_last_updated_fmt = time.strftime('%b %d, %Y (%H:%M UTC)', time.gmtime(html_time)) |
| 357 | +html_last_updated_fmt = time.strftime( |
| 358 | + '%b %d, %Y (%H:%M UTC)', time.gmtime(html_time) |
| 359 | +) |
351 | 360 |
|
352 | 361 | # Path to find HTML templates.
|
353 | 362 | templates_path = ['tools/templates']
|
|
407 | 416 | # (source start file, target name, title, author, document class [howto/manual]).
|
408 | 417 | _stdauthor = 'Guido van Rossum and the Python development team'
|
409 | 418 | latex_documents = [
|
410 |
| - ('c-api/index', 'c-api.tex', |
411 |
| - 'The Python/C API', _stdauthor, 'manual'), |
412 |
| - ('extending/index', 'extending.tex', |
413 |
| - 'Extending and Embedding Python', _stdauthor, 'manual'), |
414 |
| - ('installing/index', 'installing.tex', |
415 |
| - 'Installing Python Modules', _stdauthor, 'manual'), |
416 |
| - ('library/index', 'library.tex', |
417 |
| - 'The Python Library Reference', _stdauthor, 'manual'), |
418 |
| - ('reference/index', 'reference.tex', |
419 |
| - 'The Python Language Reference', _stdauthor, 'manual'), |
420 |
| - ('tutorial/index', 'tutorial.tex', |
421 |
| - 'Python Tutorial', _stdauthor, 'manual'), |
422 |
| - ('using/index', 'using.tex', |
423 |
| - 'Python Setup and Usage', _stdauthor, 'manual'), |
424 |
| - ('faq/index', 'faq.tex', |
425 |
| - 'Python Frequently Asked Questions', _stdauthor, 'manual'), |
426 |
| - ('whatsnew/' + version, 'whatsnew.tex', |
427 |
| - 'What\'s New in Python', 'A. M. Kuchling', 'howto'), |
| 419 | + ('c-api/index', 'c-api.tex', 'The Python/C API', _stdauthor, 'manual'), |
| 420 | + ( |
| 421 | + 'extending/index', |
| 422 | + 'extending.tex', |
| 423 | + 'Extending and Embedding Python', |
| 424 | + _stdauthor, |
| 425 | + 'manual', |
| 426 | + ), |
| 427 | + ( |
| 428 | + 'installing/index', |
| 429 | + 'installing.tex', |
| 430 | + 'Installing Python Modules', |
| 431 | + _stdauthor, |
| 432 | + 'manual', |
| 433 | + ), |
| 434 | + ( |
| 435 | + 'library/index', |
| 436 | + 'library.tex', |
| 437 | + 'The Python Library Reference', |
| 438 | + _stdauthor, |
| 439 | + 'manual', |
| 440 | + ), |
| 441 | + ( |
| 442 | + 'reference/index', |
| 443 | + 'reference.tex', |
| 444 | + 'The Python Language Reference', |
| 445 | + _stdauthor, |
| 446 | + 'manual', |
| 447 | + ), |
| 448 | + ( |
| 449 | + 'tutorial/index', |
| 450 | + 'tutorial.tex', |
| 451 | + 'Python Tutorial', |
| 452 | + _stdauthor, |
| 453 | + 'manual', |
| 454 | + ), |
| 455 | + ( |
| 456 | + 'using/index', |
| 457 | + 'using.tex', |
| 458 | + 'Python Setup and Usage', |
| 459 | + _stdauthor, |
| 460 | + 'manual', |
| 461 | + ), |
| 462 | + ( |
| 463 | + 'faq/index', |
| 464 | + 'faq.tex', |
| 465 | + 'Python Frequently Asked Questions', |
| 466 | + _stdauthor, |
| 467 | + 'manual', |
| 468 | + ), |
| 469 | + ( |
| 470 | + 'whatsnew/' + version, |
| 471 | + 'whatsnew.tex', |
| 472 | + 'What\'s New in Python', |
| 473 | + 'A. M. Kuchling', |
| 474 | + 'howto', |
| 475 | + ), |
428 | 476 | ]
|
429 | 477 | # Collect all HOWTOs individually
|
430 |
| -latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', |
431 |
| - '', _stdauthor, 'howto') |
432 |
| - for fn in os.listdir('howto') |
433 |
| - if fn.endswith('.rst') and fn != 'index.rst') |
| 478 | +latex_documents.extend( |
| 479 | + ('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', '', _stdauthor, 'howto') |
| 480 | + for fn in os.listdir('howto') |
| 481 | + if fn.endswith('.rst') and fn != 'index.rst' |
| 482 | +) |
434 | 483 |
|
435 | 484 | # Documents to append as an appendix to all manuals.
|
436 | 485 | latex_appendices = ['glossary', 'about', 'license', 'copyright']
|
|
458 | 507 | 'test($|_)',
|
459 | 508 | ]
|
460 | 509 |
|
461 |
| -coverage_ignore_classes = [ |
462 |
| -] |
| 510 | +coverage_ignore_classes = [] |
463 | 511 |
|
464 | 512 | # Glob patterns for C source files for C API coverage, relative to this directory.
|
465 | 513 | coverage_c_path = [
|
|
476 | 524 | # The coverage checker will ignore all C items whose names match these regexes
|
477 | 525 | # (using re.match) -- the keys must be the same as in coverage_c_regexes.
|
478 | 526 | coverage_ignore_c_items = {
|
479 |
| -# 'cfunction': [...] |
| 527 | + # 'cfunction': [...] |
480 | 528 | }
|
481 | 529 |
|
482 | 530 |
|
|
0 commit comments