google / google/yapf

Allow doule indentation for function definitions

Open
#1,050 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

Many projects use double indentation for function definition arguments. That is in order to allow the arguments to be clearly separated and visible.

I have not found a configuraion/knob to allow this with yapf. No matter my config it always try to go only for single indentation. How could I make the following not be changed?

```diff
def create_oracle_cache(
- self,
- oracle: HistoricalPriceOracle,
- from_asset: AssetWithOracles,
- to_asset: AssetWithOracles,
- purge_old: bool,
+ self,
+ oracle: HistoricalPriceOracle,
+ from_asset: AssetWithOracles,
+ to_asset: AssetWithOracles,
+ purge_old: bool,
) -> None:
```

Keep in mind the double indentation is **only** for function definitions. Everywhere else it should be single.

Related issue but still no solution: https://github.com/google/yapf/issues/843

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.