Skip to content

Commit aaae40f

Browse files
committed
update typescript code for compilation in Typescript 5.8
1 parent 9a6497a commit aaae40f

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

tensorboard/plugins/graph/tf_graph_info/tf-node-info.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
508508
}
509509
return tf_graph_util.convertUnitsToHumanReadable(
510510
stats.totalBytes,
511-
tf_graph_util.MEMORY_UNITS
511+
tf_graph_util.MEMORY_UNITS,
512512
);
513513
}
514514
@computed('_nodeStats')
@@ -519,7 +519,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
519519
}
520520
return tf_graph_util.convertUnitsToHumanReadable(
521521
stats.getTotalMicros(),
522-
tf_graph_util.TIME_UNITS
522+
tf_graph_util.TIME_UNITS,
523523
);
524524
}
525525
@computed('_nodeStats')
@@ -553,7 +553,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
553553
attrs = attrs.concat(
554554
entry.value.list.s.map(function (key) {
555555
return {key: key, value: 'Too large to show...'};
556-
})
556+
}),
557557
);
558558
} else {
559559
attrs.push({
@@ -565,7 +565,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
565565
return attrs;
566566
}
567567
@computed('_node')
568-
get _device(): string {
568+
get _device(): string | null {
569569
var node = this._node;
570570
return node ? node.device : null;
571571
}
@@ -580,7 +580,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
580580
return this._convertEdgeListToEdgeInfoList(
581581
hierarchy.getSuccessors(node.name),
582582
false,
583-
node.isGroupNode
583+
node.isGroupNode,
584584
);
585585
}
586586
@computed('_node', 'graphHierarchy')
@@ -594,7 +594,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
594594
return this._convertEdgeListToEdgeInfoList(
595595
hierarchy.getPredecessors(node.name),
596596
true,
597-
node.isGroupNode
597+
node.isGroupNode,
598598
);
599599
}
600600
// Only relevant if this is a library function. A list of nodes that
@@ -635,7 +635,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
635635
node: this._getNode(name, this.graphHierarchy),
636636
edgeLabel: tf_graph_scene_edge.getLabelForBaseEdge(
637637
baseEdge,
638-
this.renderHierarchy
638+
this.renderHierarchy,
639639
),
640640
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
641641
};
@@ -659,7 +659,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
659659
node: this._getNode(name, this.graphHierarchy),
660660
edgeLabel: tf_graph_scene_edge.getLabelForEdge(
661661
metaedge,
662-
this.renderHierarchy
662+
this.renderHierarchy,
663663
),
664664
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
665665
});
@@ -673,7 +673,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
673673
};
674674
}
675675
@computed('_node')
676-
get _subnodes(): unknown[] {
676+
get _subnodes(): unknown[] | null {
677677
var node = this._node;
678678
return node && node.metagraph ? node.metagraph.nodes() : null;
679679
}
@@ -704,7 +704,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
704704
this._openedControlSucc = false;
705705
this.set(
706706
'_groupButtonText',
707-
tf_graph_scene_node.getGroupSettingLabel(this._node)
707+
tf_graph_scene_node.getGroupSettingLabel(this._node),
708708
);
709709
}
710710
_resizeList(selector) {
@@ -740,7 +740,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
740740
tf_graph_hierarchy.HierarchyEvent.TEMPLATES_UPDATED,
741741
() => {
742742
this._templateIndex = this.graphHierarchy.getTemplateIndex();
743-
}
743+
},
744744
);
745745
}
746746
}

