Questions tagged [yapf]

30 questions
1
vote
1 answer

How to use yapf to keep arguments all in one line?

I am trying to configure yapf so that arguments and the like are all in the same line but I am not sure how to get that effect, so far all I see are the arguments of functions on the same line but it doesn't work for everything. This is what I have,…
dazai
  • 766
  • 4
  • 25
1
vote
1 answer

Extra indent space in tuple

I have the following line of python (2.7) code. audit_row_groups = [(key, list(group), ) for key, group in itertools.groupby(audit_rows, lambda row: (row['date'], row['table_name'], row['user_id']))] When yapf formats it, I get the…
1
vote
1 answer

Spacing on inline comments with yapf

If I have code with inline comments: def my_function(): #my comment return 1+1 Flake8 will give me this error --> E262 - inline comment should start with '# ' It wants to see a single space after the "#": def my_function(): # my…
Fred S
  • 985
  • 4
  • 11
0
votes
0 answers

YAPF seems not to work when there is a comment within a function definition

I am Using yapf 0.40.1 with Python 3.10.4. I have a pyproject.toml file with the following…
prozaxx
  • 43
  • 3
0
votes
1 answer

Configure YAPF with PEP8 styling to ignore whitespace around equals operator

I'm using YAPF with the PEP8 style, and I'm trying to ignore whenever there's whitespace around the equals '=' operator, for example: environment: Optional[Dict[str, str]] = None Is formatted to: environment: Optional[Dict[str, str]]=None There…
solarflare
  • 880
  • 2
  • 8
  • 23
0
votes
0 answers

how to ignore the assignment intendation in any python formatter (black, yapf, autopep8)

i would like my code to look like following: short = value long_name = value very_long_name = value instead all python formatter give the following result: short = value long_name = value very_long_name = value the latter is harder…
0
votes
0 answers

How to do some custom formatting in YAPF

I am looking some custom formatting along with YAPF. .e.g. "add new line before if and for statements" Is there any way we can create custom Knobs https://github.com/google/yapf#knobs
IMParasharG
  • 1,869
  • 1
  • 15
  • 26
0
votes
0 answers

yapf is formatting my VSCode Python function summaries weirdly

For some reason, with format on save enabled, yapf formats my VSCode python function/summary from this print('hi') """_summary_ Pretty-prints a json object """ def print_json(json_obj): print(json.dumps(json_obj, indent=4)) to…
Jackalakalaka
  • 91
  • 1
  • 7
0
votes
0 answers

Column_limit for yapf and pylsp on neovim

I'm running nvim 0.9 with config I took from kickstart.nvim, so nvim-lspconfig, mason plus other stuff. I configured yapf, based on how I understand the LSP docs and the kickstart.nvim, yet it is not respecting custom column_limit, it seems to be…
i_wonder
  • 1
  • 1
0
votes
0 answers

Run yapf on list of files from git-diff output

I want to add a pre-commit hook to run yapf on changed changed in a commit. I use git diff --name-only --line-prefix=`git rev-parse --show-toplevel` to get the list of full file names modified in a commit. I am not sure on how to run yapf on the…
mcgusty
  • 1,354
  • 15
  • 21
0
votes
0 answers

permission denied with yapf in ssh script because of make

I have this strange error : i have a makefile with a format target that runs yapf -ir -vv --style pep8 . When I ssh log as user into my debian 11 server and run make format it works. When i run sudo make format i get the error yapf -ir -vv --style…
user19413311
0
votes
0 answers

How to debug the error message from a yapf formatting task?

I recently inherited a code base and am in the process of using yapf (and indirectly lib2to3) to format the code base. When I run the formatter I get the following output: Traceback (most recent call last): File…
S. Braun
  • 59
  • 5
0
votes
0 answers

Enforcing argument and return documentation in the docstring

I'm trying to add a linter to a repo that would enforce docstring documentation of arguments and return values for functions and methods, as described in the Google Python Style Guide. In general, I want to enforce the following docstring…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
0
votes
1 answer

How can I configure Python linter for the lsp layer of SpaceVim?

The lsp layer in SpaceVim is great! However, there is a slight issue with the Python liner in the lsp layer. it reports the following warings on my formattting which is done using yapf using the following settings (.style.yapf). How can I configure…
Benjamin Du
  • 1,391
  • 1
  • 17
  • 25
-1
votes
1 answer

YAPF Formatting on Commits

I am currently working on a tool being used for Python developers, who use Spyder IDE. We want a consistent format. They are not willing to change IDE's that have plugins to automatically do this. I have been testing the YAPF library, and am looking…
1
2