def _get_axis_params(default_axis=0, _name=_name, _desc=_desc): # bind NOW _type = f"int or None, default: {default_axis}" _axis_parameter_doc = Parameter(_name, _type, _desc) _axis_parameter = inspect.Parameter(_name, inspect.Parameter.KEYWORD_ONLY, default=default_axis) return _axis_parameter_doc, _axis_parameter
# arrays with NaNs. Produce the appropriate array and return it. output_shape = _broadcast_array_shapes_remove_axis(samples, axis) output = np.ones(output_shape) * np.nan return output # Standard docstring / signature entries for `axis` and `nan_policy` _name = 'axis' _type = "int or None, default: 0" _desc = ( """If an int, the axis of the input along which to compute the statistic. The statistic of each axis-slice (e.g. row) of the input will appear in a corresponding element of the output. If ``None``, the input will be raveled before computing the statistic.""". split('\n')) _axis_parameter_doc = Parameter(_name, _type, _desc) _axis_parameter = inspect.Parameter(_name, inspect.Parameter.KEYWORD_ONLY, default=0) _name = 'nan_policy' _type = "{'propagate', 'omit', 'raise'}" _desc = ("""Defines how to handle input NaNs. - ``propagate``: if a NaN is present in the axis slice (e.g. row) along which the statistic is computed, the corresponding entry of the output will be NaN. - ``omit``: NaNs will be omitted when performing the calculation. If insufficient data remains in the axis slice along which the statistic is computed, the corresponding entry of the output will be NaN.
_name = 'nan_policy' _type = "{'propagate', 'omit', 'raise'}" _desc = ("""Defines how to handle input NaNs. - ``propagate``: if a NaN is present in the axis slice (e.g. row) along which the statistic is computed, the corresponding entry of the output will be NaN. - ``omit``: NaNs will be omitted when performing the calculation. If insufficient data remains in the axis slice along which the statistic is computed, the corresponding entry of the output will be NaN. - ``raise``: if a NaN is present, a ``ValueError`` will be raised.""".split( '\n')) _nan_policy_parameter_doc = Parameter(_name, _type, _desc) _nan_policy_parameter = inspect.Parameter(_name, inspect.Parameter.KEYWORD_ONLY, default='propagate') _name = 'keepdims' _type = "bool, default: False" _desc = ("""If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.""".split('\n')) _keepdims_parameter_doc = Parameter(_name, _type, _desc) _keepdims_parameter = inspect.Parameter(_name, inspect.Parameter.KEYWORD_ONLY, default=False) _standard_note_addition = (