mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Quality - run black on api/sequence directory
This commit is contained in:
@@ -68,10 +68,14 @@ class Data:
|
||||
del data["OwnerHistory"]
|
||||
if data["Creators"]:
|
||||
data["Creators"] = [p.id() for p in data["Creators"]]
|
||||
data["CreationDate"] = ifcopenshell.util.date.ifc2datetime(data["CreationDate"])
|
||||
data["CreationDate"] = ifcopenshell.util.date.ifc2datetime(
|
||||
data["CreationDate"]
|
||||
)
|
||||
data["StartTime"] = ifcopenshell.util.date.ifc2datetime(data["StartTime"])
|
||||
if data["FinishTime"]:
|
||||
data["FinishTime"] = ifcopenshell.util.date.ifc2datetime(data["FinishTime"])
|
||||
data["FinishTime"] = ifcopenshell.util.date.ifc2datetime(
|
||||
data["FinishTime"]
|
||||
)
|
||||
data["RelatedObjects"] = []
|
||||
for rel in work_schedule.Controls:
|
||||
for obj in rel.RelatedObjects:
|
||||
@@ -86,7 +90,9 @@ class Data:
|
||||
data = work_calendar.get_info()
|
||||
del data["OwnerHistory"]
|
||||
data["WorkingTimes"] = [t.id() for t in work_calendar.WorkingTimes or []]
|
||||
data["ExceptionTimes"] = [t.id() for t in work_calendar.ExceptionTimes or []]
|
||||
data["ExceptionTimes"] = [
|
||||
t.id() for t in work_calendar.ExceptionTimes or []
|
||||
]
|
||||
cls.work_calendars[work_calendar.id()] = data
|
||||
|
||||
@classmethod
|
||||
@@ -94,9 +100,21 @@ class Data:
|
||||
cls.work_times = {}
|
||||
for work_time in cls._file.by_type("IfcWorkTime"):
|
||||
data = work_time.get_info()
|
||||
data["Start"] = ifcopenshell.util.date.ifc2datetime(data["Start"]) if data["Start"] else None
|
||||
data["Finish"] = ifcopenshell.util.date.ifc2datetime(data["Finish"]) if data["Finish"] else None
|
||||
data["RecurrencePattern"] = work_time.RecurrencePattern.id() if work_time.RecurrencePattern else None
|
||||
data["Start"] = (
|
||||
ifcopenshell.util.date.ifc2datetime(data["Start"])
|
||||
if data["Start"]
|
||||
else None
|
||||
)
|
||||
data["Finish"] = (
|
||||
ifcopenshell.util.date.ifc2datetime(data["Finish"])
|
||||
if data["Finish"]
|
||||
else None
|
||||
)
|
||||
data["RecurrencePattern"] = (
|
||||
work_time.RecurrencePattern.id()
|
||||
if work_time.RecurrencePattern
|
||||
else None
|
||||
)
|
||||
cls.work_times[work_time.id()] = data
|
||||
|
||||
@classmethod
|
||||
@@ -133,7 +151,11 @@ class Data:
|
||||
if task.TaskTime:
|
||||
data["TaskTime"] = data["TaskTime"].id()
|
||||
for rel in task.IsNestedBy:
|
||||
[data["RelatedObjects"].append(o.id()) for o in rel.RelatedObjects if o.is_a("IfcTask")]
|
||||
[
|
||||
data["RelatedObjects"].append(o.id())
|
||||
for o in rel.RelatedObjects
|
||||
if o.is_a("IfcTask")
|
||||
]
|
||||
data["Nests"] = [r.RelatingObject.id() for r in task.Nests or []]
|
||||
[
|
||||
data["Outputs"].append(r.RelatingProduct.id())
|
||||
@@ -141,20 +163,36 @@ class Data:
|
||||
if r.is_a("IfcRelAssignsToProduct")
|
||||
]
|
||||
[
|
||||
data["Resources"].extend([o.id() for o in r.RelatedObjects if o.is_a("IfcResource")])
|
||||
data["Resources"].extend(
|
||||
[o.id() for o in r.RelatedObjects if o.is_a("IfcResource")]
|
||||
)
|
||||
for r in task.OperatesOn
|
||||
]
|
||||
[
|
||||
data["Controls"].extend([o.id() for o in r.RelatedObjects if o.is_a("IfcControl")])
|
||||
data["Controls"].extend(
|
||||
[o.id() for o in r.RelatedObjects if o.is_a("IfcControl")]
|
||||
)
|
||||
for r in task.OperatesOn
|
||||
]
|
||||
[data["Inputs"].extend([o.id() for o in r.RelatedObjects if o.is_a("IfcProduct")]) for r in task.OperatesOn]
|
||||
[data["IsPredecessorTo"].append(rel.id()) for rel in task.IsPredecessorTo or []]
|
||||
[data["IsSuccessorFrom"].append(rel.id()) for rel in task.IsSuccessorFrom or []]
|
||||
[
|
||||
data["Inputs"].extend(
|
||||
[o.id() for o in r.RelatedObjects if o.is_a("IfcProduct")]
|
||||
)
|
||||
for r in task.OperatesOn
|
||||
]
|
||||
[
|
||||
data["IsPredecessorTo"].append(rel.id())
|
||||
for rel in task.IsPredecessorTo or []
|
||||
]
|
||||
[
|
||||
data["IsSuccessorFrom"].append(rel.id())
|
||||
for rel in task.IsSuccessorFrom or []
|
||||
]
|
||||
[
|
||||
data["HasAssignmentsWorkCalendar"].append(rel.RelatingControl.id())
|
||||
for rel in task.HasAssignments or []
|
||||
if rel.is_a("IfcRelAssignsToControl") and rel.RelatingControl.is_a("IfcWorkCalendar")
|
||||
if rel.is_a("IfcRelAssignsToControl")
|
||||
and rel.RelatingControl.is_a("IfcWorkCalendar")
|
||||
]
|
||||
cls.tasks[task.id()] = data
|
||||
|
||||
@@ -179,7 +217,9 @@ class Data:
|
||||
data = lag_time.get_info()
|
||||
if data["LagValue"]:
|
||||
if data["LagValue"].is_a("IfcDuration"):
|
||||
data["LagValue"] = ifcopenshell.util.date.ifc2datetime(data["LagValue"].wrappedValue)
|
||||
data["LagValue"] = ifcopenshell.util.date.ifc2datetime(
|
||||
data["LagValue"].wrappedValue
|
||||
)
|
||||
else:
|
||||
data["LagValue"] = float(data["LagValue"].wrappedValue)
|
||||
cls.lag_times[lag_time.id()] = data
|
||||
|
||||
Reference in New Issue
Block a user