-
Notifications
You must be signed in to change notification settings - Fork 26
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
fix locale parsing on Linux #834
Conversation
Linux uses locale string `en_US.utf-8` instead `en-us.utf-8`. So I added a statement to convert between them correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i guess that VSCODE_NLS_CONFIG
variable uses a different format to everything else. thanks!
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
- Type of "eq" is "_NotImplementedType | Unknown" (reportUnknownVariableType)
+ Type of "eq" is "_NotImplementedType | GreaterThan | Unknown | Equality | Relational | Unequality" (reportUnknownVariableType)
- Type of "default_sort_key" is "(item: Unknown, order: Unknown | None = None) -> (tuple[tuple[Literal[5], Literal[0], str], tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownVariableType)
+ Type of "default_sort_key" is "(item: Unknown, order: Unknown | None = None) -> (tuple[Unknown, tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownVariableType)
- Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[tuple[Literal[5], Literal[0], str], tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
+ Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[Unknown, tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
- Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[tuple[Literal[5], Literal[0], str], tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
+ Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[Unknown, tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
- Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[tuple[Literal[5], Literal[0], str], tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
+ Argument type is "(item: Unknown, order: Unknown | None = None) -> (tuple[Unknown, tuple[int, tuple[Unknown, ...]], Unknown, Unknown] | Unknown | tuple[tuple[int, int, str | Unknown], tuple[int, tuple[Unknown, ...]] | tuple[int, tuple[str]], Unknown, Unknown])" (reportUnknownArgumentType)
- Type of "evalf" is "Unknown | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Equality | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Relational | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Unequality | EvalfMixin* | Any))" (reportUnknownMemberType)
+ Type of "evalf" is "Unknown | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Equality | EvalfMixin* | Any | Float)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Relational | EvalfMixin* | Any | Float)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Unequality | EvalfMixin* | Any | Float))" (reportUnknownMemberType)
- Type of "evalf" is "Unknown | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Equality | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Relational | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Unequality | EvalfMixin* | Any))" (reportUnknownMemberType)
+ Type of "evalf" is "Unknown | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Equality | EvalfMixin* | Any | Float)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Relational | EvalfMixin* | Any | Float)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Unequality | EvalfMixin* | Any | Float))" (reportUnknownMemberType)
- Type of "evalf" is "Unknown | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Mul | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Expectation | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Sum | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Self@Expr | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Order | EvalfMixin* | Any)) | Any | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Piecewise | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Equality | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Relational | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Unequality | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | Integral | EvalfMixin* | Any)) | ((n: int = 15, subs: Unknown | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: Unknown | None = None, verbose: bool = False) -> (Unknown | ExpectationMatrix | EvalfMixin* | Any))" (reportUnknownMemberType)
... (truncated 85 lines) ...
comtypes (https://github.com/enthought/comtypes): 277.37x slower (0.1s -> 24.8s in a single noisy sample)
|
Although this fix is already accepted here a few weeks ago, I'm very glad to see it.
Yes, and exactly locale names are slightly different generally in the whole Windows. From Locale names in Windows CRT Documentation we can know that the About a few days before this PR, I created an issue microsoft/pyright#9269 about this and I've been told it is as designed. |
Linux uses locale string
en_US.utf-8
insteaden-us.utf-8
. So I added a statement to convert between them correctly.