From b17efb685ae897f153efea3fe191fdd7a16defc7 Mon Sep 17 00:00:00 2001 From: Alexandre MARY Date: Fri, 13 Dec 2024 12:05:40 +0100 Subject: [PATCH 1/3] missing dependency on pyyaml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 421c56a..03c8a94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ classifiers = [ "License :: CeCILL-C Free Software License Agreement (CECILL-C)", ] dependencies = [ + "pyyaml", ] dynamic = ["version"] From 804bee98caca35ab8be531f3f0ccb2a75403f206 Mon Sep 17 00:00:00 2001 From: Alexandre MARY Date: Fri, 13 Dec 2024 14:05:43 +0100 Subject: [PATCH 2/3] import matplotlib.pyplot, fixes Issue #9 --- src/bronx/graphics/axes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bronx/graphics/axes.py b/src/bronx/graphics/axes.py index 68dcec2..6708e5e 100644 --- a/src/bronx/graphics/axes.py +++ b/src/bronx/graphics/axes.py @@ -19,6 +19,7 @@ def set_figax(figure=None, ax=None, using pyplot.subplots(), in which case any argument can be additionally passed through subplots_kw. """ + import matplotlib.pyplot plt = matplotlib.pyplot if ax is not None and figure is None: figure = ax.figure @@ -52,6 +53,7 @@ def set_nice_time_axis(axis, xy, :param datefmt: format for date :param tickslabelsrotation: angle in degrees, anti-clockwise order """ + import matplotlib.pyplot mdates = matplotlib.dates plt = matplotlib.pyplot From 10882fec943577f657d5a1ec328c43464ccd0f37 Mon Sep 17 00:00:00 2001 From: Alexandre MARY Date: Mon, 6 Jan 2025 15:40:29 +0100 Subject: [PATCH 3/3] Add 'init_before' decorator (from epygram) --- src/bronx/syntax/decorators.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/bronx/syntax/decorators.py b/src/bronx/syntax/decorators.py index 22c51d0..3a8bb53 100644 --- a/src/bronx/syntax/decorators.py +++ b/src/bronx/syntax/decorators.py @@ -105,3 +105,17 @@ def secured_getattr(self, key): else: return func(self, key) return secured_getattr + + +@nicedeco +def init_before(mtd): + """ + Decorator for methods: call method self._actual_init() + before actually calling method if not self.initialized. + """ + def initialized(self, *args, **kwargs): + if not self._initialized: + self._actual_init() + return mtd(self, *args, **kwargs) + return initialized +