Skip to content
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

specify ignored mypy error by using type: ignore[error] in lark/tree.py and lark/utils.py #1099

Merged
merged 1 commit into from
Feb 8, 2022
Merged

specify ignored mypy error by using type: ignore[error] in lark/tree.py and lark/utils.py #1099

merged 1 commit into from
Feb 8, 2022

Conversation

hf-kklein
Copy link
Contributor

instead of plain ignore

@hf-kklein hf-kklein marked this pull request as ready for review February 8, 2022 17:57
@hf-kklein hf-kklein changed the title specify ignored mypy error by using type: ignore[error] specify ignored mypy error by using type: ignore[error] in lark/tree.py Feb 8, 2022
@hf-kklein hf-kklein changed the title specify ignored mypy error by using type: ignore[error] in lark/tree.py specify ignored mypy error by using type: ignore[error] in lark/tree.py and lark/utils.py Feb 8, 2022
@erezsh
Copy link
Member

erezsh commented Feb 8, 2022

Just curious, what is the benefit of this change?

@hf-kklein
Copy link
Contributor Author

Just curious, what is the benefit of this change?

IMHO it's always better to only ignore specific linter warnings; In the same manner as it's always better to catch specific errors instead of a catch all/broad except.

@erezsh
Copy link
Member

erezsh commented Feb 8, 2022

Well, I guess.

It's a little different with exceptions though, since they can jump out of nested functions. Whereas here the "catcher" is tied directly to the line itself.

Copy link
Member

@MegaIng MegaIng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not that experienced with mypy. Maybe we should ask someone else as well?

@erezsh
Copy link
Member

erezsh commented Feb 8, 2022

I have. I'll wait to see what he thinks. (though it's probably a non-issue)

@hf-kklein
Copy link
Contributor Author

I'll wait to see what he thinks.

he uses the same style already ;)

self.base_func = func # type: ignore[assignment]

@erezsh
Copy link
Member

erezsh commented Feb 8, 2022

Fair enough.

@erezsh erezsh merged commit ea5cd4a into lark-parser:master Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants