]> 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:

Initial commit
[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 def function(default=None):
25     """Docstring comes first.
26
27     Possibly many lines.
28     """
29     # FIXME: Some comment about why this function is crap but still in production.
30     import inner_imports
31
32     if inner_imports.are_evil():
33         # Explains why we have this if.
34         # In great detail indeed.
35         x = X()
36         return x.method1()  # type: ignore
37
38     # This return is also commented for some reason.
39     return default
40
41
42 # Explains why we use global state.
43 GLOBAL_STATE = {'a': a(1), 'b': a(2), 'c': a(3)}
44
45
46 # Another comment
47 @fast(really=True)
48 async def wat():
49     async with X.open_async() as x:  # Some more comments
50         result = await x.method1()
51     # Comment after ending a block.
52     if result:
53         print('A OK', file=sys.stdout)
54         # Comment between things.
55         print()
56
57
58 # Some closing comments.
59 # Maybe Vim or Emacs directives for formatting.
60 # Who knows.