(rewrite_name=None)
return df_rolling_method_other_none_codegen
Generate df.rolling method code generator based on name of the method
Generate df.rolling method code generator based on name of the method
Generate df . rolling method code generator based on name of the method
def gen_df_rolling_method_other_none_codegen(rewrite_name=None):
    """Generate df.rolling method code generator based on name of the method"""
    def df_rolling_method_other_none_codegen(method_name, self, args=None, kws=None):
        _method_name = rewrite_name or method_name
        args = args or []
        kwargs = kws or {}

        impl_params = ['self'] + args + kwsparams2list(kwargs)
        impl_params_as_str = ', '.join(impl_params)

        impl_name = f'_df_rolling_{_method_name}_other_none_impl'
        func_lines = [f'def {impl_name}({impl_params_as_str}):']

        if 'pairwise' in kwargs:
            func_lines += [
                '  if pairwise is None:',
                '    _pairwise = True',
                '  else:',
                '    _pairwise = pairwise',
                '  if _pairwise:',
                f'    raise ValueError("Method rolling.{_method_name}(). The object pairwise\\n expected: False")'
            ]
        method_params = args + ['{}={}'.format(k, k) for k in kwargs if k != 'other']
        func_lines += df_rolling_method_main_codegen(method_params, self.data.columns, self.data.column_loc,
                                                     method_name)

        func_text = '\n'.join(func_lines)

        global_vars = {'pandas': pandas}

        return func_text, global_vars

    return df_rolling_method_other_none_codegen
def gen_df_rolling_method_other_none_codegen ( rewrite_name = None ) : def df_rolling_method_other_none_codegen ( method_name , self , args = None , kws = None ) : _method_name = rewrite_name or method_name args = args or [ ] kwargs = kws or { } impl_params = [ 'self' ] + args + kwsparams2list ( kwargs ) impl_params_as_str = ', ' . join ( impl_params ) impl_name = f'_df_rolling_{_method_name}_other_none_impl' func_lines = [ f'def {impl_name}({impl_params_as_str}):' ] if 'pairwise' in kwargs : func_lines += [ '  if pairwise is None:' , '    _pairwise = True' , '  else:' , '    _pairwise = pairwise' , '  if _pairwise:' , f'    raise ValueError("Method rolling.{_method_name}(). The object pairwise\\n expected: False")' ] method_params = args + [ '{}={}' . format ( k , k ) for k in kwargs if k != 'other' ] func_lines += df_rolling_method_main_codegen ( method_params , self . data . columns , self . data . column_loc , method_name ) func_text = '\n' . join ( func_lines ) global_vars = { 'pandas' : pandas } return func_text , global_vars return df_rolling_method_other_none_codegen