hackerrank 2026.11.2__tar.gz → 2026.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.
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/PKG-INFO +7 -3
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/README.rst +4 -2
- hackerrank-2026.11.3/docs/source/changelog/2026.11.03.md +6 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/prek.toml +0 -2
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/pyproject.toml +5 -2
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_internal_notes.py +2 -1
- hackerrank-2026.11.3/src/hackerrank/_notes_html.py +105 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/PKG-INFO +7 -3
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/SOURCES.txt +3 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/requires.txt +2 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/scm_file_list.json +3 -0
- hackerrank-2026.11.3/src/hackerrank.egg-info/scm_version.json +8 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_internal_notes.py +24 -0
- hackerrank-2026.11.3/tests/test_notes_html.py +115 -0
- hackerrank-2026.11.2/src/hackerrank.egg-info/scm_version.json +0 -8
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.git_archival.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.gitattributes +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/dependabot.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/autofix.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/ci.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/dependabot-merge.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/lint.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/publish-site.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.github/workflows/release.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.gitignore +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.prettierrc +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/.vale.ini +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/CHANGELOG.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/LICENSE +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/api-reference.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.05.12.1.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.05.12.2.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.05.12.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.07.08.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.07.19.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.07.30.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.08.16.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.08.22.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.08.27.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.08.28.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.09.07.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.09.16.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.10.09.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.10.30.1.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.10.30.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog/2026.11.02.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/changelog.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/conf.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/contributing.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/index.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/openapi-spec.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/release-process.rst +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/docs/source/unreleased.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/newsfragments/.gitkeep +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/newsfragments/README.md +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/openapi.json +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/setup.cfg +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/spelling_private_dict.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_dict_types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_project_archive.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_request_types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_responses.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/_retries.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/async_client.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/client.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/exceptions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/py.typed +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank/types.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/dependency_links.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/not-zip-safe +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/src/hackerrank.egg-info/top_level.txt +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/styles/snapper/LongProseLine.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/styles/snapper/SemanticLineBreaks.yml +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/async_client/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/async_client/test_configuration.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/async_client/test_endpoints.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/async_client/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client/test_configuration.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client/test_endpoints.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/constants.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_pagination.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_request_bodies.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_routing.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/test_assessments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/test_integrations.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/test_interviews.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/test_organization.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/endpoints/test_questions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_assessments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_candidates.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_integrations.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_interviews.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_organization.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/models/test_pagination.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/openapi_helpers.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/__init__.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/conftest.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/questions.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/responses.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_async.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_delays.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_errors.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_logging.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_policy.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/test_uploads.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/retries/transports.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_candidate_search.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_custom_system_prompt.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_documented_request_params.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_newsfragments.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_openapi.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_project_directory.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_reject_bare_string_lists.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_required_update_bodies.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_response_shapes.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/test_retry_safety_docs.py +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/typings/pyprojroot/__init__.pyi +0 -0
- {hackerrank-2026.11.2 → hackerrank-2026.11.3}/zizmor.yml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.11.
|
|
3
|
+
Version: 2026.11.3
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,9 +19,11 @@ Requires-Python: >=3.13
|
|
|
19
19
|
Description-Content-Type: text/x-rst
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: beartype>=0.23.0
|
|
22
|
+
Requires-Dist: beautifulsoup4>=4.15.0
|
|
22
23
|
Requires-Dist: httpx>=0.28.0
|
|
23
24
|
Requires-Dist: httpx2>=2.12.0
|
|
24
25
|
Requires-Dist: tenacity>=9.1.4
|
|
26
|
+
Requires-Dist: tinycss2>=1.4.0
|
|
25
27
|
Dynamic: license-file
|
|
26
28
|
|
|
27
29
|
|Build Status| |PyPI|
|
|
@@ -70,8 +72,10 @@ Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...
|
|
|
70
72
|
The same operation is available on ``AsyncHackerRank``.
|
|
71
73
|
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
72
74
|
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
Verification accepts HTML entity spelling, attribute order, block indentation, and CSS declaration spacing changes.
|
|
76
|
+
It preserves document structure, text, links, and exact code-block whitespace, and treats absent notes as empty.
|
|
77
|
+
Plain text is compared exactly.
|
|
78
|
+
Question-type restrictions remain with the caller.
|
|
75
79
|
|
|
76
80
|
HTTPX2 transports
|
|
77
81
|
-----------------
|
|
@@ -44,8 +44,10 @@ Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...
|
|
|
44
44
|
The same operation is available on ``AsyncHackerRank``.
|
|
45
45
|
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
46
46
|
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
Verification accepts HTML entity spelling, attribute order, block indentation, and CSS declaration spacing changes.
|
|
48
|
+
It preserves document structure, text, links, and exact code-block whitespace, and treats absent notes as empty.
|
|
49
|
+
Plain text is compared exactly.
|
|
50
|
+
Question-type restrictions remain with the caller.
|
|
49
51
|
|
|
50
52
|
HTTPX2 transports
|
|
51
53
|
-----------------
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# 2026.11.03 (2026-11-03)
|
|
2
|
+
|
|
3
|
+
## Changes
|
|
4
|
+
|
|
5
|
+
- Accept harmless HTML serialization changes when verifying saved interviewer notes, while retaining document structure, content, links, code whitespace, and checks for changes to other question fields.
|
|
6
|
+
([#507](https://github.com/adamtheturtle/hackerrank/issues/507))
|
|
@@ -348,8 +348,6 @@ hooks = [
|
|
|
348
348
|
{
|
|
349
349
|
id = "vale-sync",
|
|
350
350
|
name = "vale sync",
|
|
351
|
-
# The Python Vale wrapper may fail transiently while downloading its binary; see
|
|
352
|
-
# https://github.com/daniperez/vale-python-package/issues/77
|
|
353
351
|
entry = "uv run --group=dev vale sync",
|
|
354
352
|
language = "python",
|
|
355
353
|
pass_filenames = false,
|
|
@@ -34,9 +34,11 @@ dynamic = [
|
|
|
34
34
|
]
|
|
35
35
|
dependencies = [
|
|
36
36
|
"beartype>=0.23.0",
|
|
37
|
+
"beautifulsoup4>=4.15.0",
|
|
37
38
|
"httpx>=0.28.0",
|
|
38
39
|
"httpx2>=2.12.0",
|
|
39
40
|
"tenacity>=9.1.4",
|
|
41
|
+
"tinycss2>=1.4.0",
|
|
40
42
|
]
|
|
41
43
|
urls.Documentation = "https://adamtheturtle.github.io/hackerrank/"
|
|
42
44
|
urls.Source = "https://github.com/adamtheturtle/hackerrank"
|
|
@@ -57,7 +59,7 @@ dev = [
|
|
|
57
59
|
"myst-parser==5.1.0",
|
|
58
60
|
"no-defaults==2026.9.1",
|
|
59
61
|
"openapi-mock==2026.10.9",
|
|
60
|
-
"prek==0.5.
|
|
62
|
+
"prek==0.5.9",
|
|
61
63
|
"pydocstringformatter==1.0.0",
|
|
62
64
|
"pydocstyle==6.3",
|
|
63
65
|
"pygments==2.21.0",
|
|
@@ -95,7 +97,8 @@ dev = [
|
|
|
95
97
|
"sybil==10.1.0",
|
|
96
98
|
"towncrier==26.9.0",
|
|
97
99
|
"ty==0.0.95",
|
|
98
|
-
"
|
|
100
|
+
"types-tinycss2==1.5.1.20260414",
|
|
101
|
+
"vale==3.26.0.1",
|
|
99
102
|
"vulture==2.16",
|
|
100
103
|
"yamlfix==1.19.1",
|
|
101
104
|
"zizmor==1.31.1",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import replace
|
|
4
4
|
|
|
5
|
+
from hackerrank._notes_html import notes_equal
|
|
5
6
|
from hackerrank.types import JSONValue, Question
|
|
6
7
|
|
|
7
8
|
|
|
@@ -63,7 +64,7 @@ def verify_internal_notes(
|
|
|
63
64
|
) -> None:
|
|
64
65
|
"""Verify saved notes and every other modeled question field."""
|
|
65
66
|
actual = "" if after.internal_notes is None else after.internal_notes
|
|
66
|
-
if
|
|
67
|
+
if not notes_equal(expected=internal_notes, actual=actual):
|
|
67
68
|
message = f"HackerRank did not retain notes for question {before.id}"
|
|
68
69
|
raise ValueError(message)
|
|
69
70
|
if _without_notes(question=before) != _without_notes(question=after):
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Compare note HTML while retaining content and meaningful whitespace."""
|
|
2
|
+
|
|
3
|
+
from bs4 import BeautifulSoup
|
|
4
|
+
from bs4.element import NavigableString, Tag
|
|
5
|
+
from tinycss2 import parse_declaration_list, serialize
|
|
6
|
+
from tinycss2.ast import Declaration
|
|
7
|
+
|
|
8
|
+
_BLOCK_ELEMENTS = frozenset(
|
|
9
|
+
{
|
|
10
|
+
"article",
|
|
11
|
+
"aside",
|
|
12
|
+
"blockquote",
|
|
13
|
+
"col",
|
|
14
|
+
"colgroup",
|
|
15
|
+
"dd",
|
|
16
|
+
"details",
|
|
17
|
+
"div",
|
|
18
|
+
"dl",
|
|
19
|
+
"dt",
|
|
20
|
+
"figcaption",
|
|
21
|
+
"figure",
|
|
22
|
+
"footer",
|
|
23
|
+
"h1",
|
|
24
|
+
"h2",
|
|
25
|
+
"h3",
|
|
26
|
+
"h4",
|
|
27
|
+
"h5",
|
|
28
|
+
"h6",
|
|
29
|
+
"header",
|
|
30
|
+
"hr",
|
|
31
|
+
"li",
|
|
32
|
+
"main",
|
|
33
|
+
"nav",
|
|
34
|
+
"ol",
|
|
35
|
+
"p",
|
|
36
|
+
"pre",
|
|
37
|
+
"section",
|
|
38
|
+
"summary",
|
|
39
|
+
"table",
|
|
40
|
+
"tbody",
|
|
41
|
+
"td",
|
|
42
|
+
"tfoot",
|
|
43
|
+
"th",
|
|
44
|
+
"thead",
|
|
45
|
+
"tr",
|
|
46
|
+
"ul",
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
_LITERAL_ELEMENTS = frozenset({"pre", "code", "textarea", "script", "style"})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _style(value: str, /) -> str:
|
|
53
|
+
"""Normalize declaration separators without rewriting CSS values."""
|
|
54
|
+
declarations = parse_declaration_list(
|
|
55
|
+
input=value, skip_comments=False, skip_whitespace=True
|
|
56
|
+
)
|
|
57
|
+
if not all(isinstance(item, Declaration) for item in declarations):
|
|
58
|
+
return value
|
|
59
|
+
return ";".join(
|
|
60
|
+
item.name
|
|
61
|
+
+ ":"
|
|
62
|
+
+ serialize(nodes=item.value).strip(" \t\r\n\f")
|
|
63
|
+
+ ("!important" if item.important else "")
|
|
64
|
+
for item in declarations
|
|
65
|
+
if isinstance(item, Declaration)
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _formatting_space(node: NavigableString, /) -> bool:
|
|
70
|
+
"""Ignore indentation next to block elements, retaining inline
|
|
71
|
+
gaps.
|
|
72
|
+
"""
|
|
73
|
+
if bool(str(object=node).strip(" \t\r\n\f")) or any(
|
|
74
|
+
parent.name in _LITERAL_ELEMENTS for parent in node.parents
|
|
75
|
+
):
|
|
76
|
+
return False
|
|
77
|
+
return any(
|
|
78
|
+
isinstance(sibling, Tag) and sibling.name in _BLOCK_ELEMENTS
|
|
79
|
+
for sibling in (node.previous_sibling, node.next_sibling)
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _normalized_html(value: str, /) -> str:
|
|
84
|
+
"""Normalize entity spelling, attributes, CSS, and block
|
|
85
|
+
indentation.
|
|
86
|
+
"""
|
|
87
|
+
soup = BeautifulSoup(markup=value, features="html.parser")
|
|
88
|
+
if soup.find() is None:
|
|
89
|
+
return value
|
|
90
|
+
for tag in soup.find_all():
|
|
91
|
+
style = tag.get(key="style")
|
|
92
|
+
if isinstance(style, str):
|
|
93
|
+
tag["style"] = _style(style)
|
|
94
|
+
for node in list(soup.descendants):
|
|
95
|
+
# Comments and other NavigableString subclasses are meaningful markup.
|
|
96
|
+
if type(node) is NavigableString and _formatting_space(node): # pylint: disable=unidiomatic-typecheck
|
|
97
|
+
_ = node.extract()
|
|
98
|
+
return soup.decode()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def notes_equal(*, expected: str, actual: str) -> bool:
|
|
102
|
+
"""Accept observed HTML formatting without ignoring lost content."""
|
|
103
|
+
return expected == actual or _normalized_html(
|
|
104
|
+
expected
|
|
105
|
+
) == _normalized_html(actual)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.11.
|
|
3
|
+
Version: 2026.11.3
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,9 +19,11 @@ Requires-Python: >=3.13
|
|
|
19
19
|
Description-Content-Type: text/x-rst
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: beartype>=0.23.0
|
|
22
|
+
Requires-Dist: beautifulsoup4>=4.15.0
|
|
22
23
|
Requires-Dist: httpx>=0.28.0
|
|
23
24
|
Requires-Dist: httpx2>=2.12.0
|
|
24
25
|
Requires-Dist: tenacity>=9.1.4
|
|
26
|
+
Requires-Dist: tinycss2>=1.4.0
|
|
25
27
|
Dynamic: license-file
|
|
26
28
|
|
|
27
29
|
|Build Status| |PyPI|
|
|
@@ -70,8 +72,10 @@ Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...
|
|
|
70
72
|
The same operation is available on ``AsyncHackerRank``.
|
|
71
73
|
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
72
74
|
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
Verification accepts HTML entity spelling, attribute order, block indentation, and CSS declaration spacing changes.
|
|
76
|
+
It preserves document structure, text, links, and exact code-block whitespace, and treats absent notes as empty.
|
|
77
|
+
Plain text is compared exactly.
|
|
78
|
+
Question-type restrictions remain with the caller.
|
|
75
79
|
|
|
76
80
|
HTTPX2 transports
|
|
77
81
|
-----------------
|
|
@@ -44,11 +44,13 @@ docs/source/changelog/2026.10.09.md
|
|
|
44
44
|
docs/source/changelog/2026.10.30.1.md
|
|
45
45
|
docs/source/changelog/2026.10.30.md
|
|
46
46
|
docs/source/changelog/2026.11.02.md
|
|
47
|
+
docs/source/changelog/2026.11.03.md
|
|
47
48
|
newsfragments/.gitkeep
|
|
48
49
|
newsfragments/README.md
|
|
49
50
|
src/hackerrank/__init__.py
|
|
50
51
|
src/hackerrank/_dict_types.py
|
|
51
52
|
src/hackerrank/_internal_notes.py
|
|
53
|
+
src/hackerrank/_notes_html.py
|
|
52
54
|
src/hackerrank/_project_archive.py
|
|
53
55
|
src/hackerrank/_request_types.py
|
|
54
56
|
src/hackerrank/_responses.py
|
|
@@ -77,6 +79,7 @@ tests/test_custom_system_prompt.py
|
|
|
77
79
|
tests/test_documented_request_params.py
|
|
78
80
|
tests/test_internal_notes.py
|
|
79
81
|
tests/test_newsfragments.py
|
|
82
|
+
tests/test_notes_html.py
|
|
80
83
|
tests/test_openapi.py
|
|
81
84
|
tests/test_project_directory.py
|
|
82
85
|
tests/test_reject_bare_string_lists.py
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"docs/source/changelog/2026.10.30.1.md",
|
|
36
36
|
"docs/source/changelog/2026.10.30.md",
|
|
37
37
|
"docs/source/changelog/2026.11.02.md",
|
|
38
|
+
"docs/source/changelog/2026.11.03.md",
|
|
38
39
|
"docs/source/conf.py",
|
|
39
40
|
"docs/source/contributing.rst",
|
|
40
41
|
"docs/source/index.rst",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"src/hackerrank/__init__.py",
|
|
51
52
|
"src/hackerrank/_dict_types.py",
|
|
52
53
|
"src/hackerrank/_internal_notes.py",
|
|
54
|
+
"src/hackerrank/_notes_html.py",
|
|
53
55
|
"src/hackerrank/_project_archive.py",
|
|
54
56
|
"src/hackerrank/_request_types.py",
|
|
55
57
|
"src/hackerrank/_responses.py",
|
|
@@ -110,6 +112,7 @@
|
|
|
110
112
|
"tests/test_documented_request_params.py",
|
|
111
113
|
"tests/test_internal_notes.py",
|
|
112
114
|
"tests/test_newsfragments.py",
|
|
115
|
+
"tests/test_notes_html.py",
|
|
113
116
|
"tests/test_openapi.py",
|
|
114
117
|
"tests/test_project_directory.py",
|
|
115
118
|
"tests/test_reject_bare_string_lists.py",
|
|
@@ -209,3 +209,27 @@ async def test_absent_notes_are_empty(*, use_async: bool) -> None:
|
|
|
209
209
|
expected_reads = 2
|
|
210
210
|
assert get.call_count == expected_reads
|
|
211
211
|
assert put.call_count == 1
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
@pytest.mark.asyncio
|
|
215
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
216
|
+
async def test_html_readback_formatting(*, use_async: bool) -> None:
|
|
217
|
+
"""Both clients accept the platform's harmless HTML serialization."""
|
|
218
|
+
before = _question()
|
|
219
|
+
requested = "<div><p>Driver’s rate</p><pre> code\n</pre></div>"
|
|
220
|
+
saved = "<div>\n<p>Driver\u2019s rate</p>\n<pre> code\n</pre>\n</div>"
|
|
221
|
+
after = {**before, "internal_notes": saved}
|
|
222
|
+
with respx.mock(assert_all_called=True) as router:
|
|
223
|
+
_ = router.get(url=_URL).mock(
|
|
224
|
+
side_effect=[
|
|
225
|
+
httpx.Response(status_code=200, json=before),
|
|
226
|
+
httpx.Response(status_code=200, json=after),
|
|
227
|
+
]
|
|
228
|
+
)
|
|
229
|
+
put = router.put(url=_URL).respond(status_code=204)
|
|
230
|
+
result = await _update(use_async=use_async, notes=requested)
|
|
231
|
+
assert result.internal_notes == saved
|
|
232
|
+
assert (
|
|
233
|
+
json.loads(s=put.calls.last.request.content)["internal_notes"]
|
|
234
|
+
== requested
|
|
235
|
+
)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""Read-back normalization accepts formatting and rejects changed
|
|
2
|
+
notes.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from hackerrank._notes_html import notes_equal
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.parametrize(
|
|
11
|
+
argnames=("expected", "actual"),
|
|
12
|
+
argvalues=[
|
|
13
|
+
("", ""),
|
|
14
|
+
("Plain text", "Plain text"),
|
|
15
|
+
(
|
|
16
|
+
"<p>Driver’s rate × 2</p>",
|
|
17
|
+
"<p>Driver\u2019s rate \u00d7 2</p>",
|
|
18
|
+
),
|
|
19
|
+
(
|
|
20
|
+
'<a href="/guide" class="link">Guide</a>',
|
|
21
|
+
'<a class="link" href="/guide">Guide</a>',
|
|
22
|
+
),
|
|
23
|
+
(
|
|
24
|
+
(
|
|
25
|
+
'<table><colgroup><col style="width: 50.0%"/></colgroup>'
|
|
26
|
+
"<tbody><tr><td><p>Rate</p></td></tr></tbody></table>"
|
|
27
|
+
),
|
|
28
|
+
(
|
|
29
|
+
"<table>\n<colgroup>\n"
|
|
30
|
+
'<col style="width:50.0%;">\n</colgroup>\n'
|
|
31
|
+
"<tbody>\n<tr>\n<td><p>Rate</p></td>\n</tr>\n</tbody>\n</table>"
|
|
32
|
+
),
|
|
33
|
+
),
|
|
34
|
+
(
|
|
35
|
+
'<p style="color: red !important; width: 50%">Rate</p>',
|
|
36
|
+
'<p style="color:red!important;width:50%;">Rate</p>',
|
|
37
|
+
),
|
|
38
|
+
('<p style="">Rate</p>', '<p style=";">Rate</p>'),
|
|
39
|
+
(
|
|
40
|
+
(
|
|
41
|
+
"<div><p>Example</p>"
|
|
42
|
+
"<pre><code> x < 3\n\tprint(x)\n</code></pre></div>"
|
|
43
|
+
),
|
|
44
|
+
(
|
|
45
|
+
"<div>\n<p>Example</p>\n"
|
|
46
|
+
"<pre><code> x < 3\n\tprint(x)\n</code></pre>\n</div>"
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
],
|
|
50
|
+
)
|
|
51
|
+
def test_equivalent_notes(*, expected: str, actual: str) -> None:
|
|
52
|
+
"""Entity spelling, CSS separators, and block indentation may
|
|
53
|
+
change.
|
|
54
|
+
"""
|
|
55
|
+
assert notes_equal(expected=expected, actual=actual)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@pytest.mark.parametrize(
|
|
59
|
+
argnames=("expected", "actual"),
|
|
60
|
+
argvalues=[
|
|
61
|
+
("Notes", ""),
|
|
62
|
+
("<div> <p>Task</p></div>", "<div><p>Task</p></div>"),
|
|
63
|
+
("Notes\n", "Notes"),
|
|
64
|
+
("x & y", "x & y"),
|
|
65
|
+
("<p>Required</p>", "<p>Changed</p>"),
|
|
66
|
+
(
|
|
67
|
+
"<details><summary>Prompt</summary><p>Task</p></details>",
|
|
68
|
+
"<div><summary>Prompt</summary><p>Task</p></div>",
|
|
69
|
+
),
|
|
70
|
+
('<a href="/guide">Guide</a>', '<a href="/other">Guide</a>'),
|
|
71
|
+
(
|
|
72
|
+
'<img src="data:image/png;base64,abc"/>',
|
|
73
|
+
'<img src="data:image/png;base64,def"/>',
|
|
74
|
+
),
|
|
75
|
+
('<p class="required">Task</p>', "<p>Task</p>"),
|
|
76
|
+
('<p style="color: red">Task</p>', '<p style="color: blue">Task</p>'),
|
|
77
|
+
(
|
|
78
|
+
'<p style="color: red !important">Task</p>',
|
|
79
|
+
'<p style="color:red">Task</p>',
|
|
80
|
+
),
|
|
81
|
+
(
|
|
82
|
+
'<p style="color:red; color:blue">Task</p>',
|
|
83
|
+
'<p style="color:blue; color:red">Task</p>',
|
|
84
|
+
),
|
|
85
|
+
(
|
|
86
|
+
"<p style=\"--label: 'a; b: c'\">Task</p>",
|
|
87
|
+
"<p style=\"--label: 'a;b:c'\">Task</p>",
|
|
88
|
+
),
|
|
89
|
+
('<p style="invalid">Task</p>', '<p style="invalid;">Task</p>'),
|
|
90
|
+
(
|
|
91
|
+
'<p style="/* keep */ color:red">Task</p>',
|
|
92
|
+
'<p style="color:red">Task</p>',
|
|
93
|
+
),
|
|
94
|
+
(
|
|
95
|
+
"<style>p { color: red }</style>",
|
|
96
|
+
"<style>p { color: blue }</style>",
|
|
97
|
+
),
|
|
98
|
+
("<script>run()</script>", "run()"),
|
|
99
|
+
("<div><!-- keep --><p>Task</p></div>", "<div><p>Task</p></div>"),
|
|
100
|
+
(
|
|
101
|
+
"<p><span>A</span> <span>B</span></p>",
|
|
102
|
+
"<p><span>A</span><span>B</span></p>",
|
|
103
|
+
),
|
|
104
|
+
("<pre> x\n\ty\n</pre>", "<pre>x\ny\n</pre>"),
|
|
105
|
+
("<pre> </pre>", "<pre></pre>"),
|
|
106
|
+
("<code> </code>", "<code></code>"),
|
|
107
|
+
("<textarea> </textarea>", "<textarea></textarea>"),
|
|
108
|
+
("<div><p>Task</p></div>", "<div><p>Task</p><p>Extra</p></div>"),
|
|
109
|
+
],
|
|
110
|
+
)
|
|
111
|
+
def test_changed_notes(*, expected: str, actual: str) -> None:
|
|
112
|
+
"""Content, inline gaps, code whitespace, and attributes stay
|
|
113
|
+
exact.
|
|
114
|
+
"""
|
|
115
|
+
assert not notes_equal(expected=expected, actual=actual)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hackerrank-2026.11.2 → hackerrank-2026.11.3}/tests/client_edge_cases/test_request_bodies.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|