Skip to content
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

chore: Update pre-commit packages #23173

Merged
merged 14 commits into from
Mar 13, 2023
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.941
rev: v1.0.1
hooks:
- id: mypy
additional_dependencies: [types-all]
- repo: https://github.com/peterdemin/pip-compile-multi
rev: v2.4.1
rev: v2.6.2
hooks:
- id: pip-compile-multi-verify
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: check-added-large-files
Expand All @@ -41,12 +41,12 @@ repos:
- id: trailing-whitespace
args: ["--markdown-linebreak-ext=md"]
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.4.1 # Use the sha or tag you want to point at
rev: v3.0.0-alpha.4 # Use the sha or tag you want to point at
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's a bit too early to go to v3.0.0 since it's alpha still?

hooks:
- id: prettier
args: ["--ignore-path=./superset-frontend/.prettierignore"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ export function ColumnOption({
<Tooltip id="metric-name-tooltip" title={tooltipText}>
<span
className="option-label column-option-label"
css={(theme: SupersetTheme) =>
css`
margin-right: ${theme.gridUnit}px;
`
}
css={(theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit}px;
`}
ref={labelRef}
>
{getColumnLabelText(column)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,9 @@ export function MetricOption({
const label = (
<span
className="option-label metric-option-label"
css={(theme: SupersetTheme) =>
css`
margin-right: ${theme.gridUnit}px;
`
}
css={(theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit}px;
`}
ref={labelRef}
>
{link}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ import { PostProcessingContribution } from '@superset-ui/core';
import { PostProcessingFactory } from './types';

/* eslint-disable @typescript-eslint/no-unused-vars */
export const contributionOperator: PostProcessingFactory<PostProcessingContribution> =
(formData, queryObject) => {
if (formData.contributionMode) {
return {
operation: 'contribution',
options: {
orientation: formData.contributionMode,
},
};
}
return undefined;
};
export const contributionOperator: PostProcessingFactory<
PostProcessingContribution
> = (formData, queryObject) => {
if (formData.contributionMode) {
return {
operation: 'contribution',
options: {
orientation: formData.contributionMode,
},
};
}
return undefined;
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@ import { ComparisonType, PostProcessingCompare } from '@superset-ui/core';
import { getMetricOffsetsMap, isTimeComparison } from './utils';
import { PostProcessingFactory } from './types';

export const timeCompareOperator: PostProcessingFactory<PostProcessingCompare> =
(formData, queryObject) => {
const comparisonType = formData.comparison_type;
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
export const timeCompareOperator: PostProcessingFactory<
PostProcessingCompare
> = (formData, queryObject) => {
const comparisonType = formData.comparison_type;
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);

if (
isTimeComparison(formData, queryObject) &&
comparisonType !== ComparisonType.Values
) {
return {
operation: 'compare',
options: {
source_columns: Array.from(metricOffsetMap.values()),
compare_columns: Array.from(metricOffsetMap.keys()),
compare_type: comparisonType,
drop_original_columns: true,
},
};
}
if (
isTimeComparison(formData, queryObject) &&
comparisonType !== ComparisonType.Values
) {
return {
operation: 'compare',
options: {
source_columns: Array.from(metricOffsetMap.values()),
compare_columns: Array.from(metricOffsetMap.keys()),
compare_type: comparisonType,
drop_original_columns: true,
},
};
}

return undefined;
};
return undefined;
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,32 @@ import {
import { getMetricOffsetsMap, isTimeComparison } from './utils';
import { PostProcessingFactory } from './types';

export const timeComparePivotOperator: PostProcessingFactory<PostProcessingPivot> =
(formData, queryObject) => {
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
const xAxisLabel = getXAxisLabel(formData);
const columns = queryObject.series_columns || queryObject.columns;
export const timeComparePivotOperator: PostProcessingFactory<
PostProcessingPivot
> = (formData, queryObject) => {
const metricOffsetMap = getMetricOffsetsMap(formData, queryObject);
const xAxisLabel = getXAxisLabel(formData);
const columns = queryObject.series_columns || queryObject.columns;

if (isTimeComparison(formData, queryObject) && xAxisLabel) {
const aggregates = Object.fromEntries(
[...metricOffsetMap.values(), ...metricOffsetMap.keys()].map(metric => [
metric,
// use the 'mean' aggregates to avoid drop NaN
{ operator: 'mean' as NumpyFunction },
]),
);
if (isTimeComparison(formData, queryObject) && xAxisLabel) {
const aggregates = Object.fromEntries(
[...metricOffsetMap.values(), ...metricOffsetMap.keys()].map(metric => [
metric,
// use the 'mean' aggregates to avoid drop NaN
{ operator: 'mean' as NumpyFunction },
]),
);

return {
operation: 'pivot',
options: {
index: [xAxisLabel],
columns: ensureIsArray(columns).map(getColumnLabel),
drop_missing_columns: !formData?.show_empty_columns,
aggregates,
},
};
}
return {
operation: 'pivot',
options: {
index: [xAxisLabel],
columns: ensureIsArray(columns).map(getColumnLabel),
drop_missing_columns: !formData?.show_empty_columns,
aggregates,
},
};
}

return undefined;
};
return undefined;
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ export const extractForecastSeriesContext = (
export const extractForecastSeriesContexts = (
seriesNames: string[],
): { [key: string]: ForecastSeriesEnum[] } =>
seriesNames.reduce((agg, name) => {
const context = extractForecastSeriesContext(name);
const currentContexts = agg[context.name] || [];
currentContexts.push(context.type);
return { ...agg, [context.name]: currentContexts };
}, {} as { [key: string]: ForecastSeriesEnum[] });
seriesNames.reduce(
(agg, name) => {
const context = extractForecastSeriesContext(name);
const currentContexts = agg[context.name] || [];
currentContexts.push(context.type);
return { ...agg, [context.name]: currentContexts };
},
{} as { [key: string]: ForecastSeriesEnum[] },
);

export const extractForecastValuesFromTooltipParams = (
params: any[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ const processColumns = memoizeOne(function processColumns(
typeof percentMetrics,
typeof columns,
];
},
isEqualColumns);
}, isEqualColumns);

/**
* Automatically set page size based on number of cells.
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/assets/staticPages/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
-->

<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/assets/staticPages/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
-->

<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
31 changes: 16 additions & 15 deletions superset-frontend/src/components/DeprecatedSelect/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,22 @@ export type ThemeConfig = {

export type PartialThemeConfig = RecursivePartial<ThemeConfig>;

export const defaultTheme: (theme: SupersetTheme) => PartialThemeConfig =
theme => ({
borderRadius: theme.borderRadius,
zIndex: 11,
colors: colors(theme),
spacing: {
baseUnit: 3,
menuGutter: 0,
controlHeight: 34,
lineHeight: 19,
fontSize: 14,
minWidth: '6.5em',
},
weights: theme.typography.weights,
});
export const defaultTheme: (
theme: SupersetTheme,
) => PartialThemeConfig = theme => ({
borderRadius: theme.borderRadius,
zIndex: 11,
colors: colors(theme),
spacing: {
baseUnit: 3,
menuGutter: 0,
controlHeight: 34,
lineHeight: 19,
fontSize: 14,
minWidth: '6.5em',
},
weights: theme.typography.weights,
});

// let styles accept serialized CSS, too
type CSSStyles = CSSProperties | SerializedStyles;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ const StyledMenu = styled(Menu)`
font-size: ${theme.typography.sizes.s}px;
color: ${theme.colors.grayscale.base};
padding: ${theme.gridUnit}px ${theme.gridUnit * 3}px ${
theme.gridUnit
}px ${theme.gridUnit * 3}px;
theme.gridUnit
}px ${theme.gridUnit * 3}px;
}
.ant-dropdown-menu-item-selected {
color: ${theme.colors.grayscale.dark1};
Expand Down
24 changes: 9 additions & 15 deletions superset-frontend/src/components/EmptyState/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,9 @@ export const EmptyStateBig = ({
<EmptyStateContainer className={className}>
{image && <ImageContainer image={image} size={EmptyStateSize.Big} />}
<TextContainer
css={(theme: SupersetTheme) =>
css`
max-width: ${theme.gridUnit * 150}px;
`
}
css={(theme: SupersetTheme) => css`
max-width: ${theme.gridUnit * 150}px;
`}
>
<BigTitle>{title}</BigTitle>
{description && <BigDescription>{description}</BigDescription>}
Expand All @@ -189,11 +187,9 @@ export const EmptyStateMedium = ({
<EmptyStateContainer>
{image && <ImageContainer image={image} size={EmptyStateSize.Medium} />}
<TextContainer
css={(theme: SupersetTheme) =>
css`
max-width: ${theme.gridUnit * 100}px;
`
}
css={(theme: SupersetTheme) => css`
max-width: ${theme.gridUnit * 100}px;
`}
>
<Title>{title}</Title>
{description && <Description>{description}</Description>}
Expand All @@ -218,11 +214,9 @@ export const EmptyStateSmall = ({
<EmptyStateContainer>
{image && <ImageContainer image={image} size={EmptyStateSize.Small} />}
<TextContainer
css={(theme: SupersetTheme) =>
css`
max-width: ${theme.gridUnit * 75}px;
`
}
css={(theme: SupersetTheme) => css`
max-width: ${theme.gridUnit * 75}px;
`}
>
<Title>{title}</Title>
{description && <SmallDescription>{description}</SmallDescription>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ import { NULL_DISPLAY } from 'src/constants';
function NullCell() {
return (
<span
css={(theme: SupersetTheme) =>
css`
color: ${theme.colors.grayscale.light1};
`
}
css={(theme: SupersetTheme) => css`
color: ${theme.colors.grayscale.light1};
`}
>
{NULL_DISPLAY}
</span>
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/components/TableSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ const TableSelector: FunctionComponent<TableSelectorProps> = ({
);
};

export const TableSelectorMultiple: FunctionComponent<TableSelectorProps> =
props => <TableSelector tableSelectMode="multiple" {...props} />;
export const TableSelectorMultiple: FunctionComponent<
TableSelectorProps
> = props => <TableSelector tableSelectMode="multiple" {...props} />;

export default TableSelector;
Loading