Skip to content

Commit cf9ea39

Browse files
committed
Ran formatter with latest version of yapf
1 parent eb3a6fd commit cf9ea39

File tree

8 files changed

+51
-54
lines changed

8 files changed

+51
-54
lines changed

wpiformat/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242

4343
# Create the version.py file
4444
with open(version_file, 'w') as fp:
45-
fp.write("# Autogenerated by setup.py\n__version__ = \"{0}\""
46-
.format(version))
45+
fp.write("# Autogenerated by setup.py\n__version__ = \"{0}\"".format(
46+
version))
4747

4848
if exists(version_file):
4949
with open(version_file, "r") as fp:

wpiformat/test/test_licenseupdate.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ def test_licenseupdate():
2626
test.add_output(
2727
"/* Company Name */"
2828
+ os.linesep +
29-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
30-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
29+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
30+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
3131

3232
# pragma once at top of file preceded by newline
3333
test.add_input("./Test.h", os.linesep + file_appendix)
3434
test.add_output(
3535
"/* Company Name */"
3636
+ os.linesep +
37-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
38-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
37+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
38+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
3939

4040
# File containing up-to-date license preceded by newline
4141
test.add_input(
4242
"./Test.h", os.linesep +
4343
"/* Company Name */"
4444
+ os.linesep +
45-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
46-
format(year) + os.linesep + os.linesep + file_appendix)
45+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
46+
.format(year) + os.linesep + os.linesep + file_appendix)
4747
test.add_output(
4848
"/* Company Name */"
4949
+ os.linesep +
50-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
51-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
50+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
51+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
5252

5353
# File containing up-to-date range license
5454
test.add_input(
@@ -60,43 +60,43 @@ def test_licenseupdate():
6060
test.add_output(
6161
"/* Company Name */"
6262
+ os.linesep +
63-
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */".
64-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
63+
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */"
64+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
6565

6666
# File containing up-to-date license with one year
6767
test.add_input(
6868
"./Test.h",
6969
"/* Company Name */"
7070
+ os.linesep +
71-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
72-
format(year) + os.linesep + os.linesep + file_appendix)
71+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
72+
.format(year) + os.linesep + os.linesep + file_appendix)
7373
test.add_latest_input_as_output(True)
7474

7575
# File with three newlines between license and include guard
7676
test.add_input(
7777
"./Test.h",
7878
"/* Company Name */"
7979
+ os.linesep +
80-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
81-
format(year) + os.linesep + os.linesep + os.linesep + file_appendix)
80+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
81+
.format(year) + os.linesep + os.linesep + os.linesep + file_appendix)
8282
test.add_output(
8383
"/* Company Name */"
8484
+ os.linesep +
85-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
86-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
85+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
86+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
8787

8888
# File with only one newline between license and include guard
8989
test.add_input(
9090
"./Test.h",
9191
"/* Company Name */"
9292
+ os.linesep +
93-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
94-
format(year) + os.linesep + file_appendix)
93+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
94+
.format(year) + os.linesep + file_appendix)
9595
test.add_output(
9696
"/* Company Name */"
9797
+ os.linesep +
98-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
99-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
98+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
99+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
100100

101101
# File with multiline comment spanning multiple lines of license header
102102
test.add_input(
@@ -109,8 +109,8 @@ def test_licenseupdate():
109109
test.add_output(
110110
"/* Company Name */"
111111
+ os.linesep +
112-
"/* Copyright (c) {} Company Name. All Rights Reserved. */".
113-
format(year) + os.linesep + os.linesep + "/*" + os.linesep +
112+
"/* Copyright (c) {} Company Name. All Rights Reserved. */"
113+
.format(year) + os.linesep + os.linesep + "/*" + os.linesep +
114114
" * Autogenerated file! Do not manually edit this file. This version is regenerated"
115115
+ os.linesep +
116116
" * any time the publish task is run, or when this file is deleted." +
@@ -124,13 +124,13 @@ def test_licenseupdate():
124124
"./Test.h",
125125
"/* Company Name */"
126126
+ os.linesep +
127-
"/* Copyright (c) Company Name 2011-{}. All Rights Reserved. */".
128-
format(year) + os.linesep + os.linesep + file_appendix)
127+
"/* Copyright (c) Company Name 2011-{}. All Rights Reserved. */"
128+
.format(year) + os.linesep + os.linesep + file_appendix)
129129
test.add_output(
130130
"/* Company Name */"
131131
+ os.linesep +
132-
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */".
133-
format(year) + os.linesep + os.linesep + file_appendix, True, True)
132+
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */"
133+
.format(year) + os.linesep + os.linesep + file_appendix, True, True)
134134

135135
# Ensure "/*" after "*/" on same line is detected
136136
test.add_input("./Test.h",
@@ -147,13 +147,14 @@ def test_licenseupdate():
147147
test.add_output(
148148
"/* Company Name */"
149149
+ os.linesep +
150-
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */".
151-
format(year) + os.linesep + os.linesep, True, True)
150+
"/* Copyright (c) 2011-{} Company Name. All Rights Reserved. */"
151+
.format(year) + os.linesep + os.linesep, True, True)
152152

153153
# File excluded from license update isn't modified
154154
test.add_input(
155-
"./Excluded.h", "/* Copyright (c) Company Name 2011-{}. */".format(year)
156-
+ os.linesep + os.linesep + file_appendix)
155+
"./Excluded.h",
156+
"/* Copyright (c) Company Name 2011-{}. */".format(year) + os.linesep +
157+
os.linesep + file_appendix)
157158
test.add_output(
158159
"/* Copyright (c) Company Name 2011-{}. */".format(year) + os.linesep +
159160
os.linesep + file_appendix, False, True)

wpiformat/wpiformat/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,8 @@ def main():
313313
# Create list of all changed files
314314
changed_file_list = []
315315

316-
output_list = subprocess.run(
317-
["git", "diff", "--name-only", "master"],
318-
stdout=subprocess.PIPE).stdout.split()
316+
output_list = subprocess.run(["git", "diff", "--name-only", "master"],
317+
stdout=subprocess.PIPE).stdout.split()
319318
for line in output_list:
320319
changed_file_list.append(root_path + os.sep +
321320
line.strip().decode("ascii"))

wpiformat/wpiformat/clangformat.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ def run_batch(self, config_file, names):
3030
try:
3131
returncode = subprocess.run([self.exec_name] + args).returncode
3232
except FileNotFoundError:
33-
print(
34-
"Error: " + self.exec_name +
35-
" not found in PATH. Is it installed?",
36-
file=sys.stderr)
33+
print("Error: " + self.exec_name +
34+
" not found in PATH. Is it installed?",
35+
file=sys.stderr)
3736
return False
3837
return returncode == 0

wpiformat/wpiformat/includeorder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def write_headers(self, includes, ifdef_blocks=[[], [], [], [], []]):
176176

177177
for i in range(5):
178178
if includes[i]:
179-
sublist = sorted(
180-
includes[i], key=lambda include: include.group("name"))
179+
sublist = sorted(includes[i],
180+
key=lambda include: include.group("name"))
181181
str_list = [self.rebuild_include(x, i) for x in sublist]
182182
output_list.extend(self.dedup_list(str_list))
183183
output_list.append("") # Delimits groups of includes

wpiformat/wpiformat/licenseupdate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def __try_regex(self, lines, license_template):
4242
license_rgxstr = "^" + linesep.join(license_template)
4343
license_rgxstr = license_rgxstr.replace("*", "\*").replace(
4444
".", "\.").replace("(", "\(").replace(")", "\)").replace(
45-
"{year}", "(?P<year>[0-9]+)(-[0-9]+)?").replace(
46-
"{padding}", "[ ]*")
45+
"{year}",
46+
"(?P<year>[0-9]+)(-[0-9]+)?").replace("{padding}", "[ ]*")
4747
license_rgx = regex.compile(license_rgxstr, regex.M)
4848

