mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 10:57:49 +00:00
Add ty to check for missing symbols and other simple errors
This commit is contained in:
@@ -33,14 +33,14 @@ def _has_occ():
|
||||
# Previous versions (pythonocc<=0.17.3) are using just OCC.
|
||||
|
||||
try:
|
||||
import OCC.Core.BRepTools # pyright: ignore[reportMissingImports]
|
||||
import OCC.Core.BRepTools # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
return True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
import OCC.BRepTools # noqa: F401 # pyright: ignore[reportMissingImports]
|
||||
import OCC.BRepTools # noqa: F401 # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
return True
|
||||
except ImportError:
|
||||
|
||||
@@ -28,7 +28,7 @@ from ..file import file
|
||||
from . import has_occ
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports]
|
||||
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
IteratorOutput = Union["ShapeElementType", "utils.shape_tuple"]
|
||||
|
||||
@@ -47,9 +47,9 @@ if has_occ:
|
||||
from . import occ_utils as utils
|
||||
|
||||
try:
|
||||
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports]
|
||||
from OCC.Core import TopoDS # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
except ImportError:
|
||||
from OCC import TopoDS # pyright: ignore[reportMissingImports]
|
||||
from OCC import TopoDS # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
def wrap_shape_creation(settings: settings, shape: ifcopenshell_wrapper.Element):
|
||||
if getattr(settings, "use_python_opencascade", False):
|
||||
|
||||
@@ -26,17 +26,33 @@ import warnings
|
||||
from collections.abc import Iterable
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
import OCC # pyright: ignore[reportMissingImports]
|
||||
import OCC # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
from typing_extensions import assert_never
|
||||
|
||||
import ifcopenshell.ifcopenshell_wrapper as ifcopenshell_wrapper
|
||||
|
||||
try:
|
||||
from OCC.Core import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp # pyright: ignore[reportMissingImports]
|
||||
from OCC.Core import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
AIS,
|
||||
BRepTools,
|
||||
Graphic3d,
|
||||
Quantity,
|
||||
TopoDS,
|
||||
V3d,
|
||||
gp,
|
||||
)
|
||||
|
||||
USE_OCCT_HANDLE = False
|
||||
except ImportError:
|
||||
from OCC import AIS, BRepTools, Graphic3d, Quantity, TopoDS, V3d, gp # pyright: ignore[reportMissingImports]
|
||||
from OCC import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
AIS,
|
||||
BRepTools,
|
||||
Graphic3d,
|
||||
Quantity,
|
||||
TopoDS,
|
||||
V3d,
|
||||
gp,
|
||||
)
|
||||
|
||||
USE_OCCT_HANDLE = True
|
||||
|
||||
@@ -68,7 +84,7 @@ DEFAULT_STYLES = {
|
||||
|
||||
|
||||
def initialize_display():
|
||||
import OCC.Display.SimpleGui # pyright: ignore[reportMissingImports]
|
||||
import OCC.Display.SimpleGui # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
global handle, main_loop, add_menu, add_function_to_menu
|
||||
handle, main_loop, add_menu, add_function_to_menu = OCC.Display.SimpleGui.init_display()
|
||||
|
||||
Reference in New Issue
Block a user