Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def check_return_type(value, cllable = None, clss = None, caller_level = 0):
return _check_caller_type(True, cllable, value, clss, caller_level+1) | [
"Can be called from within a function or method to apply typechecking to\n the value that is going to be returned. Checking is applied w.r.t.\n type hints of the function or method hosting the call to check_return_type.\n "
] |
Please provide a description of the function:def load_diagram_from_csv(filepath, bpmn_diagram):
sequence_flows = bpmn_diagram.sequence_flows
process_elements_dict = bpmn_diagram.process_elements
diagram_attributes = bpmn_diagram.diagram_attributes
plane_attributes = bpmn_diagram... | [
"\n Reads an CSV file from given filepath and maps it into inner representation of BPMN diagram.\n Returns an instance of BPMNDiagramGraph class.\n\n :param filepath: string with output filepath,\n :param bpmn_diagram: an instance of BpmnDiagramGraph class.\n "
] |
Please provide a description of the function:def set_gateway_direction(self, value):
if value is None or not isinstance(value, str):
raise TypeError("GatewayDirection must be set to a String")
elif value not in Gateway.__gateway_directions_list:
raise ValueError("Gateway... | [
"\n Setter for 'gateway_direction' field.\n :param value - a new value of 'gateway_direction' field.\n "
] |
Please provide a description of the function:def set_name(self, value):
if value is None:
self.__name = value
elif not isinstance(value, str):
raise TypeError("Name must be set to a String")
else:
self.__name = value | [
"\n Setter for 'name' field.\n :param value - a new value of 'name' field. Must be either None (name is optional according to BPMN 2.0 XML\n Schema) or String.\n "
] |
Please provide a description of the function:def set_lane_list(self, value):
if value is None or not isinstance(value, list):
raise TypeError("LaneList new value must be a list")
else:
for element in value:
if not isinstance(element, lane.Lane):
... | [
"\n Setter for 'lane_list' field.\n :param value - a new value of 'lane_list' field. Must be a list of Lane objects\n "
] |
Please provide a description of the function:def load_diagram_from_xml(filepath, bpmn_diagram):
diagram_graph = bpmn_diagram.diagram_graph
sequence_flows = bpmn_diagram.sequence_flows
process_elements_dict = bpmn_diagram.process_elements
diagram_attributes = bpmn_diagram.diagram... | [
"\n Reads an XML file from given filepath and maps it into inner representation of BPMN diagram.\n Returns an instance of BPMNDiagramGraph class.\n\n :param filepath: string with output filepath,\n :param bpmn_diagram: an instance of BpmnDiagramGraph class.\n "
] |
Please provide a description of the function:def import_collaboration_element(diagram_graph, collaboration_element, collaboration_dict):
collaboration_dict[consts.Consts.id] = collaboration_element.getAttribute(consts.Consts.id)
collaboration_dict[consts.Consts.participants] = {}
partic... | [
"\n Method that imports information from 'collaboration' element.\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param collaboration_element: XML doument element,\n :param collaboration_dict: dictionary, that consist all information imported from 'collab... |
Please provide a description of the function:def import_participant_element(diagram_graph, participants_dictionary, participant_element):
participant_id = participant_element.getAttribute(consts.Consts.id)
name = participant_element.getAttribute(consts.Consts.name)
process_ref = partici... | [
"\n Adds 'participant' element to the collaboration dictionary.\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param participants_dictionary: dictionary with participant element attributes. Key is participant ID, value\n is a dictionary of participant... |
Please provide a description of the function:def import_diagram_and_plane_attributes(diagram_attributes, plane_attributes, diagram_element, plane_element):
diagram_attributes[consts.Consts.id] = diagram_element.getAttribute(consts.Consts.id)
diagram_attributes[consts.Consts.name] = diagram_elem... | [
"\n Adds attributes of BPMN diagram and plane elements to appropriate\n fields diagram_attributes and plane_attributes.\n Diagram inner representation contains following diagram element attributes:\n\n - id - assumed to be required in XML file, even thought BPMN 2.0 schema doesn't say so... |
Please provide a description of the function:def import_process_elements(document, diagram_graph, sequence_flows, process_elements_dict, plane_element):
for process_element in document.getElementsByTagNameNS("*", consts.Consts.process):
BpmnDiagramGraphImport.import_process_element(process_... | [
"\n Method for importing all 'process' elements in diagram.\n\n :param document: XML document,\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param sequence_flows: a list of sequence flows existing in diagram,\n :param process_elements_dict: diction... |
Please provide a description of the function:def import_lane_set_element(process_attributes, lane_set_element, plane_element):
lane_set_id = lane_set_element.getAttribute(consts.Consts.id)
lanes_attr = {}
for element in utils.BpmnImportUtils.iterate_elements(lane_set_element):
... | [
"\n Method for importing 'laneSet' element from diagram file.\n\n :param process_attributes: dictionary that holds attribute values of 'process' element, which is parent of\n imported flow node,\n :param lane_set_element: XML document element,\n :param plane_element: object re... |
Please provide a description of the function:def import_child_lane_set_element(child_lane_set_element, plane_element):
lane_set_id = child_lane_set_element.getAttribute(consts.Consts.id)
lanes_attr = {}
for element in utils.BpmnImportUtils.iterate_elements(child_lane_set_element):
... | [
"\n Method for importing 'childLaneSet' element from diagram file.\n\n :param child_lane_set_element: XML document element,\n :param plane_element: object representing a BPMN XML 'plane' element.\n "
] |
Please provide a description of the function:def import_lane_element(lane_element, plane_element):
lane_id = lane_element.getAttribute(consts.Consts.id)
lane_name = lane_element.getAttribute(consts.Consts.name)
child_lane_set_attr = {}
flow_node_refs = []
for element in ... | [
"\n Method for importing 'laneSet' element from diagram file.\n\n :param lane_element: XML document element,\n :param plane_element: object representing a BPMN XML 'plane' element.\n "
] |
Please provide a description of the function:def import_process_element(process_elements_dict, process_element):
process_id = process_element.getAttribute(consts.Consts.id)
process_element_attributes = {consts.Consts.id: process_element.getAttribute(consts.Consts.id),
... | [
"\n Adds attributes of BPMN process element to appropriate field process_attributes.\n Diagram inner representation contains following process attributes:\n\n - id - assumed to be required in XML file, even thought BPMN 2.0 schema doesn't say so,\n - isClosed - optional parameter, defaul... |
Please provide a description of the function:def import_flow_node_to_graph(bpmn_graph, process_id, process_attributes, flow_node_element):
element_id = flow_node_element.getAttribute(consts.Consts.id)
bpmn_graph.add_node(element_id)
bpmn_graph.node[element_id][consts.Consts.id] = elemen... | [
"\n Adds a new node to graph.\n Input parameter is object of class xml.dom.Element.\n Nodes are identified by ID attribute of Element.\n Method adds basic attributes (shared by all BPMN elements) to node. Those elements are:\n\n - id - added as key value, we assume that this is a ... |
Please provide a description of the function:def import_task_to_graph(diagram_graph, process_id, process_attributes, task_element):
BpmnDiagramGraphImport.import_activity_to_graph(diagram_graph, process_id, process_attributes, task_element) | [
"\n Adds to graph the new element that represents BPMN task.\n In our representation tasks have only basic attributes and elements, inherited from Activity type,\n so this method only needs to call add_flownode_to_graph.\n\n :param diagram_graph: NetworkX graph representing a BPMN proces... |
Please provide a description of the function:def import_subprocess_to_graph(diagram_graph, sequence_flows, process_id, process_attributes, subprocess_element):
BpmnDiagramGraphImport.import_activity_to_graph(diagram_graph, process_id, process_attributes,
... | [
"\n Adds to graph the new element that represents BPMN subprocess.\n In addition to attributes inherited from FlowNode type, SubProcess\n has additional attribute tiggeredByEvent (boolean type, default value - false).\n\n :param diagram_graph: NetworkX graph representing a BPMN process d... |
Please provide a description of the function:def import_data_object_to_graph(diagram_graph, process_id, process_attributes, data_object_element):
BpmnDiagramGraphImport.import_flow_node_to_graph(diagram_graph, process_id, process_attributes,
data... | [
"\n Adds to graph the new element that represents BPMN data object.\n Data object inherits attributes from FlowNode. In addition, an attribute 'isCollection' is added to the node.\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param process_id: string ob... |
Please provide a description of the function:def import_activity_to_graph(diagram_graph, process_id, process_attributes, element):
BpmnDiagramGraphImport.import_flow_node_to_graph(diagram_graph, process_id, process_attributes, element)
element_id = element.getAttribute(consts.Consts.id)
... | [
"\n Method that adds the new element that represents BPMN activity.\n Should not be used directly, only as a part of method, that imports an element which extends Activity element\n (task, subprocess etc.)\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n ... |
Please provide a description of the function:def import_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
BpmnDiagramGraphImport.import_flow_node_to_graph(diagram_graph, process_id, process_attributes, element)
... | [
"\n Adds to graph the new element that represents BPMN gateway.\n In addition to attributes inherited from FlowNode type, Gateway\n has additional attribute gatewayDirection (simple type, default value - Unspecified).\n\n :param diagram_graph: NetworkX graph representing a BPMN process d... |
Please provide a description of the function:def import_complex_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
BpmnDiagramGraphImport.import_gateway_to_graph(diagram_graph, process_id, process_attributes, element)
... | [
"\n Adds to graph the new element that represents BPMN complex gateway.\n In addition to attributes inherited from Gateway type, complex gateway\n has additional attribute default flow (default value - none).\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n... |
Please provide a description of the function:def import_event_based_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
BpmnDiagramGraphImport.import_gateway_to_graph(diagram_graph, process_id, process_attributes, element... | [
"\n Adds to graph the new element that represents BPMN event based gateway.\n In addition to attributes inherited from Gateway type, event based gateway has additional\n attributes - instantiate (boolean type, default value - false) and eventGatewayType\n (custom type tEventBasedGatewayT... |
Please provide a description of the function:def import_parallel_gateway_to_graph(diagram_graph, process_id, process_attributes, element):
BpmnDiagramGraphImport.import_gateway_to_graph(diagram_graph, process_id, process_attributes, element) | [
"\n Adds to graph the new element that represents BPMN parallel gateway.\n Parallel gateway doesn't have additional attributes. Separate method is used to improve code readability.\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param process_id: string o... |
Please provide a description of the function:def import_event_definition_elements(diagram_graph, element, event_definitions):
element_id = element.getAttribute(consts.Consts.id)
event_def_list = []
for definition_type in event_definitions:
event_def_xml = element.getElements... | [
"\n Helper function, that adds event definition elements (defines special types of events) to corresponding events.\n\n :param diagram_graph: NetworkX graph representing a BPMN process diagram,\n :param element: object representing a BPMN XML event element,\n :param event_definitions: li... |
Please provide a description of the function:def import_start_event_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
start_event_definitions = {'messageEventDefinition', 'timerEventDefinition', 'conditionalEventDefinition',
... | [
"\n Adds to graph the new element that represents BPMN start event.\n Start event inherits attribute parallelMultiple from CatchEvent type\n and sequence of eventDefinitionRef from Event type.\n Separate methods for each event type are required since each of them has different variants\n... |
Please provide a description of the function:def import_intermediate_catch_event_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
intermediate_catch_event_definitions = {'messageEventDefinition', 'timerEventDefinition',
... | [
"\n Adds to graph the new element that represents BPMN intermediate catch event.\n Intermediate catch event inherits attribute parallelMultiple from CatchEvent type\n and sequence of eventDefinitionRef from Event type.\n Separate methods for each event type are required since each of the... |
Please provide a description of the function:def import_end_event_to_graph(diagram_graph, process_id, process_attributes, element):
end_event_definitions = {'messageEventDefinition', 'signalEventDefinition', 'escalationEventDefinition',
'errorEventDefinition', 'compensa... | [
"\n Adds to graph the new element that represents BPMN end event.\n End event inherits sequence of eventDefinitionRef from Event type.\n Separate methods for each event type are required since each of them has different variants\n (Message, Error, Signal etc.).\n\n :param diagram_... |
Please provide a description of the function:def import_intermediate_throw_event_to_graph(diagram_graph, process_id, process_attributes, element):
intermediate_throw_event_definitions = {'messageEventDefinition', 'signalEventDefinition',
'escalationEventD... | [
"\n Adds to graph the new element that represents BPMN intermediate throw event.\n Intermediate throw event inherits sequence of eventDefinitionRef from Event type.\n Separate methods for each event type are required since each of them has different variants\n (Message, Error, Signal etc... |
Please provide a description of the function:def import_boundary_event_to_graph(diagram_graph, process_id, process_attributes, element):
element_id = element.getAttribute(consts.Consts.id)
boundary_event_definitions = {'messageEventDefinition', 'timerEventDefinition', 'signalEventDefinition',
... | [
"\n Adds to graph the new element that represents BPMN boundary event.\n Boundary event inherits sequence of eventDefinitionRef from Event type.\n Separate methods for each event type are required since each of them has different variants\n (Message, Error, Signal etc.).\n\n :para... |
Please provide a description of the function:def import_sequence_flow_to_graph(diagram_graph, sequence_flows, process_id, flow_element):
flow_id = flow_element.getAttribute(consts.Consts.id)
name = flow_element.getAttribute(consts.Consts.name) if flow_element.hasAttribute(consts.Consts.name) el... | [
"\n Adds a new edge to graph and a record to sequence_flows dictionary.\n Input parameter is object of class xml.dom.Element.\n Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element. We also\n provide a dictionary, that maps sequenceFlow ID attribute with... |
Please provide a description of the function:def import_message_flow_to_graph(diagram_graph, message_flows, flow_element):
flow_id = flow_element.getAttribute(consts.Consts.id)
name = flow_element.getAttribute(consts.Consts.name) if flow_element.hasAttribute(consts.Consts.name) else ""
... | [
"\n Adds a new edge to graph and a record to message flows dictionary.\n Input parameter is object of class xml.dom.Element.\n Edges are identified by pair of sourceRef and targetRef attributes of BPMNFlow element. We also\n provide a dictionary, that maps messageFlow ID attribute with i... |
Please provide a description of the function:def import_shape_di(participants_dict, diagram_graph, shape_element):
element_id = shape_element.getAttribute(consts.Consts.bpmn_element)
bounds = shape_element.getElementsByTagNameNS("*", "Bounds")[0]
if diagram_graph.has_node(element_id):
... | [
"\n Adds Diagram Interchange information (information about rendering a diagram) to appropriate\n BPMN diagram element in graph node.\n We assume that those attributes are required for each BPMNShape:\n\n - width - width of BPMNShape,\n - height - height of BPMNShape,\n - x... |
Please provide a description of the function:def import_flow_di(diagram_graph, sequence_flows, message_flows, flow_element):
flow_id = flow_element.getAttribute(consts.Consts.bpmn_element)
waypoints_xml = flow_element.getElementsByTagNameNS("*", consts.Consts.waypoint)
length = len(wayp... | [
"\n Adds Diagram Interchange information (information about rendering a diagram) to appropriate\n BPMN sequence flow represented as graph edge.\n We assume that each BPMNEdge has a list of 'waypoint' elements. BPMN 2.0 XML Schema states,\n that each BPMNEdge must have at least two waypoi... |
Please provide a description of the function:def generate_layout(bpmn_graph):
classification = generate_elements_clasification(bpmn_graph)
(sorted_nodes_with_classification, backward_flows) = topological_sort(bpmn_graph, classification[0])
grid = grid_layout(bpmn_graph, sorted_nodes_with_classification... | [
"\n :param bpmn_graph: an instance of BPMNDiagramGraph class.\n "
] |
Please provide a description of the function:def generate_elements_clasification(bpmn_graph):
nodes_classification = []
node_param_name = "node"
flow_param_name = "flow"
classification_param_name = "classification"
classification_element = "Element"
classification_join = "Join"
classif... | [
"\n :param bpmn_graph:\n :return:\n "
] |
Please provide a description of the function:def topological_sort(bpmn_graph, nodes_with_classification):
node_param_name = "node"
classification_param_name = "classification"
tmp_nodes_with_classification = copy.deepcopy(nodes_with_classification)
sorted_nodes_with_classification = []
no_inco... | [
"\n :return:\n "
] |
Please provide a description of the function:def export_task_info(node_params, output_element):
if consts.Consts.default in node_params and node_params[consts.Consts.default] is not None:
output_element.set(consts.Consts.default, node_params[consts.Consts.default]) | [
"\n Adds Task node attributes to exported XML element\n\n :param node_params: dictionary with given task parameters,\n :param output_element: object representing BPMN XML 'task' element.\n "
] |
Please provide a description of the function:def export_subprocess_info(bpmn_diagram, subprocess_params, output_element):
output_element.set(consts.Consts.triggered_by_event, subprocess_params[consts.Consts.triggered_by_event])
if consts.Consts.default in subprocess_params and subprocess_params... | [
"\n Adds Subprocess node attributes to exported XML element\n\n :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,\n :param subprocess_params: dictionary with given subprocess parameters,\n :param output_element: object representing BPMN XML 'subp... |
Please provide a description of the function:def export_data_object_info(bpmn_diagram, data_object_params, output_element):
output_element.set(consts.Consts.is_collection, data_object_params[consts.Consts.is_collection]) | [
"\n Adds DataObject node attributes to exported XML element\n\n :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,\n :param data_object_params: dictionary with given subprocess parameters,\n :param output_element: object representing BPMN XML 'sub... |
Please provide a description of the function:def export_complex_gateway_info(node_params, output_element):
output_element.set(consts.Consts.gateway_direction, node_params[consts.Consts.gateway_direction])
if consts.Consts.default in node_params and node_params[consts.Consts.default] is not None... | [
"\n Adds ComplexGateway node attributes to exported XML element\n\n :param node_params: dictionary with given complex gateway parameters,\n :param output_element: object representing BPMN XML 'complexGateway' element.\n "
] |
Please provide a description of the function:def export_event_based_gateway_info(node_params, output_element):
output_element.set(consts.Consts.gateway_direction, node_params[consts.Consts.gateway_direction])
output_element.set(consts.Consts.instantiate, node_params[consts.Consts.instantiate])
... | [
"\n Adds EventBasedGateway node attributes to exported XML element\n\n :param node_params: dictionary with given event based gateway parameters,\n :param output_element: object representing BPMN XML 'eventBasedGateway' element.\n "
] |
Please provide a description of the function:def export_inclusive_exclusive_gateway_info(node_params, output_element):
output_element.set(consts.Consts.gateway_direction, node_params[consts.Consts.gateway_direction])
if consts.Consts.default in node_params and node_params[consts.Consts.default]... | [
"\n Adds InclusiveGateway or ExclusiveGateway node attributes to exported XML element\n\n :param node_params: dictionary with given inclusive or exclusive gateway parameters,\n :param output_element: object representing BPMN XML 'inclusiveGateway'/'exclusive' element.\n "
] |
Please provide a description of the function:def export_parallel_gateway_info(node_params, output_element):
output_element.set(consts.Consts.gateway_direction, node_params[consts.Consts.gateway_direction]) | [
"\n Adds parallel gateway node attributes to exported XML element\n\n :param node_params: dictionary with given parallel gateway parameters,\n :param output_element: object representing BPMN XML 'parallelGateway' element.\n "
] |
Please provide a description of the function:def export_start_event_info(node_params, output_element):
output_element.set(consts.Consts.parallel_multiple, node_params.get(consts.Consts.parallel_multiple))
output_element.set(consts.Consts.is_interrupting, node_params.get(consts.Consts.is_interru... | [
"\n Adds StartEvent attributes to exported XML element\n\n :param node_params: dictionary with given intermediate catch event parameters,\n :param output_element: object representing BPMN XML 'intermediateCatchEvent' element.\n "
] |
Please provide a description of the function:def export_throw_event_info(node_params, output_element):
definitions = node_params[consts.Consts.event_definitions]
for definition in definitions:
definition_id = definition[consts.Consts.id]
definition_type = definition[cons... | [
"\n Adds EndEvent or IntermediateThrowingEvent attributes to exported XML element\n\n :param node_params: dictionary with given intermediate throw event parameters,\n :param output_element: object representing BPMN XML 'intermediateThrowEvent' element.\n "
] |
Please provide a description of the function:def export_boundary_event_info(node_params, output_element):
output_element.set(consts.Consts.parallel_multiple, node_params[consts.Consts.parallel_multiple])
output_element.set(consts.Consts.cancel_activity, node_params[consts.Consts.cancel_activity... | [
"\n Adds IntermediateCatchEvent attributes to exported XML element\n\n :param node_params: dictionary with given intermediate catch event parameters,\n :param output_element: object representing BPMN XML 'intermediateCatchEvent' element.\n "
] |
Please provide a description of the function:def export_definitions_element():
root = eTree.Element(consts.Consts.definitions)
root.set("xmlns", "http://www.omg.org/spec/BPMN/20100524/MODEL")
root.set("xmlns:bpmndi", "http://www.omg.org/spec/BPMN/20100524/DI")
root.set("xmlns:om... | [
"\n Creates root element ('definitions') for exported BPMN XML file.\n\n :return: definitions XML element.\n "
] |
Please provide a description of the function:def export_process_element(definitions, process_id, process_attributes_dictionary):
process = eTree.SubElement(definitions, consts.Consts.process)
process.set(consts.Consts.id, process_id)
process.set(consts.Consts.is_closed, process_attribut... | [
"\n Creates process element for exported BPMN XML file.\n\n :param process_id: string object. ID of exported process element,\n :param definitions: an XML element ('definitions'), root element of BPMN 2.0 document\n :param process_attributes_dictionary: dictionary that holds attribute va... |
Please provide a description of the function:def export_lane_set(process, lane_set, plane_element):
lane_set_xml = eTree.SubElement(process, consts.Consts.lane_set)
for key, value in lane_set[consts.Consts.lanes].items():
BpmnDiagramGraphExport.export_lane(lane_set_xml, key, value, ... | [
"\n Creates 'laneSet' element for exported BPMN XML file.\n\n :param process: an XML element ('process'), from exported BPMN 2.0 document,\n :param lane_set: dictionary with exported 'laneSet' element attributes and child elements,\n :param plane_element: XML object, representing 'plane'... |
Please provide a description of the function:def export_child_lane_set(parent_xml_element, child_lane_set, plane_element):
lane_set_xml = eTree.SubElement(parent_xml_element, consts.Consts.lane_set)
for key, value in child_lane_set[consts.Consts.lanes].items():
BpmnDiagramGraphExpor... | [
"\n Creates 'childLaneSet' element for exported BPMN XML file.\n\n :param parent_xml_element: an XML element, parent of exported 'childLaneSet' element,\n :param child_lane_set: dictionary with exported 'childLaneSet' element attributes and child elements,\n :param plane_element: XML obj... |
Please provide a description of the function:def export_lane(parent_xml_element, lane_id, lane_attr, plane_element):
lane_xml = eTree.SubElement(parent_xml_element, consts.Consts.lane)
lane_xml.set(consts.Consts.id, lane_id)
lane_xml.set(consts.Consts.name, lane_attr[consts.Consts.name]... | [
"\n Creates 'lane' element for exported BPMN XML file.\n\n :param parent_xml_element: an XML element, parent of exported 'lane' element,\n :param lane_id: string object. ID of exported lane element,\n :param lane_attr: dictionary with lane element attributes,\n :param plane_elemen... |
Please provide a description of the function:def export_diagram_plane_elements(root, diagram_attributes, plane_attributes):
diagram = eTree.SubElement(root, BpmnDiagramGraphExport.bpmndi_namespace + "BPMNDiagram")
diagram.set(consts.Consts.id, diagram_attributes[consts.Consts.id])
diagr... | [
"\n Creates 'diagram' and 'plane' elements for exported BPMN XML file.\n Returns a tuple (diagram, plane).\n\n :param root: object of Element class, representing a BPMN XML root element ('definitions'),\n :param diagram_attributes: dictionary that holds attribute values for imported 'BPM... |
Please provide a description of the function:def export_node_data(bpmn_diagram, process_id, params, process):
node_type = params[consts.Consts.type]
output_element = eTree.SubElement(process, node_type)
output_element.set(consts.Consts.id, process_id)
output_element.set(consts.C... | [
"\n Creates a new XML element (depends on node type) for given node parameters and adds it to 'process' element.\n\n :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process diagram,\n :param process_id: string representing ID of given flow node,\n :param params... |
Please provide a description of the function:def export_node_di_data(node_id, params, plane):
output_element_di = eTree.SubElement(plane, BpmnDiagramGraphExport.bpmndi_namespace + consts.Consts.bpmn_shape)
output_element_di.set(consts.Consts.id, node_id + "_gui")
output_element_di.set(... | [
"\n Creates a new BPMNShape XML element for given node parameters and adds it to 'plane' element.\n\n :param node_id: string representing ID of given flow node,\n :param params: dictionary with node parameters,\n :param plane: object of Element class, representing BPMN XML 'BPMNPlane' el... |
Please provide a description of the function:def export_flow_process_data(params, process):
output_flow = eTree.SubElement(process, consts.Consts.sequence_flow)
output_flow.set(consts.Consts.id, params[consts.Consts.id])
output_flow.set(consts.Consts.name, params[consts.Consts.name])
... | [
"\n Creates a new SequenceFlow XML element for given edge parameters and adds it to 'process' element.\n\n :param params: dictionary with edge parameters,\n :param process: object of Element class, representing BPMN XML 'process' element (root for sequence flows)\n "
] |
Please provide a description of the function:def export_flow_di_data(params, plane):
output_flow = eTree.SubElement(plane, BpmnDiagramGraphExport.bpmndi_namespace + consts.Consts.bpmn_edge)
output_flow.set(consts.Consts.id, params[consts.Consts.id] + "_gui")
output_flow.set(consts.Const... | [
"\n Creates a new BPMNEdge XML element for given edge parameters and adds it to 'plane' element.\n\n :param params: dictionary with edge parameters,\n :param plane: object of Element class, representing BPMN XML 'BPMNPlane' element (root for edge DI data).\n "
] |
Please provide a description of the function:def export_xml_file(directory, filename, bpmn_diagram):
diagram_attributes = bpmn_diagram.diagram_attributes
plane_attributes = bpmn_diagram.plane_attributes
collaboration = bpmn_diagram.collaboration
process_elements_dict = bpmn_diag... | [
"\n Exports diagram inner graph to BPMN 2.0 XML file (with Diagram Interchange data).\n\n :param directory: string representing output directory,\n :param filename: string representing output file name,\n :param bpmn_diagram: BPMNDiagramGraph class instantion representing a BPMN process ... |
Please provide a description of the function:def export_xml_file_no_di(directory, filename, bpmn_diagram):
diagram_graph = bpmn_diagram.diagram_graph
process_elements_dict = bpmn_diagram.process_elements
definitions = BpmnDiagramGraphExport.export_definitions_element()
for proc... | [
"\n Exports diagram inner graph to BPMN 2.0 XML file (without Diagram Interchange data).\n\n :param directory: string representing output directory,\n :param filename: string representing output file name,\n :param bpmn_diagram: BPMNDiagramGraph class instance representing a BPMN process... |
Please provide a description of the function:def indent(elem, level=0):
i = "\n" + level * " "
j = "\n" + (level - 1) * " "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
... | [
"\n Helper function, adds indentation to XML output.\n\n :param elem: object of Element class, representing element to which method adds intendation,\n :param level: current level of intendation.\n "
] |
Please provide a description of the function:def set_event_definition_list(self, value):
if value is None or not isinstance(value, list):
raise TypeError("EventDefinitionList new value must be a list")
else:
for element in value:
if not isinstance(element... | [
"\n Setter for 'event_definition_list' field.\n :param value - a new value of 'event_definition_list' field. Must be a list of EventDefinition objects\n "
] |
Please provide a description of the function:def iterate_elements(parent):
element = parent.firstChild
while element is not None:
yield element
element = element.nextSibling | [
"\n Helper function that iterates over child Nodes/Elements of parent Node/Element.\n\n :param parent: object of Element class, representing parent element.\n "
] |
Please provide a description of the function:def generate_nodes_clasification(bpmn_diagram):
nodes_classification = {}
classification_element = "Element"
classification_start_event = "Start Event"
classification_end_event = "End Event"
task_list = bpmn_diagram.get_node... | [
"\n Diagram elements classification. Implementation based on article \"A Simple Algorithm for Automatic Layout of\n BPMN Processes\".\n Assigns a classification to the diagram element according to specific element parameters.\n - Element - every element of the process which is not an edg... |
Please provide a description of the function:def split_join_classification(element, classification_labels, nodes_classification):
classification_join = "Join"
classification_split = "Split"
if len(element[1][consts.Consts.incoming_flow]) >= 2:
classification_labels.append(cl... | [
"\n Add the \"Split\", \"Join\" classification, if the element qualifies for.\n\n :param element: an element from BPMN diagram,\n :param classification_labels: list of labels attached to the element,\n :param nodes_classification: dictionary of classification labels. Key - node id. Value... |
Please provide a description of the function:def get_all_gateways(bpmn_graph):
gateways = filter(lambda node: node[1]['type'] in GATEWAY_TYPES, bpmn_graph.get_nodes())
return gateways | [
"\n Returns a list with all gateways in diagram\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n :return: a list with all gateways in diagram\n "
] |
Please provide a description of the function:def all_control_flow_elements_count(bpmn_graph):
gateway_counts = get_gateway_counts(bpmn_graph)
events_counts = get_events_counts(bpmn_graph)
control_flow_elements_counts = gateway_counts.copy()
control_flow_elements_counts.update(events_counts)
r... | [
"\n Returns the total count of all control flow elements\n in the BPMNDiagramGraph instance.\n \n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n :return: total count of the control flow elements in the BPMNDiagramGraph instance\n "
] |
Please provide a description of the function:def TNE_metric(bpmn_graph):
events_counts = get_events_counts(bpmn_graph)
return sum(
[count for _, count in events_counts.items()]
) | [
"\n Returns the value of the TNE metric (Total Number of Events of the Model)\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def NOAC_metric(bpmn_graph):
activities_count = all_activities_count(bpmn_graph)
control_flow_count = all_control_flow_elements_count(bpmn_graph)
return activities_count + control_flow_count | [
"\n Returns the value of the NOAC metric (Number of Activities and control flow elements)\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def NOAJS_metric(bpmn_graph):
activities_count = all_activities_count(bpmn_graph)
gateways_count = all_gateways_count(bpmn_graph)
return activities_count + gateways_count | [
"\n Returns the value of the NOAJS metric (Number of Activities, joins and splits)\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def NumberOfNodes_metric(bpmn_graph):
activities_count = all_activities_count(bpmn_graph)
control_flow_count = all_control_flow_elements_count(bpmn_graph)
return activities_count + control_flow_count | [
"\n Returns the value of the Number of Nodes metric\n (\"Number of activities and routing elements in a model\")\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def GatewayHeterogenity_metric(bpmn_graph):
gateway_counts = get_gateway_counts(bpmn_graph)
present_gateways = [gateway_name
for gateway_name, count in gateway_counts.items()
if count > 0]
return len(present_... | [
"\n Returns the value of the Gateway Heterogenity metric\n (\"Number of different types of gateways used in a mode\")\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def CoefficientOfNetworkComplexity_metric(bpmn_graph):
return float(len(bpmn_graph.get_flows())) / float(len(bpmn_graph.get_nodes())) | [
"\n Returns the value of the Coefficient of Network Complexity metric\n (\"Ratio of the total number of arcs in a process model to its total number of nodes.\")\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def AverageGatewayDegree_metric(bpmn_graph):
gateways_ids = [gateway[0] for gateway in get_all_gateways(bpmn_graph)]
all_nodes_degrees = bpmn_graph.diagram_graph.degree()
gateways_degree_values = [all_nodes_degrees[gateway_id] for gateway_id in gateways_ids... | [
"\n Returns the value of the Average Gateway Degree metric\n (\"Average of the number of both incoming and outgoing arcs of the gateway nodes in the process model\")\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: an instance of BpmnDiagramGraph representing BPMN model.\n "
] |
Please provide a description of the function:def DurfeeSquare_metric(bpmn_graph):
all_types_count = Counter([node[1]['type'] for node in bpmn_graph.get_nodes() if node[1]['type']])
length = len(all_types_count)
histogram = [0] * (length + 1)
for _, count in all_types_count.items():
histog... | [
"\n Returns the value of the Durfee Square metric\n (\"Durfee Square equals d if there are d types of elements\n which occur at least d times in the model (each),\n and the other types of elements occur no more than d times (each)\")\n for the BPMNDiagramGraph instance.\n\n :param bpmn_graph: ... |
Please provide a description of the function:def PerfectSquare_metric(bpmn_graph):
all_types_count = Counter([node[1]['type'] for node in bpmn_graph.get_nodes() if node[1]['type']])
sorted_counts = [count for _, count in all_types_count.most_common()]
potential_perfect_square = min(len(sorted_counts)... | [
"\n Returns the value of the Perfect Square metric\n (\"Given a set of element types ranked\n in decreasing order of the number of their instances,\n the PSM is the (unique) largest number\n such that the top p types occur(together)\n at least p2 times.\")\n for the BPMNDiagramGraph instance.\n... |
Please provide a description of the function:def export_process_to_csv(bpmn_diagram, directory, filename):
nodes = copy.deepcopy(bpmn_diagram.get_nodes())
start_nodes = []
export_elements = []
for node in nodes:
incoming_list = node[1].get(consts.Consts.incoming_flo... | [
"\n Root method of CSV export functionality.\n\n :param bpmn_diagram: an instance of BpmnDiagramGraph class,\n :param directory: a string object, which is a path of output directory,\n :param filename: a string object, which is a name of output file.\n "
] |
Please provide a description of the function:def export_node(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="", who="",
add_join=False):
node_type = node[1][consts.Consts.type]
if node_type == consts.Consts.start_event:
ret... | [
"\n General method for node exporting\n\n :param bpmn_graph: an instance of BpmnDiagramGraph class,\n :param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that\n will be used in exported CSV document,\n :param node: networkx... |
Please provide a description of the function:def export_element(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="",
who="", add_join=False):
node_type = node[1][consts.Consts.type]
node_classification = nodes_classification[node[0]]
... | [
"\n Export a node with \"Element\" classification (task, subprocess or gateway)\n\n :param bpmn_graph: an instance of BpmnDiagramGraph class,\n :param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that\n will be used in exported CS... |
Please provide a description of the function:def export_start_event(bpmn_graph, export_elements, node, nodes_classification, order=0, prefix="", condition="",
who=""):
# Assuming that there is only one event definition
event_definitions = node[1].get(consts.Consts.ev... | [
"\n Start event export\n\n :param bpmn_graph: an instance of BpmnDiagramGraph class,\n :param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that\n will be used in exported CSV document,\n :param node: networkx.Node object,\n... |
Please provide a description of the function:def export_end_event(export_elements, node, order=0, prefix="", condition="", who=""):
# Assuming that there is only one event definition
event_definitions = node[1].get(consts.Consts.event_definitions)
if event_definitions is not None and l... | [
"\n End event export\n\n :param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that\n will be used in exported CSV document,\n :param node: networkx.Node object,\n :param order: the order param of exported node,\n :par... |
Please provide a description of the function:def write_export_node_to_file(file_object, export_elements):
for export_element in export_elements:
# Order,Activity,Condition,Who,Subprocess,Terminated
file_object.write(
export_element["Order"] + "," + export_element... | [
"\n Exporting process to CSV file\n\n :param file_object: object of File class,\n :param export_elements: a dictionary object. The key is a node ID, value is a dictionary of parameters that\n will be used in exported CSV document.\n "
] |
Please provide a description of the function:def set_parallel_multiple(self, value):
if value is None or not isinstance(value, bool):
raise TypeError("ParallelMultiple must be set to a bool")
else:
self.__parallel_multiple = value | [
"\n Setter for 'parallel_multiple' field.\n :param value - a new value of 'parallel_multiple' field. Must be a boolean type. Does not accept None value.\n "
] |
Please provide a description of the function:def set_triggered_by_event(self, value):
if value is None or not isinstance(value, bool):
raise TypeError("TriggeredByEvent must be set to a bool")
else:
self.__triggered_by_event = value | [
"\n Setter for 'triggered_by_event' field.\n :param value - a new value of 'triggered_by_event' field. Must be a boolean type. Does not accept None value.\n "
] |
Please provide a description of the function:def set_lane_set_list(self, value):
if value is None or not isinstance(value, list):
raise TypeError("LaneSetList new value must be a list")
else:
for element in value:
if not isinstance(element, lane_set.LaneS... | [
"\n Setter for 'lane_set_list' field.\n :param value - a new value of 'lane_set_list' field. Must be a list\n "
] |
Please provide a description of the function:def set_flow_element_list(self, value):
if value is None or not isinstance(value, list):
raise TypeError("FlowElementList new value must be a list")
else:
for element in value:
if not isinstance(element, flow_e... | [
"\n Setter for 'flow_element_list' field.\n :param value - a new value of 'flow_element_list' field. Must be a list\n "
] |
Please provide a description of the function:def set_incoming(self, value):
if not isinstance(value, list):
raise TypeError("IncomingList new value must be a list")
for element in value:
if not isinstance(element, str):
raise TypeError("IncomingList eleme... | [
"\n Setter for 'incoming' field.\n :param value - a new value of 'incoming' field. List of IDs (String type) of incoming flows.\n "
] |
Please provide a description of the function:def set_outgoing(self, value):
if not isinstance(value, list):
raise TypeError("OutgoingList new value must be a list")
for element in value:
if not isinstance(element, str):
raise TypeError("OutgoingList eleme... | [
"\n Setter for 'outgoing' field.\n :param value - a new value of 'outgoing' field. Must be a list of IDs (String type) of outgoing flows.\n "
] |
Please provide a description of the function:def set_process_type(self, value):
if value is None or not isinstance(value, str):
raise TypeError("ProcessType must be set to a String")
elif value not in Process.__process_type_list:
raise ValueError("ProcessType must be one... | [
"\n Setter for 'process_type' field.\n :param value - a new value of 'process_type' field.\n "
] |
Please provide a description of the function:def set_is_closed(self, value):
if value is None or not isinstance(value, bool):
raise TypeError("IsClosed must be set to a bool")
else:
self.__is_closed = value | [
"\n Setter for 'is_closed' field.\n :param value - a new value of 'is_closed' field. Must be a boolean type. Does not accept None value.\n "
] |
Please provide a description of the function:def set_is_executable(self, value):
if value is None or not isinstance(value, bool):
raise TypeError("IsExecutable must be set to a bool")
else:
self.__is_executable = value | [
"\n Setter for 'is_executable' field.\n :param value - a new value of 'is_executable' field. Must be a boolean type. Does not accept None value.\n "
] |
Please provide a description of the function:def visualize_diagram(bpmn_diagram):
g = bpmn_diagram.diagram_graph
pos = bpmn_diagram.get_nodes_positions()
nx.draw_networkx_nodes(g, pos, node_shape='s', node_color='white',
nodelist=bpmn_diagram.get_nodes_id_list_by_type(consts.... | [
"\n Shows a simple visualization of diagram\n\n :param bpmn_diagram: an instance of BPMNDiagramGraph class.\n "
] |
Please provide a description of the function:def bpmn_diagram_to_png(bpmn_diagram, file_name):
g = bpmn_diagram.diagram_graph
graph = pydotplus.Dot()
for node in g.nodes(data=True):
if node[1].get(consts.Consts.type) == consts.Consts.task:
n = pydotplus.Node(name=node[0], shape="b... | [
"\n Create a png picture for given diagram\n\n :param bpmn_diagram: an instance of BPMNDiagramGraph class,\n :param file_name: name of generated file.\n "
] |
Please provide a description of the function:def set_id(self, value):
if value is None:
self.__id = value
if not isinstance(value, str):
raise TypeError("ID must be set to a String")
else:
self.__id = value | [
"\n Setter for 'id' field.\n :param value - a new value of 'id' field. Must be either None (ID is optional according to BPMN 2.0 XML Schema)\n or String type.\n "
] |
Please provide a description of the function:def set_source_ref(self, value):
if value is None or not isinstance(value, str):
raise TypeError("SourceRef is required and must be set to a String")
else:
self.__source_ref = value | [
"\n Setter for 'source_ref' field.\n :param value - a new value of 'source_ref' field. Required field. Must be a String type.\n "
] |
Please provide a description of the function:def set_target_ref(self, value):
if value is None or not isinstance(value, str):
raise TypeError("TargetRef is required and must be set to a String")
else:
self.__target_ref = value | [
"\n Setter for 'target_ref' field.\n :param value - a new value of 'target_ref' field. Required field. Must be a String type.\n "
] |
Please provide a description of the function:def set_is_immediate(self, value):
if value is None:
self.__is_immediate = value
elif not isinstance(value, bool):
raise TypeError("IsImediate must be set to a bool")
else:
self.__is_immediate = value | [
"\n Setter for 'is_immediate' field.\n :param value - a new value of 'is_immediate' field. Must be a boolean type.\n "
] |
Please provide a description of the function:def set_condition_expression(self, value):
if value is None:
self.__condition_expression = value
if not isinstance(value, condition_expression.ConditionExpression):
raise TypeError("ConditionExpression must be set to an instan... | [
"\n Setter for 'condition_expression' field.\n :param value - a new value of 'condition_expression' field.\n "
] |
Please provide a description of the function:def set_default(self, value):
if value is None:
self.__default = value
elif not isinstance(value, str):
raise TypeError("Default must be set to a String")
else:
self.__default = value | [
"\n Setter for 'default' field.\n :param value - a new value of 'default' field. Must be either None (default is optional according to\n BPMN 2.0 XML Schema) or String.\n "
] |
Please provide a description of the function:def orientation(p1, p2, p3):
val = (p2[consts.Consts.y] - p1[consts.Consts.y]) * (p3[consts.Consts.x] - p2[consts.Consts.x]) \
- (p2[consts.Consts.x] - p1[consts.Consts.x]) * (p3[consts.Consts.y] - p2[consts.Consts.y])
if val == 0:
return 0 # c... | [
"\n Finds orientation of three points p1, p2, p3.\n The function returns following values\n 0 --> p1, p2 and p3 are collinear\n 1 --> Clockwise\n 2 --> Counterclockwise\n :param p1: tuple representing two dimensional point\n :param p2: tuple representing two dimensional point\n :param p3: tu... |
Please provide a description of the function:def set_process_ref(self, value):
if not isinstance(value, str):
raise TypeError("ProcessRef must be set to a String")
self.__process_ref = value | [
"\n Setter for 'process_ref' field.\n :param value - a new value of 'process_ref' field. Must be either None (process_ref is optional according to\n BPMN 2.0 XML Schema) or String.\n "
] |
Please provide a description of the function:def set_message_ref(self, value):
if value is None:
self.__message_ref = value
if not isinstance(value, str):
raise TypeError("MessageRef must be set to a String")
else:
self.__message_ref = value | [
"\n Setter for 'message_ref' field.\n :param value - a new value of 'message_ref' field. Must be either None (message_ref is optional according to\n BPMN 2.0 XML Schema) or String.\n "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.