]> git.madduck.net Git - etc/vim.git/blob - tests/function.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:

Use HTTPS
[etc/vim.git] / tests / function.py
1 #!/usr/bin/env python3
2 import asyncio
3 import sys
4
5 from third_party import X, Y, Z
6
7 from library import some_connection, \
8                     some_decorator
9
10 def func_no_args():
11   a; b; c
12   if True: raise RuntimeError
13   if False: ...
14   for i in range(10):
15     print(i)
16     continue
17   return None
18 async def coroutine(arg):
19  "Single-line docstring. Multiline is harder to reformat."
20  async with some_connection() as conn:
21      await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
22  await asyncio.sleep(1)
23 @asyncio.coroutine
24 @some_decorator(
25 with_args=True,
26 many_args=[1,2,3]
27 )
28 def function_signature_stress_test(number:int,no_annotation=None,text:str="default",* ,debug:bool=False,**kwargs) -> str:
29  return text[number:-1]
30
31 def long_lines():
32     if True:
33         typedargslist.extend(
34             gen_annotated_params(ast_args.kwonlyargs, ast_args.kw_defaults, parameters, implicit_default=True)
35         )
36     _type_comment_re = re.compile(
37         r"""
38         ^
39         [\t ]*
40         \#[ ]type:[ ]*
41         (?P<type>
42             [^#\t\n]+?
43         )
44         (?<!ignore)     # note: this will force the non-greedy + in <type> to match
45                         # a trailing space which is why we need the silliness below
46         (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
47         (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
48         (?<!ignore[ ]{9})(?<!ignore[ ]{10})
49         [\t ]*
50         (?P<nl>
51             (?:\#[^\n]*)?
52             \n?
53         )
54         $
55         """, re.MULTILINE | re.VERBOSE
56     )
57
58 # output
59
60
61 #!/usr/bin/env python3
62 import asyncio
63 import sys
64
65 from third_party import X, Y, Z
66
67 from library import some_connection, some_decorator
68
69
70 def func_no_args():
71     a
72     b
73     c
74     if True:
75         raise RuntimeError
76
77     if False:
78         ...
79     for i in range(10):
80         print(i)
81         continue
82
83     return None
84
85
86 async def coroutine(arg):
87     "Single-line docstring. Multiline is harder to reformat."
88     async with some_connection() as conn:
89         await conn.do_what_i_mean('SELECT bobby, tables FROM xkcd', timeout=2)
90     await asyncio.sleep(1)
91
92
93 @asyncio.coroutine
94 @some_decorator(with_args=True, many_args=[1, 2, 3])
95 def function_signature_stress_test(
96     number: int,
97     no_annotation=None,
98     text: str = "default",
99     *,
100     debug: bool = False,
101     **kwargs,
102 ) -> str:
103     return text[number:-1]
104
105
106 def long_lines():
107     if True:
108         typedargslist.extend(
109             gen_annotated_params(
110                 ast_args.kwonlyargs,
111                 ast_args.kw_defaults,
112                 parameters,
113                 implicit_default=True,
114             )
115         )
116     _type_comment_re = re.compile(
117         r"""
118         ^
119         [\t ]*
120         \#[ ]type:[ ]*
121         (?P<type>
122             [^#\t\n]+?
123         )
124         (?<!ignore)     # note: this will force the non-greedy + in <type> to match
125                         # a trailing space which is why we need the silliness below
126         (?<!ignore[ ]{1})(?<!ignore[ ]{2})(?<!ignore[ ]{3})(?<!ignore[ ]{4})
127         (?<!ignore[ ]{5})(?<!ignore[ ]{6})(?<!ignore[ ]{7})(?<!ignore[ ]{8})
128         (?<!ignore[ ]{9})(?<!ignore[ ]{10})
129         [\t ]*
130         (?P<nl>
131             (?:\#[^\n]*)?
132             \n?
133         )
134         $
135         """,
136         re.MULTILINE | re.VERBOSE,
137     )