Skip to content

Commit 83233c0

Browse files
committed
Adds comment to ignore lints for change in TS 5.8.
This replicates an LSC from cl/744890759, so we would not override those changes when syncing our repo into the internal code base.
1 parent f95d28d commit 83233c0

File tree

2 files changed

+53
-41
lines changed

2 files changed

+53
-41
lines changed

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

Lines changed: 17 additions & 9 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({
@@ -567,6 +567,10 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
567567
@computed('_node')
568568
get _device(): string {
569569
var node = this._node;
570+
// TODO: go/ts58upgrade - Fix type mismatch caused by improved checking of
571+
// returned conditional operators after upgrade
572+
// TS2322: Type 'null' is not assignable to type 'string'.
573+
// @ts-ignore
570574
return node ? node.device : null;
571575
}
572576
@computed('_node', 'graphHierarchy')
@@ -580,7 +584,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
580584
return this._convertEdgeListToEdgeInfoList(
581585
hierarchy.getSuccessors(node.name),
582586
false,
583-
node.isGroupNode
587+
node.isGroupNode,
584588
);
585589
}
586590
@computed('_node', 'graphHierarchy')
@@ -594,7 +598,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
594598
return this._convertEdgeListToEdgeInfoList(
595599
hierarchy.getPredecessors(node.name),
596600
true,
597-
node.isGroupNode
601+
node.isGroupNode,
598602
);
599603
}
600604
// Only relevant if this is a library function. A list of nodes that
@@ -635,7 +639,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
635639
node: this._getNode(name, this.graphHierarchy),
636640
edgeLabel: tf_graph_scene_edge.getLabelForBaseEdge(
637641
baseEdge,
638-
this.renderHierarchy
642+
this.renderHierarchy,
639643
),
640644
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
641645
};
@@ -659,7 +663,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
659663
node: this._getNode(name, this.graphHierarchy),
660664
edgeLabel: tf_graph_scene_edge.getLabelForEdge(
661665
metaedge,
662-
this.renderHierarchy
666+
this.renderHierarchy,
663667
),
664668
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
665669
});
@@ -675,6 +679,10 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
675679
@computed('_node')
676680
get _subnodes(): unknown[] {
677681
var node = this._node;
682+
// TODO: go/ts58upgrade - Fix type mismatch caused by improved checking of
683+
// returned conditional operators after upgrade
684+
// TS2322: Type 'null' is not assignable to type 'unknown[]'.
685+
// @ts-ignore
678686
return node && node.metagraph ? node.metagraph.nodes() : null;
679687
}
680688
@computed('_predecessors')
@@ -704,7 +712,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
704712
this._openedControlSucc = false;
705713
this.set(
706714
'_groupButtonText',
707-
tf_graph_scene_node.getGroupSettingLabel(this._node)
715+
tf_graph_scene_node.getGroupSettingLabel(this._node),
708716
);
709717
}
710718
_resizeList(selector) {
@@ -732,7 +740,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
732740
}
733741
_isInSeries(node) {
734742
return tf_graph_scene_node.canBeInSeries(node);
735-
}
743+
},
736744
@observe('graphHierarchy')
737745
_graphHierarchyChanged() {
738746
this._templateIndex = this.graphHierarchy.getTemplateIndex();

tensorboard/plugins/hparams/tf_hparams_parallel_coords_plot/axes.ts

Lines changed: 36 additions & 32 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
@@ -181,7 +181,7 @@ export class Axis {
181181
this._brushFilter = this._buildBrushFilter(
182182
this.brushSelection()!,
183183
this.scaleType()!,
184-
this.yScale()
184+
this.yScale(),
185185
);
186186
}
187187
public brushFilter(): AxisBrushFilter {
@@ -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,7 +500,7 @@ 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 {
@@ -509,7 +509,11 @@ export class AxesCollection {
509509
public getAxisPosition(colIndex: number): number {
510510
return this._draggedAxis !== null &&
511511
this._draggedAxis.colIndex() === colIndex
512-
? this._draggedAxisPosition
512+
? // TODO: go/ts58upgrade - Fix type mismatch caused by improved checking
513+
// of returned conditional operators after upgrade
514+
// TS2322: Type 'number | null' is not assignable to type 'number'.
515+
// @ts-ignore
516+
this._draggedAxisPosition
513517
: this._stationaryAxesPositions(colIndex);
514518
}
515519
/**
@@ -531,23 +535,23 @@ export class AxesCollection {
531535
.domain()
532536
.filter((colIndex) => visibleColIndices.has(colIndex));
533537
const newDomain = Array.from(
534-
new Set([...visibleDomain, ...Array.from(visibleColIndices)])
538+
new Set([...visibleDomain, ...Array.from(visibleColIndices)]),
535539
);
536540
this._stationaryAxesPositions.domain(newDomain);
537541
}
538542
private _updateAxesPositionsInDOM(selectionOrTransition) {
539543
selectionOrTransition.attr('transform', (colIndex) =>
540-
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex))
544+
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex)),
541545
);
542546
}
543547
private _createAxes(
544-
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager
548+
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager,
545549
): Axis[] {
546550
return d3
547551
.range(tf_hparams_utils.numColumns(this._schema))
548552
.map(
549553
(colIndex) =>
550-
new Axis(this._svgProps, this._schema, interactionManager, colIndex)
554+
new Axis(this._svgProps, this._schema, interactionManager, colIndex),
551555
);
552556
}
553557
private _svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties;

0 commit comments

Comments
 (0)