forked from diascreative/conventions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_syntax.py
More file actions
74 lines (54 loc) · 1.84 KB
/
python_syntax.py
File metadata and controls
74 lines (54 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
""" This is the package __doc__. It should start one space after the initial
triple quote and not be more than 80 characters long.
Paragraphs should be separated by a single line and continue on a four
space indent.
"""
# import statements should be grouped semantically in the following order
# standard library
import datetime
# framework / library imports
from deform import Form
from pyramid.config import Configurator
# project imports
from project.models import Model
GLOBAL_CONSTANT = 'all in uppercase with underscores'
def func(required_arg, optional_arg=None):
""" optional function docstring...
"""
scoped_var = 'all in lowercase with underscores'
short_dict = {'key1': 'val1', 'key2': 'val2'}
long_dict = {'key1': 'val2',
'key2': 'val2',
'key3': 'val3',
'key4': 'val4',
'key5': 'val5',
'key6': 'val6',
'key7': 'val7',
'key8': 'val8',
'key9': 'val9',
}
short_list = ['val1', 'val2']
long_list = ['val1',
'val2',
'val3',
'val4',
'val5',
'val6',
'val7',
'val8',
'val9',
]
return dict(scoped_var = scoped_var,
short_dict = short_dict,
long_dict = long_dict,
short_list = short_list,
long_list = long_list,
)
class Klass(object):
""" A very long doc string so that we can demonstrate it falling on to the
next line after 80 chars.
The next paragraph is a line lower with the same indentation.
"""
def method(self):
""" Single line docstrings should follow the same quote format.
"""