py_trees
py_trees copied to clipboard
create_behaviour_from_function spec'd to return `Any`
calling create_behaviour_from_function
like this:
def update(self: py_trees.behaviour.Behaviour) -> py_trees.common.Status:
return py_trees.common.Status.SUCCESS
return py_trees.meta.create_behaviour_from_function(
update
)(name='Has More To Do')
results in this error from my_py:
error: Returning Any from function declared to return "Behaviour"
Looking at how create_behaviour_from_function
uses the type
function, I suspect this is more a mypy issue than py-trees, but it might be nice to explicitly declare the fuction return a Behavior
came across another example that causes the same error:
return py_trees.behaviours.Failure()
results in:
error: Returning Any from function declared to return "Behaviour"
def create_behaviour_from_function(
func: typing.Callable[[typing.Any,], common.Status],
module: typing.Optional[str] = None
):
) -> "typing.Type[behaviour.Behaviour]"
in #380.