Revert "Make dataclasses args optional to support Python 3.9 #6725"

This reverts commit ad7473ff1f.
This commit is contained in:
Andrej730
2025-12-19 18:17:19 +05:00
parent b784cb06ae
commit 29176330e8
13 changed files with 94 additions and 134 deletions
@@ -17,7 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import sys
import ifcopenshell.util.unit
import ifcopenshell.api.geometry
import dataclasses
@@ -27,8 +26,6 @@ from ifcopenshell.api.geometry.add_window_representation import create_ifc_windo
from math import cos, radians
from typing import Any, Optional, Literal, Union, get_args, overload
DATACLASS_SLOTS = {} if sys.version_info < (3, 10) else {"slots": True}
DOOR_TYPE = Literal[
"SINGLE_SWING_LEFT",
@@ -99,7 +96,7 @@ def create_ifc_box(
# we use dataclass as we need default values for arguments
# it's okay to use slots since we don't need dynamic attributes
@dataclasses.dataclass(**DATACLASS_SLOTS)
@dataclasses.dataclass(slots=True)
class DoorLiningProperties:
LiningDepth: Optional[float] = None
"""Optional, defaults to 50mm."""
@@ -173,7 +170,7 @@ class DoorLiningProperties:
setattr(self, attr, default_value * si_conversion)
@dataclasses.dataclass(**DATACLASS_SLOTS)
@dataclasses.dataclass(slots=True)
class DoorPanelProperties:
PanelDepth: Optional[float] = None
"""Frame thickness by Y axis. Optional, defaults to 35 mm."""
@@ -17,7 +17,6 @@
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
from __future__ import annotations
import sys
import numpy as np
import dataclasses
import ifcopenshell.api.geometry
@@ -26,7 +25,6 @@ from itertools import chain
from ifcopenshell.util.shape_builder import ShapeBuilder, V
from typing import Any, Optional, Literal, Union, overload
DATACLASS_SLOTS = {} if sys.version_info < (3, 10) else {"slots": True}
# SCHEMAS describe panels setup
# where:
@@ -240,7 +238,7 @@ def create_ifc_window(
# we use dataclass as we need default values for arguments
# it's okay to use slots since we don't need dynamic attributes
@dataclasses.dataclass(**DATACLASS_SLOTS)
@dataclasses.dataclass(slots=True)
class WindowLiningProperties:
LiningDepth: Optional[float] = None
"""Optional, defaults to 50mm."""
@@ -323,7 +321,7 @@ class WindowLiningProperties:
setattr(self, attr, default_value * si_conversion)
@dataclasses.dataclass(**DATACLASS_SLOTS)
@dataclasses.dataclass(slots=True)
class WindowPanelProperties:
FrameDepth: Optional[float] = None
"""Frame thickness by Y axis. Optional, defaults to 35 mm."""