From 23707e48dde5173ad664be8f38dd19f4f5e11f9f Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Wed, 25 Jan 2023 10:46:11 -0700 Subject: [PATCH 1/3] chore: removing unnecessary double spaces, a.k.a. "shotgun holes" --- .../legacy-plugin-chart-partition/src/controlPanel.tsx | 2 +- .../legacy-preset-chart-nvd3/src/NVD3Controls.tsx | 2 +- .../plugin-chart-echarts/src/Timeseries/index.ts | 4 ++-- .../components/DeprecatedSelect/OnPasteSelect.test.jsx | 2 +- .../src/components/Table/Table.stories.tsx | 10 +++++----- .../FiltersConfigForm/FilterScope/utils.ts | 2 +- .../src/explore/controlPanels/sections.tsx | 2 +- .../DatabaseConnectionForm/CommonParameters.tsx | 2 +- ...a56f1c4c6_migrate_num_period_compare_and_period_.py | 2 +- superset/utils/core.py | 2 +- superset/views/database/mixins.py | 2 +- tests/integration_tests/celery_tests.py | 2 +- tests/integration_tests/db_engine_specs/hive_tests.py | 2 +- .../db_engine_specs/postgres_tests.py | 2 +- .../integration_tests/db_engine_specs/presto_tests.py | 2 +- tests/integration_tests/utils/csv_tests.py | 2 +- tests/unit_tests/utils/date_parser_tests.py | 4 ++-- 17 files changed, 23 insertions(+), 23 deletions(-) diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx index d983dca24af82..f910a8bbfd4a5 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx @@ -317,7 +317,7 @@ const config: ControlPanelConfig = { description: t( 'Overlay one or more timeseries from a ' + 'relative time period. Expects relative time deltas ' + - 'in natural language (example: 24 hours, 7 days, ' + + 'in natural language (example: 24 hours, 7 days, ' + '52 weeks, 365 days). Free text is supported.', ), }, diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx index b45d6de31a361..a466b337425a0 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Controls.tsx @@ -467,7 +467,7 @@ export const timeSeriesSection: ControlPanelSectionConfig[] = [ description: t( 'Overlay one or more timeseries from a ' + 'relative time period. Expects relative time deltas ' + - 'in natural language (example: 24 hours, 7 days, ' + + 'in natural language (example: 24 hours, 7 days, ' + '52 weeks, 365 days). Free text is supported.', ), }, diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts index 4065a170d087a..c8210cd981911 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/index.ts @@ -49,10 +49,10 @@ export default class EchartsTimeseriesChartPlugin extends ChartPlugin< credits: ['https://echarts.apache.org'], description: hasGenericChartAxes ? t( - 'Swiss army knife for visualizing data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', + 'Swiss army knife for visualizing data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', ) : t( - 'Swiss army knife for visualizing time series data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', + 'Swiss army knife for visualizing time series data. Choose between step, line, scatter, and bar charts. This viz type has many customization options as well.', ), exampleGallery: [{ url: example }], supportedAnnotationTypes: [ diff --git a/superset-frontend/src/components/DeprecatedSelect/OnPasteSelect.test.jsx b/superset-frontend/src/components/DeprecatedSelect/OnPasteSelect.test.jsx index 3aa1641b28a74..95d01cc28b9a6 100644 --- a/superset-frontend/src/components/DeprecatedSelect/OnPasteSelect.test.jsx +++ b/superset-frontend/src/components/DeprecatedSelect/OnPasteSelect.test.jsx @@ -45,7 +45,7 @@ const defaultProps = { const defaultEvt = { preventDefault: sinon.spy(), clipboardData: { - getData: sinon.spy(() => ' United States, China , India, Canada, '), + getData: sinon.spy(() => ' United States, China, India, Canada, '), }, }; diff --git a/superset-frontend/src/components/Table/Table.stories.tsx b/superset-frontend/src/components/Table/Table.stories.tsx index 75482e2e37f38..7ae3525562d18 100644 --- a/superset-frontend/src/components/Table/Table.stories.tsx +++ b/superset-frontend/src/components/Table/Table.stories.tsx @@ -310,16 +310,16 @@ export const Basic: ComponentStory = args => ; function handlers(record: object, rowIndex: number) { return { onClick: action( - `row onClick, row: ${rowIndex}, record: ${JSON.stringify(record)}`, + `row onClick, row: ${rowIndex}, record: ${JSON.stringify(record)}`, ), // click row onDoubleClick: action( - `row onDoubleClick, row: ${rowIndex}, record: ${JSON.stringify(record)}`, + `row onDoubleClick, row: ${rowIndex}, record: ${JSON.stringify(record)}`, ), // double click row onContextMenu: action( - `row onContextMenu, row: ${rowIndex}, record: ${JSON.stringify(record)}`, + `row onContextMenu, row: ${rowIndex}, record: ${JSON.stringify(record)}`, ), // right button click row - onMouseEnter: action(`Mouse Enter, row: ${rowIndex}`), // mouse enter row - onMouseLeave: action(`Mouse Leave, row: ${rowIndex}`), // mouse leave row + onMouseEnter: action(`Mouse Enter, row: ${rowIndex}`), // mouse enter row + onMouseLeave: action(`Mouse Leave, row: ${rowIndex}`), // mouse leave row }; } diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.ts b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.ts index 150f2b295f82d..347da2d2ca687 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/utils.ts @@ -85,7 +85,7 @@ export const buildTree = ( ); } else { logging.warn( - `Unable to find item with id: ${child} in the dashboard layout. This may indicate you have invalid references in your dashboard and the references to id: ${child} should be removed.`, + `Unable to find item with id: ${child} in the dashboard layout. This may indicate you have invalid references in your dashboard and the references to id: ${child} should be removed.`, ); } }); diff --git a/superset-frontend/src/explore/controlPanels/sections.tsx b/superset-frontend/src/explore/controlPanels/sections.tsx index fe384c6f39ce4..51b6b9c2f2aa8 100644 --- a/superset-frontend/src/explore/controlPanels/sections.tsx +++ b/superset-frontend/src/explore/controlPanels/sections.tsx @@ -195,7 +195,7 @@ export const NVD3TimeSeries: ControlPanelSectionConfig[] = [ description: t( 'Overlay one or more timeseries from a ' + 'relative time period. Expects relative time deltas ' + - 'in natural language (example: 24 hours, 7 days, ' + + 'in natural language (example: 24 hours, 7 days, ' + '52 weeks, 365 days). Free text is supported.', ), }, diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx index be60ac0308d7f..99a414012b779 100644 --- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx +++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx @@ -90,7 +90,7 @@ export const httpPath = ({ placeholder={t('e.g. sql/protocolv1/o/12345')} label="HTTP Path" onChange={changeMethods.onExtraInputChange} - helpText={t('Copy the name of the HTTP Path of your cluster.')} + helpText={t('Copy the name of the HTTP Path of your cluster.')} /> ); }; diff --git a/superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py b/superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py index 1d0d81faaf2cf..2e491e9303f4e 100644 --- a/superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py +++ b/superset/migrations/versions/2018-07-05_15-19_3dda56f1c4c6_migrate_num_period_compare_and_period_.py @@ -56,7 +56,7 @@ class Slice(Base): "second": "PT1S", "minute": "PT1M", "5 minute": "PT5M", - "10 minute": "PT10M", + "10 minute": "PT10M", "half hour": "PT0.5H", "hour": "PT1H", "day": "P1D", diff --git a/superset/utils/core.py b/superset/utils/core.py index 0ab3a685a39c3..8a92a2d490cd0 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -429,7 +429,7 @@ def parse_js_uri_path_item( :param item: a uri path component :param unquote: Perform unquoting of string using urllib.parse.unquote_plus() - :param eval_undefined: When set to True and item is either 'null' or 'undefined', + :param eval_undefined: When set to True and item is either 'null' or 'undefined', assume item is undefined and return None. :return: Either None, the original item or unquoted item """ diff --git a/superset/views/database/mixins.py b/superset/views/database/mixins.py index bd83e79439c95..efd0b6c6eb25e 100644 --- a/superset/views/database/mixins.py +++ b/superset/views/database/mixins.py @@ -102,7 +102,7 @@ class DatabaseMixin: ), "expose_in_sqllab": _("Expose this DB in SQL Lab"), "allow_run_async": _( - "Operate the database in asynchronous mode, meaning " + "Operate the database in asynchronous mode, meaning " "that the queries are executed on remote workers as opposed " "to on the web server itself. " "This assumes that you have a Celery worker setup as well " diff --git a/tests/integration_tests/celery_tests.py b/tests/integration_tests/celery_tests.py index da6db727e7114..d017f9f99575c 100644 --- a/tests/integration_tests/celery_tests.py +++ b/tests/integration_tests/celery_tests.py @@ -111,7 +111,7 @@ def run_sql( def drop_table_if_exists(table_name: str, table_type: CtasMethod) -> None: """Drop table if it exists, works on any DB""" - sql = f"DROP {table_type} IF EXISTS {table_name}" + sql = f"DROP {table_type} IF EXISTS {table_name}" database = get_example_database() with database.get_sqla_engine_with_context() as engine: engine.execute(sql) diff --git a/tests/integration_tests/db_engine_specs/hive_tests.py b/tests/integration_tests/db_engine_specs/hive_tests.py index b39f2658979c4..432d097b5879a 100644 --- a/tests/integration_tests/db_engine_specs/hive_tests.py +++ b/tests/integration_tests/db_engine_specs/hive_tests.py @@ -358,7 +358,7 @@ def test_where_latest_partition(mock_method): "test_table", "test_schema", db, select(), columns ) query_result = str(result.compile(compile_kwargs={"literal_binds": True})) - assert "SELECT \nWHERE ds = '01-01-19' AND hour = 1" == query_result + assert "SELECT \nWHERE ds = '01-01-19' AND hour = 1" == query_result @mock.patch("superset.db_engine_specs.presto.PrestoEngineSpec.latest_partition") diff --git a/tests/integration_tests/db_engine_specs/postgres_tests.py b/tests/integration_tests/db_engine_specs/postgres_tests.py index a9dbfa515f602..03b3e5763fcd5 100644 --- a/tests/integration_tests/db_engine_specs/postgres_tests.py +++ b/tests/integration_tests/db_engine_specs/postgres_tests.py @@ -178,7 +178,7 @@ def test_estimate_statement_cost_select_star(self): cursor = mock.Mock() cursor.fetchone.return_value = ( - "Seq Scan on birth_names (cost=0.00..1537.91 rows=75691 width=46)", + "Seq Scan on birth_names (cost=0.00..1537.91 rows=75691 width=46)", ) sql = "SELECT * FROM birth_names" results = PostgresEngineSpec.estimate_statement_cost(sql, cursor) diff --git a/tests/integration_tests/db_engine_specs/presto_tests.py b/tests/integration_tests/db_engine_specs/presto_tests.py index 9099dbb7d776b..117654d8f83d7 100644 --- a/tests/integration_tests/db_engine_specs/presto_tests.py +++ b/tests/integration_tests/db_engine_specs/presto_tests.py @@ -502,7 +502,7 @@ def test_presto_where_latest_partition(self): "test_table", "test_schema", db, select(), columns ) query_result = str(result.compile(compile_kwargs={"literal_binds": True})) - self.assertEqual("SELECT \nWHERE ds = '01-01-19' AND hour = 1", query_result) + self.assertEqual("SELECT \nWHERE ds = '01-01-19' AND hour = 1", query_result) def test_query_cost_formatter(self): raw_cost = [ diff --git a/tests/integration_tests/utils/csv_tests.py b/tests/integration_tests/utils/csv_tests.py index e514efb1d2108..1e7618e193fb9 100644 --- a/tests/integration_tests/utils/csv_tests.py +++ b/tests/integration_tests/utils/csv_tests.py @@ -75,7 +75,7 @@ def test_df_to_escaped_csv(): assert escaped_csv_rows == [ ["col_a", "'=func()"], ["-10", "'=cmd\|' /C calc'!A0"], - ["a", "'=b"], # pandas seems to be removing the leading "" + ["a", "'=b"], # pandas seems to be removing the leading "" ["' =a", "b"], ] diff --git a/tests/unit_tests/utils/date_parser_tests.py b/tests/unit_tests/utils/date_parser_tests.py index e5b3eebd99bae..f3c8b6968077b 100644 --- a/tests/unit_tests/utils/date_parser_tests.py +++ b/tests/unit_tests/utils/date_parser_tests.py @@ -163,7 +163,7 @@ def test_datetime_eval() -> None: expected = datetime(2016, 11, 7, 9, 30, 10) assert result == expected - result = datetime_eval("datetime('today' )") + result = datetime_eval("datetime('today')") expected = datetime(2016, 11, 7) assert result == expected @@ -308,7 +308,7 @@ def test_get_past_or_future() -> None: def test_parse_human_datetime() -> None: with pytest.raises(TimeRangeAmbiguousError): - parse_human_datetime(" 2 days ") + parse_human_datetime("2 days") with pytest.raises(TimeRangeAmbiguousError): parse_human_datetime("2 day") From d77358417b28c2a367dd736adf6eaaebd8b5eaa8 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Wed, 25 Jan 2023 11:00:54 -0700 Subject: [PATCH 2/3] Ok, I overstepped on this one. --- tests/integration_tests/utils/csv_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration_tests/utils/csv_tests.py b/tests/integration_tests/utils/csv_tests.py index 1e7618e193fb9..e514efb1d2108 100644 --- a/tests/integration_tests/utils/csv_tests.py +++ b/tests/integration_tests/utils/csv_tests.py @@ -75,7 +75,7 @@ def test_df_to_escaped_csv(): assert escaped_csv_rows == [ ["col_a", "'=func()"], ["-10", "'=cmd\|' /C calc'!A0"], - ["a", "'=b"], # pandas seems to be removing the leading "" + ["a", "'=b"], # pandas seems to be removing the leading "" ["' =a", "b"], ] From 8ef309760bdfe40e51bfd5dad0408680a48868e9 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Wed, 25 Jan 2023 11:25:13 -0700 Subject: [PATCH 3/3] ok, these broke tests for whatever reasons... leaving them alone. --- tests/integration_tests/db_engine_specs/hive_tests.py | 2 +- tests/integration_tests/db_engine_specs/presto_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration_tests/db_engine_specs/hive_tests.py b/tests/integration_tests/db_engine_specs/hive_tests.py index 432d097b5879a..b39f2658979c4 100644 --- a/tests/integration_tests/db_engine_specs/hive_tests.py +++ b/tests/integration_tests/db_engine_specs/hive_tests.py @@ -358,7 +358,7 @@ def test_where_latest_partition(mock_method): "test_table", "test_schema", db, select(), columns ) query_result = str(result.compile(compile_kwargs={"literal_binds": True})) - assert "SELECT \nWHERE ds = '01-01-19' AND hour = 1" == query_result + assert "SELECT \nWHERE ds = '01-01-19' AND hour = 1" == query_result @mock.patch("superset.db_engine_specs.presto.PrestoEngineSpec.latest_partition") diff --git a/tests/integration_tests/db_engine_specs/presto_tests.py b/tests/integration_tests/db_engine_specs/presto_tests.py index 117654d8f83d7..9099dbb7d776b 100644 --- a/tests/integration_tests/db_engine_specs/presto_tests.py +++ b/tests/integration_tests/db_engine_specs/presto_tests.py @@ -502,7 +502,7 @@ def test_presto_where_latest_partition(self): "test_table", "test_schema", db, select(), columns ) query_result = str(result.compile(compile_kwargs={"literal_binds": True})) - self.assertEqual("SELECT \nWHERE ds = '01-01-19' AND hour = 1", query_result) + self.assertEqual("SELECT \nWHERE ds = '01-01-19' AND hour = 1", query_result) def test_query_cost_formatter(self): raw_cost = [