(initializer, ty)
return sdc_pandas_rolling
Generate code of the overloaded method using associated DataType and constructor.
Generate code of the overloaded method using associated DataType and constructor.
Generate code of the overloaded method using associated DataType and constructor .
def gen_sdc_pandas_rolling_overload_body(initializer, ty):
    """Generate code of the overloaded method using associated DataType and constructor."""
    def sdc_pandas_rolling(self, window, min_periods=None, center=False,
                           win_type=None, on=None, axis=0, closed=None):
        ty_checker = TypeChecker('Method rolling().')
        ty_checker.check(self, ty)

        if not isinstance(window, types.Integer):
            ty_checker.raise_exc(window, 'int', 'window')

        minp_accepted = (types.Omitted, types.NoneType, types.Integer)
        if not isinstance(min_periods, minp_accepted) and min_periods is not None:
            ty_checker.raise_exc(min_periods, 'None, int', 'min_periods')

        center_accepted = (types.Omitted, types.Boolean)
        if not isinstance(center, center_accepted) and center is not False:
            ty_checker.raise_exc(center, 'bool', 'center')

        str_types = (types.Omitted, types.NoneType, types.StringLiteral, types.UnicodeType)
        if not isinstance(win_type, str_types) and win_type is not None:
            ty_checker.raise_exc(win_type, 'str', 'win_type')

        if not isinstance(on, str_types) and on is not None:
            ty_checker.raise_exc(on, 'str', 'on')

        axis_accepted = (types.Omitted, types.Integer, types.StringLiteral, types.UnicodeType)
        if not isinstance(axis, axis_accepted) and axis != 0:
            ty_checker.raise_exc(axis, 'int, str', 'axis')

        if not isinstance(closed, str_types) and closed is not None:
            ty_checker.raise_exc(closed, 'str', 'closed')

        nan_minp = isinstance(min_periods, (types.Omitted, types.NoneType)) or min_periods is None

        def sdc_pandas_rolling_impl(self, window, min_periods=None, center=False,
                                    win_type=None, on=None, axis=0, closed=None):
            if window < 0:
                raise ValueError('window must be non-negative')

            if nan_minp == True:  # noqa
                minp = window
            else:
                minp = min_periods

            if minp < 0:
                raise ValueError('min_periods must be >= 0')
            if minp > window:
                raise ValueError('min_periods must be <= window')

            if center != False:  # noqa
                raise ValueError('Method rolling(). The object center\n expected: False')

            if win_type is not None:
                raise ValueError('Method rolling(). The object win_type\n expected: None')

            if on is not None:
                raise ValueError('Method rolling(). The object on\n expected: None')

            if axis != 0:
                raise ValueError('Method rolling(). The object axis\n expected: 0')

            if closed is not None:
                raise ValueError('Method rolling(). The object closed\n expected: None')

            return initializer(self, window, minp, center, win_type, on, axis, closed)

        return sdc_pandas_rolling_impl

    return sdc_pandas_rolling
def gen_sdc_pandas_rolling_overload_body ( initializer , ty ) : def sdc_pandas_rolling ( self , window , min_periods = None , center = False , win_type = None , on = None , axis = 0 , closed = None ) : ty_checker = TypeChecker ( 'Method rolling().' ) ty_checker . check ( self , ty ) if not isinstance ( window , types . Integer ) : ty_checker . raise_exc ( window , 'int' , 'window' ) minp_accepted = ( types . Omitted , types . NoneType , types . Integer ) if not isinstance ( min_periods , minp_accepted ) and min_periods is not None : ty_checker . raise_exc ( min_periods , 'None, int' , 'min_periods' ) center_accepted = ( types . Omitted , types . Boolean ) if not isinstance ( center , center_accepted ) and center is not False : ty_checker . raise_exc ( center , 'bool' , 'center' ) str_types = ( types . Omitted , types . NoneType , types . StringLiteral , types . UnicodeType ) if not isinstance ( win_type , str_types ) and win_type is not None : ty_checker . raise_exc ( win_type , 'str' , 'win_type' ) if not isinstance ( on , str_types ) and on is not None : ty_checker . raise_exc ( on , 'str' , 'on' ) axis_accepted = ( types . Omitted , types . Integer , types . StringLiteral , types . UnicodeType ) if not isinstance ( axis , axis_accepted ) and axis != 0 : ty_checker . raise_exc ( axis , 'int, str' , 'axis' ) if not isinstance ( closed , str_types ) and closed is not None : ty_checker . raise_exc ( closed , 'str' , 'closed' ) nan_minp = isinstance ( min_periods , ( types . Omitted , types . NoneType ) ) or min_periods is None def sdc_pandas_rolling_impl ( self , window , min_periods = None , center = False , win_type = None , on = None , axis = 0 , closed = None ) : if window < 0 : raise ValueError ( 'window must be non-negative' ) if nan_minp == True : # noqa minp = window else : minp = min_periods if minp < 0 : raise ValueError ( 'min_periods must be >= 0' ) if minp > window : raise ValueError ( 'min_periods must be <= window' ) if center != False : # noqa raise ValueError ( 'Method rolling(). The object center\n expected: False' ) if win_type is not None : raise ValueError ( 'Method rolling(). The object win_type\n expected: None' ) if on is not None : raise ValueError ( 'Method rolling(). The object on\n expected: None' ) if axis != 0 : raise ValueError ( 'Method rolling(). The object axis\n expected: 0' ) if closed is not None : raise ValueError ( 'Method rolling(). The object closed\n expected: None' ) return initializer ( self , window , minp , center , win_type , on , axis , closed ) return sdc_pandas_rolling_impl return sdc_pandas_rolling