babelplot 2024.4__tar.gz → 2024.5__tar.gz

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.
Files changed (37) hide show
  1. {babelplot-2024.4 → babelplot-2024.5}/PKG-INFO +1 -1
  2. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/catalog/bokeh_.py +2 -2
  3. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/catalog/matplotlib_.py +2 -2
  4. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/catalog/plotly_.py +1 -1
  5. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/catalog/vedo_.py +2 -2
  6. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/main.py +8 -8
  7. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/type/figure.py +4 -4
  8. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/type/frame.py +18 -7
  9. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/type/plot.py +2 -2
  10. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/version.py +1 -1
  11. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot.egg-info/PKG-INFO +1 -1
  12. {babelplot-2024.4 → babelplot-2024.5}/MANIFEST.in +0 -0
  13. {babelplot-2024.4 → babelplot-2024.5}/README-COPYRIGHT-utf8.txt +0 -0
  14. {babelplot-2024.4 → babelplot-2024.5}/README-LICENCE-utf8.txt +0 -0
  15. {babelplot-2024.4 → babelplot-2024.5}/README.rst +0 -0
  16. {babelplot-2024.4 → babelplot-2024.5}/documentation/wiki/description.asciidoc +0 -0
  17. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/__init__.py +0 -0
  18. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/helper/creation.py +0 -0
  19. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/helper/validation.py +0 -0
  20. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/specification/backend.py +0 -0
  21. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/backend/specification/runtime.py +0 -0
  22. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/constant/backend.py +0 -0
  23. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/constant/project.py +0 -0
  24. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/extension/enum_.py +0 -0
  25. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/help.py +0 -0
  26. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/specification/dimension.py +0 -0
  27. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/specification/plot.py +0 -0
  28. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/task/show_pyqt6.py +0 -0
  29. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot/type/base.py +0 -0
  30. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot.egg-info/SOURCES.txt +0 -0
  31. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot.egg-info/dependency_links.txt +0 -0
  32. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot.egg-info/requires.txt +0 -0
  33. {babelplot-2024.4 → babelplot-2024.5}/package/babelplot.egg-info/top_level.txt +0 -0
  34. {babelplot-2024.4 → babelplot-2024.5}/pyproject.toml +0 -0
  35. {babelplot-2024.4 → babelplot-2024.5}/requirements.txt +0 -0
  36. {babelplot-2024.4 → babelplot-2024.5}/setup.cfg +0 -0
  37. {babelplot-2024.4 → babelplot-2024.5}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: babelplot
3
- Version: 2024.4
3
+ Version: 2024.5
4
4
  Summary: A Meta Plotting Library That Speaks Several Backends
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/babelplot/
6
6
  Author: Eric Debreuve
@@ -35,7 +35,7 @@ def _NewPlot(
35
35
  type_: plot_type_h | type(backend_plot_t),
36
36
  plot_function: h.Callable | None,
37
37
  *args,
38
- title: str = None, # If _, then it is swallowed by kwargs!
38
+ title: str | None = None, # If _, then it is swallowed by kwargs!
39
39
  **kwargs,
40
40
  ) -> tuple[backend_plot_t, type(backend_plot_t)]:
41
41
  """"""
@@ -53,7 +53,7 @@ def _NewFrame(
53
53
  __: int,
54
54
  ___: int,
55
55
  *args,
56
- title: str = None,
56
+ title: str | None = None,
57
57
  dim: dim_e = dim_e.XY, # If _, then it is swallowed by kwargs!
58
58
  **kwargs,
59
59
  ) -> backend_frame_t:
@@ -42,7 +42,7 @@ def _NewPlot(
42
42
  type_: plot_type_h | type(backend_plot_h),
43
43
  plot_function: h.Callable | None,
44
44
  *args,
45
- title: str = None, # /!\ If _, then it is swallowed by kwargs!
45
+ title: str | None = None, # /!\ If _, then it is swallowed by kwargs!
46
46
  **kwargs,
47
47
  ) -> tuple[h.Any, h.Callable]:
48
48
  """"""
