65 lines
2.9 KiB
Python
65 lines
2.9 KiB
Python
"""Classify delivery workflows without removing any migration requirements."""
|
|
|
|
DELIVERY_BATCH_SIZE = 4
|
|
DELIVERY_MODULE_ORDER = {"Web": 0, "Part": 1, "Sketcher": 2, "PartDesign": 3, "Import": 4, "Draft": 5, "Mesh": 6}
|
|
PRODUCT_WORKFLOWS = {
|
|
"product:react-primary-shell": "product-workspace",
|
|
"product:document-workspace": "product-workspace",
|
|
"product:model-tree-properties": "product-workspace",
|
|
"product:multi-object-viewport": "product-workspace",
|
|
"product:workbench-navigation": "product-command-interaction",
|
|
"product:desktop-command-ui": "product-command-interaction",
|
|
"product:task-panel": "product-command-interaction",
|
|
"product:file-workflows": "product-document-files",
|
|
"product:recovery-status": "product-document-files",
|
|
"product:dynamic-module-session": "product-document-files",
|
|
}
|
|
PRODUCT_ORDER = {key: index for index, key in enumerate(PRODUCT_WORKFLOWS)}
|
|
|
|
|
|
def desktop_command(row: dict) -> bool:
|
|
return row.get("kind") == "desktop-gui" or ":desktop:" in str(row.get("id", ""))
|
|
|
|
|
|
def supporting_route(row: dict) -> bool:
|
|
command = str(row.get("command", "")).lower()
|
|
return row.get("category") in {"python", "inspect"} or any(
|
|
token in command for token in ("inspect", "inventory", "python", "probe", "family", "boundary"))
|
|
|
|
|
|
def delivery_route(row: dict) -> bool:
|
|
if row.get("id", "").startswith("product:"):
|
|
return row["id"] in PRODUCT_WORKFLOWS
|
|
if desktop_command(row):
|
|
return row.get("command") in {
|
|
"Std_Open", "Std_New", "Std_Import", "Std_Export", "Std_Save", "Std_SaveAs",
|
|
"Std_SaveCopy", "Std_SaveAll", "Std_Revert", "Std_Undo", "Std_Redo", "Std_Refresh",
|
|
"Std_Delete", "Std_DuplicateSelection", "Std_Transform", "Std_TransformManip",
|
|
}
|
|
if supporting_route(row):
|
|
return False
|
|
return row.get("id", "").startswith("business-format:") or row.get("category") in {"modeling", "persistence", "format"}
|
|
|
|
|
|
def workflow_family(row: dict) -> str:
|
|
record_id = str(row.get("id", ""))
|
|
if record_id.startswith("product:"):
|
|
return PRODUCT_WORKFLOWS.get(record_id, "product-extensions")
|
|
if supporting_route(row):
|
|
return "supporting-business-route"
|
|
if row.get("category") == "persistence":
|
|
return "document-persistence"
|
|
if record_id.startswith("business-format:"):
|
|
extension = str(row.get("extension") or record_id.rsplit(":", 1)[-1]).lower().lstrip(".")
|
|
extension = {"stp": "step", "iges": "igs", "brp": "brep"}.get(extension, extension)
|
|
return f"format-{extension}"
|
|
if row.get("category") == "format":
|
|
return "document-import-export"
|
|
return "create-edit-recompute"
|
|
|
|
|
|
def workflow_order(family: str) -> tuple:
|
|
first = {"product-workspace": 0, "create-edit-recompute": 0, "document-persistence": 1,
|
|
"product-command-interaction": 1, "product-document-files": 2, "document-import-export": 2}
|
|
return first.get(family, 3), family
|