Skip to content

Commit

Permalink
revert the 'require a for' change, it was the wrong solution
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Oct 3, 2024
1 parent fb4f971 commit 6651ded
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bikeshed/refs/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def forRefsIterator(targetFors: str | list[str]) -> t.Generator[t.RefWrapper, No
if exact:
refs = list(textRefsIterator([text]))
else:
textsToSearch = list(utils.linkTextVariations(text, linkType, linkFor))
textsToSearch = list(utils.linkTextVariations(text, linkType))

if any(st.endswith("()") for st in textsToSearch):
# Let argless methods (either with () at the end, or no parens at all)
Expand Down
8 changes: 2 additions & 6 deletions bikeshed/refs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ def filterOldVersions(refs: list[t.RefWrapper], status: str | None = None) -> li
return refs


def linkTextVariations(
str: str, linkType: str | None, linkFor: str | list[str] | None = None
) -> t.Generator[str, None, None]:
def linkTextVariations(str: str, linkType: str | None) -> t.Generator[str, None, None]:
# Generate intelligent variations of the provided link text,
# so explicitly adding an lt attr isn't usually necessary.
str = str.strip()
Expand Down Expand Up @@ -174,9 +172,7 @@ def linkTextVariations(

# Let people refer to methods without the parens.
# Since attrs and methods live in the same namespace, this is safe.
# But we want to avoid *other* confusions, like an interface and its constructor,
# so qualify it on there being a for value.
if linkFor and "(" not in str:
if "(" not in str:
yield str + "()"

# Allow linking to an enum-value with or without quotes
Expand Down

0 comments on commit 6651ded

Please sign in to comment.