1
1
## Stubs for logging (Python 3.4)
2
2
3
3
from typing import (
4
- Any , Callable , Iterable , Mapping , MutableMapping , Optional , IO , Tuple ,
5
- Text , Union ,
6
- overload ,
4
+ Any , Callable , Dict , Iterable , Mapping , MutableMapping , Optional , IO ,
5
+ Tuple , Text , Union , overload ,
7
6
)
7
+ from string import Template
8
+ from time import struct_time
8
9
from types import TracebackType
9
10
import sys
10
11
@@ -26,7 +27,7 @@ class Logger:
26
27
handlers = ... # type: List[Handler]
27
28
disabled = ... # type: int
28
29
def setLevel (self , lvl : Union [int , str ]) -> None : ...
29
- def isEnabledFor (self , lvl : int ) -> Union [ int , bool ] : ...
30
+ def isEnabledFor (self , lvl : int ) -> bool : ...
30
31
def getEffectiveLevel (self ) -> int : ...
31
32
def getChild (self , suffix : str ) -> 'Logger' : ...
32
33
if sys .version_info > (3 ,):
@@ -135,6 +136,14 @@ class Handler:
135
136
136
137
137
138
class Formatter :
139
+ converter = ... # type: Callable[[Optional[float]], struct_time]
140
+ _fmt = ... # type: Optional[str]
141
+ datefmt = ... # type: Optional[str]
142
+ if sys .version_info >= (3 ,):
143
+ _style = ... # type: PercentStyle
144
+ default_time_format = ... # type: str
145
+ default_msec_format = ... # type: str
146
+
138
147
if sys .version_info >= (3 ,):
139
148
def __init__ (self , fmt : Optional [str ] = ...,
140
149
datefmt : Optional [str ] = ...,
@@ -143,6 +152,7 @@ class Formatter:
143
152
def __init__ (self ,
144
153
fmt : Optional [str ] = ...,
145
154
datefmt : Optional [str ] = ...) -> None : ...
155
+
146
156
def format (self , record : LogRecord ) -> str : ...
147
157
def formatTime (self , record : LogRecord , datefmt : str = ...) -> str : ...
148
158
def formatException (self , exc_info : _SysExcInfoType ) -> str : ...
@@ -240,7 +250,7 @@ class LoggerAdapter:
240
250
def log (self ,
241
251
lvl : int , msg : Text , * args : Any , exc_info : _ExcInfoType = ...,
242
252
extra : Dict [str , Any ] = ..., ** kwargs : Any ) -> None : ...
243
- def isEnabledFor (self , lvl : int ) -> Union [ int , bool ] : ...
253
+ def isEnabledFor (self , lvl : int ) -> bool : ...
244
254
if sys .version_info >= (3 ,):
245
255
def getEffectiveLevel (self ) -> int : ...
246
256
def setLevel (self , lvl : Union [int , str ]) -> None : ...
@@ -353,3 +363,24 @@ class RootLogger(Logger):
353
363
pass
354
364
355
365
root = ... # type: RootLogger
366
+
367
+
368
+ if sys .version_info >= (3 ,):
369
+ class PercentStyle (object ):
370
+ default_format = ... # type: str
371
+ asctime_format = ... # type: str
372
+ asctime_search = ... # type: str
373
+ _fmt = ... # type: str
374
+
375
+ def __init__ (self , fmt ) -> None : ...
376
+ def usesTime (self ) -> bool : ...
377
+ def format (self , record : Any ) -> str : ...
378
+
379
+ class StrFormatStyle (PercentStyle ):
380
+ ...
381
+
382
+ class StringTemplateStyle (PercentStyle ):
383
+ _tpl = ... # type: Template
384
+
385
+ BASIC_FORMAT = ... # type: str
386
+ _STYLES = ... # type: Dict[str, Tuple[PercentStyle, str]]
0 commit comments