Add types for gettext (#217)

* Add empty stubs for gettext Translations subclasses

GNUTranslations and NullTranslations do not add any methods to the base
Translations class, so remove the TODO comment and just declare the
classes.

* Add missing types for py3 gettext.
This commit is contained in:
David Shea
2016-05-19 17:34:38 -04:00
committed by Guido van Rossum
parent 2bb026cd76
commit 8503f13a41
2 changed files with 38 additions and 32 deletions

View File

@@ -1,39 +1,44 @@
# Stubs for gettext (Python 3.4)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
from typing import Any, IO, List, Optional, Union, Callable
class NullTranslations:
def __init__(self, fp=...) -> None: ...
def add_fallback(self, fallback): ...
def gettext(self, message): ...
def lgettext(self, message): ...
def ngettext(self, msgid1, msgid2, n): ...
def lngettext(self, msgid1, msgid2, n): ...
def info(self): ...
def charset(self): ...
def output_charset(self): ...
def set_output_charset(self, charset): ...
def install(self, names=...): ...
def __init__(self, fp: IO[str] = ...) -> None: ...
def add_fallback(self, fallback: NullTranslations) -> None: ...
def gettext(self, message: str) -> str: ...
def lgettext(self, message: str) -> str: ...
def ngettext(self, singular: str, plural: str, n: int) -> str: ...
def lngettext(self, singular: str, plural: str, n: int) -> str: ...
def info(self) -> Any: ...
def charset(self) -> Any: ...
def output_charset(self) -> Any: ...
def set_output_charset(self, charset: Any) -> None: ...
def install(self, names: List[str] = ...) -> None: ...
class GNUTranslations(NullTranslations):
LE_MAGIC = ... # type: Any
BE_MAGIC = ... # type: Any
def lgettext(self, message): ...
def lngettext(self, msgid1, msgid2, n): ...
def gettext(self, message): ...
def ngettext(self, msgid1, msgid2, n): ...
LE_MAGIC = ... # type: int
BE_MAGIC = ... # type: int
def find(domain, localedir=..., languages=..., all=...): ...
def translation(domain, localedir=..., languages=..., class_=..., fallback=...,
codeset=...): ...
def install(domain, localedir=..., codeset=..., names=...): ...
def textdomain(domain=...): ...
def bindtextdomain(domain, localedir=...): ...
def dgettext(domain, message): ...
def dngettext(domain, msgid1, msgid2, n): ...
def gettext(message): ...
def ngettext(msgid1, msgid2, n): ...
def find(domain: str, localedir: str = ..., languages: List[str] = ...,
all: bool = ...): ...
Catalog = ... # type: Any
def translation(domain: str, localedir: str = ..., languages: List[str] = ...,
class_: Callable[[IO[str]], NullTranslations] = ...,
fallback: bool =... , codeset: Any = ...) -> NullTranslations: ...
def install(domain: str, localedir: str = ..., codeset: Any = ...,
names: List[str] = ...): ...
def textdomain(domain: str = ...) -> str: ...
def bindtextdomain(domain: str, localedir: str = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = ...) -> str: ...
def dgettext(domain: str, message: str) -> str: ...
def ldgettext(domain: str, message: str) -> str: ...
def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def gettext(message: str) -> str: ...
def lgettext(message: str) -> str: ...
def ngettext(singular: str, plural: str, n: int) -> str: ...
def lngettext(singular: str, plural: str, n: int) -> str: ...
Catalog = translation