mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Fix incorrect usage of AnyStr (#1215)
* 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
This commit is contained in:
committed by
Matthias Kramm
parent
dad65e4121
commit
1d6e3f492e
@@ -1,9 +1,15 @@
|
||||
from profile import Profile
|
||||
from cProfile import Profile as cProfile
|
||||
from typing import Any, AnyStr, Dict, IO, Iterable, List, Text, Tuple, TypeVar, Union, overload
|
||||
import os
|
||||
import sys
|
||||
from typing import Any, Dict, IO, Iterable, List, Text, Tuple, TypeVar, Union, overload
|
||||
|
||||
_Selector = Union[str, float, int]
|
||||
_T = TypeVar('_T', bound='Stats')
|
||||
if sys.version_info >= (3, 6):
|
||||
_Path = Union[bytes, Text, os.PathLike[Any]]
|
||||
else:
|
||||
_Path = Union[bytes, Text]
|
||||
|
||||
class Stats:
|
||||
def __init__(self: _T, __arg: Union[None, str, Text, Profile, cProfile] = ...,
|
||||
@@ -13,7 +19,7 @@ class Stats:
|
||||
def load_stats(self, arg: Union[None, str, Text, Profile, cProfile]) -> None: ...
|
||||
def get_top_level_stats(self) -> None: ...
|
||||
def add(self: _T, *arg_list: Union[None, str, Text, Profile, cProfile, _T]) -> _T: ...
|
||||
def dump_stats(self, filename: AnyStr) -> None: ...
|
||||
def dump_stats(self, filename: _Path) -> None: ...
|
||||
def get_sort_arg_defs(self) -> Dict[str, Tuple[Tuple[Tuple[int, int], ...], str]]: ...
|
||||
@overload
|
||||
def sort_stats(self: _T, field: int) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user