mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Run black, and add black to a "qa" target to make it a standardised process.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import ifcopenshell.util.date
|
||||
|
||||
|
||||
class Usecase:
|
||||
def __init__(self, file, **settings):
|
||||
self.file = file
|
||||
|
||||
@@ -25,7 +25,5 @@ class Usecase:
|
||||
work_plan.StartTime = ifcopenshell.util.date.datetime2ifc(self.settings["start_time"], "IfcDateTime")
|
||||
|
||||
context = self.file.by_type("IfcContext")[0]
|
||||
ifcopenshell.api.run(
|
||||
"project.assign_declaration", self.file, definition=work_plan, relating_context=context
|
||||
)
|
||||
ifcopenshell.api.run("project.assign_declaration", self.file, definition=work_plan, relating_context=context)
|
||||
return work_plan
|
||||
|
||||
@@ -38,7 +38,11 @@ class Usecase:
|
||||
if not work_schedule:
|
||||
return default_seconds_per_day
|
||||
psets = ifcopenshell.util.element.get_psets(work_schedule)
|
||||
if not psets or "Pset_WorkControlCommon" not in psets or "WorkDayDuration" not in psets["Pset_WorkControlCommon"]:
|
||||
if (
|
||||
not psets
|
||||
or "Pset_WorkControlCommon" not in psets
|
||||
or "WorkDayDuration" not in psets["Pset_WorkControlCommon"]
|
||||
):
|
||||
return default_seconds_per_day
|
||||
work_day_duration = ifcopenshell.util.date.ifc2datetime(psets["Pset_WorkControlCommon"]["WorkDayDuration"])
|
||||
return work_day_duration.seconds
|
||||
|
||||
@@ -142,8 +142,14 @@ class Data:
|
||||
for r in task.HasAssignments
|
||||
if r.is_a("IfcRelAssignsToProduct")
|
||||
]
|
||||
[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")]) for r in task.OperatesOn]
|
||||
[
|
||||
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")])
|
||||
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 []]
|
||||
|
||||
@@ -55,13 +55,10 @@ class Usecase:
|
||||
elif "ScheduleFinish" in self.settings["attributes"].keys() and self.settings["task_time"].ScheduleStart:
|
||||
self.calculate_duration()
|
||||
|
||||
if (
|
||||
self.settings["task_time"].ScheduleDuration
|
||||
and (
|
||||
"ScheduleStart" in self.settings["attributes"].keys()
|
||||
or "ScheduleFinish" in self.settings["attributes"].keys()
|
||||
or "ScheduleDuration" in self.settings["attributes"].keys()
|
||||
)
|
||||
if self.settings["task_time"].ScheduleDuration and (
|
||||
"ScheduleStart" in self.settings["attributes"].keys()
|
||||
or "ScheduleFinish" in self.settings["attributes"].keys()
|
||||
or "ScheduleDuration" in self.settings["attributes"].keys()
|
||||
):
|
||||
ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=self.task)
|
||||
|
||||
|
||||
@@ -19,9 +19,5 @@ class Usecase:
|
||||
for rel in self.settings["work_schedule"].Controls:
|
||||
for related_object in rel.RelatedObjects:
|
||||
if related_object.is_a("IfcTask"):
|
||||
ifcopenshell.api.run(
|
||||
"sequence.remove_task",
|
||||
self.file,
|
||||
task=related_object
|
||||
)
|
||||
ifcopenshell.api.run("sequence.remove_task", self.file, task=related_object)
|
||||
self.file.remove(self.settings["work_schedule"])
|
||||
|
||||
@@ -15,6 +15,4 @@ class Usecase:
|
||||
self.file.remove(self.settings["rel_sequence"].TimeLag)
|
||||
else:
|
||||
self.settings["rel_sequence"].TimeLag = None
|
||||
ifcopenshell.api.run(
|
||||
"sequence.cascade_schedule", self.file, task=self.settings["rel_sequence"].RelatedProcess
|
||||
)
|
||||
ifcopenshell.api.run("sequence.cascade_schedule", self.file, task=self.settings["rel_sequence"].RelatedProcess)
|
||||
|
||||
Reference in New Issue
Block a user