@@ -65,7 +65,7 @@ def _NewFrame(
65
65
  _: int,
66
66
  __: int,
67
67
  *args,
68
- title: str = None,
68
+ title: str | None = None,
69
69
  dim: dim_e = dim_e.XY,
70
70
  **kwargs,
71
71
  ) -> backend_frame_h:
@@ -49,7 +49,7 @@ def _NewPlot(
49
49
  type_: plot_type_h | type(backend_plot_t),
50
50
  plot_function: h.Callable | None,
51
51
  *args,
52
- title: str = None, # If _, then it is swallowed by kwargs!
52
+ title: str | None = None, # If _, then it is swallowed by kwargs!
53
53
  **kwargs,
54
54
  ) -> tuple[backend_plot_t, type(backend_plot_t)]:
55
55
  """"""
@@ -31,7 +31,7 @@ def _NewPlot(
31
31
  type_: plot_type_h | type(backend_plot_h),
32
32
  plot_function: h.Callable | None,
33
33
  *args,
34
- title: str = None, # If _, then it is swallowed by kwargs!
34
+ title: str | None = None, # If _, then it is swallowed by kwargs!
35
35
  **kwargs,
36
36
  ) -> tuple[backend_plot_h, type(backend_plot_h)]:
37
37
  """"""
@@ -52,7 +52,7 @@ def _NewFrame(
52
52
  _: int,
53
53
  __: int,
54
54
  *___,
55
- title: str = None,
55
+ title: str | None = None,
56
56
  dim: dim_e = dim_e.XY, # If _, then it is swallowed by kwargs!
57
57
  **____,
58
58
  ) -> backend_frame_t:
@@ -23,9 +23,9 @@ from logger_36 import LOGGER
23
23
 
24
24
  def NewFigure(
25
25
  *args,
26
- title: str = None,
26
+ title: str | None = None,
27
27
  offline_version: bool = False,
28
- pbe: str | path_t | backend_e = None,
28
+ pbe: str | path_t | backend_e | None = None,
29
29
  **kwargs,
30
30
  ) -> figure_t | None:
