gleplot 6.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gleplot/__init__.py +772 -0
- gleplot/_warn.py +45 -0
- gleplot/axes.py +10714 -0
- gleplot/cairo_support.py +232 -0
- gleplot/colors.py +721 -0
- gleplot/compiler.py +863 -0
- gleplot/config.py +491 -0
- gleplot/dataio.py +1403 -0
- gleplot/figure.py +5789 -0
- gleplot/guides.py +172 -0
- gleplot/markers.py +424 -0
- gleplot/mathtext.py +679 -0
- gleplot/palettes.py +243 -0
- gleplot/parser/__init__.py +83 -0
- gleplot/parser/expr.py +196 -0
- gleplot/parser/lexer.py +289 -0
- gleplot/parser/metadata.py +374 -0
- gleplot/parser/recognizer.py +12654 -0
- gleplot/parser/report.py +74 -0
- gleplot/parser/syntax.py +756 -0
- gleplot/parser/tables.py +484 -0
- gleplot/parser/units.py +196 -0
- gleplot/py.typed +0 -0
- gleplot/series.py +1609 -0
- gleplot/sources.py +623 -0
- gleplot/writer.py +7215 -0
- gleplot-6.0.0.dist-info/METADATA +138 -0
- gleplot-6.0.0.dist-info/RECORD +31 -0
- gleplot-6.0.0.dist-info/WHEEL +5 -0
- gleplot-6.0.0.dist-info/licenses/LICENSE +25 -0
- gleplot-6.0.0.dist-info/top_level.txt +1 -0
gleplot/_warn.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Warnings attributed to the user's line rather than to gleplot's."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import warnings
|
|
7
|
+
from types import FrameType
|
|
8
|
+
from typing import Any, Iterable, Optional, Type, Union
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def warn_external(
|
|
12
|
+
message: Union[str, Warning], category: Type[Warning] = UserWarning
|
|
13
|
+
) -> None:
|
|
14
|
+
"""``warnings.warn`` at the first calling frame outside the gleplot package.
|
|
15
|
+
|
|
16
|
+
A fixed ``stacklevel`` is right for one call path only. The same warning is
|
|
17
|
+
reached from ``Figure.savefig``, ``glp.savefig`` and ``Figure.view`` at
|
|
18
|
+
different depths, and every ``glp.*`` function adds a frame in front of the
|
|
19
|
+
``Axes`` method it forwards to.
|
|
20
|
+
"""
|
|
21
|
+
frame: Optional[FrameType] = sys._getframe(1)
|
|
22
|
+
stacklevel = 2
|
|
23
|
+
while frame is not None:
|
|
24
|
+
module = frame.f_globals.get("__name__", "")
|
|
25
|
+
if module != "gleplot" and not module.startswith("gleplot."):
|
|
26
|
+
break
|
|
27
|
+
frame = frame.f_back
|
|
28
|
+
stacklevel += 1
|
|
29
|
+
warnings.warn(message, category, stacklevel=stacklevel)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def warn_unsupported_keywords(
|
|
33
|
+
caller: str, names: Iterable[Any], hint: str = ""
|
|
34
|
+
) -> None:
|
|
35
|
+
"""One warning listing the keyword ``names`` that ``caller()`` ignores.
|
|
36
|
+
|
|
37
|
+
The shared message for keywords a public call accepts but cannot honour.
|
|
38
|
+
The caller first takes out what it handles, matplotlib's short aliases
|
|
39
|
+
included; nothing is said when ``names`` is empty. ``hint``, a sentence
|
|
40
|
+
saying what the call does take, follows the list.
|
|
41
|
+
"""
|
|
42
|
+
listed = ", ".join(sorted(str(name) for name in names))
|
|
43
|
+
if listed:
|
|
44
|
+
message = f"{caller}() ignores unsupported keyword(s): {listed}."
|
|
45
|
+
warn_external(f"{message} {hint}" if hint else message)
|