diff --git a/.pylintrc b/.pylintrc index b1aab562d..29b802eb4 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,3 +1,8 @@ +[MASTER] + +# As a temporary workaround for https://github.com/PyCQA/pylint/issues/4577 +init-hook = "import astroid; astroid.context.InferenceContext.max_inferred = 500" + [MESSAGES CONTROL] disable = bad-continuation, missing-docstring, duplicate-code, logging-fstring-interpolation, unspecified-encoding diff --git a/tests/conftest.py b/tests/conftest.py index 35fca05e0..b9e08c031 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,7 @@ from webviz_config.common_cache import CACHE from webviz_config.themes import default_theme from webviz_config.webviz_factory_registry import WEBVIZ_FACTORY_REGISTRY -from webviz_config.webviz_instance_info import WebvizInstanceInfo, WebvizRunMode +from webviz_config.webviz_instance_info import WEBVIZ_INSTANCE_INFO, WebvizRunMode def pytest_addoption(parser: Parser) -> None: @@ -28,14 +28,19 @@ def testdata_folder_fixture(request: SubRequest) -> Any: @pytest.fixture() def app() -> dash.Dash: - run_mode = WebvizRunMode.NON_PORTABLE - storage_folder = pathlib.Path(__file__).resolve().parent - app_instance_info = WebvizInstanceInfo(run_mode, storage_folder) + dash_app = dash.Dash(__name__) + + WEBVIZ_INSTANCE_INFO.initialize( + dash_app=dash_app, + run_mode=WebvizRunMode.NON_PORTABLE, + theme=default_theme, + storage_folder=pathlib.Path(__file__).resolve().parent, + ) try: - WEBVIZ_FACTORY_REGISTRY.initialize(app_instance_info, None) + WEBVIZ_FACTORY_REGISTRY.initialize(None) except RuntimeError: pass - dash_app = dash.Dash(__name__) + dash_app.css.config.serve_locally = True dash_app.scripts.config.serve_locally = True dash_app.config.suppress_callback_exceptions = True diff --git a/webviz_subsurface/_private_plugins/surface_selector.py b/webviz_subsurface/_private_plugins/surface_selector.py index 9a8d2b737..baa23d108 100644 --- a/webviz_subsurface/_private_plugins/surface_selector.py +++ b/webviz_subsurface/_private_plugins/surface_selector.py @@ -297,13 +297,7 @@ def _update_date( elif callback == f"{self.date_id_btn_next}.n_clicks": value = next_value(current_value, dates) else: - value = ( - current_value - if current_value - in dates # pylint: disable=unsupported-membership-test - else dates[0] # pylint: disable=unsubscriptable-object - ) - # pylint: disable=not-an-iterable + value = current_value if current_value in dates else dates[0] options = [{"label": format_date(date), "value": date} for date in dates] return options, value, {} @@ -331,12 +325,7 @@ def _set_data( dates_in_attr = self._dates_in_attr(attr) - if ( - dates_in_attr - and date - and not date - in dates_in_attr # PyCQA/pylint#3045 # pylint: disable=unsupported-membership-test - ): + if dates_in_attr and date and not date in dates_in_attr: raise PreventUpdate return json.dumps({"name": name, "attribute": attr, "date": date}) diff --git a/webviz_subsurface/_providers/ensemble_summary_provider/_csv_import.py b/webviz_subsurface/_providers/ensemble_summary_provider/_csv_import.py index 5e444a536..d1662a117 100644 --- a/webviz_subsurface/_providers/ensemble_summary_provider/_csv_import.py +++ b/webviz_subsurface/_providers/ensemble_summary_provider/_csv_import.py @@ -37,12 +37,11 @@ def load_ensemble_summary_csv_file( df: pd.DataFrame = pd.read_csv(csv_file) if ensemble_filter is not None: - if not "ENSEMBLE" in df.columns: + if "ENSEMBLE" not in df.columns: raise ValueError( "Cannot filter on ensemble, no ENSEMBLE column exist in CSV file" ) - # pylint: disable=unsubscriptable-object df = df[df["ENSEMBLE"] == ensemble_filter] if "ENSEMBLE" in df.columns: diff --git a/webviz_subsurface/_providers/ensemble_summary_provider/ensemble_summary_provider_factory.py b/webviz_subsurface/_providers/ensemble_summary_provider/ensemble_summary_provider_factory.py index 6651d497a..e304395dd 100644 --- a/webviz_subsurface/_providers/ensemble_summary_provider/ensemble_summary_provider_factory.py +++ b/webviz_subsurface/_providers/ensemble_summary_provider/ensemble_summary_provider_factory.py @@ -96,9 +96,9 @@ def create_from_ensemble_csv_file( if len(ensemble_df) == 0: raise ValueError("Import resulted in empty DataFrame") - if not "DATE" in ensemble_df.columns: + if "DATE" not in ensemble_df.columns: raise ValueError("No DATE column present in input data") - if not "REAL" in ensemble_df.columns: # pylint: disable=no-member + if "REAL" not in ensemble_df.columns: raise ValueError("No REAL column present in input data") ProviderImplArrowPresampled.write_backing_store_from_ensemble_dataframe( diff --git a/webviz_subsurface/plugins/_assisted_history_matching_analysis.py b/webviz_subsurface/plugins/_assisted_history_matching_analysis.py index a8203c80a..a9d65a624 100644 --- a/webviz_subsurface/plugins/_assisted_history_matching_analysis.py +++ b/webviz_subsurface/plugins/_assisted_history_matching_analysis.py @@ -336,11 +336,7 @@ def _generatetable(choiceplot, max_rows=10): get_path(self.input_dir / "misfit_obs_info.csv"), index_col=0 ) list_ok = list(misfit_info.filter(like="All_obs", axis=1).columns) - listtoplot = [ - ele - for ele in misfit_info.columns # PyCQA/pylint#4577 # pylint: disable=no-member - if ele not in list_ok - ] + listtoplot = [ele for ele in misfit_info.columns if ele not in list_ok] if choiceplot == "ALL": listtoplot = list_ok active_info = read_csv( diff --git a/webviz_subsurface/plugins/_disk_usage.py b/webviz_subsurface/plugins/_disk_usage.py index cd3dc1e17..131ae81dd 100644 --- a/webviz_subsurface/plugins/_disk_usage.py +++ b/webviz_subsurface/plugins/_disk_usage.py @@ -139,17 +139,9 @@ def get_disk_usage(scratch_dir: Path, date: Optional[str]) -> pd.DataFrame: columns={"usageKB": "usageKiB"}, inplace=True ) # Old format had an error (KB instead of KiB) - df[ # PyCQA/pylint#4577 # pylint: disable=unsupported-assignment-operation - "usageGiB" - ] = df[ # PyCQA/pylint#4577 # pylint: disable=unsubscriptable-object - "usageKiB" - ] / ( - 1024 ** 2 - ) + df["usageGiB"] = df["usageKiB"] / (1024 ** 2) - df.drop( # PyCQA/pylint#4577 # pylint: disable=no-member - columns="usageKiB", inplace=True - ) + df.drop(columns="usageKiB", inplace=True) free_space_gib = _estimate_free_space(df, scratch_dir, date) if free_space_gib < 0: diff --git a/webviz_subsurface/plugins/_horizon_uncertainty_viewer/_huv_table.py b/webviz_subsurface/plugins/_horizon_uncertainty_viewer/_huv_table.py index 9a160068b..edb30f42b 100644 --- a/webviz_subsurface/plugins/_horizon_uncertainty_viewer/_huv_table.py +++ b/webviz_subsurface/plugins/_horizon_uncertainty_viewer/_huv_table.py @@ -34,6 +34,4 @@ def update_wellpoints_df(self, column_list: List[str]) -> pd.DataFrame: for col in column_list: if colm == col: sorted_list.append(col) - return df[ # PyCQA/pylint#4577 # pylint: disable=unsubscriptable-object - sorted_list - ].round(2) + return df[sorted_list].round(2) diff --git a/webviz_subsurface/plugins/_reservoir_simulation_timeseries_onebyone.py b/webviz_subsurface/plugins/_reservoir_simulation_timeseries_onebyone.py index 660f696ed..7b801b028 100644 --- a/webviz_subsurface/plugins/_reservoir_simulation_timeseries_onebyone.py +++ b/webviz_subsurface/plugins/_reservoir_simulation_timeseries_onebyone.py @@ -179,8 +179,7 @@ def __init__( c for c in self.smry.columns if c not in ReservoirSimulationTimeSeriesOneByOne.ENSEMBLE_COLUMNS - and historical_vector(c, self.smry_meta, False) - not in self.smry.columns # PyCQA/pylint#4577 # pylint: disable=no-member + and historical_vector(c, self.smry_meta, False) not in self.smry.columns ] self.initial_vector = ( initial_vector