def _bool_method_SERIES(cls, op, special):
op_name = _get_op_name(op, special)<EOL>def na_op(x, y):<EOL><INDENT>try:<EOL><INDENT>result = op(x, y)<EOL><DEDENT>except TypeError:<EOL><INDENT>assert not isinstance(y, (list, ABCSeries, ABCIndexClass))<EOL>if isinstance(y, np.ndarray):<EOL><INDENT>assert not (is_bool_dtype(x) and is_bool_dtype(y))<EOL>x = ensure_object(x)<EOL>y = ensure_object(y)<EOL>result = libops.vec_binop(x, y, op)<EOL><DEDENT>else:<EOL><INDENT>assert lib.is_scalar(y)<EOL>if not isna(y):<EOL><INDENT>y = bool(y)<EOL><DEDENT>try:<EOL><INDENT>result = libops.scalar_binop(x, y, op)<EOL><DEDENT>except (TypeError, ValueError, AttributeError,<EOL>OverflowError, NotImplementedError):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>.format(dtype=x.dtype,<EOL>typ=type(y).__name__))<EOL><DEDENT><DEDENT><DEDENT>return result<EOL><DEDENT>fill_int = lambda x: x.fillna(<NUM_LIT:0>)<EOL>fill_bool = lambda x: x.fillna(False).astype(bool)<EOL>def wrapper(self, other):<EOL><INDENT>is_self_int_dtype = is_integer_dtype(self.dtype)<EOL>self, other = _align_method_SERIES(self, other, align_asobject=True)<EOL>res_name = get_op_result_name(self, other)<EOL>if isinstance(other, ABCDataFrame):<EOL><INDENT>return NotImplemented<EOL><DEDENT>elif isinstance(other, (ABCSeries, ABCIndexClass)):<EOL><INDENT>is_other_int_dtype = is_integer_dtype(other.dtype)<EOL>other = fill_int(other) if is_other_int_dtype else fill_bool(other)<EOL>ovalues = other.values<EOL>finalizer = lambda x: x<EOL><DEDENT>else:<EOL><INDENT>is_other_int_dtype = is_integer_dtype(np.asarray(other))<EOL>if is_list_like(other) and not isinstance(other, np.ndarray):<EOL><INDENT>other = construct_1d_object_array_from_listlike(other)<EOL><DEDENT>ovalues = other<EOL>finalizer = lambda x: x.__finalize__(self)<EOL><DEDENT>filler = (fill_int if is_self_int_dtype and is_other_int_dtype<EOL>else fill_bool)<EOL>res_values = na_op(self.values, ovalues)<EOL>unfilled = self._constructor(res_values,<EOL>index=self.index, name=res_name)<EOL>filled = filler(unfilled)<EOL>return finalizer(filled)<EOL><DEDENT>wrapper.__name__ = op_name<EOL>return wrapper<EOL>
Wrapper function for Series arithmetic operations, to avoid
code duplication.