31
31
  """
@@ -75,13 +75,13 @@ def NewPlot(
75
75
  *plt_args,
76
76
  fig_args=(),
77
77
  frm_args=(),
78
- fig_kwargs: dict[str, h.Any] = None,
79
- frm_kwargs: dict[str, h.Any] = None,
80
- fig_title: str = None,
81
- frm_title: str = None,
82
- plt_title: str = None,
78
+ fig_kwargs: dict[str, h.Any] | None = None,
79
+ frm_kwargs: dict[str, h.Any] | None = None,
80
+ fig_title: str | None = None,
81
+ frm_title: str | None = None,
82
+ plt_title: str | None = None,
83
83
  dim: str | dim_e = dim_e.XY,
84
- pbe: str | path_t | backend_e = None,
84
+ pbe: str | path_t | backend_e | None = None,
85
85
  should_show: bool = True,
86
86
  modal: bool = True,
87
87
  **plt_kwargs,
@@ -31,9 +31,9 @@ def _DefaultShape() -> list[int]:
31
31
  @dtcl.dataclass(repr=False, eq=False)
32
32
  class figure_t(base_figure_t):
33
33
 
34
- title: str = None
34
+ title: str | None = None
35
35
  offline_version: bool = False
36
- frame_class: type(frame_t) = dtcl.field(init=False, default=None)
36
+ frame_class: type(frame_t) | None = dtcl.field(init=False, default=None)
37
37
  frames: list[frame_t] = dtcl.field(init=False, default_factory=list)
38
38
  locations: list[tuple[int, int]] = dtcl.field(init=False, default_factory=list)
39
39
  shape: list[int] = dtcl.field(init=False, default_factory=_DefaultShape)
@@ -46,7 +46,7 @@ class figure_t(base_figure_t):
46
46
  def AddFrame(
47
47
  self,
48
48
  *args,
49
- title: str = None,
49
+ title: str | None = None,
50
50
  dim: str | dim_e = dim_e.XY,
51
51
  row: int = 0,
52
52
  col: int = 0,
@@ -185,7 +185,7 @@ class figure_t(base_figure_t):
185
185
  row: int,
186
186
  col: int,
187
187
  *args,
188
- title: str = None,
188
+ title: str | None = None,
189
189
  dim: dim_e = dim_e.XY,
190
190
  **kwargs,
191
191
  ) -> backend_frame_h:
@@ -5,11 +5,12 @@ SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
7
  import dataclasses as dtcl
8
+ import difflib as diff
8
9
  import typing as h
9
10
 
10
11
  from babelplot.backend.specification.runtime import BackendPlots, BackendTranslations
11
12
  from babelplot.specification.dimension import FRAME_DIM_FOR_DATA_DIM, dim_e
12
- from babelplot.specification.plot import TranslatedArguments, plot_type_h
13
+ from babelplot.specification.plot import KNOWN_PLOT_TYPES, TranslatedArguments, plot_type_h
13
14
  from babelplot.type.base import babelplot_element_t as base_frame_t
14
15
  from babelplot.type.base import backend_frame_h, backend_plot_h
15
16
  from babelplot.type.plot import BackendPlotFromAny, plot_t
@@ -19,10 +20,10 @@ plot_type_w_pbe_h = plot_type_h | type(backend_plot_h)
19
20
 
20
21
  @dtcl.dataclass(repr=False, eq=False)
21
22
  class frame_t(base_frame_t):
22
- title: str = None
23
- dim: dim_e = None
24
- frame_dim: int = dtcl.field(init=False, default=None)
25
- plot_class: type(plot_t) = dtcl.field(init=False, default=None)
23
+ title: str | None = None
24
+ dim: dim_e | None = None
25
+ frame_dim: int | None = dtcl.field(init=False, default=None)
26
+ plot_class: type(plot_t) | None = dtcl.field(init=False, default=None)
26
27
  plots: list[plot_t] = dtcl.field(init=False, default_factory=list)
27
28
 
28
29
  def __post_init__(self) -> None:
@@ -33,10 +34,20 @@ class frame_t(base_frame_t):
33
34
  self,
34
35
  type_: plot_type_w_pbe_h,
35
36
  *args,
36
- title: str = None,
37
+ title: str | None = None,
37
38
  **kwargs,
38
39
  ) -> plot_t:
39
40
  """"""
41
+ if isinstance(type_, str):
42
+ closest = diff.get_close_matches(type_.lower(), KNOWN_PLOT_TYPES, n=1)
43
+ if closest.__len__() == 0:
44
+ raise ValueError(
45
+ f"{type_}: Unknown plot type. Valid options: "
46
+ f"{str(KNOWN_PLOT_TYPES)[1:-1]}."
47
+ )
48
+
49
+ type_ = closest[0]
50
+
40
51
  plot_function = BackendPlotFromAny(
41
52
  type_, self.frame_dim, self.pbe, BackendPlots(self.pbe)
42
53
  )
@@ -77,7 +88,7 @@ class frame_t(base_frame_t):
77
88
  type_: plot_type_w_pbe_h,
78
89
  plot_function: h.Callable | None,
79
90
  *args,
80
- title: str = None,
91
+ title: str | None = None,
81
92
  **kwargs,
82
93
  ) -> tuple[h.Any, type(backend_plot_h)]:
83
94
  """
@@ -19,9 +19,9 @@ from babelplot.type.base import backend_plot_h
19
19
 
20
20
  @dtcl.dataclass(repr=False, eq=False)
21
21
  class plot_t(base_plot_t):
22
- title: str = None
22
+ title: str | None = None
23
23
  # See babelplot.type.frame.NewBackendPlot for an explanation
24
- backend_type: type(backend_plot_h) = dtcl.field(init=False, default=None)
24
+ backend_type: type(backend_plot_h) | None = dtcl.field(init=False, default=None)
25
25
 
26
26
 
27
27
  def BackendPlotFromPlotE(
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2022
4
4
  SEE COPYRIGHT NOTICE BELOW
5
5
  """
6
6
 
7
- __version__ = "2024.4"
7
+ __version__ = "2024.5"
8
8
 
9
9
  """
10
10
  COPYRIGHT NOTICE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: babelplot
3
- Version: 2024.4
3
+ Version: 2024.5
4
4
  Summary: A Meta Plotting Library That Speaks Several Backends
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/babelplot/
6
6
  Author: Eric Debreuve
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes