Skip to content

Commit f14d483

Browse files
tensorboard-gardenerwchargin
authored andcommitted
black: reformat after dropping Python 2.7 and 3.5
Summary: This is a clean run of Black 19.10b0 after removing `py27` and `py35` from the list of target versions in `pyproject.toml`. See #4406. wchargin-branch: black-20x-no27-no35
1 parent 6d85d7a commit f14d483

26 files changed

+112
-116
lines changed

tensorboard/backend/event_processing/data_provider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def read_scalars(
129129
experiment_id,
130130
plugin_name,
131131
downsample=None,
132-
run_tag_filter=None
132+
run_tag_filter=None,
133133
):
134134
self._validate_context(ctx)
135135
self._validate_experiment_id(experiment_id)
@@ -156,7 +156,7 @@ def read_tensors(
156156
experiment_id,
157157
plugin_name,
158158
downsample=None,
159-
run_tag_filter=None
159+
run_tag_filter=None,
160160
):
161161
self._validate_context(ctx)
162162
self._validate_experiment_id(experiment_id)
@@ -313,7 +313,7 @@ def read_blob_sequences(
313313
experiment_id,
314314
plugin_name,
315315
downsample=None,
316-
run_tag_filter=None
316+
run_tag_filter=None,
317317
):
318318
self._validate_context(ctx)
319319
self._validate_experiment_id(experiment_id)

tensorboard/backend/event_processing/event_accumulator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def _ExpiredPerTag(value):
778778
self.most_recent_wall_time,
779779
event.step,
780780
event.wall_time,
781-
*expired_per_type
781+
*expired_per_type,
782782
)
783783
logger.warning(purge_msg)
784784

tensorboard/backend/event_processing/event_accumulator_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -785,12 +785,12 @@ def testTFSummaryImage(self):
785785
accumulator.Reload()
786786

787787
tags = [
788-
u"1/images/image",
789-
u"2/images/image/0",
790-
u"2/images/image/1",
791-
u"3/images/image/0",
792-
u"3/images/image/1",
793-
u"3/images/image/2",
788+
"1/images/image",
789+
"2/images/image/0",
790+
"2/images/image/1",
791+
"3/images/image/0",
792+
"3/images/image/1",
793+
"3/images/image/2",
794794
]
795795

