From 75b3d91e026c0d35d9a20cde54995488c5cd4a20 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Mon, 12 Oct 2015 10:44:45 -0700 Subject: [PATCH] fixes for types.CodeType (in 2.7/ and 3/) --- stdlib/2.7/types.pyi | 16 ++++++++++++++++ stdlib/3/types.pyi | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/stdlib/2.7/types.pyi b/stdlib/2.7/types.pyi index 20e06de5b..6baf5d362 100644 --- a/stdlib/2.7/types.pyi +++ b/stdlib/2.7/types.pyi @@ -18,3 +18,19 @@ class GeneratorType: class ListType: ... + +class CodeType: + co_argcount = ... # type: int + co_cellvars = ... # type: Tuple[str] + co_code = ... # type: str + co_consts = ... # type: Tuple[Any] + co_filename = ... # type: Optional[str] + co_firstlineno = ... # type: int + co_flags = ... # type: int + co_freevars = ... # type: Tuple[str] + co_lnotab = ... # type: str + co_name = ... # type: str + co_names = ... # type: Tuple[str] + co_nlocals= ... # type: int + co_stacksize= ... # type: int + co_varnames = ... # type: Tuple[str] diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 80f4ac02c..293ae2cba 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -14,6 +14,21 @@ class BuiltinMethodType: ... class CodeType: """Create a code object. Not for the faint of heart.""" + co_argcount = ... # type: int + co_kwonlyargcount = ... # type: int + co_nlocals = ... # type: int + co_stacksize = ... # type: int + co_flags = ... # type: int + co_code = ... # type: bytes + co_consts = ... # type: Tuple[Any] + co_names = ... # type: Tuple[str] + co_varnames = ... # type: Tuple[str] + co_filename = # type: Optional[str] + co_name = ... # type: str + co_firstlineno = ... # type: int + co_lnotab = ... # type: bytes + co_freevars = ... # type: Tuple[str] + co_cellvars = ... # type: Tuple[str] def __init__(self, argcount: int, kwonlyargcount: int, @@ -30,22 +45,7 @@ class CodeType: lnotab: bytes, freevars: Sequence[str] = (), cellvars: Sequence[str] = (), - ) -> None: - self.co_argcount = argcount - self.co_kwonlyargcount = kwonlyargcount - self.co_nlocals = nlocals - self.co_stacksize = stacksize - self.co_flags = flags - self.co_code = codestring - self.co_consts = constants - self.co_names = names - self.co_varnames = varnames - self.co_filename = filename - self.co_name = name - self.co_firstlineno = firstlineno - self.co_lnotab = lnotab - self.co_freevars = freevars - self.co_cellvars = cellvars + ) -> None: ... class FrameType: f_back = ... # type: FrameType