Skip to content

Commit c28f957

Browse files
authored
Merge pull request #8 from bitcraze/rik/reorg
Refactor cflib2 package: split flat re-exports into dedicated submodules
2 parents 526d0ab + 5ce386d commit c28f957

15 files changed

Lines changed: 307 additions & 57 deletions

cflib2/__init__.py

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,51 +22,6 @@
2222
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2323
"""Crazyflie Python Library"""
2424

25-
from cflib2._rust import (
26-
Crazyflie,
27-
LinkContext,
28-
# TOC cache classes (passed to Crazyflie.connect_from_uri)
29-
NoTocCache,
30-
InMemoryTocCache,
31-
FileTocCache,
32-
# Exceptions
33-
CrazyflieError,
34-
ProtocolVersionNotSupportedError,
35-
ProtocolError,
36-
ParamError,
37-
LogError,
38-
ConversionError,
39-
LinkError,
40-
DisconnectedError,
41-
VariableNotFoundError,
42-
SystemError,
43-
AppchannelPacketTooLargeError,
44-
InvalidArgumentError,
45-
TimeoutError,
46-
MemoryError,
47-
InvalidParameterError,
48-
)
25+
from cflib2._rust import Crazyflie, LinkContext
4926

50-
__all__ = [
51-
"Crazyflie",
52-
"LinkContext",
53-
"NoTocCache",
54-
"InMemoryTocCache",
55-
"FileTocCache",
56-
# Exceptions
57-
"CrazyflieError",
58-
"ProtocolVersionNotSupportedError",
59-
"ProtocolError",
60-
"ParamError",
61-
"LogError",
62-
"ConversionError",
63-
"LinkError",
64-
"DisconnectedError",
65-
"VariableNotFoundError",
66-
"SystemError",
67-
"AppchannelPacketTooLargeError",
68-
"InvalidArgumentError",
69-
"TimeoutError",
70-
"MemoryError",
71-
"InvalidParameterError",
72-
]
27+
__all__ = ["Crazyflie", "LinkContext"]
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
#
13
# ,---------, ____ _ __
24
# | ,-^-, | / __ )(_) /_______________ _____ ___
35
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
@@ -18,8 +20,8 @@
1820
#
1921
# You should have received a copy of the GNU General Public License
2022
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21-
"""Trajectory building primitives for the Crazyflie"""
23+
"""Commander subsystem types"""
2224

23-
from cflib2._rust import Poly, Poly4D, CompressedStart, CompressedSegment
25+
from cflib2._rust import Commander
2426

25-
__all__ = ["Poly", "Poly4D", "CompressedStart", "CompressedSegment"]
27+
__all__ = ["Commander"]

cflib2/console.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Console subsystem types"""
24+
25+
from cflib2._rust import Console
26+
27+
__all__ = ["Console"]

cflib2/error.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Crazyflie exception types"""
24+
25+
from cflib2._rust import (
26+
AppchannelPacketTooLargeError,
27+
ConversionError,
28+
CrazyflieError,
29+
DisconnectedError,
30+
InvalidArgumentError,
31+
InvalidParameterError,
32+
LinkError,
33+
LogError,
34+
MemoryError,
35+
ParamError,
36+
ProtocolError,
37+
ProtocolVersionNotSupportedError,
38+
SystemError,
39+
TimeoutError,
40+
VariableNotFoundError,
41+
)
42+
43+
__all__ = [
44+
"AppchannelPacketTooLargeError",
45+
"ConversionError",
46+
"CrazyflieError",
47+
"DisconnectedError",
48+
"InvalidArgumentError",
49+
"InvalidParameterError",
50+
"LinkError",
51+
"LogError",
52+
"MemoryError",
53+
"ParamError",
54+
"ProtocolError",
55+
"ProtocolVersionNotSupportedError",
56+
"SystemError",
57+
"TimeoutError",
58+
"VariableNotFoundError",
59+
]

cflib2/high_level_commander.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""High-level commander subsystem types"""
24+
25+
from cflib2._rust import HighLevelCommander
26+
27+
__all__ = ["HighLevelCommander"]

cflib2/localization.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Localization subsystem types"""
24+
25+
from cflib2._rust import (
26+
EmergencyControl,
27+
ExternalPose,
28+
Lighthouse,
29+
LighthouseAngleData,
30+
LighthouseAngles,
31+
Localization,
32+
LocoPositioning,
33+
)
34+
35+
__all__ = [
36+
"EmergencyControl",
37+
"ExternalPose",
38+
"Lighthouse",
39+
"LighthouseAngleData",
40+
"LighthouseAngles",
41+
"Localization",
42+
"LocoPositioning",
43+
]

cflib2/log.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Log subsystem types"""
24+
25+
from cflib2._rust import Log, LogBlock, LogData, LogStream
26+
27+
__all__ = ["Log", "LogBlock", "LogData", "LogStream"]

cflib2/memory.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Memory subsystem types"""
24+
25+
from cflib2._rust import CompressedSegment, CompressedStart, Memory, Poly, Poly4D
26+
27+
__all__ = ["CompressedSegment", "CompressedStart", "Memory", "Poly", "Poly4D"]

cflib2/param.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Parameter subsystem types"""
24+
25+
from cflib2._rust import Param, PersistentParamState
26+
27+
__all__ = ["Param", "PersistentParamState"]

cflib2/platform.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# ,---------, ____ _ __
4+
# | ,-^-, | / __ )(_) /_______________ _____ ___
5+
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
6+
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
7+
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
8+
#
9+
# Copyright (C) 2025 Bitcraze AB
10+
#
11+
# This program is free software: you can redistribute it and/or modify
12+
# it under the terms of the GNU General Public License as published by
13+
# the Free Software Foundation, either version 3 of the License, or
14+
# (at your option) any later version.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
"""Platform subsystem types"""
24+
25+
from cflib2._rust import AppChannel, Platform
26+
27+
__all__ = ["AppChannel", "Platform"]

0 commit comments

Comments
 (0)