librus-python-api 1.10.1__tar.gz → 1.10.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.
Files changed (59) hide show
  1. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/API.md +3 -1
  2. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/CHANGELOG.md +19 -0
  3. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/PKG-INFO +6 -4
  4. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/README.md +5 -3
  5. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/__init__.py +1 -1
  6. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/completed_lessons.py +4 -1
  7. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/config.py +6 -2
  8. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/markup.py +6 -4
  9. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/service.py +8 -5
  10. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/.gitignore +0 -0
  11. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/LICENSE +0 -0
  12. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/SECURITY.md +0 -0
  13. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/pyproject.toml +0 -0
  14. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/_notification_bootstrap.py +0 -0
  15. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/_notification_codec.py +0 -0
  16. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/_storage.py +0 -0
  17. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/_windows_filesystem.py +0 -0
  18. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/announcements.py +0 -0
  19. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/attachment_routes.py +0 -0
  20. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/attachments.py +0 -0
  21. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/attendance.py +0 -0
  22. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/attendance_frequency.py +0 -0
  23. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/budget.py +0 -0
  24. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/checkpoint.py +0 -0
  25. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/class_free_days.py +0 -0
  26. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/detail_fields.py +0 -0
  27. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/diagnostics.py +0 -0
  28. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/exceptions.py +0 -0
  29. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/files.py +0 -0
  30. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/formative_grades.py +0 -0
  31. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/gateway_grades.py +0 -0
  32. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/grade_parsers.py +0 -0
  33. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/grade_records.py +0 -0
  34. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/homework_range.py +0 -0
  35. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/inspect_page.py +0 -0
  36. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/justifications.py +0 -0
  37. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/lifecycle.py +0 -0
  38. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/message_content.py +0 -0
  39. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/messages.py +0 -0
  40. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/models.py +0 -0
  41. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/modern_body.py +0 -0
  42. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/modern_mailbox.py +0 -0
  43. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/modern_messages.py +0 -0
  44. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/notification_models.py +0 -0
  45. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/notification_persistence.py +0 -0
  46. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/notification_workflow.py +0 -0
  47. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/notifications.py +0 -0
  48. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/parsers.py +0 -0
  49. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/parsing.py +0 -0
  50. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/persistence.py +0 -0
  51. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/py.typed +0 -0
  52. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/recipients.py +0 -0
  53. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/scheduler.py +0 -0
  54. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/school_reads.py +0 -0
  55. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/school_year_archive.py +0 -0
  56. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/sending.py +0 -0
  57. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/timetable.py +0 -0
  58. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/src/librus_python_api/transport.py +0 -0
  59. {librus_python_api-1.10.1 → librus_python_api-1.10.2}/uv.lock +0 -0
@@ -102,7 +102,9 @@ one summary across four logins. Requests are counted at dispatch and never
102
102
  refunded. Exhaustion raises `LimitError`; deadlines raise `OperationTimeoutError`.
103
103
 
104
104
  - Fresh reads are the default. `max_age_seconds > 0` allows reuse from a
105
- 64-entry per-account result cache. A new login clears it.
105
+ 64-entry per-account result cache. Every read from Librus refreshes its
106
+ entry, and a full cache drops the entry refreshed longest ago. A new login
107
+ clears it.
106
108
  - Identical in-flight reads on one account share one request. Calls with
107
109
  explicit budgets share only when they pass the same budget object. Cancelling
