google / yapf

A formatter for Python files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dedent_closing_brackets not working for Annotations[]

difhel opened this issue · comments

My config:

[tool.yapf]
based_on_style = "google"
dedent_closing_brackets = true
coalesce_brackets = true

Generated diff:

+++ ./src/db/models/annotations/__init__.py	(reformatted)
@@ -7,6 +7,8 @@
 EmailAnnotation = Annotated[str, AfterValidator(validators.email_string)]
 DomainAnnotation = Annotated[str, AfterValidator(validators.domain_name)]
 NameAnnotation = Annotated[str, AfterValidator(validators.name_string)]
-DescriptionAnnotation = Annotated[str, AfterValidator(validators.description_string)]
-RoleCodeAnnotation = Annotated[int, AfterValidator(validators.not_negative_number)]
+DescriptionAnnotation = Annotated[str,
+                                  AfterValidator(validators.description_string)]
+RoleCodeAnnotation = Annotated[int,
+                               AfterValidator(validators.not_negative_number)]
 StrIdAnnotation = Annotated[str, AfterValidator(validators.string_id)]

I want to work this feature similar to how it works with functions:

- function(long_param_a, long_param_b, long_param_c)
+ function(
+     long_param_a,
+     long_param_b,
+     long_param_c,
+     long_param_d
+ )