Fixed symbol redefinition in cgi.pyi stub (#4394)

* 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>
This commit is contained in:
Eric Traut
2020-08-06 00:05:45 -07:00
committed by GitHub
parent 65450d81ff
commit f60074f3d2

View File

@@ -1,5 +1,6 @@
import sys
from _typeshed import SupportsGetItem, SupportsItemAccess
from builtins import type as _type
from typing import IO, Any, AnyStr, Dict, Iterable, Iterator, List, Mapping, Optional, Protocol, Tuple, TypeVar, Union
_T = TypeVar("_T", bound=FieldStorage)
@@ -56,7 +57,7 @@ class MiniFieldStorage:
def __repr__(self) -> str: ...
class FieldStorage(object):
FieldStorageClass: Optional[type]
FieldStorageClass: Optional[_type]
keep_blank_values: int
strict_parsing: int
qs_on_post: Optional[str]