Skip to content

Commit abdc075

Browse files
style: format code with Black, isort and Rustfmt
This commit fixes the style issues introduced in 343785a according to the output from Black, isort and Rustfmt. Details: None
1 parent 343785a commit abdc075

18 files changed

+141
-64
lines changed

assert_outside_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# inside a func def
22
def some_function(args):
33
"""Docstring."""
4-
assert 1 > 2, (
5-
"Some message"
6-
)
4+
assert (
5+
1 > 2
6+
), "Some message"
77

88
if args != []:
99
raise AssertionError
1010

11+
1112
some_function(123)
1213

1314

14-
#Comment
15+
# Comment
1516
assert {} is not []

builtin_test.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
import gettext
22
import locale
33

4-
5-
lang = locale.getdefaultlocale()[0]
6-
trans = gettext.translation("qmm", localedir=None, languages=[lang], fallback=True)
4+
lang = (
5+
locale.getdefaultlocale()[
6+
0
7+
]
8+
)
9+
trans = gettext.translation(
10+
"qmm",
11+
localedir=None,
12+
languages=[lang],
13+
fallback=True,
14+
)
715
trans.install()
816

917
print(_("hurray!"))
1018

1119
builtinss = dir(__builtins__)
12-
print('_' in builtinss)
20+
print("_" in builtinss)
1321

1422
print(__("hurray!"))

comparision_with_a_callable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def addr(self):
99
@property
1010
def another(self):
1111
return "ddpjd"
12-
12+
1313
def not_a_property(self):
1414
return "dnvpmPkmv"
1515

dangerous_default_arg_test.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
11
"""Module Docstring."""
2+
23
import os
34

45

5-
def some_func(arg1, arg2, arg3=[1, 2, 3], arg4=None, arg5={1,2}):
6+
def some_func(
7+
arg1,
8+
arg2,
9+
arg3=[1, 2, 3],
10+
arg4=None,
11+
arg5={1, 2},
12+
):
613
"""
714
Some docstring to ensure docstring stay at its position
815
"""
916
print("I am a function!")
1017

11-
def some_other_func(arg=[1,2,3]):
18+
def some_other_func(
19+
arg=[1, 2, 3]
20+
):
1221
"""Nested function to ensure indentation doesn't get messed up"""
1322

14-
x = [1,2,3]; y={1, 2, 3}; z={'a': 1, 'b': 2}; t=(1, 2, 3)
15-
def another_nested_function(danger_one=x, danger_two=y, danger_three=z, xyz=None, safe_four=t):
23+
x = [1, 2, 3]
24+
y = {1, 2, 3}
25+
z = {"a": 1, "b": 2}
26+
t = (1, 2, 3)
27+
28+
def another_nested_function(
29+
danger_one=x,
30+
danger_two=y,
31+
danger_three=z,
32+
xyz=None,
33+
safe_four=t,
34+
):
1635
"""Another deeply nested function."""
1736
return
1837

1938
return arg
2039

2140
# Returning
22-
return (arg1, arg2, arg3, arg4)
41+
return (
42+
arg1,
43+
arg2,
44+
arg3,
45+
arg4,
46+
)

e1120.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
def func(a, b):
22
return a, b
33

4+
45
func(a)

len_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
if len(SEQ3) > 1:
2828
print(SEQ3)
2929

30+
3031
def something():
3132
if len(SEQ) > 0:
32-
print("SEQ is greater than 0")
33+
print(
34+
"SEQ is greater than 0"
35+
)

lone_fstring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33

44
def _parse_item(self, line):
5-
f"""Parses an md list item line based on the current section type.
5+
f"""Parses an md list item line based on the current section type.
66
77
Matches expressions of the form `<intent>:<example>. For the
88
syntax of <example> see the Rasa docs on NLU training data:
99
{DOCS_BASE_URL}/nlu/training-data-format/#markdown-format"""
10-
pass
10+
pass

no_self_use.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ def cl(self):
1616
self.p(4321)
1717

1818
def xyz(self, p):
19-
def somefunc(self,p):
20-
def anotherfunc(self, p):
19+
def somefunc(self, p):
20+
def anotherfunc(
21+
self, p
22+
):
2123
print(p)
24+
2225
print(p)
26+
2327
print(p)
2428

2529

prod_test.py

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,60 @@
1-
import os
2-
from sys import (
3-
path as p,
4-
argv
1+
# This should be at the top.
2+
from __future__ import (
3+
print_function,
54
)
5+
66
import math
7-
# This should be at the top.
8-
from __future__ import print_function
7+
import os
98
import random as ran
9+
from sys import argv
10+
from sys import path as p
1011

11-
def foo(this_is_unused, x=[1, 2]):
12-
x.append(ran.randint(1, 100))
12+
13+
def foo(
14+
this_is_unused, x=[1, 2]
15+
):
16+
x.append(
17+
ran.randint(1, 100)
18+
)
1319
return x
1420

1521

1622
def bar():
17-
print("Hey there, Reviewer!")
23+
print(
24+
"Hey there, Reviewer!"
25+
)
1826

1927

2028
def spam():
21-
print("Hope you're paying attention to the tests too!")
29+
print(
30+
"Hope you're paying attention to the tests too!"
31+
)
2232

2333

2434
def give_me_an_issue():
25-
print(f"okay. Let's fix this unnecessary fstring.")
35+
print(
36+
f"okay. Let's fix this unnecessary fstring."
37+
)
2638

2739

2840
def get_hypotenuse(a, b):
2941
"""Fine. Fix this pythagorean issue as well."""
30-
return math.sqrt(a**2 + b**2)
42+
return math.sqrt(
43+
a**2 + b**2
44+
)
3145

3246

3347
__all__ = [
3448
"got_hypotenuse", # Shall be deleted
35-
3649
# Yup. Delete this
37-
38-
"this_too_would_be_deleted", give_me_an_issue, spam,
39-
foo, "future", bar,
40-
get_hypotenuse, "ughhh", # With a comment,
50+
"this_too_would_be_deleted",
51+
give_me_an_issue,
52+
spam,
53+
foo,
54+
"future",
55+
bar,
56+
get_hypotenuse,
57+
"ughhh", # With a comment,
4158
"budd",
4259
"thudd",
43-
44-
4560
]

some_test.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
import os
22

3+
34
class C:
45
def something():
5-
print("Hey there!")
6-
6+
print("Hey there!")
7+
78
def something_else(self):
89
self.something()
9-
x = list([str(r) for r in range(1, 20)])
10+
x = list(
11+
[
12+
str(r)
13+
for r in range(
14+
1, 20
15+
)
16+
]
17+
)

0 commit comments

Comments
 (0)