stdlibx.option.methods package

stdlibx.option.methods.and_(opt, other)[source]
Parameters:
  • opt (Option[T])

  • other (Option[U])

Return type:

Option[U]

stdlibx.option.methods.and_then(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[T], Option[U]])

Return type:

Option[U]

stdlibx.option.methods.expect(opt, msg)[source]
Parameters:
  • opt (Option[T])

  • msg (str)

Return type:

T

stdlibx.option.methods.filter_(opt, predicate)[source]
Parameters:
  • opt (Option[T])

  • predicate (Callable[[T], bool])

Return type:

Option[T]

stdlibx.option.methods.flatten(opt)[source]
Parameters:

opt (Option[Option[T]])

Return type:

Option[T]

stdlibx.option.methods.inspect(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[T], None])

Return type:

Option[T]

stdlibx.option.methods.is_none_or(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[T], bool])

Return type:

bool

stdlibx.option.methods.is_some_and(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[T], bool])

Return type:

bool

stdlibx.option.methods.map_(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[T], U])

Return type:

Option[U]

stdlibx.option.methods.map_or(opt, default, func)[source]
Parameters:
  • opt (Option[T])

  • default (U)

  • func (Callable[[T], U])

Return type:

U

stdlibx.option.methods.map_or_else(opt, default, func)[source]
Parameters:
  • opt (Option[T])

  • default (Callable[[], U])

  • func (Callable[[T], U])

Return type:

U

stdlibx.option.methods.ok_or(opt, error)[source]
Parameters:
  • opt (Option[T])

  • error (E)

Return type:

Result[T, E]

stdlibx.option.methods.ok_or_else(opt, error)[source]
Parameters:
  • opt (Option[T])

  • error (Callable[[], E])

Return type:

Result[T, E]

stdlibx.option.methods.or_(opt, default)[source]
Parameters:
  • opt (Option[T])

  • default (Option[T])

Return type:

Option[T]

stdlibx.option.methods.or_else(opt, default)[source]
Parameters:
  • opt (Option[T])

  • default (Callable[[], Option[T]])

Return type:

Option[T]

stdlibx.option.methods.transpose(opt)[source]
Parameters:

opt (Option[Result[U, E]])

Return type:

Result[Option[U], E]

stdlibx.option.methods.unwrap(opt)[source]
Parameters:

opt (Option[T])

Return type:

T

stdlibx.option.methods.unwrap_or(opt, default)[source]
Parameters:
  • opt (Option[T])

  • default (T)

Return type:

T

stdlibx.option.methods.unwrap_or_else(opt, func)[source]
Parameters:
  • opt (Option[T])

  • func (Callable[[], T])

Return type:

T

stdlibx.option.methods.xor(opt, other)[source]
Parameters:
  • opt (Option[T])

  • other (Option[T])

Return type:

Option[T]

stdlibx.option.methods.zipped(opt, func)[source]
Parameters:
  • opt (Option[tuple[Unpack[Ts]]])

  • func (Callable[[Unpack[Ts]], Option[U]])

Return type:

Option[tuple[Unpack[Ts], U]]

Submodules