librus-python-api 1.11.2__tar.gz → 1.11.3__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.
Files changed (59) hide show
  1. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/API.md +5 -1
  2. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/CHANGELOG.md +13 -0
  3. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/PKG-INFO +5 -4
  4. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/README.md +4 -3
  5. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/__init__.py +1 -1
  6. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/grade_parsers.py +41 -18
  7. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/grade_records.py +2 -2
  8. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/.gitignore +0 -0
  9. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/LICENSE +0 -0
  10. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/SECURITY.md +0 -0
  11. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/pyproject.toml +0 -0
  12. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/_notification_bootstrap.py +0 -0
  13. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/_notification_codec.py +0 -0
  14. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/_storage.py +0 -0
  15. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/_windows_filesystem.py +0 -0
  16. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/announcements.py +0 -0
  17. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/attachment_routes.py +0 -0
  18. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/attachments.py +0 -0
  19. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/attendance.py +0 -0
  20. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/attendance_frequency.py +0 -0
  21. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/budget.py +0 -0
  22. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/checkpoint.py +0 -0
  23. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/class_free_days.py +0 -0
  24. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/completed_lessons.py +0 -0
  25. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/config.py +0 -0
  26. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/detail_fields.py +0 -0
  27. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/diagnostics.py +0 -0
  28. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/exceptions.py +0 -0
  29. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/files.py +0 -0
  30. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/formative_grades.py +0 -0
  31. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/gateway_grades.py +0 -0
  32. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/homework_range.py +0 -0
  33. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/inspect_page.py +0 -0
  34. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/justifications.py +0 -0
  35. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/lifecycle.py +0 -0
  36. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/markup.py +0 -0
  37. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/message_content.py +0 -0
  38. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/messages.py +0 -0
  39. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/models.py +0 -0
  40. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/modern_body.py +0 -0
  41. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/modern_mailbox.py +0 -0
  42. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/modern_messages.py +0 -0
  43. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/notification_models.py +0 -0
  44. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/notification_persistence.py +0 -0
  45. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/notification_workflow.py +0 -0
  46. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/notifications.py +0 -0
  47. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/parsers.py +0 -0
  48. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/parsing.py +0 -0
  49. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/persistence.py +0 -0
  50. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/py.typed +0 -0
  51. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/recipients.py +0 -0
  52. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/scheduler.py +0 -0
  53. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/school_reads.py +0 -0
  54. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/school_year_archive.py +0 -0
  55. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/sending.py +0 -0
  56. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/service.py +0 -0
  57. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/timetable.py +0 -0
  58. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/src/librus_python_api/transport.py +0 -0
  59. {librus_python_api-1.11.2 → librus_python_api-1.11.3}/uv.lock +0 -0
@@ -221,7 +221,11 @@ source)` with an aware UTC timestamp.
221
221
  - `final_grades()` returns `FinalGrades` with one `SubjectGradeSummary` per
222
222
  subject: `midterm`, `predicted_annual` and `annual`, each a
223
223
  `GradeSummaryValue(availability, raw)`. Raw school text is kept as is.
224
- `UNAVAILABLE` means the column is absent.
224
+ `UNAVAILABLE` means the column is absent. In the `Zachowanie` row a value
225
+ may share a merged cell with the columns beside it, but never with a
226
+ current-grade (`Oceny bieżące`) column, where that row holds behaviour
227
+ points: such a row raises `ParseError` instead of returning the points as a
228
+ grade. `grades()` reads no summary value from that row and is unaffected.
225
229
  - `grades(view=GradeView.ALL)` returns `Grades(identity, records, observation,
226
230
  view)`. Selecting a view (`ALL`, `WEEK`, `LAST_LOGIN`) is one POST that changes
227
231
  the filter shown in that login's session; it is never replayed
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.3 (2026-11-22) - Behaviour points never read as a final grade
4
+
5
+ - Grades: `final_grades()` no longer reads a summary value from a merged
6
+ `Zachowanie` cell that also covers a current-grade (`Oceny bieżące`)
7
+ column (#192). That cell holds the behaviour points, so a different span
8
+ order could return the points tally as the predicted grade or the midterm.
9
+ Such a row now raises `ParseError`, and so does a merged summary value in a
10
+ table whose header does not name both periods' current-grade columns, where
11
+ the rule cannot be checked. Values merged with other
12
+ columns, as in the point table and the #189 row, read as before.
13
+ `grades()` and `grades_window()` read only the subject from that row and
14
+ are unchanged. No layout seen live is affected.
15
+
3
16
  ## 1.11.2 (2026-11-21) - A behaviour row wider than the grade table
4
17
 
5
18
  - Grades: at one school the `Zachowanie` row ends with a cell that spans one
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: librus-python-api
3
- Version: 1.11.2
3
+ Version: 1.11.3
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,8 @@ 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.2` reads a behaviour row whose last cell spans past the
45
+ **Status:** `1.11.3` never returns behaviour points as a final grade when the
46
+ behaviour row's cells are merged differently. `1.11.2` reads a behaviour row whose last cell spans past the
46
47
  grade table and names the failing cell in diagnostics. `1.11.1` fixes a Windows store shared by several processes
