Skip to content

Commit

Permalink
touchups from review
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug committed Jan 8, 2025
1 parent 1ec6a4a commit 30d6c40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/extra/lark.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __init__(
)
self.terminal_strategies.update(explicit)

# TODO: should this be NonTerminal only? but rule.expansion is Symbol...
# can in fact contain any symbol, despite its name.
nonterminals: dict[str, list[tuple[Symbol, ...]]] = {}

for rule in rules:
Expand Down
9 changes: 5 additions & 4 deletions hypothesis-python/src/hypothesis/vendor/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def __init__(
*,
context: Optional["BuildContext"] = None,
) -> None:
"""Pass the output stream, and optionally the current build context.
"""Optionally pass the output stream and the current build context.
We use the context to represent objects constructed by strategies by showing
*how* they were constructed, and add annotations showing which parts of the
Expand Down Expand Up @@ -456,7 +456,9 @@ def repr_call(
func_name = f"({func_name})"
self.text(func_name)
all_args = [(None, v) for v in args] + list(kwargs.items())
comments = {
# int indicates the position of a positional argument, rather than a keyword
# argument. Currently no callers use this; see #3624.
comments: dict[Union[int, str], object] = {
k: self.slice_comments[v]
for k, v in (arg_slices or {}).items()
if v in self.slice_comments
Expand Down Expand Up @@ -492,8 +494,7 @@ def repr_call(
self.text(",")
comment = None
if k is not None:
# Optional comments are used to annotate which-parts-matter
comment = comments.get(k)
comment = comments.get(i) or comments.get(k)
if comment:
self.text(f" # {comment}")
if all_args and force_split:
Expand Down

0 comments on commit 30d6c40

Please sign in to comment.