librus-python-api 1.12.0__py3-none-any.whl → 1.12.1__py3-none-any.whl

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.
@@ -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.12.0"
4
+ __version__ = "1.12.1"
5
5
 
6
6
  from librus_python_api.attachments import AttachmentStream, ModernAttachmentStream
7
7
  from librus_python_api.budget import RequestBudget
@@ -88,7 +88,6 @@ def _collection[M: BaseModel](data: object, key: str, maximum: int, wire: type[M
88
88
  def _unique(pairs: list[tuple[str, str]]) -> dict[str, str]:
89
89
  result: dict[str, str] = {}
90
90
  for identifier, value in pairs:
91
- # Conflicting rows are never resolved by choosing one of them.
92
91
  if identifier in result and result[identifier] != value:
93
92
  raise LibrusError(ErrorKind.PARSE)
94
93
  result[identifier] = value
@@ -858,7 +858,6 @@ DESCRIPTIVE_IDENTIFIER = re.compile(r"[A-Za-z0-9_-]{1,128}")
858
858
  DESCRIPTIVE_IDENTIFIER_OPERATIONS = frozenset(
859
859
  {"descriptive_user_info", "descriptive_partial_grades"}
860
860
  )
861
- # The PartialGrades read is a POST whose only body is this fixed JSON object.
862
861
  DESCRIPTIVE_PARTIAL_GRADES_BODY = b"{}"
863
862
  DESCRIPTIVE_MAX_SUBJECTS = 1024
864
863
  DESCRIPTIVE_MAX_USERS = 8192
@@ -560,7 +560,6 @@ def describe_failure(error: BaseException) -> str | None:
560
560
  frame, line, elements, sequences, counts = site
561
561
  redactor = _Redactor()
562
562
  lines = [f"at {_site(frame, line)}"]
563
- # The elements nearest the failure first; a page summary last.
564
563
  for name, value in sorted(elements, key=lambda item: _is_page(item[1])):
565
564
  redactor.nodes = 0
566
565
  if _is_page(value):
@@ -767,7 +767,7 @@ def read_grade_records(document: html.HtmlElement) -> GradeRecords:
767
767
  else:
768
768
  for row in markup.rows(table):
769
769
  if markup.in_header(row):
770
- # The new-schema table's column labels, not a subject.
770
+ # Why: the header row has a subject row's shape ("Przedmiot").
771
771
  continue
772
772
  cells = markup.cells(row)
773
773
  if _descriptive_row(cells):
@@ -150,7 +150,6 @@ def tooltip_fields(
150
150
  result[last] = f"{result[last]}\n{rendered}".strip()
151
151
  continue
152
152
  if separator and key in result and key in TOOLTIP_REPEATABLE_LABELS:
153
- # Each repeat keeps its value, in order, as one more line.
154
153
  result[key] = f"{result[key]}\n{value}"
155
154
  last = key
156
155
  continue
@@ -2,8 +2,9 @@
2
2
  structural observation; every fixture is synthetic.
3
3
 
4
4
  One table holds every earlier school year: a year header row, a period row,
5
- grade rows (subject marks or full-year descriptive text), then exactly one
6
- behaviour section, one absences section and an empty footer, in that order.
5
+ grade rows (per year, three subject marks or one full-year descriptive text),
6
+ then exactly one behaviour section, one absences section and an empty footer,
7
+ in that order.
7
8
  A separate table lists achievements. Unknown layouts are unsupported;
8
9
  contradictions inside the known layout are parse errors. The student's name in
9
10
  the page header and the chart scripts are never read.
@@ -170,8 +171,8 @@ class _Body:
170
171
  self.text = text
171
172
  self.state = "grades"
172
173
  self.labels: set[str] = set()
173
- self.subjects: list[tuple[str, list[ArchiveMarks]]] = []
174
- self.descriptive: list[tuple[str, list[str]]] = []
174
+ self.subjects: list[tuple[str, dict[int, ArchiveMarks]]] = []
175
+ self.descriptive: list[tuple[str, dict[int, str]]] = []
175
176
  self.behaviour: list[tuple[str, str]] = []
176
177
  self.absences: dict[str, list[ArchiveCounts]] = {}
177
178
 
@@ -230,25 +231,33 @@ class _Body:
230
231
  label = self._label(cells)
231
232
  if not label:
232
233
  _fail(ErrorKind.UNSUPPORTED_CAPABILITY)
233
- if spans == [1] * (1 + 3 * self.count):
234
- values = self._values(cells[1:])
235
- marks = [
236
- ArchiveMarks(*values[3 * i : 3 * i + 3]) for i in range(self.count)
237
- ]
238
- self.subjects.append((label, marks))
239
- limit, size = ARCHIVE_MAX_SUBJECTS, len(self.subjects)
240
- elif spans == [1] + [3] * self.count:
241
- texts = self._values(
242
- cells[1:], multiline=True, limit=ARCHIVE_MAX_TEXT_LENGTH
243
- )
244
- self.descriptive.append((label, texts))
245
- limit, size = ARCHIVE_MAX_DESCRIPTIVE, len(self.descriptive)
246
- else:
234
+ marks: dict[int, ArchiveMarks] = {}
235
+ texts: dict[int, str] = {}
236
+ rest = list(zip(cells[1:], spans[1:], strict=True))
237
+ for year in range(self.count):
238
+ if rest and rest[0][1] == 3:
239
+ (cell, _), *rest = rest
240
+ texts[year] = self._values(
241
+ [cell], multiline=True, limit=ARCHIVE_MAX_TEXT_LENGTH
242
+ )[0]
243
+ elif [pair[1] for pair in rest[:3]] == [1, 1, 1]:
244
+ marks[year] = ArchiveMarks(*self._values([c for c, _ in rest[:3]]))
245
+ rest = rest[3:]
246
+ else:
247
+ _fail(ErrorKind.UNSUPPORTED_CAPABILITY)
248
+ if rest:
247
249
  _fail(ErrorKind.UNSUPPORTED_CAPABILITY)
248
250
  if label in self.labels:
249
251
  _fail(ErrorKind.PARSE)
250
252
  self.labels.add(label)
251
- if size > limit:
253
+ if marks:
254
+ self.subjects.append((label, marks))
255
+ if texts:
256
+ self.descriptive.append((label, texts))
257
+ if (
258
+ len(self.subjects) > ARCHIVE_MAX_SUBJECTS
259
+ or len(self.descriptive) > ARCHIVE_MAX_DESCRIPTIVE
260
+ ):
252
261
  _fail(ErrorKind.LIMIT)
253
262
 
254
263
  def _behaviour(
@@ -299,10 +308,14 @@ def _archive(table: html.HtmlElement, text: _Text) -> tuple[ArchiveYear, ...]:
299
308
  school_year=school_year,
300
309
  first_year=first_year,
301
310
  subjects=tuple(
302
- ArchiveSubject(label, marks[i]) for label, marks in body.subjects
311
+ ArchiveSubject(label, marks[i])
312
+ for label, marks in body.subjects
313
+ if i in marks
303
314
  ),
304
315
  descriptive=tuple(
305
- ArchiveDescriptive(label, texts[i]) for label, texts in body.descriptive
316
+ ArchiveDescriptive(label, texts[i])
317
+ for label, texts in body.descriptive
318
+ if i in texts
306
319
  ),
307
320
  behaviour_first_semester=body.behaviour[i][0],
308
321
  behaviour_second_semester_and_year_end=body.behaviour[i][1],
@@ -622,7 +622,6 @@ class AccountClient:
622
622
  self, *, budget: RequestBudget | None = None, max_age_seconds: float = 0.0
623
623
  ) -> ModernIdentity:
624
624
  async def fetch(budget: RequestBudget, _: bool) -> ModernIdentity:
625
- # Identity reads are fresh even if a modern session is already bound.
626
625
  account = await self._modern_ready(budget, refresh=True)
627
626
  return ModernIdentity(
628
627
  self._session_identity(), account, self._observation("modern_identity")
@@ -1082,8 +1081,6 @@ class AccountClient:
1082
1081
  deadline=deadline,
1083
1082
  )
1084
1083
 
1085
- # Public reads: validate input, then describe one fetch for _read.
1086
-
1087
1084
  async def notification_counts(
1088
1085
  self, *, budget: RequestBudget | None = None, max_age_seconds: float = 0.0
1089
1086
  ) -> NotificationCounts:
@@ -2049,8 +2046,6 @@ class AccountClient:
2049
2046
  ("recipients", "choices", group.identifier), fetch, budget, max_age_seconds
2050
2047
  )
2051
2048
 
2052
- # Shared read machinery.
2053
-
2054
2049
  async def _school_detail(
2055
2050
  self,
2056
2051
  operation: Literal["agenda_detail", "homework_detail"],
@@ -2390,8 +2385,6 @@ class AccountClient:
2390
2385
  def _observation(self, source: str) -> Observation:
2391
2386
  return Observation(self._alias, datetime.now(UTC), self._generation, source)
2392
2387
 
2393
- # Multi-request reads.
2394
-
2395
2388
  async def _message_page(
2396
2389
  self, folder: MessageFolder, page: int, budget: RequestBudget
2397
2390
  ) -> MessagesPage:
@@ -2794,8 +2787,6 @@ class AccountClient:
2794
2787
  kinds = await self._metadata_map("attendance_types", budget)
2795
2788
  return resolve_type_kinds(rows, kinds)
2796
2789
 
2797
- # Authentication and response validation.
2798
-
2799
2790
  def _validate_read_response(
2800
2791
  self, response: TransportResponse, content_type: str
2801
2792
  ) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: librus-python-api
3
- Version: 1.12.0
3
+ Version: 1.12.1
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
@@ -36,13 +36,20 @@ Use it in personal scripts, notification services or application backends. One
36
36
  service can manage multiple logins while keeping their sessions and data separate.
37
37
  It is not an official Librus product.
38
38
 
39
+ > **Unofficial project.** This is an independent, private open-source project.
40
+ > It is not affiliated with, endorsed by or sponsored by Librus or its owner.
41
+ > "Librus" and "Librus Synergia" are trademarks of their owner, named here only
42
+ > to say which service this software works with. See
43
+ > [Trademarks and affiliation](#trademarks-and-affiliation).
44
+
39
45
  **Requirements:** Python 3.13 or newer. Disk workflows require a trusted local
40
46
  POSIX filesystem on Linux/macOS, or a fixed local NTFS volume on Windows with
41
47
  private ACLs. Windows installations include `pywin32` and `tzdata` automatically.
42
48
  Network paths, reparse-point paths and unsafe storage permissions fail closed.
43
49
  See [platform requirements](contracts/persistence.md#windows-disk-boundary-25).
44
50
 
45
- **Status:** `1.12.0` resolves a school's own attendance types, counts
51
+ **Status:** `1.12.1` reads school-year archive rows that hold marks for one
52
+ year and text for another. `1.12.0` resolves a school's own attendance types, counts
46
53
  attendance whose lesson or subject cannot be resolved apart instead of failing
47
54
  the subject frequency read, keeps grade comment lines that hold a colon as
48
55
  text and groups repeated gateway validation errors. `1.11.5` reads gateway attendance records whose ID is not a
@@ -93,7 +100,7 @@ See [limitations](#supported-features-and-limitations) below.
93
100
  Install the exact release from PyPI after its gated publication completes:
94
101
 
95
102
  ```sh
96
- python -m pip install librus-python-api==1.12.0
103
+ python -m pip install librus-python-api==1.12.1
97
104
  ```
98
105
 
99
106
  Pin the exact version qualified by your application. Before publication, use a
@@ -109,7 +116,7 @@ python -m pip install .
109
116
  To install a locally built wheel instead:
110
117
 
111
118
  ```sh
112
- python -m pip install ./dist/librus_python_api-1.12.0-py3-none-any.whl
119
+ python -m pip install ./dist/librus_python_api-1.12.1-py3-none-any.whl
113
120
  ```
114
121
 
115
122
  No console script or background process is installed: import the library in your
@@ -331,6 +338,16 @@ school data to public reports.
331
338
 
332
339
  MIT licensed. See [LICENSE][license].
333
340
 
341
+ ## Trademarks and affiliation
342
+
343
+ This is an independent, private open-source project. It is not affiliated with,
344
+ endorsed by, sponsored by or otherwise connected to Librus or its owner, and it
345
+ is not an official Librus product. "Librus", "Librus Synergia" and related
346
+ names and logos are trademarks of their owner. They are used here only to
347
+ describe which service this software works with; the author claims no rights to
348
+ them. Use of the service through this software remains subject to the
349
+ service's own terms.
350
+
334
351
  [api]: https://github.com/krzysztofbury/librus-python-api/blob/main/API.md
335
352
  [upgrade]: https://github.com/krzysztofbury/librus-python-api/blob/main/contracts/account-context.md
336
353
  [verification]: https://github.com/krzysztofbury/librus-python-api/blob/main/VERIFICATION.md
@@ -1,4 +1,4 @@
1
- librus_python_api/__init__.py,sha256=G9bwNt89cbdKinH4UPl2srwm4gH7-08AofPg8cz-kak,6846
1
+ librus_python_api/__init__.py,sha256=PPBgdYxnKbJhjOHquqyIpiOcEqZaVzX8v0h54LzliO4,6846
2
2
  librus_python_api/_notification_bootstrap.py,sha256=18nzH0doXBNaZXCz-_ckIvRrlHTWV5Mm1t5m2-5eYGI,4669
3
3
  librus_python_api/_notification_codec.py,sha256=hU6G3zGJ5fR8wfPC6fV2OqBKs-7XpT9eRnKO3FGsTzY,13451
4
4
  librus_python_api/_storage.py,sha256=M_6ZAzN4zs7laOdKJBRH1I2rvy3pgqYgC_MZtsd2xtM,15893
@@ -7,25 +7,25 @@ librus_python_api/announcements.py,sha256=13FoOR1sq7tt9w6aLf0vclcFKDqLUiIYaO5iYD
7
7
  librus_python_api/attachment_routes.py,sha256=uSg5wCQqHJiphF0KdI0GatQxZr5SLUx6xWQRsl_U4_U,4123
8
8
  librus_python_api/attachments.py,sha256=Iq-ERZWc3gYXu6Lcv6womT2EXCc-c1Q7r_Q6VyaCm2E,10818
9
9
  librus_python_api/attendance.py,sha256=Dq2IC8WERO-9x-LZIN5Nl0PTLYmL1Iq7BZtOz6nssOI,7428
10
- librus_python_api/attendance_frequency.py,sha256=0MXLK0jY_LjL7aM22U4vK_z2mEADGzhwxDiscq5zaEY,5900
10
+ librus_python_api/attendance_frequency.py,sha256=6t4flcnydfNU4Ef1txL4JrVczcrwvHjiGQsSa1KSFwk,5829
11
11
  librus_python_api/budget.py,sha256=8fvqT7eIxyVX2P2OBG27XsYHk_HbtSS4lzuecYpHtgs,2878
12
12
  librus_python_api/checkpoint.py,sha256=QBmG9GtpyaGRaFq-FXuGA3yR1BjuMFN9V3RTvvi_FNQ,1930
13
13
  librus_python_api/class_free_days.py,sha256=IwoCgr-9ZgEYYQ6717s4cDpyFzbosHMzESMabXJLGqA,2422
14
14
  librus_python_api/completed_lessons.py,sha256=7TwLbUo67hbxO2Te6PzRfe7UzP94P1eRqfbttn9S3KA,11139
15
- librus_python_api/config.py,sha256=ntL1zEl6KwTCFOifUKI3nAbD-uOtelNUB9gyo69NVIM,68169
15
+ librus_python_api/config.py,sha256=LtD9EoPPlL6oCcwyBIFGueFDtqUCXrhW9rygK_cP_cE,68091
16
16
  librus_python_api/detail_fields.py,sha256=vDDi5sV-e30-42SF0hwAUoldiZ5wvYtb1UlLt03lBHw,1708
17
- librus_python_api/diagnostics.py,sha256=LxcN4BwX1Bn9lk70v0CxWd23-q2H_KlyJzKC6vm2SMQ,21989
17
+ librus_python_api/diagnostics.py,sha256=kPo1Xgwnm2lxsxcl4XbhwQQGdBRYFDwpBbK-rf81RTQ,21918
18
18
  librus_python_api/exceptions.py,sha256=lymPWTInw_ZBPXWftyHtolnKGfeY2Z4gB5WrqtAVYQ4,6087
19
19
  librus_python_api/files.py,sha256=pQBsIJyfTOZDz83ZB-5fcd-nPMcxR1HJ155h4zTHmsA,9223
20
20
  librus_python_api/formative_grades.py,sha256=VykwtGvViZVOJMwPH3Re1RTDCHMr1_m9_xHjZyaXDIQ,6452
21
21
  librus_python_api/gateway_grades.py,sha256=ILqWkkaRq120wG--h7GfFy4qFAQcuaa6LpzJOcCA2FU,22921
22
22
  librus_python_api/grade_parsers.py,sha256=P7s9yOzY6gYoWJUbo_ZKjE2xZlkHyDXakbQLJOQ5a9U,12759
23
- librus_python_api/grade_records.py,sha256=vx56fzZF4aX6Fq8Bev6Ya_c9ZtXd55K0PBhUW2RM0mc,31656
23
+ librus_python_api/grade_records.py,sha256=IzAw5V76vAaZzq65upDguZO9ClVZQKG8JeAoaaDh7v4,31664
24
24
  librus_python_api/homework_range.py,sha256=erYfvS6PhHU5XhnR6LkiLNy677hGVflY3UAuHOs-YUw,1663
25
25
  librus_python_api/inspect_page.py,sha256=uSFJRcEd5m36kqqP6kf2uowB4x2RGNqyfnmaakVzL94,5938
26
26
  librus_python_api/justifications.py,sha256=ZzfeZR5TvYyArQ5Oqi6VM5JmBKS2lZok4UR7hc3dI4o,7799
27
27
  librus_python_api/lifecycle.py,sha256=XzA5CEdZFo7iL5IMUrawnRvf2m9BFe0OseP-fpQFaAE,856
28
- librus_python_api/markup.py,sha256=W_nWgsoY56-XFbW-WMTc6QyR7cBqQRA-L6qgCSYg3k4,8770
28
+ librus_python_api/markup.py,sha256=nCG6XQCAHL1tZbIJ7S_vXSgLbaKtaPYQ59YAkKb09ys,8699
29
29
  librus_python_api/message_content.py,sha256=v_qoEAoaYS0_9MQBaj57i5XnC7pzv_HHWefgTt4CNyM,9043
30
30
  librus_python_api/messages.py,sha256=K9F8XVs1SojfFpdxxLV8gx9E0g81YxEHjigDzLHmDCg,10230
31
31
  librus_python_api/models.py,sha256=v9J-5qDUPbpO_MJx-jAlq-p3OGs44mfqEhGAiv3EoSQ,47782
@@ -43,12 +43,12 @@ librus_python_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  librus_python_api/recipients.py,sha256=6GQCKo-Zjg3VFSg1J8YXcDsy_U3r6-MUS4VCvz0xdaQ,10033
44
44
  librus_python_api/scheduler.py,sha256=3JplYxqvQdFz3aKXcoQUJHE9s3FPw_xRhQ2CPNLuQmA,10729
45
45
  librus_python_api/school_reads.py,sha256=YHta7DmhjS5vSa4Djq8pzp01-2jhVfGOo1Mnc738rV4,15209
46
- librus_python_api/school_year_archive.py,sha256=D0A1ywMKgoYgvi-d70__SFreMGvMb_72870Akkbb_m8,15492
46
+ librus_python_api/school_year_archive.py,sha256=TdcwtF8u3I9k6qmke2JdU3NkWIHpGieqrVcf15m6mxc,15899
47
47
  librus_python_api/sending.py,sha256=Nvvk2r-6D6Us53a2fH5GW9PcA6bWEfuOvy6c3M5QVcE,4549
48
- librus_python_api/service.py,sha256=i1ZuvJPZBWWf4DEqhJj65UjMRGe4sNVuvdYd1u-xFdU,110681
48
+ librus_python_api/service.py,sha256=LTXH1DvhN-SRqHfcgDAj4V3NNjAFCImr1U8upxJqT0E,110422
49
49
  librus_python_api/timetable.py,sha256=tX1QK9fQABxzfLaHHqTe8e6rAgdOkCoTOfAHdPwNmLE,9836
50
50
  librus_python_api/transport.py,sha256=SAg-LovpilhgmBghjw0snm5DXYQPpgYazyOQzM2T1Aw,35571
51
- librus_python_api-1.12.0.dist-info/METADATA,sha256=51gwU4CWXCN9aorT3cQn85XCZc0zq8Ptm-DrT0iAu_w,16560
52
- librus_python_api-1.12.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
53
- librus_python_api-1.12.0.dist-info/licenses/LICENSE,sha256=IuerLb3cnZCsaB23znydjjvKqP-LmSJd3syKa9NGUts,1071
54
- librus_python_api-1.12.0.dist-info/RECORD,,
51
+ librus_python_api-1.12.1.dist-info/METADATA,sha256=sm9B4fx7kKIxalr77lo4ktQlBViLaAuh6uyOXmzJZug,17515
52
+ librus_python_api-1.12.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
53
+ librus_python_api-1.12.1.dist-info/licenses/LICENSE,sha256=IuerLb3cnZCsaB23znydjjvKqP-LmSJd3syKa9NGUts,1071
54
+ librus_python_api-1.12.1.dist-info/RECORD,,