Skip to content

Commit

Permalink
wip markdown links
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed May 31, 2024
1 parent 6527dc8 commit 0b95982
Show file tree
Hide file tree
Showing 16 changed files with 285 additions and 84 deletions.
6 changes: 2 additions & 4 deletions bikeshed/biblio.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ def url(self) -> str:
raise ValueError(msg)

@abc.abstractmethod
def toHTML(self) -> t.NodesT:
...
def toHTML(self) -> t.NodesT: ...

@abc.abstractmethod
def valid(self) -> bool:
...
def valid(self) -> bool: ...

def strip(self) -> BiblioEntry:
self.linkText = self.linkText.strip()
Expand Down
9 changes: 3 additions & 6 deletions bikeshed/config/BoolSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,13 @@ def hasExplicit(self, key: t.Any) -> bool:
return key in self._internal

@t.overload
def update(self, __other: t.SupportsKeysAndGetItem[t.Any, t.Any], **kwargs: bool) -> None:
...
def update(self, __other: t.SupportsKeysAndGetItem[t.Any, t.Any], **kwargs: bool) -> None: ...

@t.overload
def update(self, __other: t.Iterable[tuple[t.Any, t.Any]], **kwargs: bool) -> None:
...
def update(self, __other: t.Iterable[tuple[t.Any, t.Any]], **kwargs: bool) -> None: ...

@t.overload
def update(self, **kwargs: bool) -> None:
...
def update(self, **kwargs: bool) -> None: ...

def update(self, __other: t.Any = None, **kwargs: bool) -> None:
# If either defaults to True, the result
Expand Down
12 changes: 4 additions & 8 deletions bikeshed/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,15 @@ def processTextNodes(nodes: list[t.NodeT], regex: re.Pattern, replacer: t.Callab


@t.overload
def reSubObject(pattern: re.Pattern, string: str, repl: None) -> list[str | re.Match]:
...
def reSubObject(pattern: re.Pattern, string: str, repl: None) -> list[str | re.Match]: ...


@t.overload
def reSubObject(
pattern: re.Pattern,
string: str,
repl: t.Callable[[re.Match], ReSubObjectU],
) -> list[str | ReSubObjectU]:
...
) -> list[str | ReSubObjectU]: ...


def reSubObject(
Expand Down Expand Up @@ -110,13 +108,11 @@ def simplifyText(text: str) -> str:


@t.overload
def splitForValues(forValues: str) -> list[str]:
...
def splitForValues(forValues: str) -> list[str]: ...


@t.overload
def splitForValues(forValues: None) -> None:
...
def splitForValues(forValues: None) -> None: ...


def splitForValues(forValues: str | None) -> list[str] | None:
Expand Down
12 changes: 4 additions & 8 deletions bikeshed/config/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,11 @@


@t.overload
def canonicalizeStatus(rawStatus: None, group: str | None) -> None:
...
def canonicalizeStatus(rawStatus: None, group: str | None) -> None: ...


@t.overload
def canonicalizeStatus(rawStatus: str, group: str | None) -> str:
...
def canonicalizeStatus(rawStatus: str, group: str | None) -> str: ...


def canonicalizeStatus(rawStatus: str | None, group: str | None) -> str | None:
Expand Down Expand Up @@ -463,13 +461,11 @@ def megaGroupsForStatus(status: str) -> list[str]:


@t.overload
def splitStatus(st: None) -> tuple[None, None]:
...
def splitStatus(st: None) -> tuple[None, None]: ...


@t.overload
def splitStatus(st: str) -> tuple[str | None, str]:
...
def splitStatus(st: str) -> tuple[str | None, str]: ...


def splitStatus(st: str | None) -> tuple[str | None, str | None]:
Expand Down
9 changes: 3 additions & 6 deletions bikeshed/datablocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@ def __call__(
firstLine: str,
lineNum: int | None,
doc: t.SpecT,
) -> list[str]:
...
) -> list[str]: ...


if t.TYPE_CHECKING:

@t.overload
def transformDataBlocks(doc: t.SpecT, lines: list[Line]) -> list[Line]:
...
def transformDataBlocks(doc: t.SpecT, lines: list[Line]) -> list[Line]: ...

@t.overload
def transformDataBlocks(doc: t.Spec, lines: list[str]) -> list[str]:
...
def transformDataBlocks(doc: t.Spec, lines: list[str]) -> list[str]: ...


def transformDataBlocks(doc: t.SpecT, lines: list[Line] | list[str]) -> list[Line] | list[str]:
Expand Down
9 changes: 3 additions & 6 deletions bikeshed/h/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,11 @@ def nextSiblingElement(el: t.ElementT) -> t.ElementT | None:


@t.overload
def appendChild(parent: t.ElementT, *els: t.NodesT, allowEmpty: t.Literal[False] = False) -> t.ElementT:
...
def appendChild(parent: t.ElementT, *els: t.NodesT, allowEmpty: t.Literal[False] = False) -> t.ElementT: ...


@t.overload
def appendChild(parent: t.ElementT, *els: t.NodesT, allowEmpty: bool) -> t.ElementT | None:
...
def appendChild(parent: t.ElementT, *els: t.NodesT, allowEmpty: bool) -> t.ElementT | None: ...


def appendChild(parent: t.ElementT, *els: t.NodesT, allowEmpty: bool = False) -> t.ElementT | None:
Expand Down Expand Up @@ -1015,8 +1013,7 @@ def __call__(
self,
attrsOrChild: t.Mapping[str, str | None] | t.NodesT | None = None,
*children: t.NodesT | None,
) -> t.ElementT:
...
) -> t.ElementT: ...


class ElementCreationHelper:
Expand Down
11 changes: 11 additions & 0 deletions bikeshed/h/parser/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,17 @@ def updateShorthandClose(self, loc: str, startTag: StartTag, sigils: tuple[str,
lineNum=loc,
)

def cancelShorthandOpen(self, startTag: StartTag, sigils: tuple[str, str]) -> None:
if not any(x.startTag == startTag for x in self.tags):
shorthand = sigils[0] + "..." + sigils[1]
m.die(
f"Programming error - tried to close a {shorthand} shorthand, but there's no matching open tag on the stack of open elements. Please report this!",
lineNum=startTag.loc,
)
while self.tags and self.tags[-1].startTag != startTag:
self.tags.pop()
self.tags.pop()

def autoCloseStart(self, tag: str) -> None:
# Handle any auto-closing that occurs as a result
# of seeing a particular start tag.
Expand Down
Loading

0 comments on commit 0b95982

Please sign in to comment.