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'm using libraries which import _RATIONAL_FORMAT:
...
fromfractionsimport_RATIONAL_FORMAT
...
but running mypy against them leads to this error:
error: Module "fractions" has no attribute "_RATIONAL_FORMAT" [attr-defined]
Is it not possible to add an entry for _RATIONAL_FORMAT? It is private, but really useful when validating numeric strings.
I saw some relevant discussion on this type of error in the mypy repo, but the solution proposed there does not work for me - it was to rewrite that particular import as an aliased import (using as), and setting the config. option implicit_reexport to true in [tool.mypy] in my project TOML. But that does not work.
My [tool.mypy] section in the project TOML looks like this:
We accept private fields on request. Please just open a PR if you want to add this to the module. Per our policy, I'm going to close this issue in the meantime.
The stub file for the
fractions
standard library is missing an entry for_RATIONAL_FORMAT
, which is a compiled regular expression.I'm using libraries which import
_RATIONAL_FORMAT
:but running mypy against them leads to this error:
Is it not possible to add an entry for
_RATIONAL_FORMAT
? It is private, but really useful when validating numeric strings.I saw some relevant discussion on this type of error in the mypy repo, but the solution proposed there does not work for me - it was to rewrite that particular import as an aliased import (using
as
), and setting the config. optionimplicit_reexport
totrue
in[tool.mypy]
in my project TOML. But that does not work.My
[tool.mypy]
section in the project TOML looks like this:I'm using
mypy
version 1.9.0 and Python 3.11.2.The text was updated successfully, but these errors were encountered: