librus-python-api 1.11.0__tar.gz → 1.11.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/API.md +8 -1
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/CHANGELOG.md +29 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/PKG-INFO +6 -4
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/README.md +5 -3
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/__init__.py +1 -1
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_windows_filesystem.py +22 -5
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/config.py +3 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/diagnostics.py +97 -39
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/grade_parsers.py +11 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/.gitignore +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/LICENSE +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/SECURITY.md +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/pyproject.toml +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_notification_bootstrap.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_notification_codec.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_storage.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/announcements.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attachment_routes.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attachments.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attendance.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attendance_frequency.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/budget.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/checkpoint.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/class_free_days.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/completed_lessons.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/detail_fields.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/exceptions.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/files.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/formative_grades.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/gateway_grades.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/grade_records.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/homework_range.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/inspect_page.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/justifications.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/lifecycle.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/markup.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/message_content.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/messages.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/models.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/modern_body.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/modern_mailbox.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/modern_messages.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notification_models.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notification_persistence.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notification_workflow.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notifications.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/parsers.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/parsing.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/persistence.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/py.typed +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/recipients.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/scheduler.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/school_reads.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/school_year_archive.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/sending.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/service.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/timetable.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/transport.py +0 -0
- {librus_python_api-1.11.0 → librus_python_api-1.11.2}/uv.lock +0 -0
|
@@ -183,7 +183,14 @@ from the exception's own traceback. Neither raises.
|
|
|
183
183
|
present, title, headings, notices, forms and input types, then the first
|
|
184
184
|
tables row by row, with known profile labels and notices by name. Output is
|
|
185
185
|
bounded. It is meant for a human to review before sharing, not for
|
|
186
|
-
automatic upload.
|
|
186
|
+
automatic upload. The layout sizes the failing code compared (`width`,
|
|
187
|
+
`span`, `position`) follow the elements (1.11.2).
|
|
188
|
+
- `diagnostics.failure_locator(error)` (1.11.2) returns one line, or None: the
|
|
189
|
+
masked path of the element nearest the failure, then those element counts
|
|
190
|
+
and sizes, for example `table.stretch.decorated[1] > tbody[1] >
|
|
191
|
+
tr.bolded.line0[2] > td.center[7]; cells 7, columns 11, width 10, span 1`.
|
|
192
|
+
It holds structure and counts only, at most 512 characters, so an
|
|
193
|
+
application can return it with the error, as `librus-mcp` does in `at`.
|
|
187
194
|
- `python -m librus_python_api.inspect_page {grades,final-grades,profile} FILE`
|
|
188
195
|
parses a saved page offline (a whole page or a copied table) and prints
|
|
189
196
|
counts, or the failure kind, frames and structure. `profile` (1.8.1) reads the
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.11.2 (2026-11-21) - A behaviour row wider than the grade table
|
|
4
|
+
|
|
5
|
+
- Grades: at one school the `Zachowanie` row ends with a cell that spans one
|
|
6
|
+
column past the grade table's header (#189). `grades()`, `grades_window()`
|
|
7
|
+
and `final_grades()` failed with `ParseError` for every such account. For
|
|
8
|
+
exactly that layout (cell spans 1, 1, 2, 1, 2, 1, 3), the extra column is
|
|
9
|
+
dropped: the annual grade keeps its value, and the annual average it merges
|
|
10
|
+
with is unavailable, as for any merged cell. Any other row wider than the
|
|
11
|
+
header still fails, since a different span order could put a value in the
|
|
12
|
+
wrong field.
|
|
13
|
+
- New `diagnostics.failure_locator(error)`: one line saying where in the page a
|
|
14
|
+
failure happened, such as `table.stretch.decorated[1] > tbody[1] >
|
|
15
|
+
tr.bolded.line0[2] > td.center[7]; cells 7, columns 11, width 10, span 1`.
|
|
16
|
+
It uses the masked path from `describe_failure` plus the sizes the parser
|
|
17
|
+
compared, and no page text or values, so an application can put it in an
|
|
18
|
+
error result. `describe_failure` and `inspect_page` now also show those sizes
|
|
19
|
+
(`width: 10`).
|
|
20
|
+
|
|
21
|
+
## 1.11.1 (2026-11-21) - Windows stores shared by several processes
|
|
22
|
+
|
|
23
|
+
- Windows: a durable store shared by several processes could report
|
|
24
|
+
`StorageError`, including on the save that records a dispatched send.
|
|
25
|
+
Between the store's sidecar check and its open, another process's
|
|
26
|
+
commit can delete SQLite's rollback journal or leave it pending deletion.
|
|
27
|
+
A journal that is gone is now absent, as on POSIX; one that stays and
|
|
28
|
+
cannot be opened still fails closed after bounded retries. On Windows CI,
|
|
29
|
+
the two-process durable-send test failed in 36 of 180 repeated runs before
|
|
30
|
+
and in none after.
|
|
31
|
+
|
|
3
32
|
## 1.11.0 (2026-11-21) - A view unavailable for now has its own error
|
|
4
33
|
|
|
5
34
|
- New `ErrorKind.TEMPORARILY_UNAVAILABLE` and `TemporarilyUnavailableError`:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: librus-python-api
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.2
|
|
4
4
|
Summary: Independent bounded async Librus Synergia client
|
|
5
5
|
Project-URL: Repository, https://github.com/krzysztofbury/librus-python-api
|
|
6
6
|
Project-URL: Issues, https://github.com/krzysztofbury/librus-python-api/issues
|
|
@@ -42,7 +42,9 @@ private ACLs. Windows installations include `pywin32` and `tzdata` automatically
|
|
|
42
42
|
Network paths, reparse-point paths and unsafe storage permissions fail closed.
|
|
43
43
|
See [platform requirements](contracts/persistence.md#windows-disk-boundary-25).
|
|
44
44
|
|
|
45
|
-
**Status:** `1.11.
|
|
45
|
+
**Status:** `1.11.2` reads a behaviour row whose last cell spans past the
|
|
46
|
+
grade table and names the failing cell in diagnostics. `1.11.1` fixes a Windows store shared by several processes
|
|
47
|
+
reporting `StorageError`, also after a dispatched send. `1.11.0` raises `TemporarilyUnavailableError` for the archive's
|
|
46
48
|
loading notice, a view that is unavailable for now while the rest of Synergia
|
|
47
49
|
works. `1.10.3` reads pages with the libxml2 that lxml's Windows wheels
|
|
48
50
|
bundle and reads a grade detail table without period headings. `1.10.2` rejects a date whose weekday
|
|
@@ -82,7 +84,7 @@ See [limitations](#supported-features-and-limitations) below.
|
|
|
82
84
|
Install the exact release from PyPI after its gated publication completes:
|
|
83
85
|
|
|
84
86
|
```sh
|
|
85
|
-
python -m pip install librus-python-api==1.11.
|
|
87
|
+
python -m pip install librus-python-api==1.11.2
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
Pin the exact version qualified by your application. Before publication, use a
|
|
@@ -98,7 +100,7 @@ python -m pip install .
|
|
|
98
100
|
To install a locally built wheel instead:
|
|
99
101
|
|
|
100
102
|
```sh
|
|
101
|
-
python -m pip install ./dist/librus_python_api-1.11.
|
|
103
|
+
python -m pip install ./dist/librus_python_api-1.11.2-py3-none-any.whl
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
No console script or background process is installed: import the library in your
|
|
@@ -16,7 +16,9 @@ private ACLs. Windows installations include `pywin32` and `tzdata` automatically
|
|
|
16
16
|
Network paths, reparse-point paths and unsafe storage permissions fail closed.
|
|
17
17
|
See [platform requirements](contracts/persistence.md#windows-disk-boundary-25).
|
|
18
18
|
|
|
19
|
-
**Status:** `1.11.
|
|
19
|
+
**Status:** `1.11.2` reads a behaviour row whose last cell spans past the
|
|
20
|
+
grade table and names the failing cell in diagnostics. `1.11.1` fixes a Windows store shared by several processes
|
|
21
|
+
reporting `StorageError`, also after a dispatched send. `1.11.0` raises `TemporarilyUnavailableError` for the archive's
|
|
20
22
|
loading notice, a view that is unavailable for now while the rest of Synergia
|
|
21
23
|
works. `1.10.3` reads pages with the libxml2 that lxml's Windows wheels
|
|
22
24
|
bundle and reads a grade detail table without period headings. `1.10.2` rejects a date whose weekday
|
|
@@ -56,7 +58,7 @@ See [limitations](#supported-features-and-limitations) below.
|
|
|
56
58
|
Install the exact release from PyPI after its gated publication completes:
|
|
57
59
|
|
|
58
60
|
```sh
|
|
59
|
-
python -m pip install librus-python-api==1.11.
|
|
61
|
+
python -m pip install librus-python-api==1.11.2
|
|
60
62
|
```
|
|
61
63
|
|
|
62
64
|
Pin the exact version qualified by your application. Before publication, use a
|
|
@@ -72,7 +74,7 @@ python -m pip install .
|
|
|
72
74
|
To install a locally built wheel instead:
|
|
73
75
|
|
|
74
76
|
```sh
|
|
75
|
-
python -m pip install ./dist/librus_python_api-1.11.
|
|
77
|
+
python -m pip install ./dist/librus_python_api-1.11.2-py3-none-any.whl
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
No console script or background process is installed: import the library in your
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Independent bounded async client. General live compatibility is unqualified."""
|
|
2
2
|
|
|
3
3
|
# Before the imports: config reads it for the User-Agent.
|
|
4
|
-
__version__ = "1.11.
|
|
4
|
+
__version__ = "1.11.2"
|
|
5
5
|
|
|
6
6
|
from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
|
|
7
7
|
from librus_python_api.budget import RequestBudget
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_windows_filesystem.py
RENAMED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import ntpath
|
|
4
4
|
import os
|
|
5
5
|
import sys
|
|
6
|
+
import time
|
|
6
7
|
from collections.abc import Callable
|
|
7
8
|
from functools import partial
|
|
8
9
|
from pathlib import Path
|
|
@@ -18,6 +19,11 @@ import winerror
|
|
|
18
19
|
from librus_python_api.exceptions import ErrorKind, LibrusError
|
|
19
20
|
|
|
20
21
|
_TRUSTED_SYSTEM_SIDS = {"S-1-5-18", "S-1-5-32-544"}
|
|
22
|
+
# Another process's SQLite deletes its rollback journal when it commits. A
|
|
23
|
+
# sidecar that is gone or pending deletion when it is opened is retried this
|
|
24
|
+
# often before the open failure stands.
|
|
25
|
+
_SIDECAR_ATTEMPTS = 40
|
|
26
|
+
_SIDECAR_RETRY_SECONDS = 0.025
|
|
21
27
|
_MAX_PATH_COMPONENTS = 128
|
|
22
28
|
_MAX_ACES = 16
|
|
23
29
|
|
|
@@ -310,11 +316,22 @@ class WindowsDirectory:
|
|
|
310
316
|
def check_sidecar(self, name: str, maximum: int) -> None:
|
|
311
317
|
# A private pinned parent excludes other OS principals from replacement.
|
|
312
318
|
# Same-user writers remain outside the threat boundary on both platforms.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
319
|
+
# Between the lstat and the open, another process's commit can delete
|
|
320
|
+
# the journal, or leave it pending deletion, and the open fails. Once
|
|
321
|
+
# it is gone it is absent, as on POSIX; a sidecar that stays and still
|
|
322
|
+
# cannot be opened fails closed after the bounded retries.
|
|
323
|
+
for attempt in range(_SIDECAR_ATTEMPTS):
|
|
324
|
+
try:
|
|
325
|
+
(self.path / name).lstat()
|
|
326
|
+
self.check_file(name, maximum)
|
|
327
|
+
except FileNotFoundError:
|
|
328
|
+
return
|
|
329
|
+
except OSError:
|
|
330
|
+
if attempt == _SIDECAR_ATTEMPTS - 1:
|
|
331
|
+
raise
|
|
332
|
+
else:
|
|
333
|
+
return
|
|
334
|
+
time.sleep(_SIDECAR_RETRY_SECONDS)
|
|
318
335
|
|
|
319
336
|
|
|
320
337
|
def acquire_lock(directory: WindowsDirectory, name: str, held: list[int]) -> None:
|
|
@@ -730,6 +730,9 @@ GRADE_MAX_COLUMNS = 64
|
|
|
730
730
|
GRADE_MAX_SUBJECTS = 128
|
|
731
731
|
GRADE_MAX_VALUE_LENGTH = 1024
|
|
732
732
|
GRADE_MERGED_SUBJECTS = frozenset({"Zachowanie"})
|
|
733
|
+
# Cell spans of the behaviour row reported in #189 (2026-11-21): the last cell
|
|
734
|
+
# covers the annual average, the annual grade and one column the header lacks.
|
|
735
|
+
GRADE_BEHAVIOUR_OVERFLOW_SPANS = (1, 1, 2, 1, 2, 1, 3)
|
|
733
736
|
GRADE_INLINE_DETAIL_LABEL = "Ocena"
|
|
734
737
|
# Tooltip fields whose free text may continue on unlabelled lines. A teacher's
|
|
735
738
|
# multi-line grade comment was observed on 2026-10-27. A formative mirror's
|
|
@@ -41,6 +41,10 @@ _INPUT_TYPES = frozenset(
|
|
|
41
41
|
# Element IDs whose presence tells a Synergia page from a login or error page.
|
|
42
42
|
_PAGE_MARKERS = ("graphic-menu", "user-section")
|
|
43
43
|
_REPORT_BYTES = 32 * 1024
|
|
44
|
+
_LOCATOR_BYTES = 512
|
|
45
|
+
# Integer locals that hold a table's layout, never a value read from the page:
|
|
46
|
+
# a row's expected width, a cell's span, a column position.
|
|
47
|
+
_SHAPE_COUNTS = frozenset({"width", "span", "position"})
|
|
44
48
|
# Markup observed on Synergia pages. Other class tokens, tags and attribute
|
|
45
49
|
# names are shown only as lengths, since they could carry data.
|
|
46
50
|
_CLASSES = frozenset(
|
|
@@ -494,55 +498,109 @@ def _is_page(element: html.HtmlElement) -> bool:
|
|
|
494
498
|
return element.getparent() is None and element.tag == "html"
|
|
495
499
|
|
|
496
500
|
|
|
501
|
+
_Elements = list[tuple[str, html.HtmlElement]]
|
|
502
|
+
_Sequences = list[tuple[str, list[html.HtmlElement] | tuple[html.HtmlElement, ...]]]
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def _failure_site(
|
|
506
|
+
error: BaseException,
|
|
507
|
+
) -> tuple[FrameType, int, _Elements, _Sequences, list[tuple[str, int]]] | None:
|
|
508
|
+
"""The innermost library frame holding HTML elements, with those elements,
|
|
509
|
+
element sequences and the layout counts named in `_SHAPE_COUNTS`."""
|
|
510
|
+
for frame, line in reversed(_frames(error, (_PACKAGE,))):
|
|
511
|
+
local_items = list(frame.f_locals.items())
|
|
512
|
+
elements = [
|
|
513
|
+
(name, value)
|
|
514
|
+
for name, value in local_items
|
|
515
|
+
if isinstance(value, html.HtmlElement)
|
|
516
|
+
][:_ELEMENT_LOCALS]
|
|
517
|
+
sequences = [
|
|
518
|
+
(name, value)
|
|
519
|
+
for name, value in local_items
|
|
520
|
+
if isinstance(value, (list, tuple))
|
|
521
|
+
and value
|
|
522
|
+
and all(isinstance(item, html.HtmlElement) for item in value)
|
|
523
|
+
][:_ELEMENT_LOCALS]
|
|
524
|
+
if not elements and not sequences:
|
|
525
|
+
continue
|
|
526
|
+
counts = [
|
|
527
|
+
(name, value)
|
|
528
|
+
for name, value in local_items
|
|
529
|
+
if name in _SHAPE_COUNTS and type(value) is int
|
|
530
|
+
]
|
|
531
|
+
return frame, line, elements, sequences, counts
|
|
532
|
+
return None
|
|
533
|
+
|
|
534
|
+
|
|
497
535
|
def describe_failure(error: BaseException) -> str | None:
|
|
498
536
|
"""The page structure around a failure, for a bug report.
|
|
499
537
|
|
|
500
538
|
Shows the HTML elements held by the innermost library frame that holds
|
|
501
539
|
any: tags, safe class tokens, known tooltip labels, known link families
|
|
502
|
-
and lengths
|
|
503
|
-
|
|
540
|
+
and lengths, then the layout counts it compared (such as `width`). A
|
|
541
|
+
whole page is summarized last (see _page_summary). Text and attribute
|
|
542
|
+
values are masked unless they equal a parser constant.
|
|
504
543
|
Returns None when there is nothing to show; never raises.
|
|
505
544
|
"""
|
|
506
545
|
try:
|
|
546
|
+
site = _failure_site(error)
|
|
547
|
+
if site is None:
|
|
548
|
+
return None
|
|
549
|
+
frame, line, elements, sequences, counts = site
|
|
507
550
|
redactor = _Redactor()
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
for name, value in local_items
|
|
518
|
-
if isinstance(value, (list, tuple))
|
|
519
|
-
and value
|
|
520
|
-
and all(isinstance(item, html.HtmlElement) for item in value)
|
|
521
|
-
][:_ELEMENT_LOCALS]
|
|
522
|
-
if not elements and not sequences:
|
|
551
|
+
lines = [f"at {_site(frame, line)}"]
|
|
552
|
+
# The elements nearest the failure first; a page summary last.
|
|
553
|
+
for name, value in sorted(elements, key=lambda item: _is_page(item[1])):
|
|
554
|
+
redactor.nodes = 0
|
|
555
|
+
if _is_page(value):
|
|
556
|
+
summary = "\n".join(_page_summary(value, redactor))
|
|
557
|
+
if len(summary) > _ELEMENT_BYTES:
|
|
558
|
+
summary = summary[:_ELEMENT_BYTES] + "...(truncated)"
|
|
559
|
+
lines += [f"{name}: page", summary]
|
|
523
560
|
continue
|
|
524
|
-
lines
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
for name, items in sequences:
|
|
540
|
-
tags = ",".join(str(item.tag) for item in items[:20])
|
|
541
|
-
lines.append(f"{name}: {len(items)} elements: {tags}")
|
|
542
|
-
report = "\n".join(lines)
|
|
543
|
-
if len(report) > _REPORT_BYTES:
|
|
544
|
-
report = report[:_REPORT_BYTES] + "...(truncated)"
|
|
545
|
-
return report
|
|
561
|
+
lines.append(f"{name}: {_path(value, redactor)}")
|
|
562
|
+
rendered = redactor.element(value)
|
|
563
|
+
if len(rendered) > _ELEMENT_BYTES:
|
|
564
|
+
rendered = rendered[:_ELEMENT_BYTES] + "...(truncated)"
|
|
565
|
+
lines.append(" " + rendered)
|
|
566
|
+
for name, items in sequences:
|
|
567
|
+
tags = ",".join(str(item.tag) for item in items[:20])
|
|
568
|
+
lines.append(f"{name}: {len(items)} elements: {tags}")
|
|
569
|
+
for name, count in counts:
|
|
570
|
+
lines.append(f"{name}: {count}")
|
|
571
|
+
report = "\n".join(lines)
|
|
572
|
+
if len(report) > _REPORT_BYTES:
|
|
573
|
+
report = report[:_REPORT_BYTES] + "...(truncated)"
|
|
574
|
+
return report
|
|
575
|
+
except Exception:
|
|
546
576
|
return None
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
def failure_locator(error: BaseException) -> str | None:
|
|
580
|
+
"""One line saying where in the page a failure happened, for an error result.
|
|
581
|
+
|
|
582
|
+
The masked path of the element nearest the failure (as in
|
|
583
|
+
`describe_failure`), then the sizes it was checked against, for example
|
|
584
|
+
`table.stretch.decorated[1] > tbody[1] > tr.bolded.line0[2] > td.center[7];
|
|
585
|
+
cells 7, columns 11, width 10`. Structure and counts only, never page text
|
|
586
|
+
or values. Returns None when no page element is involved; never raises.
|
|
587
|
+
"""
|
|
588
|
+
try:
|
|
589
|
+
site = _failure_site(error)
|
|
590
|
+
if site is None:
|
|
591
|
+
return None
|
|
592
|
+
_, _, elements, sequences, counts = site
|
|
593
|
+
redactor = _Redactor()
|
|
594
|
+
parts = [
|
|
595
|
+
_path(value, redactor) for _, value in elements if not _is_page(value)
|
|
596
|
+
][:1]
|
|
597
|
+
sizes = [f"{name} {len(items)}" for name, items in sequences]
|
|
598
|
+
sizes += [f"{name} {value}" for name, value in counts]
|
|
599
|
+
if sizes:
|
|
600
|
+
parts.append(", ".join(sizes))
|
|
601
|
+
if not parts:
|
|
602
|
+
return None
|
|
603
|
+
locator = "; ".join(parts)
|
|
604
|
+
return locator[:_LOCATOR_BYTES]
|
|
547
605
|
except Exception:
|
|
548
606
|
return None
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/grade_parsers.py
RENAMED
|
@@ -7,6 +7,7 @@ from lxml import html
|
|
|
7
7
|
|
|
8
8
|
from librus_python_api import markup
|
|
9
9
|
from librus_python_api.config import (
|
|
10
|
+
GRADE_BEHAVIOUR_OVERFLOW_SPANS,
|
|
10
11
|
GRADE_BODY_PREFIX_COLUMNS,
|
|
11
12
|
GRADE_CURRENT_HEADER,
|
|
12
13
|
GRADE_EMPTY_MARKERS,
|
|
@@ -163,6 +164,16 @@ def _subject_columns(
|
|
|
163
164
|
if len(columns) + span > GRADE_MAX_COLUMNS:
|
|
164
165
|
raise LibrusError(ErrorKind.LIMIT)
|
|
165
166
|
columns.extend([cell] * span)
|
|
167
|
+
# One school's behaviour row ends with a cell spanning one column past the
|
|
168
|
+
# header (2026-11-21, #189). Only that exact layout drops the extra column;
|
|
169
|
+
# any other span order could shift summary values into the wrong fields.
|
|
170
|
+
if (
|
|
171
|
+
subject in GRADE_MERGED_SUBJECTS
|
|
172
|
+
and tuple(markup.colspan(cell) for cell in cells)
|
|
173
|
+
== GRADE_BEHAVIOUR_OVERFLOW_SPANS
|
|
174
|
+
and len(columns) == width + 1
|
|
175
|
+
):
|
|
176
|
+
del columns[width:]
|
|
166
177
|
if len(columns) != width:
|
|
167
178
|
raise LibrusError(ErrorKind.PARSE)
|
|
168
179
|
return subject, columns
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/_notification_codec.py
RENAMED
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/announcements.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attachment_routes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/attendance_frequency.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/class_free_days.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/completed_lessons.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/detail_fields.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/formative_grades.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/gateway_grades.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/grade_records.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/homework_range.py
RENAMED
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/justifications.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/message_content.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/modern_mailbox.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/modern_messages.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notification_models.py
RENAMED
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notification_workflow.py
RENAMED
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/notifications.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{librus_python_api-1.11.0 → librus_python_api-1.11.2}/src/librus_python_api/school_year_archive.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|