Skip to content

Fix Typescript 5.8 compilation issue #6983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tensorboard/plugins/graph/tf_graph_info/tf-node-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
}
return tf_graph_util.convertUnitsToHumanReadable(
stats.totalBytes,
tf_graph_util.MEMORY_UNITS
tf_graph_util.MEMORY_UNITS,
);
}
@computed('_nodeStats')
Expand All @@ -519,7 +519,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
}
return tf_graph_util.convertUnitsToHumanReadable(
stats.getTotalMicros(),
tf_graph_util.TIME_UNITS
tf_graph_util.TIME_UNITS,
);
}
@computed('_nodeStats')
Expand Down Expand Up @@ -553,7 +553,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
attrs = attrs.concat(
entry.value.list.s.map(function (key) {
return {key: key, value: 'Too large to show...'};
})
}),
);
} else {
attrs.push({
Expand All @@ -565,7 +565,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
return attrs;
}
@computed('_node')
get _device(): string {
get _device(): string | null {
var node = this._node;
return node ? node.device : null;
}
Expand All @@ -580,7 +580,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
return this._convertEdgeListToEdgeInfoList(
hierarchy.getSuccessors(node.name),
false,
node.isGroupNode
node.isGroupNode,
);
}
@computed('_node', 'graphHierarchy')
Expand All @@ -594,7 +594,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
return this._convertEdgeListToEdgeInfoList(
hierarchy.getPredecessors(node.name),
true,
node.isGroupNode
node.isGroupNode,
);
}
// Only relevant if this is a library function. A list of nodes that
Expand Down Expand Up @@ -635,7 +635,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
node: this._getNode(name, this.graphHierarchy),
edgeLabel: tf_graph_scene_edge.getLabelForBaseEdge(
baseEdge,
this.renderHierarchy
this.renderHierarchy,
),
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
};
Expand All @@ -659,7 +659,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
node: this._getNode(name, this.graphHierarchy),
edgeLabel: tf_graph_scene_edge.getLabelForEdge(
metaedge,
this.renderHierarchy
this.renderHierarchy,
),
renderInfo: this._getRenderInfo(name, this.renderHierarchy),
});
Expand All @@ -673,7 +673,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
};
}
@computed('_node')
get _subnodes(): unknown[] {
get _subnodes(): unknown[] | null {
var node = this._node;
return node && node.metagraph ? node.metagraph.nodes() : null;
}
Expand Down Expand Up @@ -704,7 +704,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
this._openedControlSucc = false;
this.set(
'_groupButtonText',
tf_graph_scene_node.getGroupSettingLabel(this._node)
tf_graph_scene_node.getGroupSettingLabel(this._node),
);
}
_resizeList(selector) {
Expand Down Expand Up @@ -740,7 +740,7 @@ class TfNodeInfo extends LegacyElementMixin(PolymerElement) {
tf_graph_hierarchy.HierarchyEvent.TEMPLATES_UPDATED,
() => {
this._templateIndex = this.graphHierarchy.getTemplateIndex();
}
},
);
}
}
60 changes: 30 additions & 30 deletions tensorboard/plugins/hparams/tf_hparams_parallel_coords_plot/axes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class IntervalBrushFilter implements AxisBrushFilter {
lower: number,
upper: number,
lowerOpen: boolean,
upperOpen: boolean
upperOpen: boolean,
) {
this._lower = lower;
this._upper = upper;
Expand Down Expand Up @@ -121,7 +121,7 @@ export class Axis {
svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties,
schema: Schema,
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager,
colIndex: number
colIndex: number,
) {
this._svgProps = svgProps;
this._schema = schema;
Expand Down Expand Up @@ -152,7 +152,7 @@ export class Axis {
this._brushFilter = this._buildBrushFilter(
this.brushSelection()!,
this.scaleType()!,
this.yScale()
this.yScale(),
);
}
/**
Expand All @@ -165,7 +165,7 @@ export class Axis {
// Pass a copy since createAxisScale may permute the domainValues array.
domainValues.slice(),
this._svgProps.height,
this.scaleType()
this.scaleType(),
);
// TODO(erez): Try to modify the brush selection so that it selects
// the same subset of the axis domain which was selected before
Expand Down Expand Up @@ -216,7 +216,7 @@ export class Axis {
.style('text-anchor', 'middle')
.attr('y', -9)
.text((colIndex) =>
tf_hparams_utils.schemaColumnName(this._schema, colIndex)
tf_hparams_utils.schemaColumnName(this._schema, colIndex),
);
// Add dragging event handlers.
axisParentSel.call(
Expand All @@ -233,7 +233,7 @@ export class Axis {
.on('end', () => {
this._interactionManager.onDragEnd();
axisParent.removeAttribute('is-dragging');
})
}),
);
// Add the brush.
const d3Brush = d3
Expand All @@ -259,7 +259,7 @@ export class Axis {
axisParent.setAttribute('is-brushing', '');
this._interactionManager.onBrushChanged(
this.colIndex(),
d3.event.selection
d3.event.selection,
);
})
.on('brush', () => {
Expand All @@ -268,7 +268,7 @@ export class Axis {
}
this._interactionManager.onBrushChanged(
this.colIndex(),
d3.event.selection
d3.event.selection,
);
})
.on('end', () => {
Expand All @@ -277,7 +277,7 @@ export class Axis {
}
this._interactionManager.onBrushChanged(
this.colIndex(),
d3.event.selection
d3.event.selection,
);
axisParent.removeAttribute('is-brushing');
});
Expand All @@ -301,15 +301,15 @@ export class Axis {
private _buildBrushFilter(
brushSelection: d3.BrushSelection,
scaleType: ScaleType,
yScale: any /* D3 scale */
yScale: any /* D3 scale */,
) {
if (brushSelection === null) {
return new AlwaysPassingBrushFilter();
}
if (scaleType === null) {
console.error(
"Scale type is null, but brushSelection isn't: ",
brushSelection
brushSelection,
);
return new AlwaysPassingBrushFilter();
}
Expand All @@ -321,36 +321,36 @@ export class Axis {
tf_hparams_parallel_coords_plot_utils.continuousScaleInverseImage(
yScale,
brushSelection[0],
brushSelection[1]
brushSelection[1],
);
return new IntervalBrushFilter(
lower,
upper,
/*lowerOpen=*/ false,
/*upperOpen=*/ false
/*upperOpen=*/ false,
);
}
case ScaleType.QUANTILE: {
const [lower, upper] =
tf_hparams_parallel_coords_plot_utils.quantileScaleInverseImage(
yScale,
brushSelection[0],
brushSelection[1]
brushSelection[1],
);
return new IntervalBrushFilter(
lower as number,
upper as number,
/*lowerOpen=*/ false,
/*upperOpen=*/ true
/*upperOpen=*/ true,
);
}
case ScaleType.NON_NUMERIC:
return new SetBrushFilter(
tf_hparams_parallel_coords_plot_utils.pointScaleInverseImage(
yScale,
brushSelection[0],
brushSelection[1]
)
brushSelection[1],
),
);
}
console.error('Unknown scale type: ', scaleType);
Expand All @@ -375,7 +375,7 @@ export class AxesCollection {
public constructor(
svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties,
schema: Schema,
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager
interactionManager: tf_hparams_parallel_coords_plot_interaction_manager.InteractionManager,
) {
this._svgProps = svgProps;
this._schema = schema;
Expand All @@ -396,7 +396,7 @@ export class AxesCollection {
*/
public updateAxes(
options: any,
sessionGroups: tf_hparams_api.SessionGroup[]
sessionGroups: tf_hparams_api.SessionGroup[],
) {
console.assert(!this.isAxisDragging());
// Traverse options.columns, and update each corresponding axis.
Expand All @@ -406,7 +406,7 @@ export class AxesCollection {
let axis = this._axes[colIndex];
axis.setDisplayed(true);
const domainValues = sessionGroups.map((sg) =>
tf_hparams_utils.columnValueByIndex(this._schema, sg, colIndex)
tf_hparams_utils.columnValueByIndex(this._schema, sg, colIndex),
);
axis.setDomainAndScale(domainValues, column.scale);
visibleColIndices.add(colIndex);
Expand All @@ -421,7 +421,7 @@ export class AxesCollection {
// Update the DOM.
this._parentsSel = this._parentsSel.data(
Array.from(visibleColIndices),
/*key=*/ (colIndex) => colIndex
/*key=*/ (colIndex) => colIndex,
);
this._parentsSel.exit().remove();
this._parentsSel = this._parentsSel
Expand All @@ -447,7 +447,7 @@ export class AxesCollection {
return this._stationaryAxesPositions
.domain()
.map((colIndex) =>
mapFunction(this.getAxisPosition(colIndex), this._axes[colIndex])
mapFunction(this.getAxisPosition(colIndex), this._axes[colIndex]),
);
}
/**
Expand All @@ -456,12 +456,12 @@ export class AxesCollection {
* the first time it returns false.
*/
public allVisibleAxesSatisfy(
predicate: (xPosition, axis) => boolean
predicate: (xPosition, axis) => boolean,
): boolean {
return this._stationaryAxesPositions
.domain()
.every((colIndex) =>
predicate(this.getAxisPosition(colIndex), this._axes[colIndex])
predicate(this.getAxisPosition(colIndex), this._axes[colIndex]),
);
}
public getAxisForColIndex(colIndex: number): Axis {
Expand Down Expand Up @@ -490,7 +490,7 @@ export class AxesCollection {
this._draggedAxisPosition = newX;
let visibleColIndices = this._stationaryAxesPositions.domain();
visibleColIndices.sort(
(ci1, ci2) => this.getAxisPosition(ci1) - this.getAxisPosition(ci2)
(ci1, ci2) => this.getAxisPosition(ci1) - this.getAxisPosition(ci2),
);
this._stationaryAxesPositions.domain(visibleColIndices);
this._updateAxesPositionsInDOM(this._parentsSel);
Expand All @@ -500,13 +500,13 @@ export class AxesCollection {
this._draggedAxisPosition = null;
this._draggedAxis = null;
this._updateAxesPositionsInDOM(
this._parentsSel.transition().duration(duration)
this._parentsSel.transition().duration(duration),
);
}
public isAxisDragging(): boolean {
return this._draggedAxis !== null;
}
public getAxisPosition(colIndex: number): number {
public getAxisPosition(colIndex: number): number | null {
return this._draggedAxis !== null &&
this._draggedAxis.colIndex() === colIndex
? this._draggedAxisPosition
Expand All @@ -531,13 +531,13 @@ export class AxesCollection {
.domain()
.filter((colIndex) => visibleColIndices.has(colIndex));
const newDomain = Array.from(
new Set([...visibleDomain, ...Array.from(visibleColIndices)])
new Set([...visibleDomain, ...Array.from(visibleColIndices)]),
);
this._stationaryAxesPositions.domain(newDomain);
}
private _updateAxesPositionsInDOM(selectionOrTransition) {
selectionOrTransition.attr('transform', (colIndex) =>
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex))
tf_hparams_utils.translateStr(this.getAxisPosition(colIndex)),
);
}
private _createAxes(
Expand All @@ -547,7 +547,7 @@ export class AxesCollection {
.range(tf_hparams_utils.numColumns(this._schema))
.map(
(colIndex) =>
new Axis(this._svgProps, this._schema, interactionManager, colIndex)
new Axis(this._svgProps, this._schema, interactionManager, colIndex),
);
}
private _svgProps: tf_hparams_parallel_coords_plot_interaction_manager.SVGProperties;
Expand Down
Loading