Repository: sympy/sympy
File: sympy/logic/boolalg.py (Python)

Code before:
            ...

        @overload # type: ignore
        def subs(self, arg1: Mapping[Basic | complex, Boolean | complex], arg2: None=None) -> Boolean: ...
        @overload
        def subs(self, arg1: Mapping[Relational, BooleanTrue | BooleanFalse], arg2: None=None) -> Boolean: ...
        @overload
        def subs(self, arg1: Iterable[tuple[Basic | complex, Boolean | complex]], arg2: None=None, **kwargs: Any) -> Boolean: ...
        @overload
        def subs(self, arg1: Boolean | complex, arg2: Boolean | complex) -> Boolean: ...
        @overload
        def subs(self, arg1: Mapping[Basic | complex, Basic | complex], arg2: None=None, **kwargs: Any) -> Basic: ...
        @overload
        def subs(self, arg1: Iterable[tuple[Basic | complex, Basic | complex]], arg2: None=None, **kwargs: Any) -> Basic: ...
        @overload
        def subs(self, arg1: Basic | complex, arg2: Basic | complex, **kwargs: Any) -> Basic: ...

        def subs(self, arg1: Mapping[Basic | complex, Basic | complex] | Basic | complex, # type: ignore
                 arg2: Basic | complex | None = None, **kwargs: Any) -> Basic:
            ...

        def simplify(self, **kwargs) -> Boolean:
            ...

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __and__(self, other: Boolean) -> Boolean:
        return And(self, other)

    __rand__ = __and__

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __or__(self, other: Boolean) -> Boolean:
        return Or(self, other)

    __ror__ = __or__

    def __invert__(self) -> Boolean:
        """Overloading for ~"""
        return Not(self)

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __rshift__(self, other: Boolean) -> Boolean:
        return Implies(self, other)

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __lshift__(self, other: Boolean) -> Boolean:
        return Implies(other, self)

    __rrshift__ = __lshift__
    __rlshift__ = __rshift__


Review comment (suggestion):
The parameters on methods like this should be types as `Boolean | bool`. The return type should always be strictly `Boolean` though.

Code after:
            ...

        @overload # type: ignore
        def subs(self, arg1: _SupportsItems[Basic | complex, Boolean | complex]
                 | Iterable[tuple[Basic | complex, Boolean | complex]],
                 arg2: None=None, **kwargs: Any) -> Boolean: ...
        @overload
        def subs(self, arg1: Boolean | complex, arg2: Boolean | complex) -> Boolean: ...
        @overload
        def subs(self, arg1: _SupportsItems[Basic | complex, Basic | complex]
                 | Iterable[tuple[Basic | complex, Basic | complex]],
                 arg2: None=None, **kwargs: Any) -> Basic: ...
        @overload
        def subs(self, arg1: Basic | complex, arg2: Basic | complex, **kwargs: Any) -> Basic: ...

        def subs(self, arg1: _SupportsItems[Basic | complex, Basic | complex] | Basic | complex, # type: ignore
                 arg2: Basic | complex | None = None, **kwargs: Any) -> Basic:
            ...

        def simplify(self, **kwargs) -> Boolean:
            ...

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __and__(self, other: Boolean | bool) -> Boolean:
        return And(self, other)

    __rand__ = __and__

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __or__(self, other: Boolean | bool) -> Boolean:
        return Or(self, other)

    __ror__ = __or__

    def __invert__(self) -> Boolean:
        """Overloading for ~"""
        return Not(self)

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __rshift__(self, other: Boolean | bool) -> Boolean:
        return Implies(self, other)

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __lshift__(self, other: Boolean | bool) -> Boolean:
        return Implies(other, self)

    __rrshift__ = __lshift__
    __rlshift__ = __rshift__

    @sympify_return([('other', 'Boolean')], NotImplemented)
    def __xor__(self, other: Boolean | bool) -> Boolean: