-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
"Internal error" while logging non-string messages #49
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
* Accept numbers (int,float) for loguru calls Partially: #49
As mentioned in #42 (comment) I'd like to work on the 3rd case (variables): from loguru import logger
foo = "bar"
logger.info(foo) |
Partially fixes kornicameister#49 Note that mypy _cannot_ type-check a format expression if it is not Final. E.g.: ```python from loguru import logger from typing import Final foo: Final = "bar" logger.info(foo, 1) # error: Not all arguments converted during string formatting foo = "bar" logger.info(foo, 1) # no error (and will fail at runtime) ``` This is a limitation with mypy and I don't think we can do much about it
Fixes example 3 of kornicameister#49 Note that mypy _cannot_ type-check a format expression if it is not Final. E.g.: ```python from loguru import logger from typing import Final foo: Final = "bar" logger.info(foo, 1) # error: Not all arguments converted during string formatting foo = "bar" logger.info(foo, 1) # no error (and will fail at runtime) ``` This is a limitation with mypy and I don't think we can do much about it
Fixes example 3 of kornicameister#49 Note that mypy _cannot_ type-check a format expression if it is not Final. E.g.: ```python from loguru import logger from typing import Final foo: Final = "bar" logger.info(foo, 1) # error: Not all arguments converted during string formatting foo = "bar" logger.info(foo, 1) # no error (and will fail at runtime) ``` This is a limitation with mypy and I don't think we can do much about it
Fixes example 3 of kornicameister#49 Note that mypy _cannot_ type-check a format expression if it is not Final. E.g.: ```python from loguru import logger from typing import Final foo: Final = "bar" logger.info(foo, 1) # error: Not all arguments converted during string formatting foo = "bar" logger.info(foo, 1) # no error (and will fail at runtime) ``` This is a limitation with mypy and I don't think we can do much about it
Ok, I believe we have number 3 fixed, like @ThibaultLemaire did in b608dc0. I believe those are:
If I made a mistake, please correct me here. |
Looks like another funny bit has been implemented as part of #81. That will give us a single argument variation on non-str arguments, if i am correct. |
Hi! :)
It seems that some expressions are not recognized and generate an internal error in the plugin. It happens due to the
assert
here:loguru-mypy/loguru_mypy/__init__.py
Line 57 in 74d4af6
Actually, the argument does not necessarily needs to be string. Here are some examples that generate an error.
Which results in:
The text was updated successfully, but these errors were encountered: