Skip to content

Commit

Permalink
Doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
arunjose696 committed Aug 26, 2024
1 parent 60f9512 commit 098f8fb
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions modin/core/storage_formats/pandas/query_compiler_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,43 @@


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__(
cls,
**kwargs: Dict,
) -> None:
"""
Apply type casting to all children of ``QueryCompilerCaster``.
Applies 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):
Expand Down Expand Up @@ -91,7 +109,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__")
Expand Down

0 comments on commit 098f8fb

Please sign in to comment.