mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
Add ty to check for missing symbols and other simple errors
This commit is contained in:
@@ -101,7 +101,7 @@ class AggregateDecorator:
|
||||
cls.is_installed = False
|
||||
|
||||
def dotted_line_shader(self):
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface") # ty:ignore[too-many-positional-arguments]
|
||||
vert_out.smooth("FLOAT", "v_ArcLength")
|
||||
|
||||
shader_info = gpu.types.GPUShaderCreateInfo()
|
||||
|
||||
@@ -230,7 +230,7 @@ class BcfTopic(PropertyGroup):
|
||||
|
||||
|
||||
def get_related_topics(self: "BCFProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
|
||||
global RELATED_TOPICS_ENUM_ITEMS
|
||||
global RELATED_TOPICS_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
props = self
|
||||
active_topic = props.active_topic
|
||||
active_related_topics = active_topic.related_topics.keys()
|
||||
|
||||
@@ -46,26 +46,26 @@ def get_libraries(self, context):
|
||||
|
||||
|
||||
def get_namespaces(self, context):
|
||||
global NAMESPACES_ENUM_ITEMS
|
||||
global NAMESPACES_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
NAMESPACES_ENUM_ITEMS = [(uri, f"{alias}: {uri}", "") for alias, uri in BrickStore.namespaces]
|
||||
return NAMESPACES_ENUM_ITEMS
|
||||
|
||||
|
||||
def get_brick_entity_classes(self, context):
|
||||
global ENTITY_CLASSES_ENUM_ITEMS
|
||||
global ENTITY_CLASSES_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
entity = self.brick_entity_create_type
|
||||
ENTITY_CLASSES_ENUM_ITEMS = [(uri, uri.split("#")[-1], "") for uri in BrickStore.entity_classes[entity]]
|
||||
return ENTITY_CLASSES_ENUM_ITEMS
|
||||
|
||||
|
||||
def get_brick_roots(self, context):
|
||||
global BRICK_ROOTS_ENUM_ITEMS
|
||||
global BRICK_ROOTS_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
BRICK_ROOTS_ENUM_ITEMS = [(root, root, "") for root in BrickStore.root_classes]
|
||||
return BRICK_ROOTS_ENUM_ITEMS
|
||||
|
||||
|
||||
def get_brick_relations(self, context):
|
||||
global BRICK_RELATIONS_ENUM_ITEMS
|
||||
global BRICK_RELATIONS_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
BRICK_RELATIONS_ENUM_ITEMS = [(uri, uri.split("#")[-1], "") for uri in BrickStore.relationships]
|
||||
for relation in BrickschemaData.data["active_relations"]:
|
||||
if relation["predicate_name"] == "label":
|
||||
|
||||
@@ -456,7 +456,8 @@ def format_distance(
|
||||
tx_dist = fmt % d_cm
|
||||
|
||||
else:
|
||||
tx_dist = fmt % value
|
||||
assert f"Unexpected unit_system - '{unit_system}'."
|
||||
# tx_dist = fmt % value
|
||||
|
||||
return tx_dist
|
||||
|
||||
|
||||
@@ -1066,7 +1066,7 @@ class OverrideOutlinerDelete(bpy.types.Operator, tool.Ifc.Operator):
|
||||
cls.poll_message_set("Only available from Outliner.")
|
||||
return False
|
||||
|
||||
def execute(self, context):
|
||||
def execute(self, context): # ty:ignore[override-of-final-method]
|
||||
if len(getattr(context, "selected_ids", [])) == 0:
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from bonsai.bim.prop import StrProperty
|
||||
|
||||
class BIMCityJsonProperties(PropertyGroup):
|
||||
def get_lods(self, context):
|
||||
global LODS_ENUM_ITEMS
|
||||
global LODS_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
LODS_ENUM_ITEMS = [(item.name, "LOD" + item.name, "Level of Detail " + item.name) for item in self.lods]
|
||||
return LODS_ENUM_ITEMS
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ class RadianceExporterProperties(PropertyGroup):
|
||||
)
|
||||
|
||||
def get_subcategories(self, context: bpy.types.Context) -> tool.Blender.BLENDER_ENUM_ITEMS:
|
||||
global SUBCATEGORIES_ENUM_ITEMS
|
||||
global SUBCATEGORIES_ENUM_ITEMS # ty: ignore[unresolved-global]
|
||||
if self.category in spectraldb:
|
||||
SUBCATEGORIES_ENUM_ITEMS = [(k, k, "") for k in spectraldb[self.category].keys()]
|
||||
else:
|
||||
|
||||
@@ -694,10 +694,14 @@ def generate_box(usecase_path: str, ifc_file: ifcopenshell.file, settings: dict[
|
||||
|
||||
new_settings = settings.copy()
|
||||
new_settings["context"] = box_context
|
||||
new_box = ifcopenshell.api.geometry.add_representation(ifc_file, should_run_listeners=False, **new_settings)
|
||||
new_box = ifcopenshell.api.geometry.add_representation(
|
||||
ifc_file,
|
||||
should_run_listeners=False, # ty:ignore[unknown-argument]
|
||||
**new_settings,
|
||||
)
|
||||
ifcopenshell.api.geometry.assign_representation(
|
||||
ifc_file,
|
||||
should_run_listeners=False,
|
||||
should_run_listeners=False, # ty:ignore[unknown-argument]
|
||||
product=product,
|
||||
representation=new_box,
|
||||
)
|
||||
|
||||
@@ -31,11 +31,11 @@ def calculate_quantities(usecase_path, ifc_file: ifcopenshell.file, settings):
|
||||
return
|
||||
task = next(e for e in ifc_file.get_inverse(element) if e.is_a("IfcTask"))
|
||||
qto = ifcopenshell.api.pset.add_qto(
|
||||
ifc_file, should_run_listeners=False, product=task, name="Qto_TaskBaseQuantities"
|
||||
ifc_file, should_run_listeners=False, product=task, name="Qto_TaskBaseQuantities" # ty:ignore[unknown-argument]
|
||||
)
|
||||
ifcopenshell.api.pset.edit_qto(
|
||||
ifc_file,
|
||||
should_run_listeners=False,
|
||||
should_run_listeners=False, # ty:ignore[unknown-argument]
|
||||
qto=qto,
|
||||
properties={
|
||||
"StandardWork": ifcopenshell.util.date.ifc2datetime(element.ScheduleDuration).days,
|
||||
|
||||
@@ -101,7 +101,7 @@ class NestDecorator:
|
||||
cls.is_installed = False
|
||||
|
||||
def dotted_line_shader(self):
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface") # ty:ignore[too-many-positional-arguments]
|
||||
vert_out.smooth("FLOAT", "v_ArcLength")
|
||||
|
||||
shader_info = gpu.types.GPUShaderCreateInfo()
|
||||
|
||||
@@ -321,7 +321,7 @@ def get_gross_perimeter(o: bpy.types.Object) -> float:
|
||||
return gross_perimeter
|
||||
|
||||
|
||||
def get_space_net_perimeter(obj: bpy.types.Object) -> float:
|
||||
def get_space_net_perimeter(obj: bpy.types.Object) -> None:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class DecorationShader:
|
||||
PARALLEL DISTRIBUTED FORCE,
|
||||
DISTRIBUTED MOMENT,
|
||||
"""
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface") # ty:ignore[too-many-positional-arguments]
|
||||
vert_out.smooth("VEC3", "forces")
|
||||
vert_out.smooth("VEC3", "co")
|
||||
|
||||
@@ -203,7 +203,7 @@ class DecorationShader:
|
||||
"""param: pattern: type of pattern
|
||||
SINGLE FORCE,
|
||||
SINGLE MOMENT"""
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface") # ty: ignore[too-many-positional-arguments]
|
||||
vert_out.smooth("VEC3", "co")
|
||||
|
||||
shader_info = gpu.types.GPUShaderCreateInfo()
|
||||
@@ -253,7 +253,7 @@ class DecorationShader:
|
||||
|
||||
def get_planar_shader(self) -> gpu.types.GPUShader:
|
||||
"""shader for planar loads"""
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
|
||||
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface") # ty: ignore[too-many-positional-arguments]
|
||||
vert_out.smooth("VEC3", "co")
|
||||
|
||||
shader_info = gpu.types.GPUShaderCreateInfo()
|
||||
|
||||
@@ -154,7 +154,7 @@ class Cost(bonsai.core.tool.Cost):
|
||||
device = aud.Device()
|
||||
# chaching.mp3 is by Lucish_ CC-BY-3.0 https://freesound.org/people/Lucish_/sounds/554841/
|
||||
filepath = tool.Blender.get_data_dir_path("chaching.mp3").__str__()
|
||||
sound = aud.Sound(filepath)
|
||||
sound = aud.Sound(filepath) # ty:ignore[too-many-positional-arguments]
|
||||
device.play(sound)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -284,7 +284,7 @@ class IfcGit:
|
||||
if re.match("^Ifc", obj.name):
|
||||
bpy.data.objects.remove(obj, do_unlink=True)
|
||||
|
||||
bpy.data.orphans_purge(do_recursive=True)
|
||||
bpy.data.orphans_purge(do_recursive=True) # ty:ignore[unknown-argument]
|
||||
|
||||
settings = import_ifc.IfcImportSettings.factory(bpy.context, path_ifc, logging.getLogger("ImportIFC"))
|
||||
settings.should_setup_viewport_camera = False
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""Clone or update Bonsai external dependencies.
|
||||
|
||||
Must be run from the repository root.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
DEPS = [
|
||||
("https://projects.blender.org/pioverfour/sun_position.git", "sun_position"),
|
||||
("https://github.com/kevancress/MeasureIt_ARCH", "MeasureIt_ARCH"),
|
||||
("https://github.com/nortikin/sverchok.git", "sverchok"),
|
||||
]
|
||||
|
||||
base = Path("src/bonsai/external_dependencies")
|
||||
base.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for url, name in DEPS:
|
||||
path = base / name
|
||||
if not path.exists():
|
||||
subprocess.check_call(["git", "clone", url, str(path)])
|
||||
else:
|
||||
subprocess.check_call(["git", "-C", str(path), "pull", "--rebase"])
|
||||
@@ -273,10 +273,10 @@ if BPY_IS_LOADED:
|
||||
f"Couldn't find locale path in the source directory, creating dummy directory: {source_locale_path}.",
|
||||
)
|
||||
|
||||
from ui_translate.settings import ( # pyright: ignore[reportMissingImports]
|
||||
from ui_translate.settings import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
settings as ui_translate_settings,
|
||||
)
|
||||
from ui_translate.update_ui import ( # pyright: ignore[reportMissingImports]
|
||||
from ui_translate.update_ui import ( # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
UI_OT_i18n_updatetranslation_init_settings,
|
||||
)
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@ import bpy
|
||||
|
||||
# sys.path.append('C:\Program Files\Python37\Lib\site-packages')
|
||||
import lxml.etree
|
||||
from bspy import Gbxml # pyright: ignore[reportMissingImports]
|
||||
from bspy import ( # ty: ignore[unresolved-import]
|
||||
Gbxml, # pyright: ignore[reportMissingImports]
|
||||
)
|
||||
|
||||
|
||||
class GbxmlExporter:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
from math import pi
|
||||
from pathlib import Path
|
||||
|
||||
import boltspy as bolts # pyright: ignore[reportMissingImports]
|
||||
import boltspy as bolts # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
import ifcopenshell.api
|
||||
import ifcopenshell.api.material
|
||||
import ifcopenshell.api.project
|
||||
|
||||
@@ -31,7 +31,7 @@ import ifcopenshell.api.spatial
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.guid
|
||||
import numpy as np
|
||||
import pymeshlab # pyright: ignore[reportMissingImports]
|
||||
import pymeshlab # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
|
||||
class Obj2Ifc:
|
||||
|
||||
@@ -31,7 +31,7 @@ import ifcopenshell.api.spatial
|
||||
import ifcopenshell.api.unit
|
||||
import ifcopenshell.guid
|
||||
import numpy as np
|
||||
import pywavefront # pyright: ignore[reportMissingImports]
|
||||
import pywavefront # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import]
|
||||
|
||||
|
||||
class Obj2Ifc:
|
||||
|
||||
@@ -242,7 +242,7 @@ class TemplateListItemSpy(PanelSpy):
|
||||
self.spied_props: list[dict[str, Any]] = []
|
||||
self.spied_operators: list[dict[str, Any]] = []
|
||||
if len(signature(blender_panel.draw_item).parameters) == 8:
|
||||
blender_panel.draw_item(
|
||||
blender_panel.draw_item( # ty:ignore[missing-argument]
|
||||
self,
|
||||
bpy.context,
|
||||
self,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
aiohttp
|
||||
beautifulsoup4
|
||||
boto3
|
||||
botocore
|
||||
brickschema
|
||||
cjio >=0.8, <0.10
|
||||
debugpy
|
||||
ezdxf
|
||||
fake-bpy-module-latest
|
||||
git+https://github.com/prochitecture/bpypolyskel
|
||||
git+https://github.com/Andrej730/IFC2JSON_python.git@pyproject_toml
|
||||
gitpython
|
||||
isodate
|
||||
lark
|
||||
lxml
|
||||
lxml-stubs
|
||||
markdown-it-py
|
||||
natsort
|
||||
numpy
|
||||
odfpy
|
||||
openpyxl
|
||||
pandas
|
||||
pillow
|
||||
platformdirs
|
||||
pygments
|
||||
pyradiance
|
||||
pystache
|
||||
pytest
|
||||
pytest_bdd
|
||||
pytest_blender
|
||||
python-dateutil
|
||||
python-socketio
|
||||
pytz
|
||||
rdflib
|
||||
requests
|
||||
shapely
|
||||
svgwrite
|
||||
typing-extensions
|
||||
typst
|
||||
tzfpy
|
||||
xsdata
|
||||
Reference in New Issue
Block a user