47
48
  reporting `StorageError`, also after a dispatched send. `1.11.0` raises `TemporarilyUnavailableError` for the archive's
48
49
  loading notice, a view that is unavailable for now while the rest of Synergia
@@ -84,7 +85,7 @@ See [limitations](#supported-features-and-limitations) below.
84
85
  Install the exact release from PyPI after its gated publication completes:
85
86
 
86
87
  ```sh
87
- python -m pip install librus-python-api==1.11.2
88
+ python -m pip install librus-python-api==1.11.3
88
89
  ```
89
90
 
90
91
  Pin the exact version qualified by your application. Before publication, use a
@@ -100,7 +101,7 @@ python -m pip install .
100
101
  To install a locally built wheel instead:
101
102
 
102
103
  ```sh
103
- python -m pip install ./dist/librus_python_api-1.11.2-py3-none-any.whl
104
+ python -m pip install ./dist/librus_python_api-1.11.3-py3-none-any.whl
104
105
  ```
105
106
 
106
107
  No console script or background process is installed: import the library in your
@@ -16,7 +16,8 @@ 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.2` reads a behaviour row whose last cell spans past the
19
+ **Status:** `1.11.3` never returns behaviour points as a final grade when the
20
+ behaviour row's cells are merged differently. `1.11.2` reads a behaviour row whose last cell spans past the
20
21
  grade table and names the failing cell in diagnostics. `1.11.1` fixes a Windows store shared by several processes
21
22
  reporting `StorageError`, also after a dispatched send. `1.11.0` raises `TemporarilyUnavailableError` for the archive's
22
23
  loading notice, a view that is unavailable for now while the rest of Synergia
@@ -58,7 +59,7 @@ See [limitations](#supported-features-and-limitations) below.
58
59
  Install the exact release from PyPI after its gated publication completes:
59
60
 
60
61
  ```sh
61
- python -m pip install librus-python-api==1.11.2
62
+ python -m pip install librus-python-api==1.11.3
62
63
  ```
63
64
 
64
65
  Pin the exact version qualified by your application. Before publication, use a
@@ -74,7 +75,7 @@ python -m pip install .
74
75
  To install a locally built wheel instead:
75
76
 
76
77
  ```sh
77
- python -m pip install ./dist/librus_python_api-1.11.2-py3-none-any.whl
78
+ python -m pip install ./dist/librus_python_api-1.11.3-py3-none-any.whl
78
79
  ```
79
80
 
80
81
  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.2"
4
+ __version__ = "1.11.3"
5
5
 
6
6
  from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
7
7
  from librus_python_api.budget import RequestBudget
@@ -48,20 +48,24 @@ def _summary_field(cell: html.HtmlElement, *, points: bool = False) -> str | Non
48
48
 
49
49
  def _header(
50
50
  row: html.HtmlElement, *, points: bool = False
51
- ) -> tuple[dict[str, int], int]:
51
+ ) -> tuple[dict[str, int], int, frozenset[int]]:
52
+ """Summary field columns, the width, and the current-grade columns."""
52
53
  fields: dict[str, int] = {}
54
+ current: set[int] = set()
53
55
  position = GRADE_BODY_PREFIX_COLUMNS
54
56
  for cell in markup.cells(row):
55
57
  span = markup.colspan(cell)
56
58
  if position + span > GRADE_MAX_COLUMNS:
57
59
  raise LibrusError(ErrorKind.LIMIT)
60
+ if markup.text(cell) == GRADE_CURRENT_HEADER:
61
+ current.update(range(position, position + span))
58
62
  field = _summary_field(cell, points=points)
59
63
  if field is not None:
60
64
  if field in fields:
61
65
  raise LibrusError(ErrorKind.PARSE)
62
66
  fields[field] = position
63
67
  position += span
64
- return fields, position
68
+ return fields, position, frozenset(current)
65
69
 
66
70
 
67
71
  def is_point_table(table: html.HtmlElement) -> bool:
@@ -85,8 +89,11 @@ def _current_header(table: html.HtmlElement) -> bool:
85
89
  )
86
90
 
87
91
 
88
- def point_layout(table: html.HtmlElement) -> tuple[dict[str, int], int]:
89
- """Summary fields and width from the point table's current-grade header row.
92
+ def point_layout(
93
+ table: html.HtmlElement,
94
+ ) -> tuple[dict[str, int], int, frozenset[int]]:
95
+ """Summary fields, width and current-grade columns from the point table's
96
+ current-grade header row.
90
97
 
91
98
  Point tables are not required to have an annual column, so the row with
92
99
  the two current-grade headers defines the body alignment instead.
@@ -102,10 +109,11 @@ def point_layout(table: html.HtmlElement) -> tuple[dict[str, int], int]:
102
109
  return _header(headers[0], points=True)
103
110
 
104
111
 
105
- def _candidates(
106
- document: html.HtmlElement,
107
- ) -> list[tuple[html.HtmlElement, dict[str, int], int]]:
108
- candidates: list[tuple[html.HtmlElement, dict[str, int], int]] = []
112
+ _Layout = tuple[html.HtmlElement, dict[str, int], int, frozenset[int]]
113
+
114
+
115
+ def _candidates(document: html.HtmlElement) -> list[_Layout]:
116
+ candidates: list[_Layout] = []
109
117
  for table in document.iter("table"):
110
118
  if not {"decorated", "stretch"} <= set(table.get("class", "").split()):
111
119
  continue
@@ -118,14 +126,12 @@ def _candidates(
118
126
  # an annual summary title defines the body alignment contract.
119
127
  if not any(_summary_field(cell) == "annual" for cell in markup.cells(row)):
120
128
  continue
121
- fields, width = _header(row)
122
- candidates.append((table, fields, width))
129
+ fields, width, current = _header(row)
130
+ candidates.append((table, fields, width, current))
123
131
  return candidates
124
132
 
125
133
 
126
- def _locate(
127
- document: html.HtmlElement,
128
- ) -> tuple[html.HtmlElement, dict[str, int], int]:
134
+ def _locate(document: html.HtmlElement) -> _Layout:
129
135
  candidates = _candidates(document)
130
136
  if len(candidates) != 1:
131
137
  raise LibrusError(ErrorKind.PARSE)
@@ -183,12 +189,29 @@ def _summary(
183
189
  cells: list[html.HtmlElement],
184
190
  fields: dict[str, int],
185
191
  width: int,
192
+ current: frozenset[int] | None = None,
186
193
  ) -> SubjectGradeSummary:
194
+ """One subject's summary values.
195
+
196
+ `current` holds the header's current-grade columns. Pass it whenever the
197
+ values are returned; `grades()` reads only the subject and passes none.
198
+ """
187
199
  subject, columns = _subject_columns(cells, width)
188
200
  selected = [columns[index] for index in fields.values()]
189
201
  if len({id(cell) for cell in selected}) != len(selected):
190
202
  # A single merged value cannot mean two different summary fields.
191
203
  raise LibrusError(ErrorKind.PARSE)
204
+ # A merged cell over a current-grade column holds the behaviour points,
205
+ # not a summary value (#192). Unless the header names both periods'
206
+ # current-grade columns, as every grade table does, a merged value cannot
207
+ # be checked at all.
208
+ for cell in selected:
209
+ if (
210
+ current is not None
211
+ and markup.colspan(cell) > 1
212
+ and (len(current) != 2 or any(columns[index] is cell for index in current))
213
+ ):
214
+ raise LibrusError(ErrorKind.PARSE)
192
215
  values = {
193
216
  name: GradeSummaryValue(Availability.AVAILABLE, markup.text(columns[index]))
194
217
  for name, index in fields.items()
@@ -270,21 +293,21 @@ def parse_final_grades(body: bytes) -> tuple[SubjectGradeSummary, ...]:
270
293
  if len(sources) > 1 or not (sources or point_tables):
271
294
  raise LibrusError(ErrorKind.PARSE)
272
295
  if point_tables:
273
- located = {id(table) for table, _, _ in sources}
296
+ located = {id(table) for table, _, _, _ in sources}
274
297
  if any(
275
298
  _current_header(table) and id(table) not in located
276
299
  for table in document.iter("table")
277
300
  if table not in point_tables
278
301
  ):
279
302
  raise LibrusError(ErrorKind.PARSE)
280
- fields, width = point_layout(point_tables[0])
303
+ fields, width, current = point_layout(point_tables[0])
281
304
  if fields:
282
- sources.append((point_tables[0], fields, width))
305
+ sources.append((point_tables[0], fields, width, current))
283
306
  items: dict[str, SubjectGradeSummary] = {}
284
- for table, fields, width in sources:
307
+ for table, fields, width, current in sources:
285
308
  family_subjects: set[str] = set()
286
309
  for cells in _subject_rows(table, width, points=table in point_tables):
287
- item = _summary(cells, fields, width)
310
+ item = _summary(cells, fields, width, current)
288
311
  if item.subject in family_subjects:
289
312
  raise LibrusError(ErrorKind.PARSE)
290
313
  family_subjects.add(item.subject)
@@ -587,9 +587,9 @@ def _read_numeric_table(
587
587
  # Preserve the established full-row and summary alignment validation. A
588
588
  # point table aligns on its current-grade header row and may lack summaries.
589
589
  if points:
590
- fields, width = point_layout(table)
590
+ fields, width, _ = point_layout(table)
591
591
  else:
592
- _, fields, width = _locate(table)
592
+ _, fields, width, _ = _locate(table)
593
593
  current, means = _layout(table, points=points)
594
594
  periods = _period_columns(table, points=points)
595
595
  averages = collection.point_results if points else collection.averages