| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,8 +8,16 @@ python_version = 3.10 | |||
| 8 | 8 | ||
| 9 | 9 | # Be strict... | |
| 10 | 10 | strict = True | |
| 11 | - enable_error_code = truthy-bool,ignore-without-code | ||
| 11 | + warn_unreachable = True | ||
| 12 | + enable_error_code = truthy-bool,ignore-without-code,redundant-expr | ||
| 12 | 13 | ||
| 13 | - # except for a few settings that can't yet be enabled: | ||
| 14 | + # This causes *many* false positives on the peg_generator | ||
| 15 | + # due to pegen.grammar.GrammarVisitor returning Any from visit() and generic_visit(). | ||
| 16 | + # It would be possible to workaround the false positives using asserts, | ||
| 17 | + # but it would be pretty tedious, and probably isn't worth it. | ||
| 14 | 18 | warn_return_any = False | |
| 15 | - warn_unreachable = False | ||
| 19 | + | ||
| 20 | + # Not all of the strictest settings can be enabled | ||
| 21 | + # on generated Python code yet: | ||
| 22 | + [mypy-pegen.grammar_parser.*] | ||
| 23 | + disable_error_code = redundant-expr | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -66,6 +66,4 @@ def _format(node: Any, level: int = 0) -> Tuple[str, bool]: | |||
| 66 | 66 | ||
| 67 | 67 | if all(cls.__name__ != "AST" for cls in node.__class__.__mro__): | |
| 68 | 68 | raise TypeError("expected AST, got %r" % node.__class__.__name__) | |
| 69 | - if indent is not None and not isinstance(indent, str): | ||
| 70 | - indent = " " * indent | ||
| 71 | 69 | return _format(node)[0] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,8 +112,7 @@ def __str__(self) -> str: | |||
| 112 | 112 | return self.value | |
| 113 | 113 | ||
| 114 | 114 | def __iter__(self) -> Iterable[str]: | |
| 115 | - if False: | ||
| 116 | - yield | ||
| 115 | + yield from () | ||
| 117 | 116 | ||
| 118 | 117 | ||
| 119 | 118 | class NameLeaf(Leaf): | |
@@ -335,8 +334,7 @@ def __str__(self) -> str: | |||
| 335 | 334 | return f"~" | |
| 336 | 335 | ||
| 337 | 336 | def __iter__(self) -> Iterator[Tuple[str, str]]: | |
| 338 | - if False: | ||
| 339 | - yield | ||
| 337 | + yield from () | ||
| 340 | 338 | ||
| 341 | 339 | def __eq__(self, other: object) -> bool: | |
| 342 | 340 | if not isinstance(other, Cut): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments