]> git.madduck.net Git - etc/vim.git/blob - tests/comments.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Ignore typing error around Node/Leaf
[etc/vim.git] / tests / comments.py
1 #!/usr/bin/env python3
2 # Some license here.
3 #
4 # Has many lines. Many, many lines.
5 # Many, many, many lines.
6 """Module docstring.
7
8 Possibly also many, many lines.
9 """
10
11 import os.path
12 import sys
13
14 import a
15 from b.c import X  # some noqa comment
16
17 try:
18     import fast
19 except ImportError:
20     import slow as fast
21
22
23 # Some comment before a function.
24
25
26 def function(default=None):
27     """Docstring comes first.
28
29     Possibly many lines.
30     """
31     # FIXME: Some comment about why this function is crap but still in production.
32     import inner_imports
33
34     if inner_imports.are_evil():
35         # Explains why we have this if.
36         # In great detail indeed.
37         x = X()
38         return x.method1()  # type: ignore
39
40     # This return is also commented for some reason.
41     return default
42
43
44 # Explains why we use global state.
45 GLOBAL_STATE = {'a': a(1), 'b': a(2), 'c': a(3)}
46
47
48 # Another comment!
49 # This time two lines.
50
51
52 @fast(really=True)
53 async def wat():
54     async with X.open_async() as x:  # Some more comments
55         result = await x.method1()
56     # Comment after ending a block.
57     if result:
58         print('A OK', file=sys.stdout)
59         # Comment between things.
60         print()
61
62
63 # Some closing comments.
64 # Maybe Vim or Emacs directives for formatting.
65 # Who knows.