This pull request modifies the contribution guidelines to clarify
when and where 'Any' should be used.
In particular, it clarifies that 'Any' is meant mainly to be used as
a "fallback" -- if it's not possible to express a certain type, if we're not
sure what the correct type in some case is, to avoid Union returns, etc...
It also explicitly notes that 'object' should be used over 'Any' when we
want to indicate that some function can accept literally anything.
Typing stubs this way probably won't impact most people, but does make
life a bit easier for people (like me) who want to restrict/forbid the
use of Any as much as possible.
* Use _ArgsType for logging.makeRecord
* The "args" argument is passed to LogMessage, so passing a tuple in is fine as
well.
* Use Mapping rather than Dict, see https://bugs.python.org/issue21172
It should be possible to ask for every object whether it looks like
an element. If only Elements are accepted, this function would always
return True.
Fixes#2629
There does not seem to be an easy way to express that the array needs to be of a 1-byte type ('b', 'B', or 'c' in Python 2 only), so it is a bit more permissive than it should be.
In Python 3, `builtins.compile` takes 6 arguments (`source`, `filename`, `mode`, `flags=0`, `dont_inherit=False`, `optimize=-1`). This change adds the last `optimize` parameter, which is new since Python 2.
* Allow only _CData subclasses as ctypes.Array elements
* Change type of ctypes.Array.raw and .value to Any (Closes#2111)
.raw and .value don't exist on all arrays. On c_char arrays, both exist
and have type bytes; on c_wchar arrays, only .value exists and has
type Text; on all other arrays neither one exists.
This is impossible to describe properly in a stub, so marking .value as
Any is the best that can be done.
Give it enough information to determine that addinfourl
is iterable and that iteration and read methods return bytes.
Modeled after what is in stdlib/3/urllib/response.pyi after confirming
by looking at Python 2.7 stdlib code.
In Python 3, just as in Python 2, the expected exception argument to
assertRaises() and assertRaisesRegex() must be a subtype of
BaseException, not just of Exception.
Closes#2593