diff --git a/src/idl_gen_python.cpp b/src/idl_gen_python.cpp index 32c576b65..00eee9e46 100644 --- a/src/idl_gen_python.cpp +++ b/src/idl_gen_python.cpp @@ -587,6 +587,7 @@ class PythonStubGenerator { std::map> names_by_module; for (const Import &import : imports.imports) { if (import.IsLocal()) continue; // skip all local imports + if (import.module == "flatbuffers" && import.name == "") continue; // skip double include hardcoded flatbuffers if (import.name == "") { modules.insert(import.module); } else { diff --git a/tests/MyGame/Example/ArrayStruct.pyi b/tests/MyGame/Example/ArrayStruct.pyi index 6c5cbefb2..f68d38143 100644 --- a/tests/MyGame/Example/ArrayStruct.pyi +++ b/tests/MyGame/Example/ArrayStruct.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.NestedStruct import NestedStruct, NestedStructT from MyGame.Example.TestEnum import TestEnum diff --git a/tests/MyGame/Example/ArrayTable.pyi b/tests/MyGame/Example/ArrayTable.pyi index 5d713418d..fb3d0af14 100644 --- a/tests/MyGame/Example/ArrayTable.pyi +++ b/tests/MyGame/Example/ArrayTable.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.ArrayStruct import ArrayStruct, ArrayStructT diff --git a/tests/MyGame/Example/NestedStruct.pyi b/tests/MyGame/Example/NestedStruct.pyi index 7fe982ce3..df8584375 100644 --- a/tests/MyGame/Example/NestedStruct.pyi +++ b/tests/MyGame/Example/NestedStruct.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.TestEnum import TestEnum diff --git a/tests/MyGame/Example/NestedUnion/Any.pyi b/tests/MyGame/Example/NestedUnion/Any.pyi index 4b0ab03a3..a32f7f88a 100644 --- a/tests/MyGame/Example/NestedUnion/Any.pyi +++ b/tests/MyGame/Example/NestedUnion/Any.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.NestedUnion.TestSimpleTableWithEnum import TestSimpleTableWithEnum from MyGame.Example.NestedUnion.Vec3 import Vec3 diff --git a/tests/MyGame/Example/NestedUnion/Color.pyi b/tests/MyGame/Example/NestedUnion/Color.pyi index b50e562d7..2e0157cd5 100644 --- a/tests/MyGame/Example/NestedUnion/Color.pyi +++ b/tests/MyGame/Example/NestedUnion/Color.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from typing import cast diff --git a/tests/MyGame/Example/NestedUnion/NestedUnionTest.pyi b/tests/MyGame/Example/NestedUnion/NestedUnionTest.pyi index 97a742dd9..b762d9d35 100644 --- a/tests/MyGame/Example/NestedUnion/NestedUnionTest.pyi +++ b/tests/MyGame/Example/NestedUnion/NestedUnionTest.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.NestedUnion.Any import Any from MyGame.Example.NestedUnion.TestSimpleTableWithEnum import TestSimpleTableWithEnumT diff --git a/tests/MyGame/Example/NestedUnion/Test.pyi b/tests/MyGame/Example/NestedUnion/Test.pyi index f1cfa321f..337690bb7 100644 --- a/tests/MyGame/Example/NestedUnion/Test.pyi +++ b/tests/MyGame/Example/NestedUnion/Test.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing uoffset: typing.TypeAlias = flatbuffers.number_types.UOffsetTFlags.py_type diff --git a/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.pyi b/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.pyi index 4c8b6dff3..05f138062 100644 --- a/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.pyi +++ b/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.NestedUnion.Color import Color diff --git a/tests/MyGame/Example/NestedUnion/Vec3.pyi b/tests/MyGame/Example/NestedUnion/Vec3.pyi index 9205c5fe3..9057e0555 100644 --- a/tests/MyGame/Example/NestedUnion/Vec3.pyi +++ b/tests/MyGame/Example/NestedUnion/Vec3.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from MyGame.Example.NestedUnion.Color import Color from MyGame.Example.NestedUnion.Test import Test, TestT diff --git a/tests/MyGame/Example/TestEnum.pyi b/tests/MyGame/Example/TestEnum.pyi index 11ab4ef7a..5679cd820 100644 --- a/tests/MyGame/Example/TestEnum.pyi +++ b/tests/MyGame/Example/TestEnum.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing from typing import cast diff --git a/tests/MyGame/MonsterExtra.pyi b/tests/MyGame/MonsterExtra.pyi index 5088cd276..5419136e0 100644 --- a/tests/MyGame/MonsterExtra.pyi +++ b/tests/MyGame/MonsterExtra.pyi @@ -3,7 +3,6 @@ from __future__ import annotations import flatbuffers import numpy as np -import flatbuffers import typing uoffset: typing.TypeAlias = flatbuffers.number_types.UOffsetTFlags.py_type