[issue32212] few discrepancy between source and docs in logging

2017-12-04 Thread Michal Plichta

Michal Plichta <mplic...@gmail.com> added the comment:

Nice, btw maybe other parameters in logging's docs needs to be corrected.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32212>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32212] few discrepancy between source and docs in logging

2017-12-04 Thread Michal Plichta

Michal Plichta <mplic...@gmail.com> added the comment:

see at typeshed:
https://github.com/python/typeshed/blob/master/stdlib/2and3/logging/__init__.pyi#L147

def setLevel(self, lvl: Union[int, str]) -> None: ...
def setFormatter(self, form: 'Formatter') -> None: ...

this match python documentation:
Handler.setLevel(lvl)
Handler.setFormatter(form)

but is source code (logging/__init__.py):
def setFormatter(self, fmt):
self.formatter = f

def setLevel(self, level):
self.level = _checkLevel(level)

This is not big deal but keyworded arguments have different names fmt, form and 
level, lvl.

Some tools which perform static code verification are base of *.pyi from 
typeshed repo and some form source code.

--

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32212>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32212] few discrepancy between source and docs in logging

2017-12-04 Thread Michal Plichta

New submission from Michal Plichta <mplic...@gmail.com>:

my code:

logger = logging.getLogger(name)
logger.setLevel(level=logging.DEBUG)
...
stream_handler = logging.StreamHandler(stream=stdout)
stream_handler.setLevel(logging_level)
stream_handler.setFormatter(fmt=formatter)

and mypy-0.550 complains about fmt vs. form parameter in setFormatter method 
and level vs. lvl in setLevel method.

ta_cc/cc_logger.py: note: In function "_get_stream_handler":
ta_cc/cc_logger.py:34: error: Unexpected keyword argument "fmt" for 
"setFormatter" of "Handler"
/usr/local/lib/mypy/typeshed/stdlib/2and3/logging/__init__.pyi:147: note: 
"setFormatter" of "Handler" defined here
ta_cc/cc_logger.py:109: error: Unexpected keyword argument "level" for 
"setLevel" of "Logger"
/usr/local/lib/mypy/typeshed/stdlib/2and3/logging/__init__.pyi:46: note: 
"setLevel" of "Logger" defined here

I see in online documentation that indeed there are lvl and form parameters for 
all 2.7, 3.5 and 3.6 python version. However my Pycharm suggest level and fmt 
for all my installed python interpreters.

I use:
Pycharm-2017.3
Python 2.7.12
Python 3.5.2
Python 3.6.3

This is copy of my issue of: https://github.com/python/typeshed/issues/1619

--
assignee: docs@python
components: Documentation
messages: 307547
nosy: Michal Plichta, docs@python
priority: normal
severity: normal
status: open
title: few discrepancy between source and docs in logging
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32212>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com