From 68d967c2e572d1303039736a7e60d6341bdcad58 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 16 May 2025 18:12:33 +0500 Subject: [PATCH] pyproject.toml - enableTypeIgnoreComments=false --- pyproject.toml | 2 ++ src/bcf/bcf/agnostic/extensions.py | 2 +- src/bonsai/bonsai/bim/module/cost/operator.py | 4 ++-- src/bonsai/bonsai/bim/module/model/product.py | 2 +- src/bonsai/bonsai/bim/module/model/wall.py | 2 +- src/bonsai/bonsai/bim/module/sequence/operator.py | 4 ++-- src/bonsai/bonsai/bim/prop.py | 8 ++++---- .../ifcopenshell/util/representation.py | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8864121f3b..ea92b0ad6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,3 +36,5 @@ extend-exclude = ''' reportInvalidTypeForm = false disableBytesTypePromotions = true reportUnnecessaryTypeIgnoreComment = true +# Just to add a quick insert of `# pyright: ignore[xxx]` comments in Pylance. +enableTypeIgnoreComments = false diff --git a/src/bcf/bcf/agnostic/extensions.py b/src/bcf/bcf/agnostic/extensions.py index c5d4a7f556..20ecd621d8 100644 --- a/src/bcf/bcf/agnostic/extensions.py +++ b/src/bcf/bcf/agnostic/extensions.py @@ -20,7 +20,7 @@ def get_extensions_attributes(extensions: Extensions) -> dict[str, AttributeData - subattribute name""" possible_attributes = {} for field in fields(type(extensions)): - field_type = field.type.__args__[0] # type: ignore [reportAttributeAccessIssue] + field_type = field.type.__args__[0] # pyright: ignore [reportAttributeAccessIssue] subfield = next(iter(fields(field_type))) xsd_name = subfield.metadata["name"] possible_attributes[field.name] = AttributeData(field_type, subfield.name, xsd_name) diff --git a/src/bonsai/bonsai/bim/module/cost/operator.py b/src/bonsai/bonsai/bim/module/cost/operator.py index 30243712dd..dc61687704 100644 --- a/src/bonsai/bonsai/bim/module/cost/operator.py +++ b/src/bonsai/bonsai/bim/module/cost/operator.py @@ -268,7 +268,7 @@ class AssignCostItemQuantity(bpy.types.Operator, tool.Ifc.Operator): bl_label = "Assign Cost Item Quantity" bl_options = {"REGISTER", "UNDO"} cost_item: bpy.props.IntProperty() - related_object_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + related_object_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=[(i, i, "") for i in get_args(tool.Cost.RELATED_OBJECT_TYPE)], ) prop_name: bpy.props.StringProperty() @@ -745,7 +745,7 @@ class ClearCostItemAssignments(bpy.types.Operator, tool.Ifc.Operator): bl_label = "Clear Cost Item Product Assignments" bl_options = {"REGISTER", "UNDO"} cost_item: bpy.props.IntProperty() - related_object_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + related_object_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=[(i, i, "") for i in get_args(tool.Cost.RELATED_OBJECT_TYPE)], ) diff --git a/src/bonsai/bonsai/bim/module/model/product.py b/src/bonsai/bonsai/bim/module/model/product.py index 10aa79576a..3a1795396a 100644 --- a/src/bonsai/bonsai/bim/module/model/product.py +++ b/src/bonsai/bonsai/bim/module/model/product.py @@ -569,7 +569,7 @@ class AlignProduct(bpy.types.Operator): bl_options = {"REGISTER", "UNDO"} AlignType = Literal["CENTERLINE", "POSITIVE", "NEGATIVE"] - align_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + align_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=[(i, i, "") for i in get_args(AlignType)] ) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index d2c16e7c13..1943e12d7f 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -133,7 +133,7 @@ class AlignWall(bpy.types.Operator): 'Int.': align to the INTERIOR face""" AlignType = Literal["CENTER", "EXTERIOR", "INTERIOR"] - align_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + align_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=((i, i, "") for i in get_args(AlignType)) ) diff --git a/src/bonsai/bonsai/bim/module/sequence/operator.py b/src/bonsai/bonsai/bim/module/sequence/operator.py index ec7d789712..eeec20972f 100644 --- a/src/bonsai/bonsai/bim/module/sequence/operator.py +++ b/src/bonsai/bonsai/bim/module/sequence/operator.py @@ -512,7 +512,7 @@ class AssignProcess(bpy.types.Operator, tool.Ifc.Operator): bl_label = "Assign Process" bl_options = {"REGISTER", "UNDO"} task: bpy.props.IntProperty() - related_object_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + related_object_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=[(i, i, "") for i in get_args(tool.Sequence.RELATED_OBJECT_TYPE)], ) related_object: bpy.props.IntProperty() @@ -549,7 +549,7 @@ class UnassignProcess(bpy.types.Operator, tool.Ifc.Operator): bl_label = "Unassign Process" bl_options = {"REGISTER", "UNDO"} task: bpy.props.IntProperty() - related_object_type: bpy.props.EnumProperty( # type: ignore [reportRedeclaration] + related_object_type: bpy.props.EnumProperty( # pyright: ignore [reportRedeclaration] items=[(i, i, "") for i in get_args(tool.Sequence.RELATED_OBJECT_TYPE)], ) related_object: bpy.props.IntProperty() diff --git a/src/bonsai/bonsai/bim/prop.py b/src/bonsai/bonsai/bim/prop.py index 45128271b1..145e2de920 100644 --- a/src/bonsai/bonsai/bim/prop.py +++ b/src/bonsai/bonsai/bim/prop.py @@ -287,11 +287,11 @@ AttributeSpecialType = Literal["", "DATE", "DATETIME", "LENGTH", "AREA", "VOLUME class Attribute(PropertyGroup): tooltip = "`Right Click > IFC Description` to read the attribute description and online documentation" - name: StringProperty(name="Name") # type: ignore [reportRedeclaration] + name: StringProperty(name="Name") # pyright: ignore [reportRedeclaration] display_name: StringProperty(name="Display Name", get=get_display_name) - description: StringProperty(name="Description") # type: ignore [reportRedeclaration] - ifc_class: StringProperty(name="Ifc Class") # type: ignore [reportRedeclaration] - data_type: EnumProperty( # type: ignore [reportRedeclaration] + description: StringProperty(name="Description") # pyright: ignore [reportRedeclaration] + ifc_class: StringProperty(name="Ifc Class") # pyright: ignore [reportRedeclaration] + data_type: EnumProperty( # pyright: ignore [reportRedeclaration] name="Data Type", items=[(i, i, "") for i in get_args(AttributeDataType)], ) diff --git a/src/ifcopenshell-python/ifcopenshell/util/representation.py b/src/ifcopenshell-python/ifcopenshell/util/representation.py index 50ce20d044..10ddf21329 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/representation.py +++ b/src/ifcopenshell-python/ifcopenshell/util/representation.py @@ -142,7 +142,7 @@ def get_representation( :param target_view: A TargetView string, or any if left blank. :return: The first IfcShapeRepresentation matching the criteria. """ - for r in get_representations_iter(element): # type: ignore + for r in get_representations_iter(element): if is_representation_of_context(r, context, subcontext, target_view): return r