218 lines
8.1 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_1smb9b5" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0bngcu2</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0bngcu2" sourceRef="StartEvent_1" targetRef="Activity_10fbwgl" />
<bpmn:sequenceFlow id="Flow_0ggy7w4" sourceRef="Activity_10fbwgl" targetRef="Activity_0n8y9m7" />
<bpmn:manualTask id="Activity_0n8y9m7" name="About PEP8">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser># Readability
The creator of Python, Guido van Rossum, said
“Code is read much more often than its written.” It is worth taking the time to create code that is easy to understand.
For this reason we recommend following a popular standard called [PEP8](https://realpython.com/python-pep8/)
Here are some highlights from the standard...
## Variables
### Formatting:
being consistent in the naming of your variables makes them far easier to remember. If you always use lower case and separate words with underscores, you don't have to try and remember the formatting, you just have to remember what it is called. If everyone follows this standard, then you can remember their variables easier as well ...
* my_name (GOOD)
* MyName (NO)
* myname (NO)
### Use Thoughtful names.
Avoid names that don't have meaning, or are cryptic. Try to use names that are descriptive and concise.
* first_name = "Abraham" (GOOD)
* x = "Abraham Lincoln" (AVOID)
* fn = "Abraham" (AVOID)
## Whitespace
* Use blank lines, sparingly, to show clear steps
A little white space can make your code more readable.
So can comments.
* "Sparse is better than dense" -- Zen of Python. Place spaces around operators and boolean operations most of the time. Though it can be good to break this rule when there are multiple expressions of different priority. Take the following example, where the second line is harder to read than the first.
```python
if x &lt; 5: # GOOD
if x&gt;5 and x&lt;10 : # GOOD
if x &gt; 5 and x &lt; 10: # NOT AS GOOD
```
## Use Comments Sparingly
A few carefully chosen words can help *IF it isn't apparent already.* Good variable names and well written code come first. Then add additional comments only if the information is not already apparent in the code.
## Closing Brackets and braces
We work with dictionaries a lot. So we recommend closing your braces and brackets with the first line to make it easy to tell when the dictionary definition is complete. For example:
```python
children = {
"Robert",
"Edward"
"Tad",
"Willie"
}
```
# “Simple is better than complex.”
* Don't compare booleans, it's not necessary
```python
is_bigger = 6 &gt; 5
if is_bigger: # GOOD
if is_bigger == True: # AVOID
```
* "is not" is easier to read:
```python
if not x is None: # AVOID
if x is not None: # GOOD
```
</spiffworkflow:instructionsForEndUser>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0ggy7w4</bpmn:incoming>
<bpmn:outgoing>Flow_1s0vaon</bpmn:outgoing>
</bpmn:manualTask>
<bpmn:endEvent id="Event_16l8zdp">
<bpmn:incoming>Flow_0x52gsc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1s0vaon" sourceRef="Activity_0n8y9m7" targetRef="Activity_14uu3ah" />
<bpmn:sequenceFlow id="Flow_0x52gsc" sourceRef="Activity_14uu3ah" targetRef="Event_16l8zdp" />
<bpmn:scriptTask id="Activity_10fbwgl" name="Simple Script Task">
<bpmn:extensionElements>
<spiffworkflow:unitTests>
<spiffworkflow:unitTest id="Example Test">
<spiffworkflow:inputJson>{}</spiffworkflow:inputJson>
<spiffworkflow:expectedOutputJson>{
"age": 54,
"height": 1.93,
"children": [
"Robert",
"Edward",
"Tad",
"Willie"
],
"is_married": true,
"my_age": 55,
"cabinet": {
"Secretary of State": {
"name": "William H. Seward",
"age": 60,
"children": [
"William Jr.",
"Frederick",
"Augustus",
"Anna"
]
}
}
}</spiffworkflow:expectedOutputJson>
</spiffworkflow:unitTest>
</spiffworkflow:unitTests>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0bngcu2</bpmn:incoming>
<bpmn:outgoing>Flow_0ggy7w4</bpmn:outgoing>
<bpmn:script>
# Adding function
def add_one(input):
return input + 1
# Creating Variables
age = 51 # This is an integer
height = 1.93 # This is a float or "floating point number"
children = ['Robert', 'Edward', 'Tad', 'Willie'] # This is a list
is_married = True # This is a boolean
# Updating Variables
Age = 50 # Variables are case sensitive, this is a new variable.
age = 54 # This updates the age variable.
# Referencing variables
my_age = age # my_age is now set to 54
my_age = add_one(my_age)
# Deleting variables
del(Age) # The age variable no longer exists. You will get an error if you try to use it.
# This is a dictionary, and you will use a lot of them...
cabinet = {
"Secretary of State": "William H. Seward",
"Secretary of the Treasury": "Salmon P. Chase",
"Secretary of War": "Edwin M. Stanton",
"Attorney General": "Edward Bates"
}
# Dictionaries can be deeply nested and contain any type of variable
cabinet = {
"Secretary of State": {
"name": "William H. Seward",
"age": 60,
"children": ['William Jr.', 'Frederick', 'Augustus', 'Anna']
}
}
</bpmn:script>
</bpmn:scriptTask>
<bpmn:userTask id="Activity_14uu3ah" name="Simple User Task">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser></spiffworkflow:instructionsForEndUser>
<spiffworkflow:properties>
<spiffworkflow:property name="formJsonSchemaFilename" value="simple-user-task-schema.json" />
<spiffworkflow:property name="formUiSchemaFilename" value="simple-user-task-uischema.json" />
</spiffworkflow:properties>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1s0vaon</bpmn:incoming>
<bpmn:outgoing>Flow_0x52gsc</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1smb9b5">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="142" y="12" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_079whp1_di" bpmnElement="Activity_10fbwgl">
<dc:Bounds x="230" y="-10" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0ip5gqo_di" bpmnElement="Activity_0n8y9m7">
<dc:Bounds x="390" y="-10" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_02lcq5d_di" bpmnElement="Activity_14uu3ah">
<dc:Bounds x="540" y="-10" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_16l8zdp_di" bpmnElement="Event_16l8zdp">
<dc:Bounds x="802" y="12" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0bngcu2_di" bpmnElement="Flow_0bngcu2">
<di:waypoint x="178" y="30" />
<di:waypoint x="230" y="30" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0ggy7w4_di" bpmnElement="Flow_0ggy7w4">
<di:waypoint x="330" y="30" />
<di:waypoint x="390" y="30" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1s0vaon_di" bpmnElement="Flow_1s0vaon">
<di:waypoint x="490" y="30" />
<di:waypoint x="540" y="30" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0x52gsc_di" bpmnElement="Flow_0x52gsc">
<di:waypoint x="640" y="30" />
<di:waypoint x="802" y="30" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>