Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__init__.py +42 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__pycache__/__init__.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__pycache__/exceptions.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/_cext.pyi +228 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/exceptions.py +51 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/py.typed +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.py +1576 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.pyi +124 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_afm.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_blocking_input.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm_bivar.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm_multivar.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_color_data.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_constrained_layout.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_enums.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_fontconfig_pattern.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_layoutgrid.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_mathtext.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_mathtext_data.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_pylab_helpers.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_text_helpers.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_tight_bbox.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_tight_layout.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/artist.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/axis.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/backend_managers.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/backend_tools.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/category.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/cm.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/collections.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/colorbar.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/colorizer.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/container.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/contour.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/dates.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/dviread.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/font_manager.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/gridspec.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/hatch.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/image.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/inset.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/layout_engine.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/legend.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/legend_handler.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/lines.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/markers.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/mathtext.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/mlab.cpython-310.pyc +0 -0
- Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/offsetbox.cpython-310.pyc +0 -0
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__init__.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# --------------------------------------------------------------------------------------
|
| 2 |
+
# Copyright (c) 2013-2024, Nucleic Development Team.
|
| 3 |
+
#
|
| 4 |
+
# Distributed under the terms of the Modified BSD License.
|
| 5 |
+
#
|
| 6 |
+
# The full license is in the file LICENSE, distributed with this software.
|
| 7 |
+
# --------------------------------------------------------------------------------------
|
| 8 |
+
from ._cext import (
|
| 9 |
+
Constraint,
|
| 10 |
+
Expression,
|
| 11 |
+
Solver,
|
| 12 |
+
Term,
|
| 13 |
+
Variable,
|
| 14 |
+
__kiwi_version__,
|
| 15 |
+
__version__,
|
| 16 |
+
strength,
|
| 17 |
+
)
|
| 18 |
+
from .exceptions import (
|
| 19 |
+
BadRequiredStrength,
|
| 20 |
+
DuplicateConstraint,
|
| 21 |
+
DuplicateEditVariable,
|
| 22 |
+
UnknownConstraint,
|
| 23 |
+
UnknownEditVariable,
|
| 24 |
+
UnsatisfiableConstraint,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
__all__ = [
|
| 28 |
+
"BadRequiredStrength",
|
| 29 |
+
"Constraint",
|
| 30 |
+
"DuplicateConstraint",
|
| 31 |
+
"DuplicateEditVariable",
|
| 32 |
+
"Expression",
|
| 33 |
+
"Solver",
|
| 34 |
+
"Term",
|
| 35 |
+
"UnknownConstraint",
|
| 36 |
+
"UnknownEditVariable",
|
| 37 |
+
"UnsatisfiableConstraint",
|
| 38 |
+
"Variable",
|
| 39 |
+
"__kiwi_version__",
|
| 40 |
+
"__version__",
|
| 41 |
+
"strength",
|
| 42 |
+
]
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (700 Bytes). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/__pycache__/exce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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# --------------------------------------------------------------------------------------
|
| 2 |
+
# Copyright (c) 2021-2024, Nucleic Development Team.
|
| 3 |
+
#
|
| 4 |
+
# Distributed under the terms of the Modified BSD License.
|
| 5 |
+
#
|
| 6 |
+
# The full license is in the file LICENSE, distributed with this software.
|
| 7 |
+
# --------------------------------------------------------------------------------------
|
| 8 |
+
|
| 9 |
+
from typing import Any, Iterable, NoReturn, Tuple, type_check_only
|
| 10 |
+
|
| 11 |
+
try:
|
| 12 |
+
from typing import Literal
|
| 13 |
+
except ImportError:
|
| 14 |
+
from typing_extensions import Literal # type: ignore
|
| 15 |
+
|
| 16 |
+
__version__: str
|
| 17 |
+
__kiwi_version__: str
|
| 18 |
+
|
| 19 |
+
# Types
|
| 20 |
+
@type_check_only
|
| 21 |
+
class Strength:
|
| 22 |
+
@property
|
| 23 |
+
def weak(self) -> float: ...
|
| 24 |
+
@property
|
| 25 |
+
def medium(self) -> float: ...
|
| 26 |
+
@property
|
| 27 |
+
def strong(self) -> float: ...
|
| 28 |
+
@property
|
| 29 |
+
def required(self) -> float: ...
|
| 30 |
+
def create(
|
| 31 |
+
self,
|
| 32 |
+
a: int | float,
|
| 33 |
+
b: int | float,
|
| 34 |
+
c: int | float,
|
| 35 |
+
weight: int | float = 1.0,
|
| 36 |
+
/,
|
| 37 |
+
) -> float: ...
|
| 38 |
+
|
| 39 |
+
# This is meant as a singleton and users should not access the Strength type.
|
| 40 |
+
strength: Strength
|
| 41 |
+
|
| 42 |
+
class Variable:
|
| 43 |
+
"""Variable to express a constraint in a solver."""
|
| 44 |
+
|
| 45 |
+
__hash__: None # type: ignore
|
| 46 |
+
def __init__(self, name: str = "", context: Any = None, /) -> None: ...
|
| 47 |
+
def name(self) -> str:
|
| 48 |
+
"""Get the name of the variable."""
|
| 49 |
+
...
|
| 50 |
+
def setName(self, name: str, /) -> Any:
|
| 51 |
+
"""Set the name of the variable."""
|
| 52 |
+
...
|
| 53 |
+
def value(self) -> float:
|
| 54 |
+
"""Get the current value of the variable."""
|
| 55 |
+
...
|
| 56 |
+
def context(self) -> Any:
|
| 57 |
+
"""Get the context object associated with the variable."""
|
| 58 |
+
...
|
| 59 |
+
def setContext(self, context: Any, /) -> Any:
|
| 60 |
+
"""Set the context object associated with the variable."""
|
| 61 |
+
...
|
| 62 |
+
def __neg__(self) -> Term: ...
|
| 63 |
+
def __add__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 64 |
+
def __radd__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 65 |
+
def __sub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 66 |
+
def __rsub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 67 |
+
def __mul__(self, other: float) -> Term: ...
|
| 68 |
+
def __rmul__(self, other: float) -> Term: ...
|
| 69 |
+
def __truediv__(self, other: float) -> Term: ...
|
| 70 |
+
def __rtruediv__(self, other: float) -> Term: ...
|
| 71 |
+
def __eq__(self, other: float | Variable | Term | Expression) -> Constraint: ... # type: ignore
|
| 72 |
+
def __ge__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 73 |
+
def __le__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 74 |
+
def __ne__(self, other: Any) -> NoReturn: ...
|
| 75 |
+
def __gt__(self, other: Any) -> NoReturn: ...
|
| 76 |
+
def __lt__(self, other: Any) -> NoReturn: ...
|
| 77 |
+
|
| 78 |
+
class Term:
|
| 79 |
+
"""Product of a variable by a constant pre-factor."""
|
| 80 |
+
|
| 81 |
+
__hash__: None # type: ignore
|
| 82 |
+
def __init__(
|
| 83 |
+
self, variable: Variable, coefficient: int | float = 1.0, /
|
| 84 |
+
) -> None: ...
|
| 85 |
+
def coefficient(self) -> float:
|
| 86 |
+
"""Get the coefficient for the term."""
|
| 87 |
+
...
|
| 88 |
+
def variable(self) -> Variable:
|
| 89 |
+
"""Get the variable for the term."""
|
| 90 |
+
...
|
| 91 |
+
def value(self) -> float:
|
| 92 |
+
"""Get the value for the term."""
|
| 93 |
+
...
|
| 94 |
+
def __neg__(self) -> Term: ...
|
| 95 |
+
def __add__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 96 |
+
def __radd__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 97 |
+
def __sub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 98 |
+
def __rsub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 99 |
+
def __mul__(self, other: float) -> Term: ...
|
| 100 |
+
def __rmul__(self, other: float) -> Term: ...
|
| 101 |
+
def __truediv__(self, other: float) -> Term: ...
|
| 102 |
+
def __rtruediv__(self, other: float) -> Term: ...
|
| 103 |
+
def __eq__(self, other: float | Variable | Term | Expression) -> Constraint: ... # type: ignore
|
| 104 |
+
def __ge__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 105 |
+
def __le__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 106 |
+
def __ne__(self, other: Any) -> NoReturn: ...
|
| 107 |
+
def __gt__(self, other: Any) -> NoReturn: ...
|
| 108 |
+
def __lt__(self, other: Any) -> NoReturn: ...
|
| 109 |
+
|
| 110 |
+
class Expression:
|
| 111 |
+
"""Sum of terms and an additional constant."""
|
| 112 |
+
|
| 113 |
+
__hash__: None # type: ignore
|
| 114 |
+
def __init__(
|
| 115 |
+
self, terms: Iterable[Term], constant: int | float = 0.0, /
|
| 116 |
+
) -> None: ...
|
| 117 |
+
def constant(self) -> float:
|
| 118 |
+
"" "Get the constant for the expression." ""
|
| 119 |
+
...
|
| 120 |
+
def terms(self) -> Tuple[Term, ...]:
|
| 121 |
+
"""Get the tuple of terms for the expression."""
|
| 122 |
+
...
|
| 123 |
+
def value(self) -> float:
|
| 124 |
+
"""Get the value for the expression."""
|
| 125 |
+
...
|
| 126 |
+
def __neg__(self) -> Expression: ...
|
| 127 |
+
def __add__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 128 |
+
def __radd__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 129 |
+
def __sub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 130 |
+
def __rsub__(self, other: float | Variable | Term | Expression) -> Expression: ...
|
| 131 |
+
def __mul__(self, other: float) -> Expression: ...
|
| 132 |
+
def __rmul__(self, other: float) -> Expression: ...
|
| 133 |
+
def __truediv__(self, other: float) -> Expression: ...
|
| 134 |
+
def __rtruediv__(self, other: float) -> Expression: ...
|
| 135 |
+
def __eq__(self, other: float | Variable | Term | Expression) -> Constraint: ... # type: ignore
|
| 136 |
+
def __ge__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 137 |
+
def __le__(self, other: float | Variable | Term | Expression) -> Constraint: ...
|
| 138 |
+
def __ne__(self, other: Any) -> NoReturn: ...
|
| 139 |
+
def __gt__(self, other: Any) -> NoReturn: ...
|
| 140 |
+
def __lt__(self, other: Any) -> NoReturn: ...
|
| 141 |
+
|
| 142 |
+
class Constraint:
|
| 143 |
+
def __init__(
|
| 144 |
+
self,
|
| 145 |
+
expression: Expression,
|
| 146 |
+
op: Literal["=="] | Literal["<="] | Literal[">="],
|
| 147 |
+
strength: float
|
| 148 |
+
| Literal["weak"]
|
| 149 |
+
| Literal["medium"]
|
| 150 |
+
| Literal["strong"]
|
| 151 |
+
| Literal["required"] = "required",
|
| 152 |
+
/,
|
| 153 |
+
) -> None: ...
|
| 154 |
+
def expression(self) -> Expression:
|
| 155 |
+
"""Get the expression object for the constraint."""
|
| 156 |
+
...
|
| 157 |
+
def op(self) -> Literal["=="] | Literal["<="] | Literal[">="]:
|
| 158 |
+
"""Get the relational operator for the constraint."""
|
| 159 |
+
...
|
| 160 |
+
def strength(self) -> float:
|
| 161 |
+
"""Get the strength for the constraint."""
|
| 162 |
+
...
|
| 163 |
+
def violated(self) -> bool:
|
| 164 |
+
"""Indicate if the constraint is violated in teh current state of the solver."""
|
| 165 |
+
...
|
| 166 |
+
def __or__(
|
| 167 |
+
self,
|
| 168 |
+
other: float
|
| 169 |
+
| Literal["weak"]
|
| 170 |
+
| Literal["medium"]
|
| 171 |
+
| Literal["strong"]
|
| 172 |
+
| Literal["required"],
|
| 173 |
+
) -> Constraint: ...
|
| 174 |
+
def __ror__(
|
| 175 |
+
self,
|
| 176 |
+
other: float
|
| 177 |
+
| Literal["weak"]
|
| 178 |
+
| Literal["medium"]
|
| 179 |
+
| Literal["strong"]
|
| 180 |
+
| Literal["required"],
|
| 181 |
+
) -> Constraint: ...
|
| 182 |
+
|
| 183 |
+
class Solver:
|
| 184 |
+
"""Kiwi solver class."""
|
| 185 |
+
|
| 186 |
+
def __init__(self) -> None: ...
|
| 187 |
+
def addConstraint(self, constraint: Constraint, /) -> None:
|
| 188 |
+
"""Add a constraint to the solver."""
|
| 189 |
+
...
|
| 190 |
+
def removeConstraint(self, constraint: Constraint, /) -> None:
|
| 191 |
+
"""Remove a constraint from the solver."""
|
| 192 |
+
...
|
| 193 |
+
def hasConstraint(self, constraint: Constraint, /) -> bool:
|
| 194 |
+
"""Check whether the solver contains a constraint."""
|
| 195 |
+
...
|
| 196 |
+
def addEditVariable(
|
| 197 |
+
self,
|
| 198 |
+
variable: Variable,
|
| 199 |
+
strength: float
|
| 200 |
+
| Literal["weak"]
|
| 201 |
+
| Literal["medium"]
|
| 202 |
+
| Literal["strong"]
|
| 203 |
+
| Literal["required"],
|
| 204 |
+
/,
|
| 205 |
+
) -> None:
|
| 206 |
+
"""Add an edit variable to the solver."""
|
| 207 |
+
...
|
| 208 |
+
def removeEditVariable(self, variable: Variable, /) -> None:
|
| 209 |
+
"""Remove an edit variable from the solver."""
|
| 210 |
+
...
|
| 211 |
+
def hasEditVariable(self, variable: Variable, /) -> bool:
|
| 212 |
+
"""Check whether the solver contains an edit variable."""
|
| 213 |
+
...
|
| 214 |
+
def suggestValue(self, variable: Variable, value: int | float, /) -> None:
|
| 215 |
+
"""Suggest a desired value for an edit variable."""
|
| 216 |
+
...
|
| 217 |
+
def updateVariables(self) -> None:
|
| 218 |
+
"""Update the values of the solver variables."""
|
| 219 |
+
...
|
| 220 |
+
def reset(self) -> None:
|
| 221 |
+
"""Reset the solver to the initial empty starting condition."""
|
| 222 |
+
...
|
| 223 |
+
def dump(self) -> None:
|
| 224 |
+
"""Dump a representation of the solver internals to stdout."""
|
| 225 |
+
...
|
| 226 |
+
def dumps(self) -> str:
|
| 227 |
+
"""Dump a representation of the solver internals to a string."""
|
| 228 |
+
...
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/kiwisolver/exceptions.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# --------------------------------------------------------------------------------------
|
| 2 |
+
# Copyright (c) 2023-2024, Nucleic Development Team.
|
| 3 |
+
#
|
| 4 |
+
# Distributed under the terms of the Modified BSD License.
|
| 5 |
+
#
|
| 6 |
+
# The full license is in the file LICENSE, distributed with this software.
|
| 7 |
+
# --------------------------------------------------------------------------------------
|
| 8 |
+
"""Kiwi exceptions.
|
| 9 |
+
|
| 10 |
+
Imported by the kiwisolver C extension.
|
| 11 |
+
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class BadRequiredStrength(Exception):
|
| 16 |
+
pass
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class DuplicateConstraint(Exception):
|
| 20 |
+
__slots__ = ("constraint",)
|
| 21 |
+
|
| 22 |
+
def __init__(self, constraint):
|
| 23 |
+
self.constraint = constraint
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class DuplicateEditVariable(Exception):
|
| 27 |
+
__slots__ = ("edit_variable",)
|
| 28 |
+
|
| 29 |
+
def __init__(self, edit_variable):
|
| 30 |
+
self.edit_variable = edit_variable
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class UnknownConstraint(Exception):
|
| 34 |
+
__slots__ = ("constraint",)
|
| 35 |
+
|
| 36 |
+
def __init__(self, constraint):
|
| 37 |
+
self.constraint = constraint
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class UnknownEditVariable(Exception):
|
| 41 |
+
__slots__ = ("edit_variable",)
|
| 42 |
+
|
| 43 |
+
def __init__(self, edit_variable):
|
| 44 |
+
self.edit_variable = edit_variable
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class UnsatisfiableConstraint(Exception):
|
| 48 |
+
__slots__ = ("constraint",)
|
| 49 |
+
|
| 50 |
+
def __init__(self, constraint):
|
| 51 |
+
self.constraint = constraint
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
An object-oriented plotting library.
|
| 3 |
+
|
| 4 |
+
A procedural interface is provided by the companion pyplot module,
|
| 5 |
+
which may be imported directly, e.g.::
|
| 6 |
+
|
| 7 |
+
import matplotlib.pyplot as plt
|
| 8 |
+
|
| 9 |
+
or using ipython::
|
| 10 |
+
|
| 11 |
+
ipython
|
| 12 |
+
|
| 13 |
+
at your terminal, followed by::
|
| 14 |
+
|
| 15 |
+
In [1]: %matplotlib
|
| 16 |
+
In [2]: import matplotlib.pyplot as plt
|
| 17 |
+
|
| 18 |
+
at the ipython shell prompt.
|
| 19 |
+
|
| 20 |
+
For the most part, direct use of the explicit object-oriented library is
|
| 21 |
+
encouraged when programming; the implicit pyplot interface is primarily for
|
| 22 |
+
working interactively. The exceptions to this suggestion are the pyplot
|
| 23 |
+
functions `.pyplot.figure`, `.pyplot.subplot`, `.pyplot.subplots`, and
|
| 24 |
+
`.pyplot.savefig`, which can greatly simplify scripting. See
|
| 25 |
+
:ref:`api_interfaces` for an explanation of the tradeoffs between the implicit
|
| 26 |
+
and explicit interfaces.
|
| 27 |
+
|
| 28 |
+
Modules include:
|
| 29 |
+
|
| 30 |
+
:mod:`matplotlib.axes`
|
| 31 |
+
The `~.axes.Axes` class. Most pyplot functions are wrappers for
|
| 32 |
+
`~.axes.Axes` methods. The axes module is the highest level of OO
|
| 33 |
+
access to the library.
|
| 34 |
+
|
| 35 |
+
:mod:`matplotlib.figure`
|
| 36 |
+
The `.Figure` class.
|
| 37 |
+
|
| 38 |
+
:mod:`matplotlib.artist`
|
| 39 |
+
The `.Artist` base class for all classes that draw things.
|
| 40 |
+
|
| 41 |
+
:mod:`matplotlib.lines`
|
| 42 |
+
The `.Line2D` class for drawing lines and markers.
|
| 43 |
+
|
| 44 |
+
:mod:`matplotlib.patches`
|
| 45 |
+
Classes for drawing polygons.
|
| 46 |
+
|
| 47 |
+
:mod:`matplotlib.text`
|
| 48 |
+
The `.Text` and `.Annotation` classes.
|
| 49 |
+
|
| 50 |
+
:mod:`matplotlib.image`
|
| 51 |
+
The `.AxesImage` and `.FigureImage` classes.
|
| 52 |
+
|
| 53 |
+
:mod:`matplotlib.collections`
|
| 54 |
+
Classes for efficient drawing of groups of lines or polygons.
|
| 55 |
+
|
| 56 |
+
:mod:`matplotlib.colors`
|
| 57 |
+
Color specifications and making colormaps.
|
| 58 |
+
|
| 59 |
+
:mod:`matplotlib.cm`
|
| 60 |
+
Colormaps, and the `.ScalarMappable` mixin class for providing color
|
| 61 |
+
mapping functionality to other classes.
|
| 62 |
+
|
| 63 |
+
:mod:`matplotlib.ticker`
|
| 64 |
+
Calculation of tick mark locations and formatting of tick labels.
|
| 65 |
+
|
| 66 |
+
:mod:`matplotlib.backends`
|
| 67 |
+
A subpackage with modules for various GUI libraries and output formats.
|
| 68 |
+
|
| 69 |
+
The base matplotlib namespace includes:
|
| 70 |
+
|
| 71 |
+
`~matplotlib.rcParams`
|
| 72 |
+
Default configuration settings; their defaults may be overridden using
|
| 73 |
+
a :file:`matplotlibrc` file.
|
| 74 |
+
|
| 75 |
+
`~matplotlib.use`
|
| 76 |
+
Setting the Matplotlib backend. This should be called before any
|
| 77 |
+
figure is created, because it is not possible to switch between
|
| 78 |
+
different GUI backends after that.
|
| 79 |
+
|
| 80 |
+
The following environment variables can be used to customize the behavior:
|
| 81 |
+
|
| 82 |
+
:envvar:`MPLBACKEND`
|
| 83 |
+
This optional variable can be set to choose the Matplotlib backend. See
|
| 84 |
+
:ref:`what-is-a-backend`.
|
| 85 |
+
|
| 86 |
+
:envvar:`MPLCONFIGDIR`
|
| 87 |
+
This is the directory used to store user customizations to
|
| 88 |
+
Matplotlib, as well as some caches to improve performance. If
|
| 89 |
+
:envvar:`MPLCONFIGDIR` is not defined, :file:`{HOME}/.config/matplotlib`
|
| 90 |
+
and :file:`{HOME}/.cache/matplotlib` are used on Linux, and
|
| 91 |
+
:file:`{HOME}/.matplotlib` on other platforms, if they are
|
| 92 |
+
writable. Otherwise, the Python standard library's `tempfile.gettempdir`
|
| 93 |
+
is used to find a base directory in which the :file:`matplotlib`
|
| 94 |
+
subdirectory is created.
|
| 95 |
+
|
| 96 |
+
Matplotlib was initially written by John D. Hunter (1968-2012) and is now
|
| 97 |
+
developed and maintained by a host of others.
|
| 98 |
+
|
| 99 |
+
Occasionally the internal documentation (python docstrings) will refer
|
| 100 |
+
to MATLAB®, a registered trademark of The MathWorks, Inc.
|
| 101 |
+
|
| 102 |
+
"""
|
| 103 |
+
|
| 104 |
+
__all__ = [
|
| 105 |
+
"__bibtex__",
|
| 106 |
+
"__version__",
|
| 107 |
+
"__version_info__",
|
| 108 |
+
"set_loglevel",
|
| 109 |
+
"ExecutableNotFoundError",
|
| 110 |
+
"get_configdir",
|
| 111 |
+
"get_cachedir",
|
| 112 |
+
"get_data_path",
|
| 113 |
+
"matplotlib_fname",
|
| 114 |
+
"MatplotlibDeprecationWarning",
|
| 115 |
+
"RcParams",
|
| 116 |
+
"rc_params",
|
| 117 |
+
"rc_params_from_file",
|
| 118 |
+
"rcParamsDefault",
|
| 119 |
+
"rcParams",
|
| 120 |
+
"rcParamsOrig",
|
| 121 |
+
"defaultParams",
|
| 122 |
+
"rc",
|
| 123 |
+
"rcdefaults",
|
| 124 |
+
"rc_file_defaults",
|
| 125 |
+
"rc_file",
|
| 126 |
+
"rc_context",
|
| 127 |
+
"use",
|
| 128 |
+
"get_backend",
|
| 129 |
+
"interactive",
|
| 130 |
+
"is_interactive",
|
| 131 |
+
"colormaps",
|
| 132 |
+
"multivar_colormaps",
|
| 133 |
+
"bivar_colormaps",
|
| 134 |
+
"color_sequences",
|
| 135 |
+
]
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
import atexit
|
| 139 |
+
from collections import namedtuple
|
| 140 |
+
from collections.abc import MutableMapping
|
| 141 |
+
import contextlib
|
| 142 |
+
import functools
|
| 143 |
+
import importlib
|
| 144 |
+
import inspect
|
| 145 |
+
from inspect import Parameter
|
| 146 |
+
import locale
|
| 147 |
+
import logging
|
| 148 |
+
import os
|
| 149 |
+
from pathlib import Path
|
| 150 |
+
import pprint
|
| 151 |
+
import re
|
| 152 |
+
import shutil
|
| 153 |
+
import subprocess
|
| 154 |
+
import sys
|
| 155 |
+
import tempfile
|
| 156 |
+
|
| 157 |
+
from packaging.version import parse as parse_version
|
| 158 |
+
|
| 159 |
+
# cbook must import matplotlib only within function
|
| 160 |
+
# definitions, so it is safe to import from it here.
|
| 161 |
+
from . import _api, _version, cbook, _docstring, rcsetup
|
| 162 |
+
from matplotlib._api import MatplotlibDeprecationWarning
|
| 163 |
+
from matplotlib.rcsetup import cycler # noqa: F401
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
_log = logging.getLogger(__name__)
|
| 167 |
+
|
| 168 |
+
__bibtex__ = r"""@Article{Hunter:2007,
|
| 169 |
+
Author = {Hunter, J. D.},
|
| 170 |
+
Title = {Matplotlib: A 2D graphics environment},
|
| 171 |
+
Journal = {Computing in Science \& Engineering},
|
| 172 |
+
Volume = {9},
|
| 173 |
+
Number = {3},
|
| 174 |
+
Pages = {90--95},
|
| 175 |
+
abstract = {Matplotlib is a 2D graphics package used for Python
|
| 176 |
+
for application development, interactive scripting, and
|
| 177 |
+
publication-quality image generation across user
|
| 178 |
+
interfaces and operating systems.},
|
| 179 |
+
publisher = {IEEE COMPUTER SOC},
|
| 180 |
+
year = 2007
|
| 181 |
+
}"""
|
| 182 |
+
|
| 183 |
+
# modelled after sys.version_info
|
| 184 |
+
_VersionInfo = namedtuple('_VersionInfo',
|
| 185 |
+
'major, minor, micro, releaselevel, serial')
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def _parse_to_version_info(version_str):
|
| 189 |
+
"""
|
| 190 |
+
Parse a version string to a namedtuple analogous to sys.version_info.
|
| 191 |
+
|
| 192 |
+
See:
|
| 193 |
+
https://packaging.pypa.io/en/latest/version.html#packaging.version.parse
|
| 194 |
+
https://docs.python.org/3/library/sys.html#sys.version_info
|
| 195 |
+
"""
|
| 196 |
+
v = parse_version(version_str)
|
| 197 |
+
if v.pre is None and v.post is None and v.dev is None:
|
| 198 |
+
return _VersionInfo(v.major, v.minor, v.micro, 'final', 0)
|
| 199 |
+
elif v.dev is not None:
|
| 200 |
+
return _VersionInfo(v.major, v.minor, v.micro, 'alpha', v.dev)
|
| 201 |
+
elif v.pre is not None:
|
| 202 |
+
releaselevel = {
|
| 203 |
+
'a': 'alpha',
|
| 204 |
+
'b': 'beta',
|
| 205 |
+
'rc': 'candidate'}.get(v.pre[0], 'alpha')
|
| 206 |
+
return _VersionInfo(v.major, v.minor, v.micro, releaselevel, v.pre[1])
|
| 207 |
+
else:
|
| 208 |
+
# fallback for v.post: guess-next-dev scheme from setuptools_scm
|
| 209 |
+
return _VersionInfo(v.major, v.minor, v.micro + 1, 'alpha', v.post)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def _get_version():
|
| 213 |
+
"""Return the version string used for __version__."""
|
| 214 |
+
# Only shell out to a git subprocess if really needed, i.e. when we are in
|
| 215 |
+
# a matplotlib git repo but not in a shallow clone, such as those used by
|
| 216 |
+
# CI, as the latter would trigger a warning from setuptools_scm.
|
| 217 |
+
root = Path(__file__).resolve().parents[2]
|
| 218 |
+
if ((root / ".matplotlib-repo").exists()
|
| 219 |
+
and (root / ".git").exists()
|
| 220 |
+
and not (root / ".git/shallow").exists()):
|
| 221 |
+
try:
|
| 222 |
+
import setuptools_scm
|
| 223 |
+
except ImportError:
|
| 224 |
+
pass
|
| 225 |
+
else:
|
| 226 |
+
return setuptools_scm.get_version(
|
| 227 |
+
root=root,
|
| 228 |
+
dist_name="matplotlib",
|
| 229 |
+
version_scheme="release-branch-semver",
|
| 230 |
+
local_scheme="node-and-date",
|
| 231 |
+
fallback_version=_version.version,
|
| 232 |
+
)
|
| 233 |
+
# Get the version from the _version.py file if not in repo or setuptools_scm is
|
| 234 |
+
# unavailable.
|
| 235 |
+
return _version.version
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
@_api.caching_module_getattr
|
| 239 |
+
class __getattr__:
|
| 240 |
+
__version__ = property(lambda self: _get_version())
|
| 241 |
+
__version_info__ = property(
|
| 242 |
+
lambda self: _parse_to_version_info(self.__version__))
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def _check_versions():
|
| 246 |
+
|
| 247 |
+
# Quickfix to ensure Microsoft Visual C++ redistributable
|
| 248 |
+
# DLLs are loaded before importing kiwisolver
|
| 249 |
+
from . import ft2font # noqa: F401
|
| 250 |
+
|
| 251 |
+
for modname, minver in [
|
| 252 |
+
("cycler", "0.10"),
|
| 253 |
+
("dateutil", "2.7"),
|
| 254 |
+
("kiwisolver", "1.3.1"),
|
| 255 |
+
("numpy", "1.23"),
|
| 256 |
+
("pyparsing", "2.3.1"),
|
| 257 |
+
]:
|
| 258 |
+
module = importlib.import_module(modname)
|
| 259 |
+
if parse_version(module.__version__) < parse_version(minver):
|
| 260 |
+
raise ImportError(f"Matplotlib requires {modname}>={minver}; "
|
| 261 |
+
f"you have {module.__version__}")
|
| 262 |
+
|
| 263 |
+
|
| 264 |
+
_check_versions()
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
# The decorator ensures this always returns the same handler (and it is only
|
| 268 |
+
# attached once).
|
| 269 |
+
@functools.cache
|
| 270 |
+
def _ensure_handler():
|
| 271 |
+
"""
|
| 272 |
+
The first time this function is called, attach a `StreamHandler` using the
|
| 273 |
+
same format as `logging.basicConfig` to the Matplotlib root logger.
|
| 274 |
+
|
| 275 |
+
Return this handler every time this function is called.
|
| 276 |
+
"""
|
| 277 |
+
handler = logging.StreamHandler()
|
| 278 |
+
handler.setFormatter(logging.Formatter(logging.BASIC_FORMAT))
|
| 279 |
+
_log.addHandler(handler)
|
| 280 |
+
return handler
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
def set_loglevel(level):
|
| 284 |
+
"""
|
| 285 |
+
Configure Matplotlib's logging levels.
|
| 286 |
+
|
| 287 |
+
Matplotlib uses the standard library `logging` framework under the root
|
| 288 |
+
logger 'matplotlib'. This is a helper function to:
|
| 289 |
+
|
| 290 |
+
- set Matplotlib's root logger level
|
| 291 |
+
- set the root logger handler's level, creating the handler
|
| 292 |
+
if it does not exist yet
|
| 293 |
+
|
| 294 |
+
Typically, one should call ``set_loglevel("info")`` or
|
| 295 |
+
``set_loglevel("debug")`` to get additional debugging information.
|
| 296 |
+
|
| 297 |
+
Users or applications that are installing their own logging handlers
|
| 298 |
+
may want to directly manipulate ``logging.getLogger('matplotlib')`` rather
|
| 299 |
+
than use this function.
|
| 300 |
+
|
| 301 |
+
Parameters
|
| 302 |
+
----------
|
| 303 |
+
level : {"notset", "debug", "info", "warning", "error", "critical"}
|
| 304 |
+
The log level of the handler.
|
| 305 |
+
|
| 306 |
+
Notes
|
| 307 |
+
-----
|
| 308 |
+
The first time this function is called, an additional handler is attached
|
| 309 |
+
to Matplotlib's root handler; this handler is reused every time and this
|
| 310 |
+
function simply manipulates the logger and handler's level.
|
| 311 |
+
|
| 312 |
+
"""
|
| 313 |
+
_log.setLevel(level.upper())
|
| 314 |
+
_ensure_handler().setLevel(level.upper())
|
| 315 |
+
|
| 316 |
+
|
| 317 |
+
def _logged_cached(fmt, func=None):
|
| 318 |
+
"""
|
| 319 |
+
Decorator that logs a function's return value, and memoizes that value.
|
| 320 |
+
|
| 321 |
+
After ::
|
| 322 |
+
|
| 323 |
+
@_logged_cached(fmt)
|
| 324 |
+
def func(): ...
|
| 325 |
+
|
| 326 |
+
the first call to *func* will log its return value at the DEBUG level using
|
| 327 |
+
%-format string *fmt*, and memoize it; later calls to *func* will directly
|
| 328 |
+
return that value.
|
| 329 |
+
"""
|
| 330 |
+
if func is None: # Return the actual decorator.
|
| 331 |
+
return functools.partial(_logged_cached, fmt)
|
| 332 |
+
|
| 333 |
+
called = False
|
| 334 |
+
ret = None
|
| 335 |
+
|
| 336 |
+
@functools.wraps(func)
|
| 337 |
+
def wrapper(**kwargs):
|
| 338 |
+
nonlocal called, ret
|
| 339 |
+
if not called:
|
| 340 |
+
ret = func(**kwargs)
|
| 341 |
+
called = True
|
| 342 |
+
_log.debug(fmt, ret)
|
| 343 |
+
return ret
|
| 344 |
+
|
| 345 |
+
return wrapper
|
| 346 |
+
|
| 347 |
+
|
| 348 |
+
_ExecInfo = namedtuple("_ExecInfo", "executable raw_version version")
|
| 349 |
+
|
| 350 |
+
|
| 351 |
+
class ExecutableNotFoundError(FileNotFoundError):
|
| 352 |
+
"""
|
| 353 |
+
Error raised when an executable that Matplotlib optionally
|
| 354 |
+
depends on can't be found.
|
| 355 |
+
"""
|
| 356 |
+
pass
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
@functools.cache
|
| 360 |
+
def _get_executable_info(name):
|
| 361 |
+
"""
|
| 362 |
+
Get the version of some executable that Matplotlib optionally depends on.
|
| 363 |
+
|
| 364 |
+
.. warning::
|
| 365 |
+
The list of executables that this function supports is set according to
|
| 366 |
+
Matplotlib's internal needs, and may change without notice.
|
| 367 |
+
|
| 368 |
+
Parameters
|
| 369 |
+
----------
|
| 370 |
+
name : str
|
| 371 |
+
The executable to query. The following values are currently supported:
|
| 372 |
+
"dvipng", "gs", "inkscape", "magick", "pdftocairo", "pdftops". This
|
| 373 |
+
list is subject to change without notice.
|
| 374 |
+
|
| 375 |
+
Returns
|
| 376 |
+
-------
|
| 377 |
+
tuple
|
| 378 |
+
A namedtuple with fields ``executable`` (`str`) and ``version``
|
| 379 |
+
(`packaging.Version`, or ``None`` if the version cannot be determined).
|
| 380 |
+
|
| 381 |
+
Raises
|
| 382 |
+
------
|
| 383 |
+
ExecutableNotFoundError
|
| 384 |
+
If the executable is not found or older than the oldest version
|
| 385 |
+
supported by Matplotlib. For debugging purposes, it is also
|
| 386 |
+
possible to "hide" an executable from Matplotlib by adding it to the
|
| 387 |
+
:envvar:`_MPLHIDEEXECUTABLES` environment variable (a comma-separated
|
| 388 |
+
list), which must be set prior to any calls to this function.
|
| 389 |
+
ValueError
|
| 390 |
+
If the executable is not one that we know how to query.
|
| 391 |
+
"""
|
| 392 |
+
|
| 393 |
+
def impl(args, regex, min_ver=None, ignore_exit_code=False):
|
| 394 |
+
# Execute the subprocess specified by args; capture stdout and stderr.
|
| 395 |
+
# Search for a regex match in the output; if the match succeeds, the
|
| 396 |
+
# first group of the match is the version.
|
| 397 |
+
# Return an _ExecInfo if the executable exists, and has a version of
|
| 398 |
+
# at least min_ver (if set); else, raise ExecutableNotFoundError.
|
| 399 |
+
try:
|
| 400 |
+
output = subprocess.check_output(
|
| 401 |
+
args, stderr=subprocess.STDOUT,
|
| 402 |
+
text=True, errors="replace")
|
| 403 |
+
except subprocess.CalledProcessError as _cpe:
|
| 404 |
+
if ignore_exit_code:
|
| 405 |
+
output = _cpe.output
|
| 406 |
+
else:
|
| 407 |
+
raise ExecutableNotFoundError(str(_cpe)) from _cpe
|
| 408 |
+
except OSError as _ose:
|
| 409 |
+
raise ExecutableNotFoundError(str(_ose)) from _ose
|
| 410 |
+
match = re.search(regex, output)
|
| 411 |
+
if match:
|
| 412 |
+
raw_version = match.group(1)
|
| 413 |
+
version = parse_version(raw_version)
|
| 414 |
+
if min_ver is not None and version < parse_version(min_ver):
|
| 415 |
+
raise ExecutableNotFoundError(
|
| 416 |
+
f"You have {args[0]} version {version} but the minimum "
|
| 417 |
+
f"version supported by Matplotlib is {min_ver}")
|
| 418 |
+
return _ExecInfo(args[0], raw_version, version)
|
| 419 |
+
else:
|
| 420 |
+
raise ExecutableNotFoundError(
|
| 421 |
+
f"Failed to determine the version of {args[0]} from "
|
| 422 |
+
f"{' '.join(args)}, which output {output}")
|
| 423 |
+
|
| 424 |
+
if name in os.environ.get("_MPLHIDEEXECUTABLES", "").split(","):
|
| 425 |
+
raise ExecutableNotFoundError(f"{name} was hidden")
|
| 426 |
+
|
| 427 |
+
if name == "dvipng":
|
| 428 |
+
return impl(["dvipng", "-version"], "(?m)^dvipng(?: .*)? (.+)", "1.6")
|
| 429 |
+
elif name == "gs":
|
| 430 |
+
execs = (["gswin32c", "gswin64c", "mgs", "gs"] # "mgs" for miktex.
|
| 431 |
+
if sys.platform == "win32" else
|
| 432 |
+
["gs"])
|
| 433 |
+
for e in execs:
|
| 434 |
+
try:
|
| 435 |
+
return impl([e, "--version"], "(.*)", "9")
|
| 436 |
+
except ExecutableNotFoundError:
|
| 437 |
+
pass
|
| 438 |
+
message = "Failed to find a Ghostscript installation"
|
| 439 |
+
raise ExecutableNotFoundError(message)
|
| 440 |
+
elif name == "inkscape":
|
| 441 |
+
try:
|
| 442 |
+
# Try headless option first (needed for Inkscape version < 1.0):
|
| 443 |
+
return impl(["inkscape", "--without-gui", "-V"],
|
| 444 |
+
"Inkscape ([^ ]*)")
|
| 445 |
+
except ExecutableNotFoundError:
|
| 446 |
+
pass # Suppress exception chaining.
|
| 447 |
+
# If --without-gui is not accepted, we may be using Inkscape >= 1.0 so
|
| 448 |
+
# try without it:
|
| 449 |
+
return impl(["inkscape", "-V"], "Inkscape ([^ ]*)")
|
| 450 |
+
elif name == "magick":
|
| 451 |
+
if sys.platform == "win32":
|
| 452 |
+
# Check the registry to avoid confusing ImageMagick's convert with
|
| 453 |
+
# Windows's builtin convert.exe.
|
| 454 |
+
import winreg
|
| 455 |
+
binpath = ""
|
| 456 |
+
for flag in [0, winreg.KEY_WOW64_32KEY, winreg.KEY_WOW64_64KEY]:
|
| 457 |
+
try:
|
| 458 |
+
with winreg.OpenKeyEx(
|
| 459 |
+
winreg.HKEY_LOCAL_MACHINE,
|
| 460 |
+
r"Software\Imagemagick\Current",
|
| 461 |
+
0, winreg.KEY_QUERY_VALUE | flag) as hkey:
|
| 462 |
+
binpath = winreg.QueryValueEx(hkey, "BinPath")[0]
|
| 463 |
+
except OSError:
|
| 464 |
+
pass
|
| 465 |
+
path = None
|
| 466 |
+
if binpath:
|
| 467 |
+
for name in ["convert.exe", "magick.exe"]:
|
| 468 |
+
candidate = Path(binpath, name)
|
| 469 |
+
if candidate.exists():
|
| 470 |
+
path = str(candidate)
|
| 471 |
+
break
|
| 472 |
+
if path is None:
|
| 473 |
+
raise ExecutableNotFoundError(
|
| 474 |
+
"Failed to find an ImageMagick installation")
|
| 475 |
+
else:
|
| 476 |
+
path = "convert"
|
| 477 |
+
info = impl([path, "--version"], r"^Version: ImageMagick (\S*)")
|
| 478 |
+
if info.raw_version == "7.0.10-34":
|
| 479 |
+
# https://github.com/ImageMagick/ImageMagick/issues/2720
|
| 480 |
+
raise ExecutableNotFoundError(
|
| 481 |
+
f"You have ImageMagick {info.version}, which is unsupported")
|
| 482 |
+
return info
|
| 483 |
+
elif name == "pdftocairo":
|
| 484 |
+
return impl(["pdftocairo", "-v"], "pdftocairo version (.*)")
|
| 485 |
+
elif name == "pdftops":
|
| 486 |
+
info = impl(["pdftops", "-v"], "^pdftops version (.*)",
|
| 487 |
+
ignore_exit_code=True)
|
| 488 |
+
if info and not (
|
| 489 |
+
3 <= info.version.major or
|
| 490 |
+
# poppler version numbers.
|
| 491 |
+
parse_version("0.9") <= info.version < parse_version("1.0")):
|
| 492 |
+
raise ExecutableNotFoundError(
|
| 493 |
+
f"You have pdftops version {info.version} but the minimum "
|
| 494 |
+
f"version supported by Matplotlib is 3.0")
|
| 495 |
+
return info
|
| 496 |
+
else:
|
| 497 |
+
raise ValueError(f"Unknown executable: {name!r}")
|
| 498 |
+
|
| 499 |
+
|
| 500 |
+
def _get_xdg_config_dir():
|
| 501 |
+
"""
|
| 502 |
+
Return the XDG configuration directory, according to the XDG base
|
| 503 |
+
directory spec:
|
| 504 |
+
|
| 505 |
+
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
| 506 |
+
"""
|
| 507 |
+
return os.environ.get('XDG_CONFIG_HOME') or str(Path.home() / ".config")
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
def _get_xdg_cache_dir():
|
| 511 |
+
"""
|
| 512 |
+
Return the XDG cache directory, according to the XDG base directory spec:
|
| 513 |
+
|
| 514 |
+
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
| 515 |
+
"""
|
| 516 |
+
return os.environ.get('XDG_CACHE_HOME') or str(Path.home() / ".cache")
|
| 517 |
+
|
| 518 |
+
|
| 519 |
+
def _get_config_or_cache_dir(xdg_base_getter):
|
| 520 |
+
configdir = os.environ.get('MPLCONFIGDIR')
|
| 521 |
+
if configdir:
|
| 522 |
+
configdir = Path(configdir)
|
| 523 |
+
elif sys.platform.startswith(('linux', 'freebsd')):
|
| 524 |
+
# Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first,
|
| 525 |
+
# as _xdg_base_getter can throw.
|
| 526 |
+
configdir = Path(xdg_base_getter(), "matplotlib")
|
| 527 |
+
else:
|
| 528 |
+
configdir = Path.home() / ".matplotlib"
|
| 529 |
+
# Resolve the path to handle potential issues with inaccessible symlinks.
|
| 530 |
+
configdir = configdir.resolve()
|
| 531 |
+
try:
|
| 532 |
+
configdir.mkdir(parents=True, exist_ok=True)
|
| 533 |
+
except OSError as exc:
|
| 534 |
+
_log.warning("mkdir -p failed for path %s: %s", configdir, exc)
|
| 535 |
+
else:
|
| 536 |
+
if os.access(str(configdir), os.W_OK) and configdir.is_dir():
|
| 537 |
+
return str(configdir)
|
| 538 |
+
_log.warning("%s is not a writable directory", configdir)
|
| 539 |
+
# If the config or cache directory cannot be created or is not a writable
|
| 540 |
+
# directory, create a temporary one.
|
| 541 |
+
try:
|
| 542 |
+
tmpdir = tempfile.mkdtemp(prefix="matplotlib-")
|
| 543 |
+
except OSError as exc:
|
| 544 |
+
raise OSError(
|
| 545 |
+
f"Matplotlib requires access to a writable cache directory, but there "
|
| 546 |
+
f"was an issue with the default path ({configdir}), and a temporary "
|
| 547 |
+
f"directory could not be created; set the MPLCONFIGDIR environment "
|
| 548 |
+
f"variable to a writable directory") from exc
|
| 549 |
+
os.environ["MPLCONFIGDIR"] = tmpdir
|
| 550 |
+
atexit.register(shutil.rmtree, tmpdir)
|
| 551 |
+
_log.warning(
|
| 552 |
+
"Matplotlib created a temporary cache directory at %s because there was "
|
| 553 |
+
"an issue with the default path (%s); it is highly recommended to set the "
|
| 554 |
+
"MPLCONFIGDIR environment variable to a writable directory, in particular to "
|
| 555 |
+
"speed up the import of Matplotlib and to better support multiprocessing.",
|
| 556 |
+
tmpdir, configdir)
|
| 557 |
+
return tmpdir
|
| 558 |
+
|
| 559 |
+
|
| 560 |
+
@_logged_cached('CONFIGDIR=%s')
|
| 561 |
+
def get_configdir():
|
| 562 |
+
"""
|
| 563 |
+
Return the string path of the configuration directory.
|
| 564 |
+
|
| 565 |
+
The directory is chosen as follows:
|
| 566 |
+
|
| 567 |
+
1. If the MPLCONFIGDIR environment variable is supplied, choose that.
|
| 568 |
+
2. On Linux, follow the XDG specification and look first in
|
| 569 |
+
``$XDG_CONFIG_HOME``, if defined, or ``$HOME/.config``. On other
|
| 570 |
+
platforms, choose ``$HOME/.matplotlib``.
|
| 571 |
+
3. If the chosen directory exists and is writable, use that as the
|
| 572 |
+
configuration directory.
|
| 573 |
+
4. Else, create a temporary directory, and use it as the configuration
|
| 574 |
+
directory.
|
| 575 |
+
"""
|
| 576 |
+
return _get_config_or_cache_dir(_get_xdg_config_dir)
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
@_logged_cached('CACHEDIR=%s')
|
| 580 |
+
def get_cachedir():
|
| 581 |
+
"""
|
| 582 |
+
Return the string path of the cache directory.
|
| 583 |
+
|
| 584 |
+
The procedure used to find the directory is the same as for
|
| 585 |
+
`get_configdir`, except using ``$XDG_CACHE_HOME``/``$HOME/.cache`` instead.
|
| 586 |
+
"""
|
| 587 |
+
return _get_config_or_cache_dir(_get_xdg_cache_dir)
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
@_logged_cached('matplotlib data path: %s')
|
| 591 |
+
def get_data_path():
|
| 592 |
+
"""Return the path to Matplotlib data."""
|
| 593 |
+
return str(Path(__file__).with_name("mpl-data"))
|
| 594 |
+
|
| 595 |
+
|
| 596 |
+
def matplotlib_fname():
|
| 597 |
+
"""
|
| 598 |
+
Get the location of the config file.
|
| 599 |
+
|
| 600 |
+
The file location is determined in the following order
|
| 601 |
+
|
| 602 |
+
- ``$PWD/matplotlibrc``
|
| 603 |
+
- ``$MATPLOTLIBRC`` if it is not a directory
|
| 604 |
+
- ``$MATPLOTLIBRC/matplotlibrc``
|
| 605 |
+
- ``$MPLCONFIGDIR/matplotlibrc``
|
| 606 |
+
- On Linux,
|
| 607 |
+
- ``$XDG_CONFIG_HOME/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
|
| 608 |
+
is defined)
|
| 609 |
+
- or ``$HOME/.config/matplotlib/matplotlibrc`` (if ``$XDG_CONFIG_HOME``
|
| 610 |
+
is not defined)
|
| 611 |
+
- On other platforms,
|
| 612 |
+
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
|
| 613 |
+
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
|
| 614 |
+
exist.
|
| 615 |
+
"""
|
| 616 |
+
|
| 617 |
+
def gen_candidates():
|
| 618 |
+
# rely on down-stream code to make absolute. This protects us
|
| 619 |
+
# from having to directly get the current working directory
|
| 620 |
+
# which can fail if the user has ended up with a cwd that is
|
| 621 |
+
# non-existent.
|
| 622 |
+
yield 'matplotlibrc'
|
| 623 |
+
try:
|
| 624 |
+
matplotlibrc = os.environ['MATPLOTLIBRC']
|
| 625 |
+
except KeyError:
|
| 626 |
+
pass
|
| 627 |
+
else:
|
| 628 |
+
yield matplotlibrc
|
| 629 |
+
yield os.path.join(matplotlibrc, 'matplotlibrc')
|
| 630 |
+
yield os.path.join(get_configdir(), 'matplotlibrc')
|
| 631 |
+
yield os.path.join(get_data_path(), 'matplotlibrc')
|
| 632 |
+
|
| 633 |
+
for fname in gen_candidates():
|
| 634 |
+
if os.path.exists(fname) and not os.path.isdir(fname):
|
| 635 |
+
return fname
|
| 636 |
+
|
| 637 |
+
raise RuntimeError("Could not find matplotlibrc file; your Matplotlib "
|
| 638 |
+
"install is broken")
|
| 639 |
+
|
| 640 |
+
|
| 641 |
+
# rcParams deprecated and automatically mapped to another key.
|
| 642 |
+
# Values are tuples of (version, new_name, f_old2new, f_new2old).
|
| 643 |
+
_deprecated_map = {}
|
| 644 |
+
# rcParams deprecated; some can manually be mapped to another key.
|
| 645 |
+
# Values are tuples of (version, new_name_or_None).
|
| 646 |
+
_deprecated_ignore_map = {}
|
| 647 |
+
# rcParams deprecated; can use None to suppress warnings; remain actually
|
| 648 |
+
# listed in the rcParams.
|
| 649 |
+
# Values are tuples of (version,)
|
| 650 |
+
_deprecated_remain_as_none = {}
|
| 651 |
+
|
| 652 |
+
|
| 653 |
+
@_docstring.Substitution(
|
| 654 |
+
"\n".join(map("- {}".format, sorted(rcsetup._validators, key=str.lower)))
|
| 655 |
+
)
|
| 656 |
+
class RcParams(MutableMapping, dict):
|
| 657 |
+
"""
|
| 658 |
+
A dict-like key-value store for config parameters, including validation.
|
| 659 |
+
|
| 660 |
+
Validating functions are defined and associated with rc parameters in
|
| 661 |
+
:mod:`matplotlib.rcsetup`.
|
| 662 |
+
|
| 663 |
+
The list of rcParams is:
|
| 664 |
+
|
| 665 |
+
%s
|
| 666 |
+
|
| 667 |
+
See Also
|
| 668 |
+
--------
|
| 669 |
+
:ref:`customizing-with-matplotlibrc-files`
|
| 670 |
+
"""
|
| 671 |
+
|
| 672 |
+
validate = rcsetup._validators
|
| 673 |
+
|
| 674 |
+
# validate values on the way in
|
| 675 |
+
def __init__(self, *args, **kwargs):
|
| 676 |
+
self.update(*args, **kwargs)
|
| 677 |
+
|
| 678 |
+
def _set(self, key, val):
|
| 679 |
+
"""
|
| 680 |
+
Directly write data bypassing deprecation and validation logic.
|
| 681 |
+
|
| 682 |
+
Notes
|
| 683 |
+
-----
|
| 684 |
+
As end user or downstream library you almost always should use
|
| 685 |
+
``rcParams[key] = val`` and not ``_set()``.
|
| 686 |
+
|
| 687 |
+
There are only very few special cases that need direct data access.
|
| 688 |
+
These cases previously used ``dict.__setitem__(rcParams, key, val)``,
|
| 689 |
+
which is now deprecated and replaced by ``rcParams._set(key, val)``.
|
| 690 |
+
|
| 691 |
+
Even though private, we guarantee API stability for ``rcParams._set``,
|
| 692 |
+
i.e. it is subject to Matplotlib's API and deprecation policy.
|
| 693 |
+
|
| 694 |
+
:meta public:
|
| 695 |
+
"""
|
| 696 |
+
dict.__setitem__(self, key, val)
|
| 697 |
+
|
| 698 |
+
def _get(self, key):
|
| 699 |
+
"""
|
| 700 |
+
Directly read data bypassing deprecation, backend and validation
|
| 701 |
+
logic.
|
| 702 |
+
|
| 703 |
+
Notes
|
| 704 |
+
-----
|
| 705 |
+
As end user or downstream library you almost always should use
|
| 706 |
+
``val = rcParams[key]`` and not ``_get()``.
|
| 707 |
+
|
| 708 |
+
There are only very few special cases that need direct data access.
|
| 709 |
+
These cases previously used ``dict.__getitem__(rcParams, key, val)``,
|
| 710 |
+
which is now deprecated and replaced by ``rcParams._get(key)``.
|
| 711 |
+
|
| 712 |
+
Even though private, we guarantee API stability for ``rcParams._get``,
|
| 713 |
+
i.e. it is subject to Matplotlib's API and deprecation policy.
|
| 714 |
+
|
| 715 |
+
:meta public:
|
| 716 |
+
"""
|
| 717 |
+
return dict.__getitem__(self, key)
|
| 718 |
+
|
| 719 |
+
def _update_raw(self, other_params):
|
| 720 |
+
"""
|
| 721 |
+
Directly update the data from *other_params*, bypassing deprecation,
|
| 722 |
+
backend and validation logic on both sides.
|
| 723 |
+
|
| 724 |
+
This ``rcParams._update_raw(params)`` replaces the previous pattern
|
| 725 |
+
``dict.update(rcParams, params)``.
|
| 726 |
+
|
| 727 |
+
Parameters
|
| 728 |
+
----------
|
| 729 |
+
other_params : dict or `.RcParams`
|
| 730 |
+
The input mapping from which to update.
|
| 731 |
+
"""
|
| 732 |
+
if isinstance(other_params, RcParams):
|
| 733 |
+
other_params = dict.items(other_params)
|
| 734 |
+
dict.update(self, other_params)
|
| 735 |
+
|
| 736 |
+
def _ensure_has_backend(self):
|
| 737 |
+
"""
|
| 738 |
+
Ensure that a "backend" entry exists.
|
| 739 |
+
|
| 740 |
+
Normally, the default matplotlibrc file contains *no* entry for "backend" (the
|
| 741 |
+
corresponding line starts with ##, not #; we fill in _auto_backend_sentinel
|
| 742 |
+
in that case. However, packagers can set a different default backend
|
| 743 |
+
(resulting in a normal `#backend: foo` line) in which case we should *not*
|
| 744 |
+
fill in _auto_backend_sentinel.
|
| 745 |
+
"""
|
| 746 |
+
dict.setdefault(self, "backend", rcsetup._auto_backend_sentinel)
|
| 747 |
+
|
| 748 |
+
def __setitem__(self, key, val):
|
| 749 |
+
try:
|
| 750 |
+
if key in _deprecated_map:
|
| 751 |
+
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
|
| 752 |
+
_api.warn_deprecated(
|
| 753 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 754 |
+
key = alt_key
|
| 755 |
+
val = alt_val(val)
|
| 756 |
+
elif key in _deprecated_remain_as_none and val is not None:
|
| 757 |
+
version, = _deprecated_remain_as_none[key]
|
| 758 |
+
_api.warn_deprecated(version, name=key, obj_type="rcparam")
|
| 759 |
+
elif key in _deprecated_ignore_map:
|
| 760 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 761 |
+
_api.warn_deprecated(
|
| 762 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 763 |
+
return
|
| 764 |
+
elif key == 'backend':
|
| 765 |
+
if val is rcsetup._auto_backend_sentinel:
|
| 766 |
+
if 'backend' in self:
|
| 767 |
+
return
|
| 768 |
+
try:
|
| 769 |
+
cval = self.validate[key](val)
|
| 770 |
+
except ValueError as ve:
|
| 771 |
+
raise ValueError(f"Key {key}: {ve}") from None
|
| 772 |
+
self._set(key, cval)
|
| 773 |
+
except KeyError as err:
|
| 774 |
+
raise KeyError(
|
| 775 |
+
f"{key} is not a valid rc parameter (see rcParams.keys() for "
|
| 776 |
+
f"a list of valid parameters)") from err
|
| 777 |
+
|
| 778 |
+
def __getitem__(self, key):
|
| 779 |
+
if key in _deprecated_map:
|
| 780 |
+
version, alt_key, alt_val, inverse_alt = _deprecated_map[key]
|
| 781 |
+
_api.warn_deprecated(
|
| 782 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 783 |
+
return inverse_alt(self._get(alt_key))
|
| 784 |
+
|
| 785 |
+
elif key in _deprecated_ignore_map:
|
| 786 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 787 |
+
_api.warn_deprecated(
|
| 788 |
+
version, name=key, obj_type="rcparam", alternative=alt_key)
|
| 789 |
+
return self._get(alt_key) if alt_key else None
|
| 790 |
+
|
| 791 |
+
# In theory, this should only ever be used after the global rcParams
|
| 792 |
+
# has been set up, but better be safe e.g. in presence of breakpoints.
|
| 793 |
+
elif key == "backend" and self is globals().get("rcParams"):
|
| 794 |
+
val = self._get(key)
|
| 795 |
+
if val is rcsetup._auto_backend_sentinel:
|
| 796 |
+
from matplotlib import pyplot as plt
|
| 797 |
+
plt.switch_backend(rcsetup._auto_backend_sentinel)
|
| 798 |
+
|
| 799 |
+
return self._get(key)
|
| 800 |
+
|
| 801 |
+
def _get_backend_or_none(self):
|
| 802 |
+
"""Get the requested backend, if any, without triggering resolution."""
|
| 803 |
+
backend = self._get("backend")
|
| 804 |
+
return None if backend is rcsetup._auto_backend_sentinel else backend
|
| 805 |
+
|
| 806 |
+
def __repr__(self):
|
| 807 |
+
class_name = self.__class__.__name__
|
| 808 |
+
indent = len(class_name) + 1
|
| 809 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 810 |
+
repr_split = pprint.pformat(dict(self), indent=1,
|
| 811 |
+
width=80 - indent).split('\n')
|
| 812 |
+
repr_indented = ('\n' + ' ' * indent).join(repr_split)
|
| 813 |
+
return f'{class_name}({repr_indented})'
|
| 814 |
+
|
| 815 |
+
def __str__(self):
|
| 816 |
+
return '\n'.join(map('{0[0]}: {0[1]}'.format, sorted(self.items())))
|
| 817 |
+
|
| 818 |
+
def __iter__(self):
|
| 819 |
+
"""Yield sorted list of keys."""
|
| 820 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 821 |
+
yield from sorted(dict.__iter__(self))
|
| 822 |
+
|
| 823 |
+
def __len__(self):
|
| 824 |
+
return dict.__len__(self)
|
| 825 |
+
|
| 826 |
+
def find_all(self, pattern):
|
| 827 |
+
"""
|
| 828 |
+
Return the subset of this RcParams dictionary whose keys match,
|
| 829 |
+
using :func:`re.search`, the given ``pattern``.
|
| 830 |
+
|
| 831 |
+
.. note::
|
| 832 |
+
|
| 833 |
+
Changes to the returned dictionary are *not* propagated to
|
| 834 |
+
the parent RcParams dictionary.
|
| 835 |
+
|
| 836 |
+
"""
|
| 837 |
+
pattern_re = re.compile(pattern)
|
| 838 |
+
return RcParams((key, value)
|
| 839 |
+
for key, value in self.items()
|
| 840 |
+
if pattern_re.search(key))
|
| 841 |
+
|
| 842 |
+
def copy(self):
|
| 843 |
+
"""Copy this RcParams instance."""
|
| 844 |
+
rccopy = RcParams()
|
| 845 |
+
for k in self: # Skip deprecations and revalidation.
|
| 846 |
+
rccopy._set(k, self._get(k))
|
| 847 |
+
return rccopy
|
| 848 |
+
|
| 849 |
+
|
| 850 |
+
def rc_params(fail_on_error=False):
|
| 851 |
+
"""Construct a `RcParams` instance from the default Matplotlib rc file."""
|
| 852 |
+
return rc_params_from_file(matplotlib_fname(), fail_on_error)
|
| 853 |
+
|
| 854 |
+
|
| 855 |
+
@functools.cache
|
| 856 |
+
def _get_ssl_context():
|
| 857 |
+
try:
|
| 858 |
+
import certifi
|
| 859 |
+
except ImportError:
|
| 860 |
+
_log.debug("Could not import certifi.")
|
| 861 |
+
return None
|
| 862 |
+
import ssl
|
| 863 |
+
return ssl.create_default_context(cafile=certifi.where())
|
| 864 |
+
|
| 865 |
+
|
| 866 |
+
@contextlib.contextmanager
|
| 867 |
+
def _open_file_or_url(fname):
|
| 868 |
+
if (isinstance(fname, str)
|
| 869 |
+
and fname.startswith(('http://', 'https://', 'ftp://', 'file:'))):
|
| 870 |
+
import urllib.request
|
| 871 |
+
ssl_ctx = _get_ssl_context()
|
| 872 |
+
if ssl_ctx is None:
|
| 873 |
+
_log.debug(
|
| 874 |
+
"Could not get certifi ssl context, https may not work."
|
| 875 |
+
)
|
| 876 |
+
with urllib.request.urlopen(fname, context=ssl_ctx) as f:
|
| 877 |
+
yield (line.decode('utf-8') for line in f)
|
| 878 |
+
else:
|
| 879 |
+
fname = os.path.expanduser(fname)
|
| 880 |
+
with open(fname, encoding='utf-8') as f:
|
| 881 |
+
yield f
|
| 882 |
+
|
| 883 |
+
|
| 884 |
+
def _rc_params_in_file(fname, transform=lambda x: x, fail_on_error=False):
|
| 885 |
+
"""
|
| 886 |
+
Construct a `RcParams` instance from file *fname*.
|
| 887 |
+
|
| 888 |
+
Unlike `rc_params_from_file`, the configuration class only contains the
|
| 889 |
+
parameters specified in the file (i.e. default values are not filled in).
|
| 890 |
+
|
| 891 |
+
Parameters
|
| 892 |
+
----------
|
| 893 |
+
fname : path-like
|
| 894 |
+
The loaded file.
|
| 895 |
+
transform : callable, default: the identity function
|
| 896 |
+
A function called on each individual line of the file to transform it,
|
| 897 |
+
before further parsing.
|
| 898 |
+
fail_on_error : bool, default: False
|
| 899 |
+
Whether invalid entries should result in an exception or a warning.
|
| 900 |
+
"""
|
| 901 |
+
import matplotlib as mpl
|
| 902 |
+
rc_temp = {}
|
| 903 |
+
with _open_file_or_url(fname) as fd:
|
| 904 |
+
try:
|
| 905 |
+
for line_no, line in enumerate(fd, 1):
|
| 906 |
+
line = transform(line)
|
| 907 |
+
strippedline = cbook._strip_comment(line)
|
| 908 |
+
if not strippedline:
|
| 909 |
+
continue
|
| 910 |
+
tup = strippedline.split(':', 1)
|
| 911 |
+
if len(tup) != 2:
|
| 912 |
+
_log.warning('Missing colon in file %r, line %d (%r)',
|
| 913 |
+
fname, line_no, line.rstrip('\n'))
|
| 914 |
+
continue
|
| 915 |
+
key, val = tup
|
| 916 |
+
key = key.strip()
|
| 917 |
+
val = val.strip()
|
| 918 |
+
if val.startswith('"') and val.endswith('"'):
|
| 919 |
+
val = val[1:-1] # strip double quotes
|
| 920 |
+
if key in rc_temp:
|
| 921 |
+
_log.warning('Duplicate key in file %r, line %d (%r)',
|
| 922 |
+
fname, line_no, line.rstrip('\n'))
|
| 923 |
+
rc_temp[key] = (val, line, line_no)
|
| 924 |
+
except UnicodeDecodeError:
|
| 925 |
+
_log.warning('Cannot decode configuration file %r as utf-8.',
|
| 926 |
+
fname)
|
| 927 |
+
raise
|
| 928 |
+
|
| 929 |
+
config = RcParams()
|
| 930 |
+
|
| 931 |
+
for key, (val, line, line_no) in rc_temp.items():
|
| 932 |
+
if key in rcsetup._validators:
|
| 933 |
+
if fail_on_error:
|
| 934 |
+
config[key] = val # try to convert to proper type or raise
|
| 935 |
+
else:
|
| 936 |
+
try:
|
| 937 |
+
config[key] = val # try to convert to proper type or skip
|
| 938 |
+
except Exception as msg:
|
| 939 |
+
_log.warning('Bad value in file %r, line %d (%r): %s',
|
| 940 |
+
fname, line_no, line.rstrip('\n'), msg)
|
| 941 |
+
elif key in _deprecated_ignore_map:
|
| 942 |
+
version, alt_key = _deprecated_ignore_map[key]
|
| 943 |
+
_api.warn_deprecated(
|
| 944 |
+
version, name=key, alternative=alt_key, obj_type='rcparam',
|
| 945 |
+
addendum="Please update your matplotlibrc.")
|
| 946 |
+
else:
|
| 947 |
+
# __version__ must be looked up as an attribute to trigger the
|
| 948 |
+
# module-level __getattr__.
|
| 949 |
+
version = ('main' if '.post' in mpl.__version__
|
| 950 |
+
else f'v{mpl.__version__}')
|
| 951 |
+
_log.warning("""
|
| 952 |
+
Bad key %(key)s in file %(fname)s, line %(line_no)s (%(line)r)
|
| 953 |
+
You probably need to get an updated matplotlibrc file from
|
| 954 |
+
https://github.com/matplotlib/matplotlib/blob/%(version)s/lib/matplotlib/mpl-data/matplotlibrc
|
| 955 |
+
or from the matplotlib source distribution""",
|
| 956 |
+
dict(key=key, fname=fname, line_no=line_no,
|
| 957 |
+
line=line.rstrip('\n'), version=version))
|
| 958 |
+
return config
|
| 959 |
+
|
| 960 |
+
|
| 961 |
+
def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
|
| 962 |
+
"""
|
| 963 |
+
Construct a `RcParams` from file *fname*.
|
| 964 |
+
|
| 965 |
+
Parameters
|
| 966 |
+
----------
|
| 967 |
+
fname : str or path-like
|
| 968 |
+
A file with Matplotlib rc settings.
|
| 969 |
+
fail_on_error : bool
|
| 970 |
+
If True, raise an error when the parser fails to convert a parameter.
|
| 971 |
+
use_default_template : bool
|
| 972 |
+
If True, initialize with default parameters before updating with those
|
| 973 |
+
in the given file. If False, the configuration class only contains the
|
| 974 |
+
parameters specified in the file. (Useful for updating dicts.)
|
| 975 |
+
"""
|
| 976 |
+
config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
|
| 977 |
+
|
| 978 |
+
if not use_default_template:
|
| 979 |
+
return config_from_file
|
| 980 |
+
|
| 981 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 982 |
+
config = RcParams({**rcParamsDefault, **config_from_file})
|
| 983 |
+
|
| 984 |
+
if "".join(config['text.latex.preamble']):
|
| 985 |
+
_log.info("""
|
| 986 |
+
*****************************************************************
|
| 987 |
+
You have the following UNSUPPORTED LaTeX preamble customizations:
|
| 988 |
+
%s
|
| 989 |
+
Please do not ask for support with these customizations active.
|
| 990 |
+
*****************************************************************
|
| 991 |
+
""", '\n'.join(config['text.latex.preamble']))
|
| 992 |
+
_log.debug('loaded rc file %s', fname)
|
| 993 |
+
|
| 994 |
+
return config
|
| 995 |
+
|
| 996 |
+
|
| 997 |
+
rcParamsDefault = _rc_params_in_file(
|
| 998 |
+
cbook._get_data_path("matplotlibrc"),
|
| 999 |
+
# Strip leading comment.
|
| 1000 |
+
transform=lambda line: line[1:] if line.startswith("#") else line,
|
| 1001 |
+
fail_on_error=True)
|
| 1002 |
+
rcParamsDefault._update_raw(rcsetup._hardcoded_defaults)
|
| 1003 |
+
rcParamsDefault._ensure_has_backend()
|
| 1004 |
+
|
| 1005 |
+
rcParams = RcParams() # The global instance.
|
| 1006 |
+
rcParams._update_raw(rcParamsDefault)
|
| 1007 |
+
rcParams._update_raw(_rc_params_in_file(matplotlib_fname()))
|
| 1008 |
+
rcParamsOrig = rcParams.copy()
|
| 1009 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1010 |
+
# This also checks that all rcParams are indeed listed in the template.
|
| 1011 |
+
# Assigning to rcsetup.defaultParams is left only for backcompat.
|
| 1012 |
+
defaultParams = rcsetup.defaultParams = {
|
| 1013 |
+
# We want to resolve deprecated rcParams, but not backend...
|
| 1014 |
+
key: [(rcsetup._auto_backend_sentinel if key == "backend" else
|
| 1015 |
+
rcParamsDefault[key]),
|
| 1016 |
+
validator]
|
| 1017 |
+
for key, validator in rcsetup._validators.items()}
|
| 1018 |
+
if rcParams['axes.formatter.use_locale']:
|
| 1019 |
+
locale.setlocale(locale.LC_ALL, '')
|
| 1020 |
+
|
| 1021 |
+
|
| 1022 |
+
def rc(group, **kwargs):
|
| 1023 |
+
"""
|
| 1024 |
+
Set the current `.rcParams`. *group* is the grouping for the rc, e.g.,
|
| 1025 |
+
for ``lines.linewidth`` the group is ``lines``, for
|
| 1026 |
+
``axes.facecolor``, the group is ``axes``, and so on. Group may
|
| 1027 |
+
also be a list or tuple of group names, e.g., (*xtick*, *ytick*).
|
| 1028 |
+
*kwargs* is a dictionary attribute name/value pairs, e.g.,::
|
| 1029 |
+
|
| 1030 |
+
rc('lines', linewidth=2, color='r')
|
| 1031 |
+
|
| 1032 |
+
sets the current `.rcParams` and is equivalent to::
|
| 1033 |
+
|
| 1034 |
+
rcParams['lines.linewidth'] = 2
|
| 1035 |
+
rcParams['lines.color'] = 'r'
|
| 1036 |
+
|
| 1037 |
+
The following aliases are available to save typing for interactive users:
|
| 1038 |
+
|
| 1039 |
+
===== =================
|
| 1040 |
+
Alias Property
|
| 1041 |
+
===== =================
|
| 1042 |
+
'lw' 'linewidth'
|
| 1043 |
+
'ls' 'linestyle'
|
| 1044 |
+
'c' 'color'
|
| 1045 |
+
'fc' 'facecolor'
|
| 1046 |
+
'ec' 'edgecolor'
|
| 1047 |
+
'mew' 'markeredgewidth'
|
| 1048 |
+
'aa' 'antialiased'
|
| 1049 |
+
===== =================
|
| 1050 |
+
|
| 1051 |
+
Thus you could abbreviate the above call as::
|
| 1052 |
+
|
| 1053 |
+
rc('lines', lw=2, c='r')
|
| 1054 |
+
|
| 1055 |
+
Note you can use python's kwargs dictionary facility to store
|
| 1056 |
+
dictionaries of default parameters. e.g., you can customize the
|
| 1057 |
+
font rc as follows::
|
| 1058 |
+
|
| 1059 |
+
font = {'family' : 'monospace',
|
| 1060 |
+
'weight' : 'bold',
|
| 1061 |
+
'size' : 'larger'}
|
| 1062 |
+
rc('font', **font) # pass in the font dict as kwargs
|
| 1063 |
+
|
| 1064 |
+
This enables you to easily switch between several configurations. Use
|
| 1065 |
+
``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
|
| 1066 |
+
restore the default `.rcParams` after changes.
|
| 1067 |
+
|
| 1068 |
+
Notes
|
| 1069 |
+
-----
|
| 1070 |
+
Similar functionality is available by using the normal dict interface, i.e.
|
| 1071 |
+
``rcParams.update({"lines.linewidth": 2, ...})`` (but ``rcParams.update``
|
| 1072 |
+
does not support abbreviations or grouping).
|
| 1073 |
+
"""
|
| 1074 |
+
|
| 1075 |
+
aliases = {
|
| 1076 |
+
'lw': 'linewidth',
|
| 1077 |
+
'ls': 'linestyle',
|
| 1078 |
+
'c': 'color',
|
| 1079 |
+
'fc': 'facecolor',
|
| 1080 |
+
'ec': 'edgecolor',
|
| 1081 |
+
'mew': 'markeredgewidth',
|
| 1082 |
+
'aa': 'antialiased',
|
| 1083 |
+
}
|
| 1084 |
+
|
| 1085 |
+
if isinstance(group, str):
|
| 1086 |
+
group = (group,)
|
| 1087 |
+
for g in group:
|
| 1088 |
+
for k, v in kwargs.items():
|
| 1089 |
+
name = aliases.get(k) or k
|
| 1090 |
+
key = f'{g}.{name}'
|
| 1091 |
+
try:
|
| 1092 |
+
rcParams[key] = v
|
| 1093 |
+
except KeyError as err:
|
| 1094 |
+
raise KeyError(('Unrecognized key "%s" for group "%s" and '
|
| 1095 |
+
'name "%s"') % (key, g, name)) from err
|
| 1096 |
+
|
| 1097 |
+
|
| 1098 |
+
def rcdefaults():
|
| 1099 |
+
"""
|
| 1100 |
+
Restore the `.rcParams` from Matplotlib's internal default style.
|
| 1101 |
+
|
| 1102 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1103 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1104 |
+
|
| 1105 |
+
See Also
|
| 1106 |
+
--------
|
| 1107 |
+
matplotlib.rc_file_defaults
|
| 1108 |
+
Restore the `.rcParams` from the rc file originally loaded by
|
| 1109 |
+
Matplotlib.
|
| 1110 |
+
matplotlib.style.use
|
| 1111 |
+
Use a specific style file. Call ``style.use('default')`` to restore
|
| 1112 |
+
the default style.
|
| 1113 |
+
"""
|
| 1114 |
+
# Deprecation warnings were already handled when creating rcParamsDefault,
|
| 1115 |
+
# no need to reemit them here.
|
| 1116 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1117 |
+
from .style.core import STYLE_BLACKLIST
|
| 1118 |
+
rcParams.clear()
|
| 1119 |
+
rcParams.update({k: v for k, v in rcParamsDefault.items()
|
| 1120 |
+
if k not in STYLE_BLACKLIST})
|
| 1121 |
+
|
| 1122 |
+
|
| 1123 |
+
def rc_file_defaults():
|
| 1124 |
+
"""
|
| 1125 |
+
Restore the `.rcParams` from the original rc file loaded by Matplotlib.
|
| 1126 |
+
|
| 1127 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1128 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1129 |
+
"""
|
| 1130 |
+
# Deprecation warnings were already handled when creating rcParamsOrig, no
|
| 1131 |
+
# need to reemit them here.
|
| 1132 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1133 |
+
from .style.core import STYLE_BLACKLIST
|
| 1134 |
+
rcParams.update({k: rcParamsOrig[k] for k in rcParamsOrig
|
| 1135 |
+
if k not in STYLE_BLACKLIST})
|
| 1136 |
+
|
| 1137 |
+
|
| 1138 |
+
def rc_file(fname, *, use_default_template=True):
|
| 1139 |
+
"""
|
| 1140 |
+
Update `.rcParams` from file.
|
| 1141 |
+
|
| 1142 |
+
Style-blacklisted `.rcParams` (defined in
|
| 1143 |
+
``matplotlib.style.core.STYLE_BLACKLIST``) are not updated.
|
| 1144 |
+
|
| 1145 |
+
Parameters
|
| 1146 |
+
----------
|
| 1147 |
+
fname : str or path-like
|
| 1148 |
+
A file with Matplotlib rc settings.
|
| 1149 |
+
|
| 1150 |
+
use_default_template : bool
|
| 1151 |
+
If True, initialize with default parameters before updating with those
|
| 1152 |
+
in the given file. If False, the current configuration persists
|
| 1153 |
+
and only the parameters specified in the file are updated.
|
| 1154 |
+
"""
|
| 1155 |
+
# Deprecation warnings were already handled in rc_params_from_file, no need
|
| 1156 |
+
# to reemit them here.
|
| 1157 |
+
with _api.suppress_matplotlib_deprecation_warning():
|
| 1158 |
+
from .style.core import STYLE_BLACKLIST
|
| 1159 |
+
rc_from_file = rc_params_from_file(
|
| 1160 |
+
fname, use_default_template=use_default_template)
|
| 1161 |
+
rcParams.update({k: rc_from_file[k] for k in rc_from_file
|
| 1162 |
+
if k not in STYLE_BLACKLIST})
|
| 1163 |
+
|
| 1164 |
+
|
| 1165 |
+
@contextlib.contextmanager
|
| 1166 |
+
def rc_context(rc=None, fname=None):
|
| 1167 |
+
"""
|
| 1168 |
+
Return a context manager for temporarily changing rcParams.
|
| 1169 |
+
|
| 1170 |
+
The :rc:`backend` will not be reset by the context manager.
|
| 1171 |
+
|
| 1172 |
+
rcParams changed both through the context manager invocation and
|
| 1173 |
+
in the body of the context will be reset on context exit.
|
| 1174 |
+
|
| 1175 |
+
Parameters
|
| 1176 |
+
----------
|
| 1177 |
+
rc : dict
|
| 1178 |
+
The rcParams to temporarily set.
|
| 1179 |
+
fname : str or path-like
|
| 1180 |
+
A file with Matplotlib rc settings. If both *fname* and *rc* are given,
|
| 1181 |
+
settings from *rc* take precedence.
|
| 1182 |
+
|
| 1183 |
+
See Also
|
| 1184 |
+
--------
|
| 1185 |
+
:ref:`customizing-with-matplotlibrc-files`
|
| 1186 |
+
|
| 1187 |
+
Examples
|
| 1188 |
+
--------
|
| 1189 |
+
Passing explicit values via a dict::
|
| 1190 |
+
|
| 1191 |
+
with mpl.rc_context({'interactive': False}):
|
| 1192 |
+
fig, ax = plt.subplots()
|
| 1193 |
+
ax.plot(range(3), range(3))
|
| 1194 |
+
fig.savefig('example.png')
|
| 1195 |
+
plt.close(fig)
|
| 1196 |
+
|
| 1197 |
+
Loading settings from a file::
|
| 1198 |
+
|
| 1199 |
+
with mpl.rc_context(fname='print.rc'):
|
| 1200 |
+
plt.plot(x, y) # uses 'print.rc'
|
| 1201 |
+
|
| 1202 |
+
Setting in the context body::
|
| 1203 |
+
|
| 1204 |
+
with mpl.rc_context():
|
| 1205 |
+
# will be reset
|
| 1206 |
+
mpl.rcParams['lines.linewidth'] = 5
|
| 1207 |
+
plt.plot(x, y)
|
| 1208 |
+
|
| 1209 |
+
"""
|
| 1210 |
+
orig = dict(rcParams.copy())
|
| 1211 |
+
del orig['backend']
|
| 1212 |
+
try:
|
| 1213 |
+
if fname:
|
| 1214 |
+
rc_file(fname)
|
| 1215 |
+
if rc:
|
| 1216 |
+
rcParams.update(rc)
|
| 1217 |
+
yield
|
| 1218 |
+
finally:
|
| 1219 |
+
rcParams._update_raw(orig) # Revert to the original rcs.
|
| 1220 |
+
|
| 1221 |
+
|
| 1222 |
+
def use(backend, *, force=True):
|
| 1223 |
+
"""
|
| 1224 |
+
Select the backend used for rendering and GUI integration.
|
| 1225 |
+
|
| 1226 |
+
If pyplot is already imported, `~matplotlib.pyplot.switch_backend` is used
|
| 1227 |
+
and if the new backend is different than the current backend, all Figures
|
| 1228 |
+
will be closed.
|
| 1229 |
+
|
| 1230 |
+
Parameters
|
| 1231 |
+
----------
|
| 1232 |
+
backend : str
|
| 1233 |
+
The backend to switch to. This can either be one of the standard
|
| 1234 |
+
backend names, which are case-insensitive:
|
| 1235 |
+
|
| 1236 |
+
- interactive backends:
|
| 1237 |
+
GTK3Agg, GTK3Cairo, GTK4Agg, GTK4Cairo, MacOSX, nbAgg, notebook, QtAgg,
|
| 1238 |
+
QtCairo, TkAgg, TkCairo, WebAgg, WX, WXAgg, WXCairo, Qt5Agg, Qt5Cairo
|
| 1239 |
+
|
| 1240 |
+
- non-interactive backends:
|
| 1241 |
+
agg, cairo, pdf, pgf, ps, svg, template
|
| 1242 |
+
|
| 1243 |
+
or a string of the form: ``module://my.module.name``.
|
| 1244 |
+
|
| 1245 |
+
notebook is a synonym for nbAgg.
|
| 1246 |
+
|
| 1247 |
+
Switching to an interactive backend is not possible if an unrelated
|
| 1248 |
+
event loop has already been started (e.g., switching to GTK3Agg if a
|
| 1249 |
+
TkAgg window has already been opened). Switching to a non-interactive
|
| 1250 |
+
backend is always possible.
|
| 1251 |
+
|
| 1252 |
+
force : bool, default: True
|
| 1253 |
+
If True (the default), raise an `ImportError` if the backend cannot be
|
| 1254 |
+
set up (either because it fails to import, or because an incompatible
|
| 1255 |
+
GUI interactive framework is already running); if False, silently
|
| 1256 |
+
ignore the failure.
|
| 1257 |
+
|
| 1258 |
+
See Also
|
| 1259 |
+
--------
|
| 1260 |
+
:ref:`backends`
|
| 1261 |
+
matplotlib.get_backend
|
| 1262 |
+
matplotlib.pyplot.switch_backend
|
| 1263 |
+
|
| 1264 |
+
"""
|
| 1265 |
+
name = rcsetup.validate_backend(backend)
|
| 1266 |
+
# don't (prematurely) resolve the "auto" backend setting
|
| 1267 |
+
if rcParams._get_backend_or_none() == name:
|
| 1268 |
+
# Nothing to do if the requested backend is already set
|
| 1269 |
+
pass
|
| 1270 |
+
else:
|
| 1271 |
+
# if pyplot is not already imported, do not import it. Doing
|
| 1272 |
+
# so may trigger a `plt.switch_backend` to the _default_ backend
|
| 1273 |
+
# before we get a chance to change to the one the user just requested
|
| 1274 |
+
plt = sys.modules.get('matplotlib.pyplot')
|
| 1275 |
+
# if pyplot is imported, then try to change backends
|
| 1276 |
+
if plt is not None:
|
| 1277 |
+
try:
|
| 1278 |
+
# we need this import check here to re-raise if the
|
| 1279 |
+
# user does not have the libraries to support their
|
| 1280 |
+
# chosen backend installed.
|
| 1281 |
+
plt.switch_backend(name)
|
| 1282 |
+
except ImportError:
|
| 1283 |
+
if force:
|
| 1284 |
+
raise
|
| 1285 |
+
# if we have not imported pyplot, then we can set the rcParam
|
| 1286 |
+
# value which will be respected when the user finally imports
|
| 1287 |
+
# pyplot
|
| 1288 |
+
else:
|
| 1289 |
+
rcParams['backend'] = backend
|
| 1290 |
+
# if the user has asked for a given backend, do not helpfully
|
| 1291 |
+
# fallback
|
| 1292 |
+
rcParams['backend_fallback'] = False
|
| 1293 |
+
|
| 1294 |
+
|
| 1295 |
+
if os.environ.get('MPLBACKEND'):
|
| 1296 |
+
rcParams['backend'] = os.environ.get('MPLBACKEND')
|
| 1297 |
+
|
| 1298 |
+
|
| 1299 |
+
def get_backend(*, auto_select=True):
|
| 1300 |
+
"""
|
| 1301 |
+
Return the name of the current backend.
|
| 1302 |
+
|
| 1303 |
+
Parameters
|
| 1304 |
+
----------
|
| 1305 |
+
auto_select : bool, default: True
|
| 1306 |
+
Whether to trigger backend resolution if no backend has been
|
| 1307 |
+
selected so far. If True, this ensures that a valid backend
|
| 1308 |
+
is returned. If False, this returns None if no backend has been
|
| 1309 |
+
selected so far.
|
| 1310 |
+
|
| 1311 |
+
.. versionadded:: 3.10
|
| 1312 |
+
|
| 1313 |
+
.. admonition:: Provisional
|
| 1314 |
+
|
| 1315 |
+
The *auto_select* flag is provisional. It may be changed or removed
|
| 1316 |
+
without prior warning.
|
| 1317 |
+
|
| 1318 |
+
See Also
|
| 1319 |
+
--------
|
| 1320 |
+
matplotlib.use
|
| 1321 |
+
"""
|
| 1322 |
+
if auto_select:
|
| 1323 |
+
return rcParams['backend']
|
| 1324 |
+
else:
|
| 1325 |
+
backend = rcParams._get('backend')
|
| 1326 |
+
if backend is rcsetup._auto_backend_sentinel:
|
| 1327 |
+
return None
|
| 1328 |
+
else:
|
| 1329 |
+
return backend
|
| 1330 |
+
|
| 1331 |
+
|
| 1332 |
+
def interactive(b):
|
| 1333 |
+
"""
|
| 1334 |
+
Set whether to redraw after every plotting command (e.g. `.pyplot.xlabel`).
|
| 1335 |
+
"""
|
| 1336 |
+
rcParams['interactive'] = b
|
| 1337 |
+
|
| 1338 |
+
|
| 1339 |
+
def is_interactive():
|
| 1340 |
+
"""
|
| 1341 |
+
Return whether to redraw after every plotting command.
|
| 1342 |
+
|
| 1343 |
+
.. note::
|
| 1344 |
+
|
| 1345 |
+
This function is only intended for use in backends. End users should
|
| 1346 |
+
use `.pyplot.isinteractive` instead.
|
| 1347 |
+
"""
|
| 1348 |
+
return rcParams['interactive']
|
| 1349 |
+
|
| 1350 |
+
|
| 1351 |
+
def _val_or_rc(val, rc_name):
|
| 1352 |
+
"""
|
| 1353 |
+
If *val* is None, return ``mpl.rcParams[rc_name]``, otherwise return val.
|
| 1354 |
+
"""
|
| 1355 |
+
return val if val is not None else rcParams[rc_name]
|
| 1356 |
+
|
| 1357 |
+
|
| 1358 |
+
def _init_tests():
|
| 1359 |
+
# The version of FreeType to install locally for running the tests. This must match
|
| 1360 |
+
# the value in `meson.build`.
|
| 1361 |
+
LOCAL_FREETYPE_VERSION = '2.6.1'
|
| 1362 |
+
|
| 1363 |
+
from matplotlib import ft2font
|
| 1364 |
+
if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
|
| 1365 |
+
ft2font.__freetype_build_type__ != 'local'):
|
| 1366 |
+
_log.warning(
|
| 1367 |
+
"Matplotlib is not built with the correct FreeType version to run tests. "
|
| 1368 |
+
"Rebuild without setting system-freetype=true in Meson setup options. "
|
| 1369 |
+
"Expect many image comparison failures below. "
|
| 1370 |
+
"Expected freetype version %s. "
|
| 1371 |
+
"Found freetype version %s. "
|
| 1372 |
+
"Freetype build type is %slocal.",
|
| 1373 |
+
LOCAL_FREETYPE_VERSION,
|
| 1374 |
+
ft2font.__freetype_version__,
|
| 1375 |
+
"" if ft2font.__freetype_build_type__ == 'local' else "not ")
|
| 1376 |
+
|
| 1377 |
+
|
| 1378 |
+
def _replacer(data, value):
|
| 1379 |
+
"""
|
| 1380 |
+
Either returns ``data[value]`` or passes ``data`` back, converts either to
|
| 1381 |
+
a sequence.
|
| 1382 |
+
"""
|
| 1383 |
+
try:
|
| 1384 |
+
# if key isn't a string don't bother
|
| 1385 |
+
if isinstance(value, str):
|
| 1386 |
+
# try to use __getitem__
|
| 1387 |
+
value = data[value]
|
| 1388 |
+
except Exception:
|
| 1389 |
+
# key does not exist, silently fall back to key
|
| 1390 |
+
pass
|
| 1391 |
+
return cbook.sanitize_sequence(value)
|
| 1392 |
+
|
| 1393 |
+
|
| 1394 |
+
def _label_from_arg(y, default_name):
|
| 1395 |
+
try:
|
| 1396 |
+
return y.name
|
| 1397 |
+
except AttributeError:
|
| 1398 |
+
if isinstance(default_name, str):
|
| 1399 |
+
return default_name
|
| 1400 |
+
return None
|
| 1401 |
+
|
| 1402 |
+
|
| 1403 |
+
def _add_data_doc(docstring, replace_names):
|
| 1404 |
+
"""
|
| 1405 |
+
Add documentation for a *data* field to the given docstring.
|
| 1406 |
+
|
| 1407 |
+
Parameters
|
| 1408 |
+
----------
|
| 1409 |
+
docstring : str
|
| 1410 |
+
The input docstring.
|
| 1411 |
+
replace_names : list of str or None
|
| 1412 |
+
The list of parameter names which arguments should be replaced by
|
| 1413 |
+
``data[name]`` (if ``data[name]`` does not throw an exception). If
|
| 1414 |
+
None, replacement is attempted for all arguments.
|
| 1415 |
+
|
| 1416 |
+
Returns
|
| 1417 |
+
-------
|
| 1418 |
+
str
|
| 1419 |
+
The augmented docstring.
|
| 1420 |
+
"""
|
| 1421 |
+
if (docstring is None
|
| 1422 |
+
or replace_names is not None and len(replace_names) == 0):
|
| 1423 |
+
return docstring
|
| 1424 |
+
docstring = inspect.cleandoc(docstring)
|
| 1425 |
+
|
| 1426 |
+
data_doc = ("""\
|
| 1427 |
+
If given, all parameters also accept a string ``s``, which is
|
| 1428 |
+
interpreted as ``data[s]`` if ``s`` is a key in ``data``."""
|
| 1429 |
+
if replace_names is None else f"""\
|
| 1430 |
+
If given, the following parameters also accept a string ``s``, which is
|
| 1431 |
+
interpreted as ``data[s]`` if ``s`` is a key in ``data``:
|
| 1432 |
+
|
| 1433 |
+
{', '.join(map('*{}*'.format, replace_names))}""")
|
| 1434 |
+
# using string replacement instead of formatting has the advantages
|
| 1435 |
+
# 1) simpler indent handling
|
| 1436 |
+
# 2) prevent problems with formatting characters '{', '%' in the docstring
|
| 1437 |
+
if _log.level <= logging.DEBUG:
|
| 1438 |
+
# test_data_parameter_replacement() tests against these log messages
|
| 1439 |
+
# make sure to keep message and test in sync
|
| 1440 |
+
if "data : indexable object, optional" not in docstring:
|
| 1441 |
+
_log.debug("data parameter docstring error: no data parameter")
|
| 1442 |
+
if 'DATA_PARAMETER_PLACEHOLDER' not in docstring:
|
| 1443 |
+
_log.debug("data parameter docstring error: missing placeholder")
|
| 1444 |
+
return docstring.replace(' DATA_PARAMETER_PLACEHOLDER', data_doc)
|
| 1445 |
+
|
| 1446 |
+
|
| 1447 |
+
def _preprocess_data(func=None, *, replace_names=None, label_namer=None):
|
| 1448 |
+
"""
|
| 1449 |
+
A decorator to add a 'data' kwarg to a function.
|
| 1450 |
+
|
| 1451 |
+
When applied::
|
| 1452 |
+
|
| 1453 |
+
@_preprocess_data()
|
| 1454 |
+
def func(ax, *args, **kwargs): ...
|
| 1455 |
+
|
| 1456 |
+
the signature is modified to ``decorated(ax, *args, data=None, **kwargs)``
|
| 1457 |
+
with the following behavior:
|
| 1458 |
+
|
| 1459 |
+
- if called with ``data=None``, forward the other arguments to ``func``;
|
| 1460 |
+
- otherwise, *data* must be a mapping; for any argument passed in as a
|
| 1461 |
+
string ``name``, replace the argument by ``data[name]`` (if this does not
|
| 1462 |
+
throw an exception), then forward the arguments to ``func``.
|
| 1463 |
+
|
| 1464 |
+
In either case, any argument that is a `MappingView` is also converted to a
|
| 1465 |
+
list.
|
| 1466 |
+
|
| 1467 |
+
Parameters
|
| 1468 |
+
----------
|
| 1469 |
+
replace_names : list of str or None, default: None
|
| 1470 |
+
The list of parameter names for which lookup into *data* should be
|
| 1471 |
+
attempted. If None, replacement is attempted for all arguments.
|
| 1472 |
+
label_namer : str, default: None
|
| 1473 |
+
If set e.g. to "namer" (which must be a kwarg in the function's
|
| 1474 |
+
signature -- not as ``**kwargs``), if the *namer* argument passed in is
|
| 1475 |
+
a (string) key of *data* and no *label* kwarg is passed, then use the
|
| 1476 |
+
(string) value of the *namer* as *label*. ::
|
| 1477 |
+
|
| 1478 |
+
@_preprocess_data(label_namer="foo")
|
| 1479 |
+
def func(foo, label=None): ...
|
| 1480 |
+
|
| 1481 |
+
func("key", data={"key": value})
|
| 1482 |
+
# is equivalent to
|
| 1483 |
+
func.__wrapped__(value, label="key")
|
| 1484 |
+
"""
|
| 1485 |
+
|
| 1486 |
+
if func is None: # Return the actual decorator.
|
| 1487 |
+
return functools.partial(
|
| 1488 |
+
_preprocess_data,
|
| 1489 |
+
replace_names=replace_names, label_namer=label_namer)
|
| 1490 |
+
|
| 1491 |
+
sig = inspect.signature(func)
|
| 1492 |
+
varargs_name = None
|
| 1493 |
+
varkwargs_name = None
|
| 1494 |
+
arg_names = []
|
| 1495 |
+
params = list(sig.parameters.values())
|
| 1496 |
+
for p in params:
|
| 1497 |
+
if p.kind is Parameter.VAR_POSITIONAL:
|
| 1498 |
+
varargs_name = p.name
|
| 1499 |
+
elif p.kind is Parameter.VAR_KEYWORD:
|
| 1500 |
+
varkwargs_name = p.name
|
| 1501 |
+
else:
|
| 1502 |
+
arg_names.append(p.name)
|
| 1503 |
+
data_param = Parameter("data", Parameter.KEYWORD_ONLY, default=None)
|
| 1504 |
+
if varkwargs_name:
|
| 1505 |
+
params.insert(-1, data_param)
|
| 1506 |
+
else:
|
| 1507 |
+
params.append(data_param)
|
| 1508 |
+
new_sig = sig.replace(parameters=params)
|
| 1509 |
+
arg_names = arg_names[1:] # remove the first "ax" / self arg
|
| 1510 |
+
|
| 1511 |
+
assert {*arg_names}.issuperset(replace_names or []) or varkwargs_name, (
|
| 1512 |
+
"Matplotlib internal error: invalid replace_names "
|
| 1513 |
+
f"({replace_names!r}) for {func.__name__!r}")
|
| 1514 |
+
assert label_namer is None or label_namer in arg_names, (
|
| 1515 |
+
"Matplotlib internal error: invalid label_namer "
|
| 1516 |
+
f"({label_namer!r}) for {func.__name__!r}")
|
| 1517 |
+
|
| 1518 |
+
@functools.wraps(func)
|
| 1519 |
+
def inner(ax, *args, data=None, **kwargs):
|
| 1520 |
+
if data is None:
|
| 1521 |
+
return func(
|
| 1522 |
+
ax,
|
| 1523 |
+
*map(cbook.sanitize_sequence, args),
|
| 1524 |
+
**{k: cbook.sanitize_sequence(v) for k, v in kwargs.items()})
|
| 1525 |
+
|
| 1526 |
+
bound = new_sig.bind(ax, *args, **kwargs)
|
| 1527 |
+
auto_label = (bound.arguments.get(label_namer)
|
| 1528 |
+
or bound.kwargs.get(label_namer))
|
| 1529 |
+
|
| 1530 |
+
for k, v in bound.arguments.items():
|
| 1531 |
+
if k == varkwargs_name:
|
| 1532 |
+
for k1, v1 in v.items():
|
| 1533 |
+
if replace_names is None or k1 in replace_names:
|
| 1534 |
+
v[k1] = _replacer(data, v1)
|
| 1535 |
+
elif k == varargs_name:
|
| 1536 |
+
if replace_names is None:
|
| 1537 |
+
bound.arguments[k] = tuple(_replacer(data, v1) for v1 in v)
|
| 1538 |
+
else:
|
| 1539 |
+
if replace_names is None or k in replace_names:
|
| 1540 |
+
bound.arguments[k] = _replacer(data, v)
|
| 1541 |
+
|
| 1542 |
+
new_args = bound.args
|
| 1543 |
+
new_kwargs = bound.kwargs
|
| 1544 |
+
|
| 1545 |
+
args_and_kwargs = {**bound.arguments, **bound.kwargs}
|
| 1546 |
+
if label_namer and "label" not in args_and_kwargs:
|
| 1547 |
+
new_kwargs["label"] = _label_from_arg(
|
| 1548 |
+
args_and_kwargs.get(label_namer), auto_label)
|
| 1549 |
+
|
| 1550 |
+
return func(*new_args, **new_kwargs)
|
| 1551 |
+
|
| 1552 |
+
inner.__doc__ = _add_data_doc(inner.__doc__, replace_names)
|
| 1553 |
+
inner.__signature__ = new_sig
|
| 1554 |
+
return inner
|
| 1555 |
+
|
| 1556 |
+
|
| 1557 |
+
_log.debug('interactive is %s', is_interactive())
|
| 1558 |
+
_log.debug('platform is %s', sys.platform)
|
| 1559 |
+
|
| 1560 |
+
|
| 1561 |
+
@_api.deprecated("3.10", alternative="matplotlib.cbook.sanitize_sequence")
|
| 1562 |
+
def sanitize_sequence(data):
|
| 1563 |
+
return cbook.sanitize_sequence(data)
|
| 1564 |
+
|
| 1565 |
+
|
| 1566 |
+
@_api.deprecated("3.10", alternative="matplotlib.rcsetup.validate_backend")
|
| 1567 |
+
def validate_backend(s):
|
| 1568 |
+
return rcsetup.validate_backend(s)
|
| 1569 |
+
|
| 1570 |
+
|
| 1571 |
+
# workaround: we must defer colormaps import to after loading rcParams, because
|
| 1572 |
+
# colormap creation depends on rcParams
|
| 1573 |
+
from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
| 1574 |
+
from matplotlib.cm import _multivar_colormaps as multivar_colormaps # noqa: E402
|
| 1575 |
+
from matplotlib.cm import _bivar_colormaps as bivar_colormaps # noqa: E402
|
| 1576 |
+
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__init__.pyi
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = [
|
| 2 |
+
"__bibtex__",
|
| 3 |
+
"__version__",
|
| 4 |
+
"__version_info__",
|
| 5 |
+
"set_loglevel",
|
| 6 |
+
"ExecutableNotFoundError",
|
| 7 |
+
"get_configdir",
|
| 8 |
+
"get_cachedir",
|
| 9 |
+
"get_data_path",
|
| 10 |
+
"matplotlib_fname",
|
| 11 |
+
"MatplotlibDeprecationWarning",
|
| 12 |
+
"RcParams",
|
| 13 |
+
"rc_params",
|
| 14 |
+
"rc_params_from_file",
|
| 15 |
+
"rcParamsDefault",
|
| 16 |
+
"rcParams",
|
| 17 |
+
"rcParamsOrig",
|
| 18 |
+
"defaultParams",
|
| 19 |
+
"rc",
|
| 20 |
+
"rcdefaults",
|
| 21 |
+
"rc_file_defaults",
|
| 22 |
+
"rc_file",
|
| 23 |
+
"rc_context",
|
| 24 |
+
"use",
|
| 25 |
+
"get_backend",
|
| 26 |
+
"interactive",
|
| 27 |
+
"is_interactive",
|
| 28 |
+
"colormaps",
|
| 29 |
+
"color_sequences",
|
| 30 |
+
]
|
| 31 |
+
|
| 32 |
+
import os
|
| 33 |
+
from pathlib import Path
|
| 34 |
+
|
| 35 |
+
from collections.abc import Callable, Generator
|
| 36 |
+
import contextlib
|
| 37 |
+
from packaging.version import Version
|
| 38 |
+
|
| 39 |
+
from matplotlib._api import MatplotlibDeprecationWarning
|
| 40 |
+
from typing import Any, Literal, NamedTuple, overload
|
| 41 |
+
|
| 42 |
+
class _VersionInfo(NamedTuple):
|
| 43 |
+
major: int
|
| 44 |
+
minor: int
|
| 45 |
+
micro: int
|
| 46 |
+
releaselevel: str
|
| 47 |
+
serial: int
|
| 48 |
+
|
| 49 |
+
__bibtex__: str
|
| 50 |
+
__version__: str
|
| 51 |
+
__version_info__: _VersionInfo
|
| 52 |
+
|
| 53 |
+
def set_loglevel(level: str) -> None: ...
|
| 54 |
+
|
| 55 |
+
class _ExecInfo(NamedTuple):
|
| 56 |
+
executable: str
|
| 57 |
+
raw_version: str
|
| 58 |
+
version: Version
|
| 59 |
+
|
| 60 |
+
class ExecutableNotFoundError(FileNotFoundError): ...
|
| 61 |
+
|
| 62 |
+
def _get_executable_info(name: str) -> _ExecInfo: ...
|
| 63 |
+
def get_configdir() -> str: ...
|
| 64 |
+
def get_cachedir() -> str: ...
|
| 65 |
+
def get_data_path() -> str: ...
|
| 66 |
+
def matplotlib_fname() -> str: ...
|
| 67 |
+
|
| 68 |
+
class RcParams(dict[str, Any]):
|
| 69 |
+
validate: dict[str, Callable]
|
| 70 |
+
def __init__(self, *args, **kwargs) -> None: ...
|
| 71 |
+
def _set(self, key: str, val: Any) -> None: ...
|
| 72 |
+
def _get(self, key: str) -> Any: ...
|
| 73 |
+
|
| 74 |
+
def _update_raw(self, other_params: dict | RcParams) -> None: ...
|
| 75 |
+
|
| 76 |
+
def _ensure_has_backend(self) -> None: ...
|
| 77 |
+
def __setitem__(self, key: str, val: Any) -> None: ...
|
| 78 |
+
def __getitem__(self, key: str) -> Any: ...
|
| 79 |
+
def __iter__(self) -> Generator[str, None, None]: ...
|
| 80 |
+
def __len__(self) -> int: ...
|
| 81 |
+
def find_all(self, pattern: str) -> RcParams: ...
|
| 82 |
+
def copy(self) -> RcParams: ...
|
| 83 |
+
|
| 84 |
+
def rc_params(fail_on_error: bool = ...) -> RcParams: ...
|
| 85 |
+
def rc_params_from_file(
|
| 86 |
+
fname: str | Path | os.PathLike,
|
| 87 |
+
fail_on_error: bool = ...,
|
| 88 |
+
use_default_template: bool = ...,
|
| 89 |
+
) -> RcParams: ...
|
| 90 |
+
|
| 91 |
+
rcParamsDefault: RcParams
|
| 92 |
+
rcParams: RcParams
|
| 93 |
+
rcParamsOrig: RcParams
|
| 94 |
+
defaultParams: dict[str, Any]
|
| 95 |
+
|
| 96 |
+
def rc(group: str, **kwargs) -> None: ...
|
| 97 |
+
def rcdefaults() -> None: ...
|
| 98 |
+
def rc_file_defaults() -> None: ...
|
| 99 |
+
def rc_file(
|
| 100 |
+
fname: str | Path | os.PathLike, *, use_default_template: bool = ...
|
| 101 |
+
) -> None: ...
|
| 102 |
+
@contextlib.contextmanager
|
| 103 |
+
def rc_context(
|
| 104 |
+
rc: dict[str, Any] | None = ..., fname: str | Path | os.PathLike | None = ...
|
| 105 |
+
) -> Generator[None, None, None]: ...
|
| 106 |
+
def use(backend: str, *, force: bool = ...) -> None: ...
|
| 107 |
+
@overload
|
| 108 |
+
def get_backend(*, auto_select: Literal[True] = True) -> str: ...
|
| 109 |
+
@overload
|
| 110 |
+
def get_backend(*, auto_select: Literal[False]) -> str | None: ...
|
| 111 |
+
def interactive(b: bool) -> None: ...
|
| 112 |
+
def is_interactive() -> bool: ...
|
| 113 |
+
|
| 114 |
+
def _preprocess_data(
|
| 115 |
+
func: Callable | None = ...,
|
| 116 |
+
*,
|
| 117 |
+
replace_names: list[str] | None = ...,
|
| 118 |
+
label_namer: str | None = ...
|
| 119 |
+
) -> Callable: ...
|
| 120 |
+
|
| 121 |
+
from matplotlib.cm import _colormaps as colormaps # noqa: E402
|
| 122 |
+
from matplotlib.cm import _multivar_colormaps as multivar_colormaps # noqa: E402
|
| 123 |
+
from matplotlib.cm import _bivar_colormaps as bivar_colormaps # noqa: E402
|
| 124 |
+
from matplotlib.colors import _color_sequences as color_sequences # noqa: E402
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_afm.cpython-310.pyc
ADDED
|
Binary file (15.2 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_blocking_input.cpython-310.pyc
ADDED
|
Binary file (1.41 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm.cpython-310.pyc
ADDED
|
Binary file (30.1 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm_bivar.cpython-310.pyc
ADDED
|
Binary file (68.8 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_cm_multivar.cpython-310.pyc
ADDED
|
Binary file (5.76 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_color_data.cpython-310.pyc
ADDED
|
Binary file (50.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_constrained_layout.cpython-310.pyc
ADDED
|
Binary file (19.2 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_enums.cpython-310.pyc
ADDED
|
Binary file (6.76 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_fontconfig_pattern.cpython-310.pyc
ADDED
|
Binary file (3.87 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_layoutgrid.cpython-310.pyc
ADDED
|
Binary file (15.6 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_mathtext.cpython-310.pyc
ADDED
|
Binary file (84.2 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_mathtext_data.cpython-310.pyc
ADDED
|
Binary file (41.8 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_pylab_helpers.cpython-310.pyc
ADDED
|
Binary file (5.17 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_text_helpers.cpython-310.pyc
ADDED
|
Binary file (2.72 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_tight_bbox.cpython-310.pyc
ADDED
|
Binary file (2.63 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/_tight_layout.cpython-310.pyc
ADDED
|
Binary file (8.93 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/artist.cpython-310.pyc
ADDED
|
Binary file (57.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/axis.cpython-310.pyc
ADDED
|
Binary file (82.5 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/backend_managers.cpython-310.pyc
ADDED
|
Binary file (11.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/backend_tools.cpython-310.pyc
ADDED
|
Binary file (32.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/category.cpython-310.pyc
ADDED
|
Binary file (7.81 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/cm.cpython-310.pyc
ADDED
|
Binary file (9.37 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/collections.cpython-310.pyc
ADDED
|
Binary file (86.7 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/colorbar.cpython-310.pyc
ADDED
|
Binary file (44.1 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/colorizer.cpython-310.pyc
ADDED
|
Binary file (21.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/container.cpython-310.pyc
ADDED
|
Binary file (5.71 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/contour.cpython-310.pyc
ADDED
|
Binary file (52.9 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/dates.cpython-310.pyc
ADDED
|
Binary file (57.4 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/dviread.cpython-310.pyc
ADDED
|
Binary file (36 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/font_manager.cpython-310.pyc
ADDED
|
Binary file (47.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/gridspec.cpython-310.pyc
ADDED
|
Binary file (27.1 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/hatch.cpython-310.pyc
ADDED
|
Binary file (7.34 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/image.cpython-310.pyc
ADDED
|
Binary file (53.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/inset.cpython-310.pyc
ADDED
|
Binary file (8.68 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/layout_engine.cpython-310.pyc
ADDED
|
Binary file (11.8 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/legend.cpython-310.pyc
ADDED
|
Binary file (41.4 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/legend_handler.cpython-310.pyc
ADDED
|
Binary file (24.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/lines.cpython-310.pyc
ADDED
|
Binary file (47 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/markers.cpython-310.pyc
ADDED
|
Binary file (29.5 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/mathtext.cpython-310.pyc
ADDED
|
Binary file (4.74 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/mlab.cpython-310.pyc
ADDED
|
Binary file (24.3 kB). View file
|
|
|
Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/matplotlib/__pycache__/offsetbox.cpython-310.pyc
ADDED
|
Binary file (53.3 kB). View file
|
|
|