Fix type hints in Template class (#3491)
Fix type hints in Template class (#3491)

Nothing in the standard library documentation for the string module suggests that the value associated with any key in the mapping parameter(or kwds) to Template.substitute and Template.safe_substitute should be a string. In fact any object can be used, for example

Template("$number is a number.").substitute({"number": 1})

The above code sample currently causes an error message like this:

error: Dict entry 0 has incompatible type "str": "int"; expected "str": "str"

which obviously shouldn't be emitted. Also a similar logic is already in place for methods in the Formatter class. However as I saw the notice about loose types above the Formatter class, I opted to use `object` instead of `Any` as the implementation inside the affected functions just uses the built-in str function on values inside mappings.
euresti/typeshed