PEP 484 indicates that all type annotations within a stub file are supposed to be considered forward references even if they are not quoted. This means a type checker needs to use scope-based symbol resolution without regard for code flow order. Lookups will find same-named symbols within the same scope even if they are declared after the type annotation. This change fixes a couple of cases where this occurs and confuses pyright.
Co-authored-by: Eric Traut <erictr@microsoft.com>
Tornado ships with inline annotations, but it no longer is Python 2
compatible. I think that it makes sense to keep the legacy stubs for
Python 2 compatibility, at least for a while longer.
This restores stubs removed in #4321, but moves them to
`third_party/2`.
* Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 4). These were all identified as unused symbols by the pyright type checker and language server.
Co-authored-by: Eric Traut <erictr@microsoft.com>
* Replaced parameter name "self" with "cls" for a few class methods. Pyright emits a warning if a class method doesn't follow the PEP 8 standard where the first parameter is named "cls" for a class method. This change eliminates these warnings.
* Missed a file.
Co-authored-by: Eric Traut <erictr@microsoft.com>
* PEP 484 says that type checkers should assume that all types used in a stub should use forward declarations even though they are not quoted. This stub is using the symbol "type" within the context of a class scope. The "type" symbol is declared within this scope, so pyright assumes that the forward declaration should be used. The solution is to define a symbol with a different name in the outer scope to avoid the name conflict.
* Fixed import sort order.
Co-authored-by: Eric Traut <erictr@microsoft.com>
* Pyright detects and reports cases where a multi-part module name is accessed but is not explicitly imported. These are dangerous because they rely on import resolution ordering within a program, which can easily change. This change eliminates errors detected by pyright.
* Fixed regression caught by CI test.
* Fixed black formatting issues.
Co-authored-by: Eric Traut <erictr@microsoft.com>
This makes mypy think that conditions like
parameter.kind is Parameter.POSITIONAL_OR_KEYWORD
are always false, which triggers `unreachable` warnings, among other
problems.
* Enable some branches for Python2 pathlib2
* Define an alias _PathLike, instead of using multiple branches
* Drop a Python 3.4 branch (the Python 2 branch is identical to
the 3.5+ branch)
* Move Path.__new__ to the top
Add support for the following syslog facilities:
- LOG_NTP
- LOG_SECURITY
- LOG_CONSOLE
- LOG_SOLCRON
In addition, reorder the entries to match the CPython implementation to
make it easier to read.