108
110
  one waiter leaves others running; cancelling the last waiter cancels and joins
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.2 (2026-11-17) - Stricter dates and lesson cells; cache fixes
4
+
5
+ - Dates followed by a weekday label, such as `2026-11-15 (ndz.)` in grade and
6
+ point-grade tooltips, now fail as `PARSE` when the label names another day
7
+ of the week (`2026-11-15 (pon.)`), as homework dates already did. Both
8
+ Sunday labels, `ndz.` and `nd.`, are still accepted, and dates without a
9
+ label are unchanged (#178).
10
+ - Completed lessons: a subject/teacher cell with more than one comma (such as
11
+ `Biology, advanced, Teacher`) now fails the read as a parse error. It used to
12
+ keep the whole cell as the subject and drop the teacher (#177).
13
+ - Attendance frequency: a lesson or subject collection that fails to parse, is
14
+ denied or is too large is no longer cached as an empty map for an hour, which
15
+ made every later `subject_frequency` call look up each lesson on its own. The
16
+ next call reads the collection again; parsed collections keep their one-hour
17
+ lifetime (#176).
18
+ - The per-account result cache and the attendance metadata cache drop the
19
+ entry refreshed longest ago when full. They used to drop the entry stored
20
+ first, even if it had just been read again (#175).
21
+
3
22
  ## 1.10.1 (2026-11-15) - Descriptive grades shown as grade boxes
4
23
 
5
24
  Thank you, @sanyok-ua, for the sanitized pages on #76 that showed this layout (#173).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: librus-python-api
3
- Version: 1.10.1
3
+ Version: 1.10.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.10.1` reads descriptive grades that the new-schema table
45
+ **Status:** `1.10.2` rejects a date whose weekday label names another
46
+ day and a completed-lesson cell with more than one comma, and fixes two cache
47
+ bugs. `1.10.1` reads descriptive grades that the new-schema table
46
48
  shows as grade boxes. `1.10.0` returns behaviour points as a typed value
47
49
  (`GradeRecords.behaviour_points`), reads the e-Justifications list on parent
48
50
  logins (`AccountClient.justifications()`) and checks the gateway grade
@@ -77,7 +79,7 @@ See [limitations](#supported-features-and-limitations) below.
77
79
  Install the exact release from PyPI after its gated publication completes:
78
80
 
79
81
  ```sh
80
- python -m pip install librus-python-api==1.10.1
82
+ python -m pip install librus-python-api==1.10.2
81
83
  ```
82
84
 
83
85
  Pin the exact version qualified by your application. Before publication, use a
@@ -93,7 +95,7 @@ python -m pip install .
93
95
  To install a locally built wheel instead:
94
96
 
95
97
  ```sh
96
- python -m pip install ./dist/librus_python_api-1.10.1-py3-none-any.whl
98
+ python -m pip install ./dist/librus_python_api-1.10.2-py3-none-any.whl
97
99
  ```
98
100
 
99
101
  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.10.1` reads descriptive grades that the new-schema table
19
+ **Status:** `1.10.2` rejects a date whose weekday label names another
20
+ day and a completed-lesson cell with more than one comma, and fixes two cache
21
+ bugs. `1.10.1` reads descriptive grades that the new-schema table
20
22
  shows as grade boxes. `1.10.0` returns behaviour points as a typed value
21
23
  (`GradeRecords.behaviour_points`), reads the e-Justifications list on parent
22
24
  logins (`AccountClient.justifications()`) and checks the gateway grade
@@ -51,7 +53,7 @@ See [limitations](#supported-features-and-limitations) below.
51
53
  Install the exact release from PyPI after its gated publication completes:
52
54
 
53
55
  ```sh
54
- python -m pip install librus-python-api==1.10.1
56
+ python -m pip install librus-python-api==1.10.2
55
57
  ```
56
58
 
57
59
  Pin the exact version qualified by your application. Before publication, use a
@@ -67,7 +69,7 @@ python -m pip install .
67
69
  To install a locally built wheel instead:
68
70
 
69
71
  ```sh
70
- python -m pip install ./dist/librus_python_api-1.10.1-py3-none-any.whl
72
+ python -m pip install ./dist/librus_python_api-1.10.2-py3-none-any.whl
71
73
  ```
72
74
 
73
75
  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.10.1"
4
+ __version__ = "1.10.2"
5
5
 
6
6
  from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
7
7
  from librus_python_api.budget import RequestBudget
@@ -203,8 +203,11 @@ def _lesson(
203
203
  raw_number, combined, topic, z_value, symbol = values
204
204
  if raw_number not in {"", "-"} and re.fullmatch(r"[0-9]{1,2}", raw_number) is None:
205
205
  raise LibrusError(ErrorKind.PARSE)
206
- # Some schools render "<b>Subject</b>, <br>Teacher" or pad the comma.
206
+ # Some schools render "<b>Subject</b>, <br>Teacher" or pad the comma. More
207
+ # than one comma leaves the subject/teacher boundary ambiguous, so fail.
207
208
  names = [name.strip() for name in combined.split(",")]
209
+ if len(names) > 2:
210
+ raise LibrusError(ErrorKind.PARSE)
208
211
  subject, teacher = (names[0], names[1]) if len(names) == 2 else (combined, None)
209
212
  if not subject or teacher == "":
210
213
  raise LibrusError(ErrorKind.PARSE)
@@ -1052,8 +1052,12 @@ HOMEWORK_MARK_DONE_HANDLER = (
1052
1052
  r"\s*showConfirmQuestion\(\s*[0-9]{1,64}\s*,\s*[0-9]{1,64}\s*\);?\s*"
1053
1053
  )
1054
1054
  WEEKDAY_LABELS = ("pon.", "wt.", "śr.", "czw.", "pt.", "sob.", "ndz.")
1055
- # Grade tooltips also use the short Sunday display label.
1056
- CIVIL_DATE_WEEKDAY_LABELS = frozenset((*WEEKDAY_LABELS, "nd."))
1055
+ # Accepted labels per weekday (Monday first) after a civil date. Grade
1056
+ # tooltips also use the short Sunday display label.
1057
+ CIVIL_DATE_WEEKDAY_LABELS: tuple[tuple[str, ...], ...] = (
1058
+ *((label,) for label in WEEKDAY_LABELS[:-1]),
1059
+ (WEEKDAY_LABELS[-1], "nd."),
1060
+ )
1057
1061
  # Observed page-level notices shown instead of the requested content.
1058
1062
  PAGE_NOTICES = MappingProxyType(
1059
1063
  {
@@ -164,14 +164,16 @@ def tooltip_line(chunk: str) -> str:
164
164
  def civil_date(value: str | None) -> date:
165
165
  """An ISO date, optionally followed by its weekday label in parentheses."""
166
166
  match = re.fullmatch(r"([0-9]{4}-[0-9]{2}-[0-9]{2})(?: \(([^()]+)\))?", value or "")
167
- if match is None or (
168
- match[2] is not None and match[2] not in CIVIL_DATE_WEEKDAY_LABELS
169
- ):
167
+ if match is None:
170
168
  raise LibrusError(ErrorKind.PARSE)
171
169
  try:
172
- return date.fromisoformat(match[1])
170
+ day = date.fromisoformat(match[1])
173
171
  except ValueError:
174
172
  pass
173
+ else:
174
+ # A label must name the date's own weekday, as for homework dates.
175
+ if match[2] is None or match[2] in CIVIL_DATE_WEEKDAY_LABELS[day.weekday()]:
176
+ return day
175
177
  raise LibrusError(ErrorKind.PARSE)
176
178
 
177
179
 
@@ -2201,6 +2201,9 @@ class AccountClient:
2201
2201
  error.kind,
2202
2202
  )
2203
2203
  raise
2204
+ # Reinsert so iteration order follows refresh time: eviction then drops
2205
+ # the least recently refreshed entry, not the one just read again.
2206
+ self._cache.pop(key, None)
2204
2207
  self._cache[key] = (time.monotonic(), result)
2205
2208
  if len(self._cache) > ACCOUNT_RESULT_CACHE_SIZE:
2206
2209
  del self._cache[next(iter(self._cache))]
@@ -2589,6 +2592,7 @@ class AccountClient:
2589
2592
  reference=identifier,
2590
2593
  content_type=JSON,
2591
2594
  )
2595
+ self._metadata.pop(key, None) # refresh order, as in _cached
2592
2596
  self._metadata[key] = time.monotonic(), value
2593
2597
  if len(self._metadata) > ATTENDANCE_METADATA_CACHE_SIZE:
2594
2598
  del self._metadata[next(iter(self._metadata))]
@@ -2612,15 +2616,14 @@ class AccountClient:
2612
2616
  )
2613
2617
  except LibrusError as error:
2614
2618
  # An unavailable or unexpected collection degrades to the original
2615
- # per-reference lookups. Deadlines, budgets, cancellation and session
2616
- # failures still propagate. Only deterministic outcomes are cached.
2619
+ # per-reference lookups for this call only; the next call reads the
2620
+ # collection again. Deadlines, budgets, cancellation and session
2621
+ # failures still propagate. Only parsed maps are cached.
2617
2622
  if error.kind not in _METADATA_MAP_FALLBACK:
2618
2623
  raise
2619
2624
  if error.kind is ErrorKind.LIMIT:
2620
2625
  budget.check() # An exhausted caller budget is not a large collection.
2621
- if error.kind is ErrorKind.CONNECTION:
2622
- return MappingProxyType({})
2623
- value = MappingProxyType({})
2626
+ return MappingProxyType({})
2624
2627
  self._metadata_maps[endpoint] = time.monotonic(), value
2625
2628
  return value
2626
2629