Lines Matching +full:plugin +full:- +full:syntax +full:- +full:logical +full:- +full:assignment +full:- +full:operators
21 Most of the current formatters for Python --- e.g., autopep8, and pep8ify ---
26 YAPF takes a different approach. It's based off of `'clang-format' <https://cl
32 formatting - if the whole codebase of a project is simply piped through YAPF
53 .. code-block:: shell
59 .. code-block:: shell
64 often; therefore, the best way to keep up-to-date with the latest development
67 Note that if you intend to use YAPF as a command-line tool rather than as a
72 .. code-block:: shell
93 usage: yapf [-h] [-v] [-d | -i] [-r | -l START-END] [-e PATTERN]
94 [--style STYLE] [--style-help] [--no-local-style] [-p]
95 [-vv]
104 -h, --help show this help message and exit
105 -v, --version show version number and exit
106 -d, --diff print the diff for the fixed source
107 -i, --in-place make changes to files in place
108 -r, --recursive run recursively over directories
109 -l START-END, --lines START-END
110 range of lines to reformat, one-based
111 -e PATTERN, --exclude PATTERN
113 --style STYLE specify formatting style: either a style name (for
120 --style-help show style settings and exit; this output can be saved
122 --no-local-style don't search for local style definition
123 -p, --parallel Run yapf in parallel when formatting multiple files.
125 -vv, --verbose Print out file names while processing
128 ------------
130 ------------
132 Normally YAPF returns zero on successful program termination and non-zero otherwise.
134 If ``--diff`` is supplied, YAPF returns zero when no changes were necessary, non-zero
136 has been YAPF-formatted.
138 ---------------------------------------------
140 ---------------------------------------------
146 ``.yapfignore``'s syntax is similar to UNIX's filename pattern matching::
158 .. code-block:: ini
173 To control the style, run YAPF with the ``--style`` argument. It accepts one of
177 The config file is a simple listing of (case-insensitive) ``key = value`` pairs
180 .. code-block:: ini
191 - ``pep8`` (default)
192 - ``google`` (based off of the `Google Python Style Guide`_)
193 - ``yapf`` (for use with Google open source projects)
194 - ``facebook``
196 .. _`Google Python Style Guide`: https://github.com/google/styleguide/blob/gh-pages/pyguide.md
205 .. code-block:: shell
207 --style='{based_on_style: pep8, indent_width: 2}'
233 .. code-block:: python
244 return 37*-+2
248 return 37+-+a[42-x : y**3]
252 .. code-block:: python
263 return 37 * -+2
270 return 37 + -+a[42 - x:y**3]
279 .. code-block:: python
293 .. code-block:: python
299 that we want to format. The lines are 1-based indexed. It can be used by
300 third-party code (e.g., IDEs) when reformatting a snippet of code rather
303 .. code-block:: python
311 .. code-block:: python
314 --- foo.py (original)
316 @@ -1 +1 @@
317 -a==b
325 .. code-block:: python
336 'utf-8'
342 .. code-block:: python
345 (None, 'utf-8')
355 usage: yapf-diff [-h] [-i] [-p NUM] [--regex PATTERN] [--iregex PATTERN][-v]
356 [--style STYLE] [--binary BINARY]
362 git diff -U0 --no-color --relative HEAD^ | yapf-diff -i
363 svn diff --diff-cmd=diff -x-U0 | yapf-diff -p0 -i
371 -h, --help show this help message and exit
372 -i, --in-place apply edits to files instead of displaying a diff
373 -p NUM, --prefix NUM strip the smallest prefix containing P slashes
374 --regex PATTERN custom pattern selecting file paths to reformat
375 (case sensitive, overrides -iregex)
376 --iregex PATTERN custom pattern selecting file paths to reformat
377 (case insensitive, overridden by -regex)
378 -v, --verbose be more verbose, ineffective without -i
379 --style STYLE specify formatting style: either a style name (for
386 --binary BINARY location of binary to use for yapf
400 .. code-block:: python
409 Allow splitting before a default / named assignment in an argument list.
417 .. code-block:: python
420 b = 1 / 2 - 3 * 4
421 c = (1 + 2) * (3 - 4)
422 d = (1 - 2) / (3 + 4)
423 e = 1 * 2 - 3
428 .. code-block:: python
431 b = 1/2 - 3*4
432 c = (1+2) * (3-4)
433 d = (1-2) / (3+4)
434 e = 1*2 - 3
441 .. code-block:: python
444 # <------ this blank line
452 Insert a blank line before a class-level docstring.
455 Sets the number of desired blank lines surrounding top-level function and
458 .. code-block:: python
462 # <------ having two blank lines here
463 # <------ is the default setting
468 Sets the number of desired blank lines between top-level imports and
476 .. code-block:: python
487 .. code-block:: python
496 The column limit (or max line-length)
501 - ``SPACE``: Use spaces for continuation alignment. This is default
503 - ``FIXED``: Use fixed number (CONTINUATION_INDENT_WIDTH) of columns
506 - ``VALIGN-RIGHT``: Vertically align continuation lines to multiple of
518 .. code-block:: python
523 } # <--- this bracket is dedented and on a separate line
529 start_ts=now()-timedelta(days=3),
531 ) # <--- this bracket is dedented and on a separate line
535 the list is comma-terminated.
558 .. code-block:: python
578 .. code-block:: python
583 } # <--- this bracket is indented and on a separate line
589 start_ts=now()-timedelta(days=3),
591 ) # <--- this bracket is indented and on a separate line
597 Do not include spaces around selected binary operators. For example:
599 .. code-block:: python
601 1 + 2 * 3 - 4 / 5
605 .. code-block:: python
607 1 + 2*3 - 4/5
613 Set to ``True`` to prefer spaces around the assignment operator for default
619 .. code-block:: python
625 .. code-block:: python
632 .. code-block:: python
638 .. code-block:: python
645 .. code-block:: python
652 .. code-block:: python
658 .. code-block:: python
672 .. code-block:: python
678 .. code-block:: python
680 1 + 1 # Adding values <-- 5 spaces between the end of the statement and comment
684 .. code-block:: python
697 .. code-block:: python
699 1 + 1 # Adding values <-- end of line comments in block aligned to col 15
702 …longer_statement # This is a longer statement <-- end of line comments in block aligned to col …
705 …a_very_long_statement_that_extends_beyond_the_final_column # Comment <-- the end of line comments…
714 .. code-block:: python
734 .. code-block:: python
743 .. code-block:: python
754 Set to ``True`` to prefer splitting before ``+``, ``-``, ``*``, ``/``, ``//``,
765 .. code-block:: python
775 .. code-block:: python
781 .. code-block:: python
806 .. code-block:: python
814 .. code-block:: python
829 The penalty of splitting the line around the ``+``, ``-``, ``*``, ``/``,
830 ``//``, ``%``, and ``@`` operators.
837 operators.
846 The penalty incurred by adding a line split to the logical line. The more
852 .. code-block:: python
860 .. code-block:: python
866 The penalty of splitting the line around the ``and`` and ``or`` operators.
874 --------------------------------------------
876 --------------------------------------------
879 be as good as hand-formatting. In particular, large data literals may become
889 .. code-block:: python
903 .. code-block:: python
916 -------------------------------
918 -------------------------------
920 We wanted to use clang-format's reformatting algorithm. It's very powerful and
923 to convert to using clang-format's algorithm.
925 -----------------------------
927 -----------------------------
930 tool. This means that a tool or IDE plugin is free to use YAPF.
932 -----------------------------------------
934 -----------------------------------------
942 .. code-block:: python
950 .. code-block:: python
961 ----------------
963 ----------------
973 ``LogicalLine``\s into one line. For instance, an if-then statement with a
976 .. code-block:: python
982 formatting decision --- i.e., whether to split or not to split before a token.
991 .. code-block:: python
1009 doing so will always be detrimental (i.e., it will require a backslash-newline,