* Add __getattr__ to ModuleType.
Modules can contain anything, so give them a generic "__getattr__(name) -> Any".
This makes code like the following type-check, in pytype:
sys.modules.get("random").randint
* undo Python 3 change
* Revert "undo Python 3 change"
This reverts commit 96cf2d529e374a754f1ba681f0fc81aab25f81ef.
* Revert "Add __getattr__ to ModuleType."
This reverts commit 3ac1cf8a3b25dabfe386fbf34aef680fb1acd112.
* In stdlib/2/, make sys.modules a Dict[str, Any].
(Instead of Dict[str, ModuleType])
Same as stdlib/3/.
From Samuel Freilich:
In Python 2, the predicate parameter in itertools.ifilter and
itertools.ifilterfalse can be None, indicating that true or false values
should be retained (functionally equivalent to passing "bool" as the
predicate). In Python 3, filter and itertools.filterfalse have
the same behavior.
* add typing.ContextManager for 3.6+ only
This fixes the easier part of #655.
Would it make sense to add a generic typing.ContextManager that exists in any Python version?
* update comment
* fix argument types for ContextManager.__exit__
* add AsyncContextManager
* add @asynccontextmanager
* typing.ContextManager now always exists
* back out async-related changes
Will submit those in a separate PR later
* fix import order
* AbstractContextManager only exists in 3.6+
* AbstractContextManager -> ContextManager
* Fix incorrect usage of AnyStr
- sqlite3 was using Union[bytes, AnyStr], which doesn't make sense
- The urllib functions I changed accept either bytes or str for their "safe"
argument
- Also added supports for PathLike to pstats
- Remove some unused imports of AnyStr
* pstats: python 2 accepts unicode
* Add pyi for pydoc [Python 2.7]
* Fixed issues
* A few more fixes
- `synopsis -> Optional[AnyStr]`
- `visiblename` takes a `Container`
- `getdoc -> Union...` not `AnyStr`
* `synopsis` and `source_synopsis`
CPython _warnings module implementation accepts Warning subclasses and None, but not any subclass of BaseException
specified in the stub. The stub for warnings is correct.
* Fix a few return types in stdlib/2/inspect.pyi.
* Rename _FrameRecord to _FrameInfo
* Correct some return types in itertools.pyi from Iterable to Iterator.
* Change types.pyi syntax that pytype can't parse.
* Simplify and add missing types for copy module.
Error and error were missing. I also removed the internal arg memo.
* Move copy module into 2and3
* Bring back internal kwargs
* md5.md5(string)
* switch md5 from str to AnyStr, add missing constants
* add missing import
* digest() and hexdigest() never return unicode
* make md5.md5 an alias of, and fix, hashlib_hash
* remove unnecessary import
* fix duplicate block_size
* md5.md5 and md5.new are aliases for hashlib.md5
* Add buffer types to struct module.
I noticed these were missing and I made the version look alike for an easy rename into 2and3.
* Add array to WriteBuffer, add iter_unpack
* Code review comments