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

respect magic trailing commas in return types (#3916)
[etc/vim.git] / tests / data / preview / prefer_rhs_split.py
1 first_item, second_item = (
2     some_looooooooong_module.some_looooooooooooooong_function_name(
3         first_argument, second_argument, third_argument
4     )
5 )
6
7 some_dict["with_a_long_key"] = (
8     some_looooooooong_module.some_looooooooooooooong_function_name(
9         first_argument, second_argument, third_argument
10     )
11 )
12
13 # Make sure it works when the RHS only has one pair of (optional) parens.
14 first_item, second_item = (
15     some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
16 )
17
18 some_dict["with_a_long_key"] = (
19     some_looooooooong_module.SomeClass.some_looooooooooooooong_variable_name
20 )
21
22 # Make sure chaining assignments work.
23 first_item, second_item, third_item, forth_item = m["everything"] = (
24     some_looooooooong_module.some_looooooooooooooong_function_name(
25         first_argument, second_argument, third_argument
26     )
27 )
28
29 # Make sure when the RHS's first split at the non-optional paren fits,
30 # we split there instead of the outer RHS optional paren.
31 first_item, second_item = some_looooooooong_module.some_loooooog_function_name(
32     first_argument, second_argument, third_argument
33 )
34
35 (
36     first_item,
37     second_item,
38     third_item,
39     forth_item,
40     fifth_item,
41     last_item_very_loooooong,
42 ) = some_looooooooong_module.some_looooooooooooooong_function_name(
43     first_argument, second_argument, third_argument
44 )
45
46 (
47     first_item,
48     second_item,
49     third_item,
50     forth_item,
51     fifth_item,
52     last_item_very_loooooong,
53 ) = everything = some_looooong_function_name(
54     first_argument, second_argument, third_argument
55 )
56
57
58 # Make sure unsplittable type ignore won't be moved.
59 some_kind_of_table[some_key] = util.some_function(  # type: ignore  # noqa: E501
60     some_arg
61 ).intersection(pk_cols)
62
63 some_kind_of_table[
64     some_key
65 ] = lambda obj: obj.some_long_named_method()  # type: ignore  # noqa: E501
66
67 some_kind_of_table[
68     some_key  # type: ignore  # noqa: E501
69 ] = lambda obj: obj.some_long_named_method()
70
71
72 # Make when when the left side of assignment plus the opening paren "... = (" is
73 # exactly line length limit + 1, it won't be split like that.
74 xxxxxxxxx_yyy_zzzzzzzz[
75     xx.xxxxxx(x_yyy_zzzzzz.xxxxx[0]), x_yyy_zzzzzz.xxxxxx(xxxx=1)
76 ] = 1
77
78
79 # Right side of assignment contains un-nested pairs of inner parens.
80 some_kind_of_instance.some_kind_of_map[a_key] = (
81     isinstance(some_var, SomeClass)
82     and table.something_and_something != table.something_else
83 ) or (
84     isinstance(some_other_var, BaseClass) and table.something != table.some_other_thing
85 )