4949
# Compare license

wpiformat/wpiformat/pyformat.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def run_batch(self, config_file, names):
1616
args = [sys.executable, "-m", "yapf", "--style", "google", "-i"]
1717
returncode = subprocess.run(args + names).returncode
1818
except FileNotFoundError:
19-
print(
20-
"Error: yapf not found in PATH. Is it installed?",
21-
file=sys.stderr)
19+
print("Error: yapf not found in PATH. Is it installed?",
20+
file=sys.stderr)
2221
return False
2322
return True

wpiformat/wpiformat/stdlib.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ def __init__(self):
103103
"isgreater", "isgreaterequal", "isless", "islessequal",
104104
"islessgreater", "isunordered"
105105
}))
106-
self.headers.append(
107-
Header("setjmp", {"longjmp", "setjmp"}, ["jmp_buf"]))
106+
self.headers.append(Header("setjmp", {"longjmp", "setjmp"},
107+
["jmp_buf"]))
108108
self.headers.append(
109109
Header("signal", {"signal", "raise"}, ["sig_atomic_t"], False))
110110
self.headers.append(Header("stdarg", {"va_list"}))
@@ -114,12 +114,11 @@ def __init__(self):
114114
# size_t isn't actually defined in stdint, but it fits best here for
115115
# removing the std:: prefix
116116
self.headers.append(
117-
Header(
118-
"stdint",
119-
type_regexes=[
120-
"((u?int((_fast|_least)?(8|16|32|64)|max|ptr)|size)_t)"
121-
],
122-
add_prefix=False))
117+
Header("stdint",
118+
type_regexes=[
119+
"((u?int((_fast|_least)?(8|16|32|64)|max|ptr)|size)_t)"
120+
],
121+
add_prefix=False))
123122

124123
self.headers.append(
125124
Header(

0 commit comments

Comments
 (0)