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

Fix long lines with power operator(s) getting splitted before line length (#3942)
[etc/vim.git] / tests / data / cases / power_op_spacing.py
1 def function(**kwargs):
2     t = a**2 + b**3
3     return t ** 2
4
5
6 def function_replace_spaces(**kwargs):
7     t = a **2 + b** 3 + c ** 4
8
9
10 def function_dont_replace_spaces():
11     {**a, **b, **c}
12
13
14 a = 5**~4
15 b = 5 ** f()
16 c = -(5**2)
17 d = 5 ** f["hi"]
18 e = lazy(lambda **kwargs: 5)
19 f = f() ** 5
20 g = a.b**c.d
21 h = 5 ** funcs.f()
22 i = funcs.f() ** 5
23 j = super().name ** 5
24 k = [(2**idx, value) for idx, value in pairs]
25 l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
26 m = [([2**63], [1, 2**63])]
27 n = count <= 10**5
28 o = settings(max_examples=10**6)
29 p = {(k, k**2): v**2 for k, v in pairs}
30 q = [10**i for i in range(6)]
31 r = x**y
32 s = 1 ** 1
33 t = (
34     1
35     ** 1
36     **1
37     ** 1
38 )
39
40 a = 5.0**~4.0
41 b = 5.0 ** f()
42 c = -(5.0**2.0)
43 d = 5.0 ** f["hi"]
44 e = lazy(lambda **kwargs: 5)
45 f = f() ** 5.0
46 g = a.b**c.d
47 h = 5.0 ** funcs.f()
48 i = funcs.f() ** 5.0
49 j = super().name ** 5.0
50 k = [(2.0**idx, value) for idx, value in pairs]
51 l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
52 m = [([2.0**63.0], [1.0, 2**63.0])]
53 n = count <= 10**5.0
54 o = settings(max_examples=10**6.0)
55 p = {(k, k**2): v**2.0 for k, v in pairs}
56 q = [10.5**i for i in range(6)]
57 s = 1.0 ** 1.0
58 t = (
59     1.0
60     ** 1.0
61     **1.0
62     ** 1.0
63 )
64
65
66 # WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)
67 if hasattr(view, "sum_of_weights"):
68     return np.divide(  # type: ignore[no-any-return]
69         view.variance,  # type: ignore[union-attr]
70         view.sum_of_weights,  # type: ignore[union-attr]
71         out=np.full(view.sum_of_weights.shape, np.nan),  # type: ignore[union-attr]
72         where=view.sum_of_weights**2 > view.sum_of_weights_squared,  # type: ignore[union-attr]
73     )
74
75 return np.divide(
76     where=view.sum_of_weights_of_weight_long**2 > view.sum_of_weights_squared,  # type: ignore
77 )
78
79
80 # output
81
82
83 def function(**kwargs):
84     t = a**2 + b**3
85     return t**2
86
87
88 def function_replace_spaces(**kwargs):
89     t = a**2 + b**3 + c**4
90
91
92 def function_dont_replace_spaces():
93     {**a, **b, **c}
94
95
96 a = 5**~4
97 b = 5 ** f()
98 c = -(5**2)
99 d = 5 ** f["hi"]
100 e = lazy(lambda **kwargs: 5)
101 f = f() ** 5
102 g = a.b**c.d
103 h = 5 ** funcs.f()
104 i = funcs.f() ** 5
105 j = super().name ** 5
106 k = [(2**idx, value) for idx, value in pairs]
107 l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
108 m = [([2**63], [1, 2**63])]
109 n = count <= 10**5
110 o = settings(max_examples=10**6)
111 p = {(k, k**2): v**2 for k, v in pairs}
112 q = [10**i for i in range(6)]
113 r = x**y
114 s = 1**1
115 t = 1**1**1**1
116
117 a = 5.0**~4.0
118 b = 5.0 ** f()
119 c = -(5.0**2.0)
120 d = 5.0 ** f["hi"]
121 e = lazy(lambda **kwargs: 5)
122 f = f() ** 5.0
123 g = a.b**c.d
124 h = 5.0 ** funcs.f()
125 i = funcs.f() ** 5.0
126 j = super().name ** 5.0
127 k = [(2.0**idx, value) for idx, value in pairs]
128 l = mod.weights_[0] == pytest.approx(0.95**100, abs=0.001)
129 m = [([2.0**63.0], [1.0, 2**63.0])]
130 n = count <= 10**5.0
131 o = settings(max_examples=10**6.0)
132 p = {(k, k**2): v**2.0 for k, v in pairs}
133 q = [10.5**i for i in range(6)]
134 s = 1.0**1.0
135 t = 1.0**1.0**1.0**1.0
136
137
138 # WE SHOULD DEFINITELY NOT EAT THESE COMMENTS (https://github.com/psf/black/issues/2873)
139 if hasattr(view, "sum_of_weights"):
140     return np.divide(  # type: ignore[no-any-return]
141         view.variance,  # type: ignore[union-attr]
142         view.sum_of_weights,  # type: ignore[union-attr]
143         out=np.full(view.sum_of_weights.shape, np.nan),  # type: ignore[union-attr]
144         where=view.sum_of_weights**2 > view.sum_of_weights_squared,  # type: ignore[union-attr]
145     )
146
147 return np.divide(
148     where=view.sum_of_weights_of_weight_long**2 > view.sum_of_weights_squared,  # type: ignore
149 )