Debian Codegraph @

tests/data/cases/line_ranges_basic.py

raw
1 # flags: --line-ranges=5-6
2 # NOTE: If you need to modify this file, pay special attention to the --line-ranges=
3 # flag above as it's formatting specifically these lines.
4 def foo1(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
5 def foo2(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
6 def foo3(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
7 def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
8
9 # Adding some unformated code covering a wide range of syntaxes.
10
11 if True:
12 # Incorrectly indented prefix comments.
13 pass
14
15 import typing
16 from typing import (
17 Any ,
18 )
19 class MyClass( object): # Trailing comment with extra leading space.
20 #NOTE: The following indentation is incorrect:
21 @decor( 1 * 3 )
22 def my_func( arg):
23 pass
24
25 try: # Trailing comment with extra leading space.
26 for i in range(10): # Trailing comment with extra leading space.
27 while condition:
28 if something:
29 then_something( )
30 elif something_else:
31 then_something_else( )
32 except ValueError as e:
33 unformatted( )
34 finally:
35 unformatted( )
36
37 async def test_async_unformatted( ): # Trailing comment with extra leading space.
38 async for i in some_iter( unformatted ): # Trailing comment with extra leading space.
39 await asyncio.sleep( 1 )
40 async with some_context( unformatted ):
41 print( "unformatted" )
42
43
44 # output
45 # flags: --line-ranges=5-6
46 # NOTE: If you need to modify this file, pay special attention to the --line-ranges=
47 # flag above as it's formatting specifically these lines.
48 def foo1(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
49 def foo2(
50 parameter_1,
51 parameter_2,
52 parameter_3,
53 parameter_4,
54 parameter_5,
55 parameter_6,
56 parameter_7,
57 ):
58 pass
59
60
61 def foo3(
62 parameter_1,
63 parameter_2,
64 parameter_3,
65 parameter_4,
66 parameter_5,
67 parameter_6,
68 parameter_7,
69 ):
70 pass
71
72
73 def foo4(parameter_1, parameter_2, parameter_3, parameter_4, parameter_5, parameter_6, parameter_7): pass
74
75 # Adding some unformated code covering a wide range of syntaxes.
76
77 if True:
78 # Incorrectly indented prefix comments.
79 pass
80
81 import typing
82 from typing import (
83 Any ,
84 )
85 class MyClass( object): # Trailing comment with extra leading space.
86 #NOTE: The following indentation is incorrect:
87 @decor( 1 * 3 )
88 def my_func( arg):
89 pass
90
91 try: # Trailing comment with extra leading space.
92 for i in range(10): # Trailing comment with extra leading space.
93 while condition:
94 if something:
95 then_something( )
96 elif something_else:
97 then_something_else( )
98 except ValueError as e:
99 unformatted( )
100 finally:
101 unformatted( )
102
103 async def test_async_unformatted( ): # Trailing comment with extra leading space.
104 async for i in some_iter( unformatted ): # Trailing comment with extra leading space.
105 await asyncio.sleep( 1 )
106 async with some_context( unformatted ):
107 print( "unformatted" )