Skip to content

Commit

Permalink
Merge pull request #1099 from hf-kklein/specific_type_ignore
Browse files Browse the repository at this point in the history
specify ignored mypy error by using `type: ignore[error]` in lark/tree.py and lark/utils.py
  • Loading branch information
erezsh authored Feb 8, 2022
2 parents 24ae421 + add2b33 commit ea5cd4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lark/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def iter_subtrees(self) -> 'Iterator[Tree[_Leaf_T]]':
for subtree in queue:
subtrees[id(subtree)] = subtree
# Reason for type ignore https://github.com/python/mypy/issues/10999
queue += [c for c in reversed(subtree.children) # type: ignore
queue += [c for c in reversed(subtree.children) # type: ignore[misc]
if isinstance(c, Tree) and id(c) not in subtrees]

del queue
Expand Down Expand Up @@ -204,7 +204,7 @@ def pydot__tree_to_graph(tree: Tree, rankdir="LR", **kwargs):
possible attributes, see https://www.graphviz.org/doc/info/attrs.html.
"""

import pydot # type: ignore
import pydot # type: ignore[import]
graph = pydot.Dot(graph_type='digraph', rankdir=rankdir, **kwargs)

i = [0]
Expand Down
2 changes: 1 addition & 1 deletion lark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def combine_alternatives(lists):
try:
import atomicwrites
except ImportError:
atomicwrites = None # type: ignore
atomicwrites = None # type: ignore[assigment]

class FS:
exists = staticmethod(os.path.exists)
Expand Down

0 comments on commit ea5cd4a

Please sign in to comment.