Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add mypy stubs (Fixes #240) #283

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ universal=1
license-file = LICENSE

[flake8]
max-line-length = 110
max-line-length = 110

[mypy]
mypy_path = stubs/
4 changes: 4 additions & 0 deletions stubs/future/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__ver_major__: int
__ver_minor__: int
__ver_patch__: int
__ver_sub__: str
4 changes: 4 additions & 0 deletions stubs/future/backports/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .misc import ChainMap as ChainMap, Counter as Counter, OrderedDict as OrderedDict, ceil as ceil, check_output as check_output, cmp_to_key as cmp_to_key, count as count, recursive_repr as recursive_repr
from future.standard_library import import_top_level_modules as import_top_level_modules

__future_module__: bool
14 changes: 14 additions & 0 deletions stubs/future/backports/_markupbase.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Any

class ParserBase:
def __init__(self) -> None: ...
def error(self, message: Any) -> None: ...
lineno: int = ...
offset: int = ...
def reset(self) -> None: ...
def getpos(self): ...
def updatepos(self, i: Any, j: Any): ...
def parse_declaration(self, i: Any): ...
def parse_marked_section(self, i: Any, report: int = ...): ...
def parse_comment(self, i: Any, report: int = ...): ...
def unknown_decl(self, data: Any) -> None: ...
172 changes: 172 additions & 0 deletions stubs/future/backports/datetime.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
from _datetime import *
from _datetime import __doc__ as __doc__
from future.builtins import bytes as bytes, int as int, map as map, object as object, round as round, str as str
from future.utils import PY2 as PY2, native_str as native_str
from typing import Any, Optional

MINYEAR: int
MAXYEAR: int
dbm: int

class timedelta:
def __new__(cls, days: int = ..., seconds: int = ..., microseconds: int = ..., milliseconds: int = ..., minutes: int = ..., hours: int = ..., weeks: int = ...): ...
def total_seconds(self): ...
@property
def days(self): ...
@property
def seconds(self): ...
@property
def microseconds(self): ...
def __add__(self, other: Any): ...
__radd__: Any = ...
def __sub__(self, other: Any): ...
def __rsub__(self, other: Any): ...
def __neg__(self): ...
def __pos__(self): ...
def __abs__(self): ...
def __mul__(self, other: Any): ...
__rmul__: Any = ...
def __floordiv__(self, other: Any): ...
def __truediv__(self, other: Any): ...
def __mod__(self, other: Any): ...
def __divmod__(self, other: Any): ...
def __eq__(self, other: Any) -> Any: ...
def __ne__(self, other: Any) -> Any: ...
def __le__(self, other: Any) -> Any: ...
def __lt__(self, other: Any) -> Any: ...
def __ge__(self, other: Any) -> Any: ...
def __gt__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ...
def __bool__(self): ...
def __reduce__(self): ...

class date:
def __new__(cls, year: Any, month: Optional[Any] = ..., day: Optional[Any] = ...): ...
@classmethod
def fromtimestamp(cls, t: Any): ...
@classmethod
def today(cls): ...
@classmethod
def fromordinal(cls, n: Any): ...
def ctime(self): ...
def strftime(self, fmt: Any): ...
def __format__(self, fmt: Any): ...
def isoformat(self): ...
@property
def year(self): ...
@property
def month(self): ...
@property
def day(self): ...
def timetuple(self): ...
def toordinal(self): ...
def replace(self, year: Optional[Any] = ..., month: Optional[Any] = ..., day: Optional[Any] = ...): ...
def __eq__(self, other: Any) -> Any: ...
def __ne__(self, other: Any) -> Any: ...
def __le__(self, other: Any) -> Any: ...
def __lt__(self, other: Any) -> Any: ...
def __ge__(self, other: Any) -> Any: ...
def __gt__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ...
def __add__(self, other: Any): ...
__radd__: Any = ...
def __sub__(self, other: Any): ...
def weekday(self): ...
def isoweekday(self): ...
def isocalendar(self): ...
def __reduce__(self): ...

class tzinfo:
def tzname(self, dt: Any) -> None: ...
def utcoffset(self, dt: Any) -> None: ...
def dst(self, dt: Any) -> None: ...
def fromutc(self, dt: Any): ...
def __reduce__(self): ...

class time:
def __new__(cls, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[Any] = ...): ...
@property
def hour(self): ...
@property
def minute(self): ...
@property
def second(self): ...
@property
def microsecond(self): ...
@property
def tzinfo(self): ...
def __eq__(self, other: Any) -> Any: ...
def __ne__(self, other: Any) -> Any: ...
def __le__(self, other: Any) -> Any: ...
def __lt__(self, other: Any) -> Any: ...
def __ge__(self, other: Any) -> Any: ...
def __gt__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ...
def isoformat(self): ...
def strftime(self, fmt: Any): ...
def __format__(self, fmt: Any): ...
def utcoffset(self): ...
def tzname(self): ...
def dst(self): ...
def replace(self, hour: Optional[Any] = ..., minute: Optional[Any] = ..., second: Optional[Any] = ..., microsecond: Optional[Any] = ..., tzinfo: bool = ...): ...
def __bool__(self): ...
def __reduce__(self): ...

class datetime(date):
def __new__(cls, year: Any, month: Optional[Any] = ..., day: Optional[Any] = ..., hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo: Optional[Any] = ...): ...
@property
def hour(self): ...
@property
def minute(self): ...
@property
def second(self): ...
@property
def microsecond(self): ...
@property
def tzinfo(self): ...
@classmethod
def fromtimestamp(cls, t: Any, tz: Optional[Any] = ...): ...
@classmethod
def utcfromtimestamp(cls, t: Any): ...
@classmethod
def now(cls, tz: Optional[Any] = ...): ...
@classmethod
def utcnow(cls): ...
@classmethod
def combine(cls, date: Any, time: Any): ...
def timetuple(self): ...
def timestamp(self): ...
def utctimetuple(self): ...
def date(self): ...
def time(self): ...
def timetz(self): ...
def replace(self, year: Optional[Any] = ..., month: Optional[Any] = ..., day: Optional[Any] = ..., hour: Optional[Any] = ..., minute: Optional[Any] = ..., second: Optional[Any] = ..., microsecond: Optional[Any] = ..., tzinfo: bool = ...): ...
def astimezone(self, tz: Optional[Any] = ...): ...
def ctime(self): ...
def isoformat(self, sep: str = ...): ...
@classmethod
def strptime(cls, date_string: Any, format: Any): ...
def utcoffset(self): ...
def tzname(self): ...
def dst(self): ...
def __eq__(self, other: Any) -> Any: ...
def __ne__(self, other: Any) -> Any: ...
def __le__(self, other: Any) -> Any: ...
def __lt__(self, other: Any) -> Any: ...
def __ge__(self, other: Any) -> Any: ...
def __gt__(self, other: Any) -> Any: ...
def __add__(self, other: Any): ...
__radd__: Any = ...
def __sub__(self, other: Any): ...
def __hash__(self) -> Any: ...
def __reduce__(self): ...

class timezone(tzinfo):
def __new__(cls, offset: Any, name: Any = ...): ...
def __getinitargs__(self): ...
def __eq__(self, other: Any) -> Any: ...
def __hash__(self) -> Any: ...
def utcoffset(self, dt: Any): ...
def tzname(self, dt: Any): ...
def dst(self, dt: Any) -> None: ...
def fromutc(self, dt: Any): ...
21 changes: 21 additions & 0 deletions stubs/future/backports/email/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import Any

def message_from_string(s: Any, *args: Any, **kws: Any): ...
def message_from_bytes(s: Any, *args: Any, **kws: Any): ...
def message_from_file(fp: Any, *args: Any, **kws: Any): ...
def message_from_binary_file(fp: Any, *args: Any, **kws: Any): ...

# Names in __all__ with no definition:
# base64mime
# charset
# encoders
# errors
# feedparser
# generator
# header
# iterators
# message
# mime
# parser
# quoprimime
# utils
15 changes: 15 additions & 0 deletions stubs/future/backports/email/_encoded_words.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from typing import Any, Optional

def decode_q(encoded: Any): ...

class _QByteMap(dict):
safe: Any = ...
def __missing__(self, key: Any): ...

def encode_q(bstring: Any): ...
def len_q(bstring: Any): ...
def decode_b(encoded: Any): ...
def encode_b(bstring: Any): ...
def len_b(bstring: Any): ...
def decode(ew: Any): ...
def encode(string: Any, charset: str = ..., encoding: Optional[Any] = ..., lang: str = ...): ...
Loading