from typing import Callable, Optional, TypeVar

from rx import operators as ops
from rx.core import Observable, pipe, typing
from rx.internal.basic import default_comparer

_T = TypeVar("_T")


def contains_(
    value: _T, comparer: Optional[typing.Comparer[_T]] = None
) -> Callable[[Observable[_T]], Observable[bool]]:
    comparer_ = comparer or default_comparer

    filtering = ops.filter(lambda v: comparer_(v, value))
    something = ops.some()

    return pipe(filtering, something)


__all__ = ["contains_"]

from typing import Callable, Optional, TypeVar

from rx import operators as ops
from rx.core import Observable, pipe, typing
from rx.internal.basic import default_comparer

_T = TypeVar("_T")


def contains_(
    value: _T, comparer: Optional[typing.Comparer[_T]] = None
) -> Callable[[Observable[_T]], Observable[bool]]:
    comparer_ = comparer or default_comparer

    def predicate(v: _T) -> bool:
        return comparer_(v, value)

    filtering = ops.filter(predicate)
    something = ops.some()

    return pipe(filtering, something)


__all__ = ["contains_"]

Use typed function instead of lambda
Use typed function instead of lambda


  from typing import Callable, Optional, TypeVar
  
  from rx import operators as ops
  from rx.core import Observable, pipe, typing
  from rx.internal.basic import default_comparer
  
  _T = TypeVar("_T")
  
  
  def contains_(
      value: _T, comparer: Optional[typing.Comparer[_T]] = None
  ) -> Callable[[Observable[_T]], Observable[bool]]:
      comparer_ = comparer or default_comparer
  
-     filtering = ops.filter(lambda v: comparer_(v, value))
+     def predicate(v: _T) -> bool:
+         return comparer_(v, value)
+ 
+     filtering = ops.filter(predicate)
      something = ops.some()
  
      return pipe(filtering, something)
  
  
  __all__ = ["contains_"]
  
Use typed function instead of lambda
## Code Before:
from typing import Callable, Optional, TypeVar

from rx import operators as ops
from rx.core import Observable, pipe, typing
from rx.internal.basic import default_comparer

_T = TypeVar("_T")


def contains_(
    value: _T, comparer: Optional[typing.Comparer[_T]] = None
) -> Callable[[Observable[_T]], Observable[bool]]:
    comparer_ = comparer or default_comparer

    filtering = ops.filter(lambda v: comparer_(v, value))
    something = ops.some()

    return pipe(filtering, something)


__all__ = ["contains_"]

## Instruction:
Use typed function instead of lambda
## Code After:
from typing import Callable, Optional, TypeVar

from rx import operators as ops
from rx.core import Observable, pipe, typing
from rx.internal.basic import default_comparer

_T = TypeVar("_T")


def contains_(
    value: _T, comparer: Optional[typing.Comparer[_T]] = None
) -> Callable[[Observable[_T]], Observable[bool]]:
    comparer_ = comparer or default_comparer

    def predicate(v: _T) -> bool:
        return comparer_(v, value)

    filtering = ops.filter(predicate)
    something = ops.some()

    return pipe(filtering, something)


__all__ = ["contains_"]
