Skip to content

Commit

Permalink
chore: Update pre-commit packages (#23173)
Browse files Browse the repository at this point in the history
  • Loading branch information
hughhhh authored Mar 13, 2023
1 parent 9ae81b7 commit b820eb8
Show file tree
Hide file tree
Showing 87 changed files with 112 additions and 218 deletions.
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ repos:
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.941
rev: v1.0.1
hooks:
- id: mypy
args: [--check-untyped-defs]
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,7 +42,7 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion RELEASING/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _get_pull_request_details(self, git_log: GitLog) -> Dict[str, Any]:
title = pr_info.title if pr_info else git_log.message
pr_type = re.match(SUPERSET_PULL_REQUEST_TYPES, title)
if pr_type:
pr_type = pr_type.group().strip('"')
pr_type = pr_type.group().strip('"') # type: ignore

labels = (" | ").join([label.name for label in pr_info.labels])
is_risky = self._is_risk_pull_request(pr_info.labels)
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,11 @@ const FilterControls: FC<FilterControlsProps> = ({

const renderHorizontalContent = () => (
<div
css={(theme: SupersetTheme) =>
css`
padding: 0 ${theme.gridUnit * 4}px;
min-width: 0;
flex: 1;
`
}
css={(theme: SupersetTheme) => css`
padding: 0 ${theme.gridUnit * 4}px;
min-width: 0;
flex: 1;
`}
>
<DropdownContainer
items={items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ export const FiltersDropdownContent = ({
forceRenderOutOfScope,
}: FiltersDropdownContentProps) => (
<div
css={(theme: SupersetTheme) =>
css`
width: ${theme.gridUnit * 56}px;
padding: ${theme.gridUnit}px 0;
`
}
css={(theme: SupersetTheme) => css`
width: ${theme.gridUnit * 56}px;
padding: ${theme.gridUnit}px 0;
`}
>
{overflowedCrossFilters.map(crossFilter =>
rendererCrossFilter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,16 @@ export const NameRow = ({

return (
<Row
css={(theme: SupersetTheme) =>
css`
margin-bottom: ${theme.gridUnit * 3}px;
justify-content: space-between;
`
}
css={(theme: SupersetTheme) => css`
margin-bottom: ${theme.gridUnit * 3}px;
justify-content: space-between;
`}
>
<InternalRow>
<Icons.FilterSmall
css={(theme: SupersetTheme) =>
css`
margin-right: ${theme.gridUnit}px;
`
}
css={(theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit}px;
`}
/>
<TooltipWithTruncation title={elementsTruncated ? filter.name : null}>
<FilterName ref={filterNameRef}>{filter.name}</FilterName>
Expand Down
10 changes: 4 additions & 6 deletions superset-frontend/src/explore/components/ControlHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ const ControlHeader: FC<ControlHeaderProps> = ({
<div className="ControlHeader" data-test={`${name}-header`}>
<div className="pull-left">
<FormLabel
css={(theme: SupersetTheme) =>
css`
margin-bottom: ${theme.gridUnit * 0.5}px;
position: relative;
`
}
css={(theme: SupersetTheme) => css`
margin-bottom: ${theme.gridUnit * 0.5}px;
position: relative;
`}
>
{leftNode && <span>{leftNode}</span>}
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ function VizSupportValidation({ vizType }: { vizType: string }) {
return (
<div
className="text-danger"
css={(theme: SupersetTheme) =>
css`
margin-top: ${theme.gridUnit}px;
`
}
css={(theme: SupersetTheme) => css`
margin-top: ${theme.gridUnit}px;
`}
>
<i className="fa fa-exclamation-circle text-danger" />{' '}
<small>{t('This visualization type is not supported.')}</small>
Expand Down Expand Up @@ -114,15 +112,13 @@ const VizTypeControl = ({
{initialValue && <VizSupportValidation vizType={initialValue} />}
</div>
<div
css={(theme: SupersetTheme) =>
css`
display: flex;
justify-content: flex-end;
margin-top: ${theme.gridUnit * 3}px;
color: ${theme.colors.grayscale.base};
text-decoration: underline;
`
}
css={(theme: SupersetTheme) => css`
display: flex;
justify-content: flex-end;
margin-top: ${theme.gridUnit * 3}px;
color: ${theme.colors.grayscale.base};
text-decoration: underline;
`}
>
<span role="button" tabIndex={0} onClick={openModal}>
{t('View all charts')}
Expand Down
7 changes: 3 additions & 4 deletions superset-frontend/src/views/CRUD/alert/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,9 @@ const timezoneHeaderStyle = (theme: SupersetTheme) => css`
margin: ${theme.gridUnit * 3}px 0;
`;

const inputSpacer = (theme: SupersetTheme) =>
css`
margin-right: ${theme.gridUnit * 3}px;
`;
const inputSpacer = (theme: SupersetTheme) => css`
margin-right: ${theme.gridUnit * 3}px;
`;

type NotificationAddStatus = 'active' | 'disabled' | 'hidden';

Expand Down
7 changes: 4 additions & 3 deletions superset-frontend/src/views/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const StyledHeader = styled.header`
justify-content: center;
/* must be exactly the height of the Antd navbar */
min-height: 50px;
padding: ${theme.gridUnit}px ${theme.gridUnit * 2}px ${
theme.gridUnit
}px ${theme.gridUnit * 4}px;
padding: ${theme.gridUnit}px
${theme.gridUnit * 2}px
${theme.gridUnit}px
${theme.gridUnit * 4}px;
max-width: ${theme.gridUnit * theme.brandIconMaxWidth}px;
img {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ export default function transformProps(chartProps: TableChartProps) {
typeof column === 'object' ? column : { label: column },
);
} else {
/* eslint-disable */
const metricMap = datasource.metrics.reduce((acc, current) => {
const map = acc;
map[current.metric_name] = current;
return map;
}, {} as Record<string, Metric>);
/* eslint-disable */
rows = metrics.map(metric =>
typeof metric === 'object' ? metric : metricMap[metric],
);
Expand Down
1 change: 0 additions & 1 deletion superset/charts/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@


class ExportChartsCommand(ExportModelsCommand):

dao = ChartDAO
not_found = ChartNotFoundError

Expand Down
1 change: 0 additions & 1 deletion superset/charts/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ class ChartDataFilterSchema(Schema):


class ChartDataExtrasSchema(Schema):

relative_start = fields.String(
description="Start time for relative time deltas. "
'Default: `config["DEFAULT_RELATIVE_START_TIME"]`',
Expand Down
1 change: 0 additions & 1 deletion superset/cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def load_test_users_run() -> None:
Syncs permissions for those users/roles
"""
if app.config["TESTING"]:

sm = security_manager

examples_db = database_utils.get_example_database()
Expand Down
1 change: 0 additions & 1 deletion superset/commands/export/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class ExportAssetsCommand(BaseCommand):
"""

def run(self) -> Iterator[Tuple[str, str]]:

metadata = {
"version": EXPORT_VERSION,
"type": "assets",
Expand Down
1 change: 0 additions & 1 deletion superset/commands/export/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@


class ExportModelsCommand(BaseCommand):

dao: Type[BaseDAO] = BaseDAO
not_found: Type[CommandException] = CommandException

Expand Down
2 changes: 0 additions & 2 deletions superset/common/query_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,9 @@ def cache_key(self, **extra: Any) -> str:
and hasattr(self.datasource, "database")
and self.datasource.database.impersonate_user
):

if key := self.datasource.database.db_engine_spec.get_impersonation_key(
getattr(g, "user", None)
):

logger.debug(
"Adding impersonation key to QueryObject cache dict: %s", key
)
Expand Down
1 change: 1 addition & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,7 @@ def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument
# functionality for both the SQL_Lab and Charts.
MUTATE_AFTER_SPLIT = False


# This allows for a user to add header data to any outgoing emails. For example,
# if you need to include metadata in the header or you want to change the specifications
# of the email title, header, or sender.
Expand Down
1 change: 0 additions & 1 deletion superset/dashboards/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def append_charts(position: Dict[str, Any], charts: Set[Slice]) -> Dict[str, Any


class ExportDashboardsCommand(ExportModelsCommand):

dao = DashboardDAO
not_found = DashboardNotFoundError

Expand Down
6 changes: 2 additions & 4 deletions superset/databases/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,12 +1308,10 @@ def available(self) -> Response:
and hasattr(engine_spec, "sqlalchemy_uri_placeholder")
and getattr(engine_spec, "default_driver") in drivers
):
payload[
"parameters"
] = engine_spec.parameters_json_schema() # type: ignore
payload["parameters"] = engine_spec.parameters_json_schema()
payload[
"sqlalchemy_uri_placeholder"
] = engine_spec.sqlalchemy_uri_placeholder # type: ignore
] = engine_spec.sqlalchemy_uri_placeholder

available_databases.append(payload)

Expand Down
1 change: 0 additions & 1 deletion superset/databases/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def parse_extra(extra_payload: str) -> Dict[str, Any]:


class ExportDatabasesCommand(ExportModelsCommand):

dao = DatabaseDAO
not_found = DatabaseNotFoundError

Expand Down
1 change: 0 additions & 1 deletion superset/databases/commands/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def ping(engine: Engine) -> bool:
)
raise DatabaseSecurityUnsafeError(message=str(ex)) from ex
except SupersetTimeoutException as ex:

event_logger.log_with_context(
action=get_log_connection_action(
"test_connection_error", ssh_tunnel, ex
Expand Down
Loading

0 comments on commit b820eb8

Please sign in to comment.