|
1 | 1 | # Matplotlib documentation build configuration file, created by |
2 | 2 | # sphinx-quickstart on Fri May 2 12:33:25 2008. |
3 | 3 | # |
4 | | -# This file is execfile()d with the current directory set to its containing dir. |
| 4 | +# This file is execfile()d with the current directory set to its containing |
| 5 | +# dir. |
5 | 6 | # |
6 | 7 | # The contents of this file are pickled, so don't put values in the namespace |
7 | | -# that aren't pickleable (module imports are okay, they're removed automatically). |
| 8 | +# that aren't pickleable (module imports are okay, they're removed |
| 9 | +# automatically). |
8 | 10 | # |
9 | 11 | # All configuration values have a default value; values that are commented out |
10 | 12 | # serve to show the default value. |
|
30 | 32 |
|
31 | 33 | # Parse year using SOURCE_DATE_EPOCH, falling back to current time. |
32 | 34 | # https://reproducible-builds.org/specs/source-date-epoch/ |
33 | | -sourceyear = datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year |
| 35 | +sourceyear = datetime.utcfromtimestamp( |
| 36 | + int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year |
34 | 37 |
|
35 | 38 | # If your extensions are in another directory, add it here. If the directory |
36 | 39 | # is relative to the documentation root, use os.path.abspath to make it |
@@ -226,9 +229,11 @@ def _check_dependencies(): |
226 | 229 | } |
227 | 230 |
|
228 | 231 | project = 'Matplotlib' |
229 | | -copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, ' |
230 | | - 'Michael Droettboom and the Matplotlib development ' |
231 | | - f'team; 2012 - {sourceyear} The Matplotlib development team') |
| 232 | +copyright = ( |
| 233 | + '2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom ' |
| 234 | + 'and the Matplotlib development team; ' |
| 235 | + f'2012 - {sourceyear} The Matplotlib development team' |
| 236 | +) |
232 | 237 |
|
233 | 238 |
|
234 | 239 | # The default replacements for |version| and |release|, also used in various |
@@ -389,8 +394,10 @@ def _check_dependencies(): |
389 | 394 | # The paper size ('letter' or 'a4'). |
390 | 395 | latex_paper_size = 'letter' |
391 | 396 |
|
392 | | -# Grouping the document tree into LaTeX files. List of tuples |
393 | | -# (source start file, target name, title, author, document class [howto/manual]). |
| 397 | +# Grouping the document tree into LaTeX files. |
| 398 | +# List of tuples: |
| 399 | +# (source start file, target name, title, author, |
| 400 | +# document class [howto/manual]) |
394 | 401 |
|
395 | 402 | latex_documents = [ |
396 | 403 | ('contents', 'Matplotlib.tex', 'Matplotlib', |
@@ -618,23 +625,19 @@ def linkcode_resolve(domain, info): |
618 | 625 | except (OSError, TypeError): |
619 | 626 | lineno = None |
620 | 627 |
|
621 | | - if lineno: |
622 | | - linespec = "#L%d-L%d" % (lineno, lineno + len(source) - 1) |
623 | | - else: |
624 | | - linespec = "" |
| 628 | + linespec = (f"#L{lineno:d}-L{lineno + len(source) - 1:d}" |
| 629 | + if lineno else "") |
625 | 630 |
|
626 | 631 | startdir = Path(matplotlib.__file__).parent.parent |
627 | 632 | fn = os.path.relpath(fn, start=startdir).replace(os.path.sep, '/') |
628 | 633 |
|
629 | 634 | if not fn.startswith(('matplotlib/', 'mpl_toolkits/')): |
630 | 635 | return None |
631 | 636 |
|
632 | | - m = re.match(r'^.*post[0-9]+\+\w([a-z0-9]+).\w+$', matplotlib.__version__) |
633 | | - if m: |
634 | | - return "https://github.com/matplotlib/matplotlib/blob/%s/lib/%s%s" % ( |
635 | | - m.group(1), fn, linespec) |
636 | | - else: |
637 | | - return "https://github.com/matplotlib/matplotlib/blob/v%s/lib/%s%s" % ( |
638 | | - matplotlib.__version__, fn, linespec) |
| 637 | + m = re.match(r'^.*post[0-9]+\+\w([a-z0-9]+).\w+$', |
| 638 | + matplotlib.__version__) |
| 639 | + version = m.group(1) if m else f'v{matplotlib.__version__}' |
| 640 | + return ("https://github.com/matplotlib/matplotlib/blob" |
| 641 | + f"/{version}/lib/{fn}{linespec}") |
639 | 642 | else: |
640 | 643 | extensions.append('sphinx.ext.viewcode') |
0 commit comments