mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
Fix Ruff UP013 (convert-typed-dict-functional-to-class)
https://docs.astral.sh/ruff/rules/convert-typed-dict-functional-to-class/
This commit is contained in:
@@ -30,16 +30,21 @@ import bonsai.tool as tool
|
||||
from bonsai.bim.module.structural.shader import DecorationShader
|
||||
from typing import Literal, TypedDict, Iterable
|
||||
|
||||
MemberInfo = TypedDict(
|
||||
"MemberInfo",
|
||||
{"member": ifcopenshell.entity_instance, "activities": list[tuple[ifcopenshell.entity_instance, float]]},
|
||||
)
|
||||
|
||||
class MemberInfo(TypedDict):
|
||||
member: ifcopenshell.entity_instance
|
||||
activities: list[tuple[ifcopenshell.entity_instance, float]]
|
||||
|
||||
|
||||
LoadConfigItem = TypedDict(
|
||||
"LoadConfigItem", {"pos": float, "descr": Literal["start", "end", "middle"], "load values": np.ndarray}
|
||||
)
|
||||
|
||||
DiscreteConfigItem = TypedDict("DiscreteConfigItem", {"pos": float, "values": list[float]})
|
||||
|
||||
class DiscreteConfigItem(TypedDict):
|
||||
pos: float
|
||||
values: list[float]
|
||||
|
||||
|
||||
ParsedLoad = TypedDict(
|
||||
"ParsedLoad",
|
||||
@@ -51,9 +56,14 @@ ParsedLoad = TypedDict(
|
||||
"point load configuration": list[list[DiscreteConfigItem]],
|
||||
},
|
||||
)
|
||||
LoadByDirection = TypedDict(
|
||||
"LoadByDirection", {"constant": float, "quadratic": float, "sinus": float, "polyline": list[list[float]]}
|
||||
)
|
||||
|
||||
|
||||
class LoadByDirection(TypedDict):
|
||||
constant: float
|
||||
quadratic: float
|
||||
sinus: float
|
||||
polyline: list[list[float]]
|
||||
|
||||
|
||||
ProcessedLoad = TypedDict(
|
||||
"ProcessedLoad",
|
||||
|
||||
@@ -249,8 +249,16 @@ def flatten(iterable):
|
||||
yield item
|
||||
|
||||
|
||||
Call = TypedDict("Call", {"name": str, "args": tuple[Any, ...], "kwargs": dict[str, Any]})
|
||||
Prediction = TypedDict("Prediction", {"type": Literal["SHOULD_BE_CALLED"], "number": Optional[int], "call": Call})
|
||||
class Call(TypedDict):
|
||||
name: str
|
||||
args: tuple[Any, ...]
|
||||
kwargs: dict[str, Any]
|
||||
|
||||
|
||||
class Prediction(TypedDict):
|
||||
type: Literal["SHOULD_BE_CALLED"]
|
||||
number: Optional[int]
|
||||
call: Call
|
||||
|
||||
|
||||
class Prophecy:
|
||||
|
||||
Reference in New Issue
Block a user