You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked in the logging standard library and to me it seems that FileHandler has a standard mro, inheriting set_name from Handler, yet mypy complains:
Looks like there are several improvements to be made to logging:
Details
λ stubtest logging --concise --custom-typeshed-dir .
logging.BufferingFormatter is not present in stub
logging.Formatter.usesTime is not present in stub
logging.Handler.get_name is not present in stub
logging.Handler.set_name is not present in stub
logging.Logger.callHandlers is not present in stub
logging.Logger.fatal is not present in stub
logging.LoggerAdapter.manager is not present in stub
logging.LoggerAdapter.name is not present in stub
logging.PercentStyle.validate is not present in stub
logging.PercentStyle.validation_pattern is not present in stub
logging.StrFormatStyle.field_spec is not present in stub
logging.StrFormatStyle.fmt_spec is not present in stub
logging.StrFormatStyle.validate is not present in stub
logging.StringTemplateStyle.validate is not present in stub
logging.config.BaseConfigurator is not present in stub
logging.config.ConvertingDict is not present in stub
logging.config.ConvertingList is not present in stub
logging.config.ConvertingMixin is not present in stub
logging.config.ConvertingTuple is not present in stub
logging.config.DictConfigurator is not present in stub
logging.config.dictConfigClass is not present in stub
logging.config.valid_ident is not present in stub
logging.handlers.QueueListener.handle is not present in stub
logging.handlers.RotatingFileHandler.shouldRollover is not present in stub
logging.handlers.SysLogHandler.append_nul is not present in stub
logging.handlers.TimedRotatingFileHandler.computeRollover is not present in stub
logging.handlers.TimedRotatingFileHandler.getFilesToDelete is not present in stub
logging.handlers.TimedRotatingFileHandler.shouldRollover is not present in stub
logging.handlers.WatchedFileHandler.reopenIfNeeded is not present in stub
Looks like there are several improvements to be made...
Hiya! Thanks for taking action on this, but I'm a bit confused as to why this is a typeshed issue, can you please help me fix my thoughts? I think:
typeshed adds type hints / stubs to standard library
type hints help with in/out types of methods like set_name
mypy's error "has no attribute" is unrelated to type hints. I think this because another tool pylint gives no error:
$ pylint example.py --disable=missing-module-docstring
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Stubs also define existence. mypy doesn't look at actual code at all when there are stubs (nor would that be possible for C extensions).
I'm not familiar enough with pylint to know why it does what it does (Does it complain if you access logging.Handler.asdfjhaskjdfhaks? Does it import stdlib modules and dynamically introspect them?).
mypy doesn't look at actual code at all when there are stubs
Ah, you have cleared my confusion! I might have a stab at this myself if I have free time over the next week.
I'm not familiar enough with pylint...
$ echo"h.nonexistant()">> example.py
$ pylint example --disable=missing-module-docstring
************* Module example
example:5:0: E1101: Instance of 'FileHandler' has no 'nonexistant' member (no-member)
---------------------------------------------------------------------
Your code has been rated at -2.50/10 (previous run: 10.00/10, -12.50)
Activity
hauntsaninja commentedon Apr 26, 2021
Looks like there are several improvements to be made to
logging:Details
spagh-eddie commentedon Apr 26, 2021
Hiya! Thanks for taking action on this, but I'm a bit confused as to why this is a
typeshedissue, can you please help me fix my thoughts? I think:typeshedadds type hints / stubs to standard libraryset_namemypy's error "has no attribute" is unrelated to type hints. I think this because another toolpylintgives no error:hauntsaninja commentedon Apr 26, 2021
Stubs also define existence. mypy doesn't look at actual code at all when there are stubs (nor would that be possible for C extensions).
I'm not familiar enough with pylint to know why it does what it does (Does it complain if you access logging.Handler.asdfjhaskjdfhaks? Does it import stdlib modules and dynamically introspect them?).
spagh-eddie commentedon Apr 27, 2021
Ah, you have cleared my confusion! I might have a stab at this myself if I have free time over the next week.
wiseaidev commentedon May 8, 2021
Let's see what do we have here. Looks interesting!
Akuli commentedon May 12, 2021
fixed in #5388