Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The package version runs on its own semver; the schema it is generated from is `

## Unreleased

## 0.154.1 (2026-11-26)

- **A calendar's era walk is linear in its eras**, as the npm SDK's is. Each era's domain looked for the next up era in a slice of the rest of the sorted list, so the walk was quadratic: one `format_step` label took 331 ms under 15,000 eras; now 101 ms, the same labels.

## 0.154.0 (2026-11-25)

- **`name_finder` passes over what is no mention**, as the npm SDK's `nameFinder` 4.208.0 does. In any text, a bare web address (`http://` or `https://`, in any ASCII case, to the next white space or `<`) and an autolink (`<scheme:…>`) are now passed over, beside the addresses and Markdown links they were before. A call can say its text is Markdown, `find(text, markdown=True)`: then nothing is read inside an inline code span (backtick runs matched by length), a fenced code block (closed by its own character, at least as long, or open to the end), an HTML tag or comment, or a reference definition's line either. The option is off by default, so the answers without it change only inside web addresses. An indented code block, a fence inside a quote or a list, and a definition's title on the next line are read as prose. Held by version 3 of the shared cases (84 cases, 16 with the option; 14 timed recipes), with eight planted faults each red; the two packages gave the same answers on 4,000 made texts, read with the option and without.
Expand Down
2 changes: 1 addition & 1 deletion src/onlyworlds/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.154.0"
__version__ = "0.154.1"
10 changes: 9 additions & 1 deletion src/onlyworlds/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,14 @@ def _era_domains(eras: list[Any]) -> list[EraDomain]:

def _era_domains_of(eras: list[Any]) -> list[EraDomain]:
ordered = _js_sorted(eras, lambda a, b: _to_number(_get(a, "start")) - _to_number(_get(b, "start")))
# The next UP era after each, found in one pass from the end: a search of the rest of the list for each era
# made this quadratic in the era count.
next_ups: list[Any] = [None] * len(ordered)
after: Any = None
for i in range(len(ordered) - 1, -1, -1):
next_ups[i] = after
if _strict_eq(_direction(ordered[i]), "up"):
after = ordered[i]
out: list[EraDomain] = []
for i, era in enumerate(ordered):
end = _get(era, "end")
Expand All @@ -949,7 +957,7 @@ def _era_domains_of(eras: list[Any]) -> list[EraDomain]:
out.append(EraDomain(era, -math.inf if _nullish(end) else end, _get(era, "start")))
else:
# An open end runs to the next UP era's start: a down era holds no step at or above its pivot.
next_up = next((e for e in ordered[i + 1 :] if _strict_eq(_direction(e), "up")), None)
next_up = next_ups[i]
hi = end
if _nullish(hi):
hi = math.inf if next_up is None or _nullish(_get(next_up, "start")) else _get(next_up, "start")
Expand Down
Loading