File tree Expand file tree Collapse file tree 3 files changed +50
-23
lines changed Expand file tree Collapse file tree 3 files changed +50
-23
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,13 @@ repos:
67
67
- id : remove-crlf
68
68
- id : forbid-crlf
69
69
70
- - repo : https://github.com/repo-helper/formate
71
- rev : v0.4.3
70
+ - repo : https://github.com/python-formate/snippet-fmt
71
+ rev : v0.1.1
72
+ hooks :
73
+ - id : snippet-fmt
74
+
75
+ - repo : https://github.com/python-formate/formate
76
+ rev : v0.4.9
72
77
hooks :
73
78
- id : formate
74
79
exclude : ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$
Original file line number Diff line number Diff line change @@ -31,21 +31,21 @@ Function signatures
31
31
32
32
Function signatures should be laid out like this:
33
33
34
- .. code-block :: python
34
+ .. code-block :: python3
35
35
36
36
def long_function_name(
37
- var_one : str ,
38
- var_two : int ,
39
- var_three : List[str ],
40
- var_four : Dict[str , Any],
41
- ) -> Iterable[Tuple[str , int ]]:
37
+ var_one: str,
38
+ var_two: int,
39
+ var_three: List[str],
40
+ var_four: Dict[str, Any],
41
+ ) -> Iterable[Tuple[str, int]]:
42
42
...
43
43
44
44
with each argument on its own line, and the function name and return annotatons on separate lines.
45
45
Ensure to include the trailing comma after the last argument's annotation.
46
46
If the signature is short enough it may be placed on one line:
47
47
48
- .. code-block :: python
48
+ .. code-block :: python3
49
49
50
50
def function_name(var_one: str, var_two: int) -> bool:
51
51
...
@@ -82,23 +82,25 @@ Long Sequences
82
82
83
83
Long sequences should be written with each element on its own line and a trailing comma after the last element:
84
84
85
- .. code-block :: python
85
+ .. code-block :: python3
86
86
87
87
# Bad
88
88
my_list = [
89
- 1 , 2 , 3 ,
90
- 4 , 5 , 6
91
- ]
89
+ 1, 2, 3,
90
+ 4, 5, 6
91
+ ]
92
+
93
+ .. code-block :: python
92
94
93
95
# Good
94
96
my_list = [
95
- 1 ,
96
- 2 ,
97
- 3 ,
98
- 4 ,
99
- 5 ,
100
- 6 ,
101
- ]
97
+ 1 ,
98
+ 2 ,
99
+ 3 ,
100
+ 4 ,
101
+ 5 ,
102
+ 6 ,
103
+ ]
102
104
103
105
104
106
Maximum Line Length
@@ -166,15 +168,15 @@ Docstrings
166
168
167
169
The first line of the docstring must start a new line:
168
170
169
- .. code-block :: python
171
+ .. code-block :: python3
170
172
171
173
# Bad:
172
-
173
174
"""Return a foobang
174
175
"""
175
176
176
- # Good:
177
+ .. code-block :: python
177
178
179
+ # Good:
178
180
"""
179
181
Return a foobang
180
182
"""
Original file line number Diff line number Diff line change @@ -114,3 +114,23 @@ autodoc_exclude_members = [
114
114
" __abstractmethods__" ,
115
115
" __hash__" ,
116
116
]
117
+
118
+ [tool .mypy ]
119
+ python_version = " 3.8"
120
+ namespace_packages = true
121
+ check_untyped_defs = true
122
+ warn_unused_ignores = true
123
+ no_implicit_optional = true
124
+
125
+ [tool .snippet-fmt ]
126
+ directives = [ " code-block" ,]
127
+
128
+ [tool .snippet-fmt .languages .python ]
129
+ reformat = true
130
+
131
+ [tool .snippet-fmt .languages .TOML ]
132
+ reformat = true
133
+
134
+ [tool .snippet-fmt .languages .ini ]
135
+
136
+ [tool .snippet-fmt .languages .json ]
You can’t perform that action at this time.
0 commit comments