Add stubs for six.ensure_{binary,str,text} functions (#2704)

This commit is contained in:
Guido van Rossum
2018-12-19 16:07:16 -08:00
committed by Jelle Zijlstra
parent 44e6b6e0d4
commit a2c0f4b827
2 changed files with 8 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ from __future__ import print_function
import types
from typing import (
Any, AnyStr, Callable, Dict, Iterable, Mapping, NoReturn, Optional,
Pattern, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView
Pattern, Text, Tuple, Type, TypeVar, Union, overload, ValuesView, KeysView, ItemsView,
)
import typing
import unittest
@@ -90,4 +90,7 @@ print_ = print
def with_metaclass(meta: type, *bases: type) -> type: ...
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
def python_2_unicode_compatible(klass: _T) -> _T: ...

View File

@@ -14,6 +14,7 @@ from typing import (
NoReturn,
Optional,
Pattern,
Text,
Tuple,
Type,
TypeVar,
@@ -101,4 +102,7 @@ print_ = print
def with_metaclass(meta: type, *bases: type) -> type: ...
def add_metaclass(metaclass: type) -> Callable[[_T], _T]: ...
def ensure_binary(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> bytes: ...
def ensure_str(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> str: ...
def ensure_text(s: Union[bytes, Text], encoding: str = ..., errors: str = ...) -> Text: ...
def python_2_unicode_compatible(klass: _T) -> _T: ...