Add global and nonlocal formatting (#6170)

## Summary

Adds `global` and `nonlocal` formatting, without the "deviation from
black" outlined in the linked issue, which I'll do separately.

See: https://github.com/astral-sh/ruff/issues/4798.

## Test Plan

Added a fixture in the Ruff-specific directory since the Black fixtures
don't seem to cover this.
This commit is contained in:
Charlie Marsh 2023-07-29 10:39:42 -04:00 committed by GitHub
parent 5d9814d84d
commit 76741cac77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 118 additions and 6 deletions

View file

@ -0,0 +1,12 @@
def f():
global x, y, z
def f():
# leading comment
global x, y, z # end-of-line comment
# trailing comment
def f():
global analyze_featuremap_layer, analyze_featuremapcompression_layer, analyze_latencies_post, analyze_motions_layer, analyze_size_model

View file

@ -0,0 +1,12 @@
def f():
nonlocal x, y, z
def f():
# leading comment
nonlocal x, y, z # end-of-line comment
# trailing comment
def f():
nonlocal analyze_featuremap_layer, analyze_featuremapcompression_layer, analyze_latencies_post, analyze_motions_layer, analyze_size_model