796796
self.assertTagsEqual(

tensorboard/backend/event_processing/plugin_event_accumulator_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ def testNewStyleScalarSummary(self):
401401

402402
tags = [
403403
graph_metadata.RUN_GRAPH_NAME,
404-
u"accuracy/scalar_summary",
405-
u"xent/scalar_summary",
404+
"accuracy/scalar_summary",
405+
"xent/scalar_summary",
406406
]
407407
self.assertTagsEqual(
408408
accumulator.Tags(),
@@ -445,9 +445,9 @@ def testNewStyleAudioSummary(self):
445445

446446
tags = [
447447
graph_metadata.RUN_GRAPH_NAME,
448-
u"1/one/audio_summary",
449-
u"2/two/audio_summary",
450-
u"3/three/audio_summary",
448+
"1/one/audio_summary",
449+
"2/two/audio_summary",
450+
"3/three/audio_summary",
451451
]
452452
self.assertTagsEqual(
453453
accumulator.Tags(),
@@ -488,9 +488,9 @@ def testNewStyleImageSummary(self):
488488

489489
tags = [
490490
graph_metadata.RUN_GRAPH_NAME,
491-
u"1/images/image_summary",
492-
u"2/images/image_summary",
493-
u"3/images/image_summary",
491+
"1/images/image_summary",
492+
"2/images/image_summary",
493+
"3/images/image_summary",
494494
]
495495
self.assertTagsEqual(
496496
accumulator.Tags(),

tensorboard/backend/http_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def Respond(
232232
"data:",
233233
# used by What-If tool for image sprites.
234234
"blob:",
235-
*_CSP_IMG_DOMAINS_WHITELIST
235+
*_CSP_IMG_DOMAINS_WHITELIST,
236236
),
237237
"object-src 'none'",
238238
"style-src %s"
@@ -243,7 +243,7 @@ def Respond(
243243
"data:",
244244
# inline styles: Polymer templates + d3 uses inline styles.
245245
"'unsafe-inline'",
246-
*_CSP_STYLE_DOMAINS_WHITELIST
246+
*_CSP_STYLE_DOMAINS_WHITELIST,
247247
),
248248
"connect-src %s"
249249
% _create_csp_string("'self'", *_CSP_CONNECT_DOMAINS_WHITELIST),

tensorboard/backend/json_util_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def testSet_turnsIntoSortedList(self):
6969

7070
def testByteString_turnsIntoUnicodeString(self):
7171
self.assertEqual(
72-
json_util.Cleanse(b"\xc2\xa3"), u"\u00a3"
72+
json_util.Cleanse(b"\xc2\xa3"), "\u00a3"
7373
) # is # sterling
7474

7575

tensorboard/compat/tensorflow_stub/io/gfile_s3_test.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,8 @@ def testRead(self):
156156

157157
@mock_s3
158158
def testReadLines(self):
159-
ckpt_lines = (
160-
[u"\n"] + [u"line {}\n".format(i) for i in range(10)] + [u" "]
161-
)
162-
ckpt_content = u"".join(ckpt_lines)
159+
ckpt_lines = ["\n"] + ["line {}\n".format(i) for i in range(10)] + [" "]
160+
ckpt_content = "".join(ckpt_lines)
163161
temp_dir = self._CreateDeepS3Structure(ckpt_content=ckpt_content)
164162
ckpt_path = self._PathJoin(temp_dir, "model.ckpt")
165163
with gfile.GFile(ckpt_path, "r") as f:
@@ -193,7 +191,7 @@ def testReadWithOffset(self):
193191
def testWrite(self):
194192
temp_dir = self._CreateDeepS3Structure()
195193
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
196-
ckpt_content = u"asdfasdfasdffoobarbuzz"
194+
ckpt_content = "asdfasdfasdffoobarbuzz"
197195
with gfile.GFile(ckpt_path, "w") as f:
198196
f.write(ckpt_content)
199197
with gfile.GFile(ckpt_path, "r") as f:
@@ -204,9 +202,9 @@ def testWrite(self):
204202
def testOverwrite(self):
205203
temp_dir = self._CreateDeepS3Structure()
206204
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
207-
ckpt_content = u"asdfasdfasdffoobarbuzz"
205+
ckpt_content = "asdfasdfasdffoobarbuzz"
208206
with gfile.GFile(ckpt_path, "w") as f:
209-
f.write(u"original")
207+
f.write("original")
210208
with gfile.GFile(ckpt_path, "w") as f:
211209
f.write(ckpt_content)
212210
with gfile.GFile(ckpt_path, "r") as f:
@@ -217,7 +215,7 @@ def testOverwrite(self):
217215
def testWriteMultiple(self):
218216
temp_dir = self._CreateDeepS3Structure()
219217
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
220-
ckpt_content = u"asdfasdfasdffoobarbuzz" * 5
218+
ckpt_content = "asdfasdfasdffoobarbuzz" * 5
221219
with gfile.GFile(ckpt_path, "w") as f:
222220
for i in range(0, len(ckpt_content), 3):
223221
f.write(ckpt_content[i : i + 3])
@@ -232,7 +230,7 @@ def testWriteMultiple(self):
232230
def testWriteEmpty(self):
233231
temp_dir = self._CreateDeepS3Structure()
234232
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
235-
ckpt_content = u""
233+
ckpt_content = ""
236234
with gfile.GFile(ckpt_path, "w") as f:
237235
f.write(ckpt_content)
238236
with gfile.GFile(ckpt_path, "r") as f:

tensorboard/compat/tensorflow_stub/io/gfile_test.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ def testReadLines(self):
151151
# the underlying byte offsets (counting \r). Multibyte characters would
152152
# similarly cause desynchronization.
153153
raw_ckpt_lines = (
154-
[u"\r\n"] + [u"line {}\r\n".format(i) for i in range(10)] + [u" "]
154+
["\r\n"] + ["line {}\r\n".format(i) for i in range(10)] + [" "]
155155
)
156156
expected_ckpt_lines = ( # without \r
157-
[u"\n"] + [u"line {}\n".format(i) for i in range(10)] + [u" "]
157+
["\n"] + ["line {}\n".format(i) for i in range(10)] + [" "]
158158
)
159159
# Write out newlines as given (i.e., \r\n) regardless of OS, so as to
160160
# test translation on read.
161161
with io.open(ckpt_path, "w", newline="") as f:
162-
data = u"".join(raw_ckpt_lines)
162+
data = "".join(raw_ckpt_lines)
163163
f.write(data)
164164
with gfile.GFile(ckpt_path, "r") as f:
165165
f.buff_chunk_size = 4 # Test buffering by reducing chunk size
@@ -194,7 +194,7 @@ def testWrite(self):
194194
temp_dir = self.get_temp_dir()
195195
self._CreateDeepDirectoryStructure(temp_dir)
196196
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
197-
ckpt_content = u"asdfasdfasdffoobarbuzz"
197+
ckpt_content = "asdfasdfasdffoobarbuzz"
198198
with gfile.GFile(ckpt_path, "w") as f:
199199
f.write(ckpt_content)
200200
with open(ckpt_path, "r") as f:
@@ -205,9 +205,9 @@ def testOverwrite(self):
205205
temp_dir = self.get_temp_dir()
206206
self._CreateDeepDirectoryStructure(temp_dir)
207207
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
208-
ckpt_content = u"asdfasdfasdffoobarbuzz"
208+
ckpt_content = "asdfasdfasdffoobarbuzz"
209209
with gfile.GFile(ckpt_path, "w") as f:
210-
f.write(u"original")
210+
f.write("original")
211211
with gfile.GFile(ckpt_path, "w") as f:
212212
f.write(ckpt_content)
213213
with open(ckpt_path, "r") as f:
@@ -218,7 +218,7 @@ def testWriteMultiple(self):
218218
temp_dir = self.get_temp_dir()
219219
self._CreateDeepDirectoryStructure(temp_dir)
220220
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
221-
ckpt_content = u"asdfasdfasdffoobarbuzz" * 5
221+
ckpt_content = "asdfasdfasdffoobarbuzz" * 5
222222
with gfile.GFile(ckpt_path, "w") as f:
223223
for i in range(0, len(ckpt_content), 3):
224224
f.write(ckpt_content[i : i + 3])
@@ -233,7 +233,7 @@ def testWriteEmpty(self):
233233
temp_dir = self.get_temp_dir()
234234
self._CreateDeepDirectoryStructure(temp_dir)
235235
ckpt_path = os.path.join(temp_dir, "model2.ckpt")
236-
ckpt_content = u""
236+
ckpt_content = ""
237237
with gfile.GFile(ckpt_path, "w") as f:
238238
f.write(ckpt_content)
239239
with open(ckpt_path, "r") as f:

tensorboard/data/dispatching_provider_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def read_scalars(
7474
experiment_id,
7575
plugin_name,
7676
downsample=None,
77-
run_tag_filter=None
77+
run_tag_filter=None,
7878
):
7979
self._validate_eid(experiment_id)
8080
if run_tag_filter is None:
@@ -113,7 +113,7 @@ def read_tensors(
113113
experiment_id,
114114
plugin_name,
115115
downsample=None,
116-
run_tag_filter=None
116+
run_tag_filter=None,
117117
):
118118
raise NotImplementedError()
119119

@@ -143,7 +143,7 @@ def read_blob_sequences(
143143
experiment_id,
144144
plugin_name,
145145
downsample=None,
146-
run_tag_filter=None
146+
run_tag_filter=None,
147147
):
148148
self._validate_eid(experiment_id)
149149
if run_tag_filter is None:

tensorboard/data/grpc_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def read_scalars(
103103
experiment_id,
104104
plugin_name,
105105
downsample=None,
106-
run_tag_filter=None
106+
run_tag_filter=None,
107107
):
108108
with timing.log_latency("build request"):
109109
req = data_provider_pb2.ReadScalarsRequest()

0 commit comments

Comments
 (0)