Debian Codegraph @

tests/data/cases/fmtskip8.py

raw
1 # Make sure a leading comment is not removed.
2 def some_func( unformatted, args ): # fmt: skip
3 print("I am some_func")
4 return 0
5 # Make sure this comment is not removed.
6
7
8 # Make sure a leading comment is not removed.
9 async def some_async_func( unformatted, args): # fmt: skip
10 print("I am some_async_func")
11 await asyncio.sleep(1)
12
13
14 # Make sure a leading comment is not removed.
15 class SomeClass( Unformatted, SuperClasses ): # fmt: skip
16 def some_method( self, unformatted, args ): # fmt: skip
17 print("I am some_method")
18 return 0
19
20 async def some_async_method( self, unformatted, args ): # fmt: skip
21 print("I am some_async_method")
22 await asyncio.sleep(1)
23
24
25 # Make sure a leading comment is not removed.
26 if unformatted_call( args ): # fmt: skip
27 print("First branch")
28 # Make sure this is not removed.
29 elif another_unformatted_call( args ): # fmt: skip
30 print("Second branch")
31 else : # fmt: skip
32 print("Last branch")
33
34
35 while some_condition( unformatted, args ): # fmt: skip
36 print("Do something")
37
38
39 for i in some_iter( unformatted, args ): # fmt: skip
40 print("Do something")
41
42
43 async def test_async_for():
44 async for i in some_async_iter( unformatted, args ): # fmt: skip
45 print("Do something")
46
47
48 try : # fmt: skip
49 some_call()
50 except UnformattedError as ex: # fmt: skip
51 handle_exception()
52 finally : # fmt: skip
53 finally_call()
54
55
56 with give_me_context( unformatted, args ): # fmt: skip
57 print("Do something")
58
59
60 async def test_async_with():
61 async with give_me_async_context( unformatted, args ): # fmt: skip
62 print("Do something")