No, Any and object both mean that the argument can be anything, but Any takes this to mean ‘so let me do anything with it’, essentially disabling type checking for the argument, whereas object instead says ‘so ensure that anything I do with it works with arbitrary objects’.
EDIT: And now that I read this linked page, I also understand the issue. I was trying to make the type more specific in the class where I implemented __contains__ and this is what the warning is about:
It’s unsafe to override a method with a more specific argument type, as it violates the Liskov substitution principle. For return types, it’s unsafe to override a method with a more general return type.