Skip to content

Commit f896d86

Browse files
tensorboard-gardenerwchargin
authored andcommitted
black: reformat after upgrading to Black v20.8b1
Summary: This is a clean run of Black v20.8b1. See #4406. wchargin-branch: black-20x-no27-no35
1 parent f14d483 commit f896d86

File tree

85 files changed

+860
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+860
-261
lines changed

tensorboard/backend/application.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,10 @@ def _serve_plugin_entry(self, request):
390390
"""
391391
).format(name=name, script_content=script_content)
392392
return http_util.Respond(
393-
request, html, "text/html", csp_scripts_sha256s=[script_sha],
393+
request,
394+
html,
395+
"text/html",
396+
csp_scripts_sha256s=[script_sha],
394397
)
395398

396399
@wrappers.Request.application

tensorboard/backend/application_test.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ def app(request):
190190
server = werkzeug_test.Client(app, wrappers.BaseResponse)
191191
response = server.get("/")
192192
self.assertEqual(
193-
response.get_data(), b"Unauthenticated: who are you?",
193+
response.get_data(),
194+
b"Unauthenticated: who are you?",
194195
)
195196
self.assertEqual(response.status_code, 401)
196197
self.assertStartsWith(
@@ -224,11 +225,15 @@ def setUp(self):
224225
),
225226
FakePlugin(
226227
plugin_name="baz",
227-
routes_mapping={"/esmodule": lambda req: None,},
228+
routes_mapping={
229+
"/esmodule": lambda req: None,
230+
},
228231
es_module_path_value="/esmodule",
229232
),
230233
FakePlugin(
231-
plugin_name="qux", is_active_value=False, is_ng_component=True,
234+
plugin_name="qux",
235+
is_active_value=False,
236+
is_ng_component=True,
232237
),
233238
]
234239
app = application.TensorBoardWSGI(plugins)
@@ -289,7 +294,9 @@ def testPluginsListing(self):
289294
},
290295
"qux": {
291296
"enabled": False,
292-
"loading_mechanism": {"type": "NG_COMPONENT",},
297+
"loading_mechanism": {
298+
"type": "NG_COMPONENT",
299+
},
293300
"tab_name": "qux",
294301
"remove_dom": False,
295302
"disable_reload": False,
@@ -305,7 +312,9 @@ def testPluginsListingWithDataProviderListActivePlugins(self):
305312
plugins = [
306313
FakePlugin(plugin_name="foo", is_active_value=False),
307314
FakePlugin(
308-
plugin_name="bar", is_active_value=False, data_plugin_names=(),
315+
plugin_name="bar",
316+
is_active_value=False,
317+
data_plugin_names=(),
309318
),
310319
FakePlugin(plugin_name="baz", is_active_value=False),
311320
FakePlugin(
@@ -495,7 +504,9 @@ def setUp(self):
495504
),
496505
FakePlugin(
497506
plugin_name="baz",
498-
routes_mapping={"/esmodule": lambda req: None,},
507+
routes_mapping={
508+
"/esmodule": lambda req: None,
509+
},
499510
es_module_path_value="/esmodule",
500511
),
501512
]
@@ -695,7 +706,9 @@ def setUp(self):
695706
),
696707
FakePluginLoader(
697708
plugin_name="whoami",
698-
routes_mapping={"/eid": self._eid_handler,},
709+
routes_mapping={
710+
"/eid": self._eid_handler,
711+
},
699712
),
700713
],
701714
data_provider=FakeDataProvider(),
@@ -761,7 +774,10 @@ def _wildcard_special_handler(self, request):
761774
def testPluginsAdded(self):
762775
# The routes are prefixed with /data/plugin/[plugin name].
763776
expected_routes = frozenset(
764-
("/data/plugin/foo/foo_route", "/data/plugin/bar/bar_route",)
777+
(
778+
"/data/plugin/foo/foo_route",
779+
"/data/plugin/bar/bar_route",
780+
)
765781
)
766782
self.assertLessEqual(expected_routes, frozenset(self.app.exact_routes))
767783

tensorboard/backend/event_processing/data_provider.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,20 @@ def _convert_blob_sequence_event(experiment_id, plugin_name, run, tag, event):
445445
values = tuple(
446446
provider.BlobReference(
447447
_encode_blob_key(
448-
experiment_id, plugin_name, run, tag, event.step, idx,
448+
experiment_id,
449+
plugin_name,
450+
run,
451+
tag,
452+
event.step,
453+
idx,
449454
)
450455
)
451456
for idx in range(num_blobs)
452457
)
453458
return provider.BlobSequenceDatum(
454-
wall_time=event.wall_time, step=event.step, values=values,
459+
wall_time=event.wall_time,
460+
step=event.step,
461+
values=values,
455462
)
456463

457464

tensorboard/backend/event_processing/data_provider_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ def test_read_tensors(self):
377377
)
378378

379379
run_tag_filter = base_provider.RunTagFilter(
380-
runs=["lebesgue"], tags=["uniform", "bimodal"],
380+
runs=["lebesgue"],
381+
tags=["uniform", "bimodal"],
381382
)
382383
result = provider.read_tensors(
383384
self.ctx,

tensorboard/backend/event_processing/event_accumulator_test.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,11 @@ def testTFSummaryImage(self):
795795

796796
self.assertTagsEqual(
797797
accumulator.Tags(),
798-
{ea.IMAGES: tags, ea.GRAPH: True, ea.META_GRAPH: False,},
798+
{
799+
ea.IMAGES: tags,
800+
ea.GRAPH: True,
801+
ea.META_GRAPH: False,
802+
},
799803
)
800804

801805
def testTFSummaryTensor(self):
@@ -819,7 +823,10 @@ def testTFSummaryTensor(self):
819823
accumulator.Reload()
820824

821825
self.assertTagsEqual(
822-
accumulator.Tags(), {ea.TENSORS: ["scalar", "vector", "string"],}
826+
accumulator.Tags(),
827+
{
828+
ea.TENSORS: ["scalar", "vector", "string"],
829+
},
823830
)
824831

825832
scalar_proto = accumulator.Tensors("scalar")[0].tensor_proto
@@ -949,7 +956,13 @@ def testGraphFromMetaGraphBecomesAvailable(self):
949956
# Verify that we can load those events properly
950957
acc = ea.EventAccumulator(directory)
951958
acc.Reload()
952-
self.assertTagsEqual(acc.Tags(), {ea.GRAPH: True, ea.META_GRAPH: True,})
959+
self.assertTagsEqual(
960+
acc.Tags(),
961+
{
962+
ea.GRAPH: True,
963+
ea.META_GRAPH: True,
964+
},
965+
)
953966

954967
expected_graph_def = graph_pb2.GraphDef.FromString(
955968
graph.as_graph_def(add_shapes=True).SerializeToString()

tensorboard/backend/event_processing/event_file_loader_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ def assertEventWallTimes(self, load_result, event_wall_times_in_order):
139139
transposed = list(zip(*load_result))
140140
wall_times, events = transposed if transposed else ([], [])
141141
self.assertEqual(
142-
list(wall_times), event_wall_times_in_order,
142+
list(wall_times),
143+
event_wall_times_in_order,
143144
)
144145
self.assertEqual(
145-
[event.wall_time for event in events], event_wall_times_in_order,
146+
[event.wall_time for event in events],
147+
event_wall_times_in_order,
146148
)
147149

148150

tensorboard/backend/event_processing/event_multiplexer_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def __init__(self, path):
5252
self._path = path
5353
self.reload_called = False
5454
self._plugin_to_tag_to_content = {
55-
"baz_plugin": {"foo": "foo_content", "bar": "bar_content",}
55+
"baz_plugin": {
56+
"foo": "foo_content",
57+
"bar": "bar_content",
58+
}
5659
}
5760

5861
def Tags(self):

tensorboard/backend/event_processing/io_wrapper_test.py

Lines changed: 129 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,72 @@ def testListRecursivelyViaGlobbing(self):
123123
expected = [
124124
[
125125
"",
126-
["foo", "bar", "a.tfevents.1", "model.ckpt", "quuz", "waldo",],
126+
[
127+
"foo",
128+
"bar",
129+
"a.tfevents.1",
130+
"model.ckpt",
131+
"quuz",
132+
"waldo",
133+
],
134+
],
135+
[
136+
"bar",
137+
[
138+
"b.tfevents.1",
139+
"red_herring.txt",
140+
"baz",
141+
"quux",
142+
],
143+
],
144+
[
145+
"bar/baz",
146+
[
147+
"c.tfevents.1",
148+
"d.tfevents.1",
149+
],
127150
],
128-
["bar", ["b.tfevents.1", "red_herring.txt", "baz", "quux",]],
129-
["bar/baz", ["c.tfevents.1", "d.tfevents.1",]],
130151
[
131152
"bar/quux",
132-
["some_flume_output.txt", "some_more_flume_output.txt",],
153+
[
154+
"some_flume_output.txt",
155+
"some_more_flume_output.txt",
156+
],
157+
],
158+
[
159+
"quuz",
160+
[
161+
"e.tfevents.1",
162+
"garply",
163+
],
164+
],
165+
[
166+
"quuz/garply",
167+
[
168+
"f.tfevents.1",
169+
"corge",
170+
"grault",
171+
],
133172
],
134-
["quuz", ["e.tfevents.1", "garply",]],
135-
["quuz/garply", ["f.tfevents.1", "corge", "grault",]],
136173
["quuz/garply/corge", ["g.tfevents.1"]],
137-
["quuz/garply/grault", ["h.tfevents.1",]],
138-
["waldo", ["fred",]],
139-
["waldo/fred", ["i.tfevents.1",]],
174+
[
175+
"quuz/garply/grault",
176+
[
177+
"h.tfevents.1",
178+
],
179+
],
180+
[
181+
"waldo",
182+
[
183+
"fred",
184+
],
185+
],
186+
[
187+
"waldo/fred",
188+
[
189+
"i.tfevents.1",
190+
],
191+
],
140192
]
141193
for pair in expected:
142194
# If this is not the top-level directory, prepend the high-level
@@ -169,8 +221,19 @@ def skipTestListRecursivelyViaGlobbingForPathWithGlobCharacters(self):
169221
open(os.path.join(temp_dir, file_name), "w").close()
170222

171223
expected = [
172-
["", ["a.tfevents.1", "subdirectory",]],
173-
["subdirectory", ["b.tfevents.1",]],
224+
[
225+
"",
226+
[
227+
"a.tfevents.1",
228+
"subdirectory",
229+
],
230+
],
231+
[
232+
"subdirectory",
233+
[
234+
"b.tfevents.1",
235+
],
236+
],
174237
# The contents of the bar subdirectory should be excluded from
175238
# this listing because the * character should have been escaped.
176239
]
@@ -188,20 +251,66 @@ def testListRecursivelyViaWalking(self):
188251
temp_dir = tempfile.mkdtemp(prefix=self.get_temp_dir())
189252
self._CreateDeepDirectoryStructure(temp_dir)
190253
expected = [
191-
["", ["a.tfevents.1", "model.ckpt",]],
254+
[
255+
"",
256+
[
257+
"a.tfevents.1",
258+
"model.ckpt",
259+
],
260+
],
192261
["foo", []],
193-
["bar", ["b.tfevents.1", "red_herring.txt",]],
194-
["bar/baz", ["c.tfevents.1", "d.tfevents.1",]],
262+
[
263+
"bar",
264+
[
265+
"b.tfevents.1",
266+
"red_herring.txt",
267+
],
268+
],
269+
[
270+
"bar/baz",
271+
[
272+
"c.tfevents.1",
273+
"d.tfevents.1",
274+
],
275+
],
195276
[
196277
"bar/quux",
197-
["some_flume_output.txt", "some_more_flume_output.txt",],
278+
[
279+
"some_flume_output.txt",
280+
"some_more_flume_output.txt",
281+
],
282+
],
283+
[
284+
"quuz",
285+
[
286+
"e.tfevents.1",
287+
],
288+
],
289+
[
290+
"quuz/garply",
291+
[
292+
"f.tfevents.1",
293+
],
294+
],
295+
[
296+
"quuz/garply/corge",
297+
[
298+
"g.tfevents.1",
299+
],
300+
],
301+
[
302+
"quuz/garply/grault",
303+
[
304+
"h.tfevents.1",
305+
],
198306
],
199-
["quuz", ["e.tfevents.1",]],
200-
["quuz/garply", ["f.tfevents.1",]],
201-
["quuz/garply/corge", ["g.tfevents.1",]],
202-
["quuz/garply/grault", ["h.tfevents.1",]],
203307
["waldo", []],
204-
["waldo/fred", ["i.tfevents.1",]],
308+
[
309+
"waldo/fred",
310+
[
311+
"i.tfevents.1",
312+
],
313+
],
205314
]
206315
for pair in expected:
207316
# If this is not the top-level directory, prepend the high-level

0 commit comments

Comments
 (0)