| 1 | # Python settings for QMK |
| 2 | [flake8] |
| 3 | ignore = |
| 4 | # QMK is ok with long lines. |
| 5 | E501 |
| 6 | per_file_ignores = |
| 7 | **/__init__.py:F401 |
| 8 | |
| 9 | # Let's slowly crank this down |
| 10 | max_complexity=16 |
| 11 | |
| 12 | [yapf] |
| 13 | # Align closing bracket with visual indentation. |
| 14 | align_closing_bracket_with_visual_indent=True |
| 15 | |
| 16 | # Allow dictionary keys to exist on multiple lines. For example: |
| 17 | # |
| 18 | # x = { |
| 19 | # ('this is the first element of a tuple', |
| 20 | # 'this is the second element of a tuple'): |
| 21 | # value, |
| 22 | # } |
| 23 | allow_multiline_dictionary_keys=False |
| 24 | |
| 25 | # Allow lambdas to be formatted on more than one line. |
| 26 | allow_multiline_lambdas=False |
| 27 | |
| 28 | # Allow splitting before a default / named assignment in an argument list. |
| 29 | allow_split_before_default_or_named_assigns=True |
| 30 | |
| 31 | # Allow splits before the dictionary value. |
| 32 | allow_split_before_dict_value=True |
| 33 | |
| 34 | # Let spacing indicate operator precedence. For example: |
| 35 | # |
| 36 | # a = 1 * 2 + 3 / 4 |
| 37 | # b = 1 / 2 - 3 * 4 |
| 38 | # c = (1 + 2) * (3 - 4) |
| 39 | # d = (1 - 2) / (3 + 4) |
| 40 | # e = 1 * 2 - 3 |
| 41 | # f = 1 + 2 + 3 + 4 |
| 42 | # |
| 43 | # will be formatted as follows to indicate precedence: |
| 44 | # |
| 45 | # a = 1*2 + 3/4 |
| 46 | # b = 1/2 - 3*4 |
| 47 | # c = (1+2) * (3-4) |
| 48 | # d = (1-2) / (3+4) |
| 49 | # e = 1*2 - 3 |
| 50 | # f = 1 + 2 + 3 + 4 |
| 51 | # |
| 52 | arithmetic_precedence_indication=True |
| 53 | |
| 54 | # Number of blank lines surrounding top-level function and class |
| 55 | # definitions. |
| 56 | blank_lines_around_top_level_definition=2 |
| 57 | |
| 58 | # Insert a blank line before a class-level docstring. |
| 59 | blank_line_before_class_docstring=False |
| 60 | |
| 61 | # Insert a blank line before a module docstring. |
| 62 | blank_line_before_module_docstring=False |
| 63 | |
| 64 | # Insert a blank line before a 'def' or 'class' immediately nested |
| 65 | # within another 'def' or 'class'. For example: |
| 66 | # |
| 67 | # class Foo: |
| 68 | # # <------ this blank line |
| 69 | # def method(): |
| 70 | # ... |
| 71 | blank_line_before_nested_class_or_def=False |
| 72 | |
| 73 | # Do not split consecutive brackets. Only relevant when |
| 74 | # dedent_closing_brackets is set. For example: |
| 75 | # |
| 76 | # call_func_that_takes_a_dict( |
| 77 | # { |
| 78 | # 'key1': 'value1', |
| 79 | # 'key2': 'value2', |
| 80 | # } |
| 81 | # ) |
| 82 | # |
| 83 | # would reformat to: |
| 84 | # |
| 85 | # call_func_that_takes_a_dict({ |
| 86 | # 'key1': 'value1', |
| 87 | # 'key2': 'value2', |
| 88 | # }) |
| 89 | coalesce_brackets=True |
| 90 | |
| 91 | # The column limit. |
| 92 | column_limit=256 |
| 93 | |
| 94 | # The style for continuation alignment. Possible values are: |
| 95 | # |
| 96 | # - SPACE: Use spaces for continuation alignment. This is default behavior. |
| 97 | # - FIXED: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns |
| 98 | # (ie: CONTINUATION_INDENT_WIDTH/INDENT_WIDTH tabs) for continuation |
| 99 | # alignment. |
| 100 | # - VALIGN-RIGHT: Vertically align continuation lines with indent |
| 101 | # characters. Slightly right (one more indent character) if cannot |
| 102 | # vertically align continuation lines with indent characters. |
| 103 | # |
| 104 | # For options FIXED, and VALIGN-RIGHT are only available when USE_TABS is |
| 105 | # enabled. |
| 106 | continuation_align_style=SPACE |
| 107 | |
| 108 | # Indent width used for line continuations. |
| 109 | continuation_indent_width=4 |
| 110 | |
| 111 | # Put closing brackets on a separate line, dedented, if the bracketed |
| 112 | # expression can't fit in a single line. Applies to all kinds of brackets, |
| 113 | # including function definitions and calls. For example: |
| 114 | # |
| 115 | # config = { |
| 116 | # 'key1': 'value1', |
| 117 | # 'key2': 'value2', |
| 118 | # } # <--- this bracket is dedented and on a separate line |
| 119 | # |
| 120 | # time_series = self.remote_client.query_entity_counters( |
| 121 | # entity='dev3246.region1', |
| 122 | # key='dns.query_latency_tcp', |
| 123 | # transform=Transformation.AVERAGE(window=timedelta(seconds=60)), |
| 124 | # start_ts=now()-timedelta(days=3), |
| 125 | # end_ts=now(), |
| 126 | # ) # <--- this bracket is dedented and on a separate line |
| 127 | dedent_closing_brackets=True |
| 128 | |
| 129 | # Disable the heuristic which places each list element on a separate line |
| 130 | # if the list is comma-terminated. |
| 131 | disable_ending_comma_heuristic=False |
| 132 | |
| 133 | # Place each dictionary entry onto its own line. |
| 134 | each_dict_entry_on_separate_line=True |
| 135 | |
| 136 | # The regex for an i18n comment. The presence of this comment stops |
| 137 | # reformatting of that line, because the comments are required to be |
| 138 | # next to the string they translate. |
| 139 | i18n_comment= |
| 140 | |
| 141 | # The i18n function call names. The presence of this function stops |
| 142 | # reformattting on that line, because the string it has cannot be moved |
| 143 | # away from the i18n comment. |
| 144 | i18n_function_call= |
| 145 | |
| 146 | # Indent blank lines. |
| 147 | indent_blank_lines=False |
| 148 | |
| 149 | # Indent the dictionary value if it cannot fit on the same line as the |
| 150 | # dictionary key. For example: |
| 151 | # |
| 152 | # config = { |
| 153 | # 'key1': |
| 154 | # 'value1', |
| 155 | # 'key2': value1 + |
| 156 | # value2, |
| 157 | # } |
| 158 | indent_dictionary_value=True |
| 159 | |
| 160 | # The number of columns to use for indentation. |
| 161 | indent_width=4 |
| 162 | |
| 163 | # Join short lines into one line. E.g., single line 'if' statements. |
| 164 | join_multiple_lines=False |
| 165 | |
| 166 | # Do not include spaces around selected binary operators. For example: |
| 167 | # |
| 168 | # 1 + 2 * 3 - 4 / 5 |
| 169 | # |
| 170 | # will be formatted as follows when configured with "*,/": |
| 171 | # |
| 172 | # 1 + 2*3 - 4/5 |
| 173 | no_spaces_around_selected_binary_operators= |
| 174 | |
| 175 | # Use spaces around default or named assigns. |
| 176 | spaces_around_default_or_named_assign=False |
| 177 | |
| 178 | # Use spaces around the power operator. |
| 179 | spaces_around_power_operator=False |
| 180 | |
| 181 | # The number of spaces required before a trailing comment. |
| 182 | # This can be a single value (representing the number of spaces |
| 183 | # before each trailing comment) or list of values (representing |
| 184 | # alignment column values; trailing comments within a block will |
| 185 | # be aligned to the first column value that is greater than the maximum |
| 186 | # line length within the block). For example: |
| 187 | # |
| 188 | # With spaces_before_comment=5: |
| 189 | # |
| 190 | # 1 + 1 # Adding values |
| 191 | # |
| 192 | # will be formatted as: |
| 193 | # |
| 194 | # 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment |
| 195 | # |
| 196 | # With spaces_before_comment=15, 20: |
| 197 | # |
| 198 | # 1 + 1 # Adding values |
| 199 | # two + two # More adding |
| 200 | # |
| 201 | # longer_statement # This is a longer statement |
| 202 | # short # This is a shorter statement |
| 203 | # |
| 204 | # a_very_long_statement_that_extends_beyond_the_final_column # Comment |
| 205 | # short # This is a shorter statement |
| 206 | # |
| 207 | # will be formatted as: |
| 208 | # |
| 209 | # 1 + 1 # Adding values <-- end of line comments in block aligned to col 15 |
| 210 | # two + two # More adding |
| 211 | # |
| 212 | # longer_statement # This is a longer statement <-- end of line comments in block aligned to col 20 |
| 213 | # short # This is a shorter statement |
| 214 | # |
| 215 | # a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments are aligned based on the line length |
| 216 | # short # This is a shorter statement |
| 217 | # |
| 218 | spaces_before_comment=2 |
| 219 | |
| 220 | # Insert a space between the ending comma and closing bracket of a list, |
| 221 | # etc. |
| 222 | space_between_ending_comma_and_closing_bracket=False |
| 223 | |
| 224 | # Split before arguments |
| 225 | split_all_comma_separated_values=False |
| 226 | |
| 227 | # Split before arguments if the argument list is terminated by a |
| 228 | # comma. |
| 229 | split_arguments_when_comma_terminated=True |
| 230 | |
| 231 | # Set to True to prefer splitting before '+', '-', '*', '/', '//', or '@' |
| 232 | # rather than after. |
| 233 | split_before_arithmetic_operator=False |
| 234 | |
| 235 | # Set to True to prefer splitting before '&', '|' or '^' rather than |
| 236 | # after. |
| 237 | split_before_bitwise_operator=True |
| 238 | |
| 239 | # Split before the closing bracket if a list or dict literal doesn't fit on |
| 240 | # a single line. |
| 241 | split_before_closing_bracket=True |
| 242 | |
| 243 | # Split before a dictionary or set generator (comp_for). For example, note |
| 244 | # the split before the 'for': |
| 245 | # |
| 246 | # foo = { |
| 247 | # variable: 'Hello world, have a nice day!' |
| 248 | # for variable in bar if variable != 42 |
| 249 | # } |
| 250 | split_before_dict_set_generator=True |
| 251 | |
| 252 | # Split before the '.' if we need to split a longer expression: |
| 253 | # |
| 254 | # foo = ('This is a really long string: {}, {}, {}, {}'.format(a, b, c, d)) |
| 255 | # |
| 256 | # would reformat to something like: |
| 257 | # |
| 258 | # foo = ('This is a really long string: {}, {}, {}, {}' |
| 259 | # .format(a, b, c, d)) |
| 260 | split_before_dot=False |
| 261 | |
| 262 | # Split after the opening paren which surrounds an expression if it doesn't |
| 263 | # fit on a single line. |
| 264 | split_before_expression_after_opening_paren=False |
| 265 | |
| 266 | # If an argument / parameter list is going to be split, then split before |
| 267 | # the first argument. |
| 268 | split_before_first_argument=False |
| 269 | |
| 270 | # Set to True to prefer splitting before 'and' or 'or' rather than |
| 271 | # after. |
| 272 | split_before_logical_operator=False |
| 273 | |
| 274 | # Split named assignments onto individual lines. |
| 275 | split_before_named_assigns=True |
| 276 | |
| 277 | # Set to True to split list comprehensions and generators that have |
| 278 | # non-trivial expressions and multiple clauses before each of these |
| 279 | # clauses. For example: |
| 280 | # |
| 281 | # result = [ |
| 282 | # a_long_var + 100 for a_long_var in xrange(1000) |
| 283 | # if a_long_var % 10] |
| 284 | # |
| 285 | # would reformat to something like: |
| 286 | # |
| 287 | # result = [ |
| 288 | # a_long_var + 100 |
| 289 | # for a_long_var in xrange(1000) |
| 290 | # if a_long_var % 10] |
| 291 | split_complex_comprehension=True |
| 292 | |
| 293 | # The penalty for splitting right after the opening bracket. |
| 294 | split_penalty_after_opening_bracket=300 |
| 295 | |
| 296 | # The penalty for splitting the line after a unary operator. |
| 297 | split_penalty_after_unary_operator=10000 |
| 298 | |
| 299 | # The penalty of splitting the line around the '+', '-', '*', '/', '//', |
| 300 | # ``%``, and '@' operators. |
| 301 | split_penalty_arithmetic_operator=300 |
| 302 | |
| 303 | # The penalty for splitting right before an if expression. |
| 304 | split_penalty_before_if_expr=0 |
| 305 | |
| 306 | # The penalty of splitting the line around the '&', '|', and '^' |
| 307 | # operators. |
| 308 | split_penalty_bitwise_operator=300 |
| 309 | |
| 310 | # The penalty for splitting a list comprehension or generator |
| 311 | # expression. |
| 312 | split_penalty_comprehension=80 |
| 313 | |
| 314 | # The penalty for characters over the column limit. |
| 315 | split_penalty_excess_character=7000 |
| 316 | |
| 317 | # The penalty incurred by adding a line split to the unwrapped line. The |
| 318 | # more line splits added the higher the penalty. |
| 319 | split_penalty_for_added_line_split=30 |
| 320 | |
| 321 | # The penalty of splitting a list of "import as" names. For example: |
| 322 | # |
| 323 | # from a_very_long_or_indented_module_name_yada_yad import (long_argument_1, |
| 324 | # long_argument_2, |
| 325 | # long_argument_3) |
| 326 | # |
| 327 | # would reformat to something like: |
| 328 | # |
| 329 | # from a_very_long_or_indented_module_name_yada_yad import ( |
| 330 | # long_argument_1, long_argument_2, long_argument_3) |
| 331 | split_penalty_import_names=0 |
| 332 | |
| 333 | # The penalty of splitting the line around the 'and' and 'or' |
| 334 | # operators. |
| 335 | split_penalty_logical_operator=300 |
| 336 | |
| 337 | # Use the Tab character for indentation. |
| 338 | use_tabs=False |
| 339 | |