tensorboard/plugins/hparams/tf_hparams_parallel_coords_plot/axes.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class IntervalBrushFilter implements AxisBrushFilter {
5959
lower: number,
6060
upper: number,
6161
lowerOpen: boolean,
62-
upperOpen: boolean
62+
upperOpen: boolean,
6363
) {
6464
this._lower = lower;
6565
this._upper = upper;
@@ -121,7 +121,7 @@ export class Axis {
121121
svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties,
122122
schema: Schema,
123123
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager,
124-
colIndex: number
124+
colIndex: number,
125125
) {
126126
this._svgProps = svgProps;
127127
this._schema = schema;
@@ -152,7 +152,7 @@ export class Axis {
152152
this._brushFilter = this._buildBrushFilter(
153153
this.brushSelection()!,
154154
this.scaleType()!,
155-
this.yScale()
155+
this.yScale(),
156156
);
157157
}
158158
/**
@@ -165,7 +165,7 @@ export class Axis {
165165
// Pass a copy since createAxisScale may permute the domainValues array.
166166
domainValues.slice(),
167167
this._svgProps.height,
168-
this.scaleType()
168+
this.scaleType(),
169169
);
170170
// TODO(erez): Try to modify the brush selection so that it selects
171171
// the same subset of the axis domain which was selected before
@@ -216,7 +216,7 @@ export class Axis {
216216
.style('text-anchor', 'middle')
217217
.attr('y', -9)
218218
.text((colIndex) =>
219-
tf_hparams_utils.schemaColumnName(this._schema, colIndex)
219+
tf_hparams_utils.schemaColumnName(this._schema, colIndex),
220220
);
221221
// Add dragging event handlers.
222222
axisParentSel.call(
@@ -233,7 +233,7 @@ export class Axis {
233233
.on('end', () => {
234234
this._interactionManager.onDragEnd();
235235
axisParent.removeAttribute('is-dragging');
236-
})
236+
}),
237237
);
238238
// Add the brush.
239239
const d3Brush = d3
@@ -259,7 +259,7 @@ export class Axis {
259259
axisParent.setAttribute('is-brushing', '');
260260
this._interactionManager.onBrushChanged(
261261
this.colIndex(),
262-
d3.event.selection
262+
d3.event.selection,
263263
);
264264
})
265265
.on('brush', () => {
@@ -268,7 +268,7 @@ export class Axis {
268268
}
269269
this._interactionManager.onBrushChanged(
270270
this.colIndex(),
271-
d3.event.selection
271+
d3.event.selection,
272272
);
273273
})
274274
.on('end', () => {
@@ -277,7 +277,7 @@ export class Axis {
277277
}
278278
this._interactionManager.onBrushChanged(
279279
this.colIndex(),
280-
d3.event.selection
280+
d3.event.selection,
281281
);
282282
axisParent.removeAttribute('is-brushing');
283283
});
@@ -301,15 +301,15 @@ export class Axis {
301301
private _buildBrushFilter(
302302
brushSelection: d3.BrushSelection,
303303
scaleType: ScaleType,
304-
yScale: any /* D3 scale */
304+
yScale: any /* D3 scale */,
305305
) {
306306
if (brushSelection === null) {
307307
return new AlwaysPassingBrushFilter();
308308
}
309309
if (scaleType === null) {
310310
console.error(
311311
"Scale type is null, but brushSelection isn't: ",
312-
brushSelection
312+
brushSelection,
313313
);
314314
return new AlwaysPassingBrushFilter();
315315
}
@@ -321,36 +321,36 @@ export class Axis {
321321
tf_hparams_parallel_coords_plot_utils.continuousScaleInverseImage(
322322
yScale,
323323
brushSelection[0],
324-
brushSelection[1]
324+
brushSelection[1],
325325
);
326326
return new IntervalBrushFilter(
327327
lower,
328328
upper,
329329
/*lowerOpen=*/ false,
330-
/*upperOpen=*/ false
330+
/*upperOpen=*/ false,
331331
);
332332
}
333333
case ScaleType.QUANTILE: {
334334
const [lower, upper] =
335335
tf_hparams_parallel_coords_plot_utils.quantileScaleInverseImage(
336336
yScale,
337337
brushSelection[0],
338-
brushSelection[1]
338+
brushSelection[1],
339339
);
340340
return new IntervalBrushFilter(
341341
lower as number,
342342
upper as number,
343343
/*lowerOpen=*/ false,
344-
/*upperOpen=*/ true
344+
/*upperOpen=*/ true,
345345
);
346346
}
347347
case ScaleType.NON_NUMERIC:
348348
return new SetBrushFilter(
349349
tf_hparams_parallel_coords_plot_utils.pointScaleInverseImage(
350350
yScale,
351351
brushSelection[0],
352-
brushSelection[1]
353-
)
352+
brushSelection[1],
353+
),
354354
);
355355
}
356356
console.error('Unknown scale type: ', scaleType);
@@ -375,7 +375,7 @@ export class AxesCollection {
375375
public constructor(
376376
svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties,
377377
schema: Schema,
378-
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager
378+
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager,
379379
) {
380380
this._svgProps = svgProps;
381381
this._schema = schema;
@@ -396,7 +396,7 @@ export class AxesCollection {
396396
*/
397397
public updateAxes(
398398
options: any,
399-
sessionGroups: tf_hparams_api.SessionGroup[]
399+
sessionGroups: tf_hparams_api.SessionGroup[],
400400
) {
401401
console.assert(!this.isAxisDragging());
402402
// Traverse options.columns, and update each corresponding axis.
@@ -406,7 +406,7 @@ export class AxesCollection {
406406
let axis = this._axes[colIndex];
407407
axis.setDisplayed(true);
408408
const domainValues = sessionGroups.map((sg) =>
409-
tf_hparams_utils.columnValueByIndex(this._schema, sg, colIndex)
409+
tf_hparams_utils.columnValueByIndex(this._schema, sg, colIndex),
410410
);
411411
axis.setDomainAndScale(domainValues, column.scale);
412412
visibleColIndices.add(colIndex);
@@ -421,7 +421,7 @@ export class AxesCollection {
421421
// Update the DOM.
422422
this._parentsSel = this._parentsSel.data(
423423
Array.from(visibleColIndices),
424-
/*key=*/ (colIndex) => colIndex
424+
/*key=*/ (colIndex) => colIndex,
425425
);
426426
this._parentsSel.exit().remove();
427427
this._parentsSel = this._parentsSel
@@ -447,7 +447,7 @@ export class AxesCollection {
447447
return this._stationaryAxesPositions
448448
.domain()
449449
.map((colIndex) =>
450-
mapFunction(this.getAxisPosition(colIndex), this._axes[colIndex])
450+
mapFunction(this.getAxisPosition(colIndex), this._axes[colIndex]),
451451
);
452452
}
453453
/**
@@ -456,12 +456,12 @@ export class AxesCollection {
456456
* the first time it returns false.
457457
*/
458458
public allVisibleAxesSatisfy(
459-
predicate: (xPosition, axis) => boolean
459+
predicate: (xPosition, axis) => boolean,
460460
): boolean {
461461
return this._stationaryAxesPositions
462462
.domain()
463463
.every((colIndex) =>
464-
predicate(this.getAxisPosition(colIndex), this._axes[colIndex])
464+
predicate(this.getAxisPosition(colIndex), this._axes[colIndex]),
465465
);
466466
}
467467
public getAxisForColIndex(colIndex: number): Axis {
@@ -490,7 +490,7 @@ export class AxesCollection {
490490
this._draggedAxisPosition = newX;
491491
let visibleColIndices = this._stationaryAxesPositions.domain();
492492
visibleColIndices.sort(
493-
(ci1, ci2) => this.getAxisPosition(ci1) - this.getAxisPosition(ci2)
493+
(ci1, ci2) => this.getAxisPosition(ci1) - this.getAxisPosition(ci2),
494494
);
495495
this._stationaryAxesPositions.domain(visibleColIndices);
496496
this._updateAxesPositionsInDOM(this._parentsSel);
@@ -500,13 +500,13 @@ export class AxesCollection {
500500
this._draggedAxisPosition = null;
501501
this._draggedAxis = null;
502502
this._updateAxesPositionsInDOM(
503-
this._parentsSel.transition().duration(duration)
503+
this._parentsSel.transition().duration(duration),
504504
);
505505
}
506506
public isAxisDragging(): boolean {
507507
return this._draggedAxis !== null;
508508
}
509-
public getAxisPosition(colIndex: number): number {
509+
public getAxisPosition(colIndex: number): number | null {
510510
return this._draggedAxis !== null &&
511511
this._draggedAxis.colIndex() === colIndex
512512
? this._draggedAxisPosition
@@ -531,13 +531,13 @@ export class AxesCollection {
531531
.domain()
532532
.filter((colIndex) => visibleColIndices.has(colIndex));
533533
const newDomain = Array.from(
534-
new Set([...visibleDomain, ...Array.from(visibleColIndices)])
534+
new Set([...visibleDomain, ...Array.from(visibleColIndices)]),
535535
);
536536
this._stationaryAxesPositions.domain(newDomain);
537537
}
538538
private _updateAxesPositionsInDOM(selectionOrTransition) {
539539
selectionOrTransition.attr('transform', (colIndex) =>
540-
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex))
540+
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex)),
541541
);
542542
}
543543
private _createAxes(
@@ -547,7 +547,7 @@ export class AxesCollection {
547547
.range(tf_hparams_utils.numColumns(this._schema))
548548
.map(
549549
(colIndex) =>
550-
new Axis(this._svgProps, this._schema, interactionManager, colIndex)
550+
new Axis(this._svgProps, this._schema, interactionManager, colIndex),
551551
);
552552
}
553553
private _svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties;

0 commit comments

Comments
 (0)