python: move exception types out of __init__.py
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 19 Jun 2023 18:47:15 +0000 (14:47 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 21 Sep 2023 17:29:44 +0000 (13:29 -0400)
commit0feb43aa37d822b8d1110186db61a25eb6bb1c22
treeb6202227d5b2c31f54c1fe8cba304189b50a51f3
parente5914347c8eea0f26c07348d0ac64dbe020de44a
python: move exception types out of __init__.py

Move exception types defined in __init__.py.

 - Move _MemoryError to error.py
 - Move _IncompleteUserClass to component.py
 - Move the others to utils.py

I initially moved them to a new exceptions.py file, but I think that
it's just fine to move them in the existing files.  But it's a
possibility too, if y'all prefer that.

The goal of this commit is to make it easier to use these types
internally, using the form:

    from bt2 import utils as bt2_utils

    ... use bt2_utils.TryAgain ...

... in order to get rid of the internal `import bt2` imports.

Note that it would be possible to keep the exception types in
__init__.py and do:

    from bt2 import TryAgain

... and then use `TryAgain` in the code, but I think we prefer using a
module qualifier for whatever is imported.

Change-Id: I7d8dbdc28a3a2e3e38093903d622487a45fe7637
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10387
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/bindings/python/bt2/bt2/__init__.py
src/bindings/python/bt2/bt2/component.py
src/bindings/python/bt2/bt2/error.py
src/bindings/python/bt2/bt2/utils.py
This page took 0.026009 seconds and 4 git commands to generate.