From 9af55f279c4d15ba5985c0227af133b7970faea4 Mon Sep 17 00:00:00 2001 From: arunjose696 Date: Mon, 26 Aug 2024 16:32:45 +0200 Subject: [PATCH] Doc updates --- .github/workflows/ci.yml | 2 -- .../pandas/query_compiler_validator.py | 29 +++++++++++++++---- .../pandas/native_df_mode/test_indexing.py | 2 -- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d118b436c17..8fb26225613 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -705,8 +705,6 @@ jobs: - run: python -m pytest modin/tests/pandas/native_df_mode/test_join_sort.py - run: python -m pytest modin/tests/pandas/native_df_mode/test_map_metadata.py - run: python -m pytest modin/tests/pandas/native_df_mode/test_pickle.py - - run: python -m pytest modin/tests/pandas/native_df_mode/test_reduce.py - - run: python -m pytest modin/tests/pandas/native_df_mode/test_udf.py - run: python -m pytest modin/tests/pandas/native_df_mode/test_window.py - uses: ./.github/actions/upload-coverage diff --git a/modin/core/storage_formats/pandas/query_compiler_validator.py b/modin/core/storage_formats/pandas/query_compiler_validator.py index 57925c62b2f..caff9c9b0cd 100644 --- a/modin/core/storage_formats/pandas/query_compiler_validator.py +++ b/modin/core/storage_formats/pandas/query_compiler_validator.py @@ -31,10 +31,7 @@ class QueryCompilerCaster: - """ - Cast all query compiler arguments of a the member function to current query compiler. - - """ + """Cast all query compiler arguments of a the member function to current query compiler.""" @classmethod def __init_subclass__( @@ -44,12 +41,34 @@ def __init_subclass__( """ Apply type casting to all children of ``QueryCompilerCaster``. + This method is called automatically when a class inherits from + ``QueryCompilerCaster``. It ensures that all member functions within the + subclass have their arguments automatically casted to the current query + compiler type. + + Parameters + ---------- + **kwargs : Additional keyword arguments """ super().__init_subclass__(**kwargs) apply_argument_cast()(cls) def cast_nested_args_to_current_qc_type(arguments, current_qc): + """ + Cast all arguments in nested fashion to current query compiler. + + Parameters + ---------- + arguments : tuple or dict + current_qc : BaseQueryCompiler + + Returns + ------- + tuple or dict + Returns args and kwargs with all query compilers casted to current_qc. + """ + def cast_arg_to_current_qc(arg): current_qc_type = type(current_qc) if isinstance(arg, BaseQueryCompiler) and not isinstance(arg, current_qc_type): @@ -91,7 +110,7 @@ def apply_argument_cast(): """ def decorator(obj: Fn) -> Fn: - """Decorate function or class to cast all arguments that are query compilers to the current query compiler""" + """Cast all arguments that are query compilers to the current query compiler.""" if isinstance(obj, type): all_attrs = dict(inspect.getmembers(obj)) all_attrs.pop("__abstractmethods__") diff --git a/modin/tests/pandas/native_df_mode/test_indexing.py b/modin/tests/pandas/native_df_mode/test_indexing.py index 9b0d2712db7..60cc4b85e3b 100644 --- a/modin/tests/pandas/native_df_mode/test_indexing.py +++ b/modin/tests/pandas/native_df_mode/test_indexing.py @@ -148,8 +148,6 @@ def test_set_index(data, key_func, drop_kwargs, request, data_frame_mode_pair): "data_frame_mode_pair", list(product(NativeDataframeMode.choices, repeat=2)) ) def test_loc(data, data_frame_mode_pair): - modin_df = pd.DataFrame(data) - pandas_df = pandas.DataFrame(data) modin_df, pandas_df = create_test_dfs(data, data_frame_mode=data_frame_mode_pair[0]) indices = [i % 3 == 0 for i in range(len(modin_df.index))]