hackerrank 2026.10.30__tar.gz → 2026.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.
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/autofix.yml +1 -1
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/ci.yml +2 -2
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/lint.yml +1 -1
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/release.yml +1 -1
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/PKG-INFO +11 -1
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/README.rst +10 -0
- hackerrank-2026.11.2/docs/source/changelog/2026.10.30.1.md +5 -0
- hackerrank-2026.11.2/docs/source/changelog/2026.11.02.md +6 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/pyproject.toml +3 -3
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/spelling_private_dict.txt +2 -0
- hackerrank-2026.11.2/src/hackerrank/_internal_notes.py +71 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/async_client.py +50 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/client.py +50 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/PKG-INFO +11 -1
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/SOURCES.txt +4 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/scm_file_list.json +4 -0
- hackerrank-2026.11.2/src/hackerrank.egg-info/scm_version.json +8 -0
- hackerrank-2026.11.2/tests/test_internal_notes.py +211 -0
- hackerrank-2026.10.30/src/hackerrank.egg-info/scm_version.json +0 -8
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.git_archival.txt +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.gitattributes +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/dependabot.yml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/dependabot-merge.yml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.github/workflows/publish-site.yml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.gitignore +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.prettierrc +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/.vale.ini +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/CHANGELOG.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/LICENSE +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/conftest.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/api-reference.rst +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.05.12.1.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.05.12.2.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.05.12.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.07.08.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.07.19.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.07.30.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.08.16.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.08.22.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.08.27.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.08.28.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.09.07.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.09.16.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.10.09.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog/2026.10.30.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/changelog.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/conf.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/contributing.rst +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/index.rst +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/openapi-spec.rst +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/release-process.rst +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/docs/source/unreleased.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/newsfragments/.gitkeep +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/newsfragments/README.md +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/openapi.json +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/prek.toml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/setup.cfg +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/_dict_types.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/_project_archive.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/_request_types.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/_responses.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/_retries.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/exceptions.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/py.typed +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/transports.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank/types.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/dependency_links.txt +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/not-zip-safe +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/requires.txt +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/src/hackerrank.egg-info/top_level.txt +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/styles/snapper/LongProseLine.yml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/styles/snapper/SemanticLineBreaks.yml +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/async_client/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/async_client/test_configuration.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/async_client/test_endpoints.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/async_client/test_transports.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client/test_configuration.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client/test_endpoints.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client/test_errors.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client/test_transports.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/constants.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/test_errors.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/test_pagination.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/test_request_bodies.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/test_routing.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/client_edge_cases/test_transports.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/conftest.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/test_assessments.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/test_integrations.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/test_interviews.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/test_organization.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/endpoints/test_questions.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_assessments.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_candidates.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_integrations.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_interviews.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_organization.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/models/test_pagination.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/openapi_helpers.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/__init__.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/conftest.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/questions.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/responses.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_async.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_delays.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_errors.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_logging.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_policy.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/test_uploads.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/retries/transports.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_candidate_search.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_custom_system_prompt.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_documented_request_params.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_newsfragments.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_openapi.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_project_directory.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_reject_bare_string_lists.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_required_update_bodies.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_response_shapes.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/tests/test_retry_safety_docs.py +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/typings/pyprojroot/__init__.pyi +0 -0
- {hackerrank-2026.10.30 → hackerrank-2026.11.2}/zizmor.yml +0 -0
|
@@ -21,7 +21,7 @@ jobs:
|
|
|
21
21
|
persist-credentials: false
|
|
22
22
|
|
|
23
23
|
- name: Install uv
|
|
24
|
-
uses: astral-sh/setup-uv@v10.3.
|
|
24
|
+
uses: astral-sh/setup-uv@v10.3.3
|
|
25
25
|
with:
|
|
26
26
|
enable-cache: true
|
|
27
27
|
cache-dependency-glob: '**/pyproject.toml'
|
|
@@ -44,7 +44,7 @@ jobs:
|
|
|
44
44
|
persist-credentials: false
|
|
45
45
|
|
|
46
46
|
- name: Install uv
|
|
47
|
-
uses: astral-sh/setup-uv@v10.3.
|
|
47
|
+
uses: astral-sh/setup-uv@v10.3.3
|
|
48
48
|
with:
|
|
49
49
|
enable-cache: true
|
|
50
50
|
cache-dependency-glob: '**/pyproject.toml'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.
|
|
3
|
+
Version: 2026.11.2
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -63,6 +63,16 @@ Generate an API token from the `HackerRank for Work tokens page`_ and pass it as
|
|
|
63
63
|
|
|
64
64
|
.. _HackerRank for Work tokens page: https://www.hackerrank.com/work/settings/token
|
|
65
65
|
|
|
66
|
+
Updating private notes
|
|
67
|
+
----------------------
|
|
68
|
+
|
|
69
|
+
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
70
|
+
The same operation is available on ``AsyncHackerRank``.
|
|
71
|
+
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
72
|
+
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
73
|
+
The default compares exact text and treats absent notes as empty.
|
|
74
|
+
HTML comparison policies and question-type restrictions remain with the caller.
|
|
75
|
+
|
|
66
76
|
HTTPX2 transports
|
|
67
77
|
-----------------
|
|
68
78
|
|
|
@@ -37,6 +37,16 @@ Generate an API token from the `HackerRank for Work tokens page`_ and pass it as
|
|
|
37
37
|
|
|
38
38
|
.. _HackerRank for Work tokens page: https://www.hackerrank.com/work/settings/token
|
|
39
39
|
|
|
40
|
+
Updating private notes
|
|
41
|
+
----------------------
|
|
42
|
+
|
|
43
|
+
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
44
|
+
The same operation is available on ``AsyncHackerRank``.
|
|
45
|
+
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
46
|
+
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
47
|
+
The default compares exact text and treats absent notes as empty.
|
|
48
|
+
HTML comparison policies and question-type restrictions remain with the caller.
|
|
49
|
+
|
|
40
50
|
HTTPX2 transports
|
|
41
51
|
-----------------
|
|
42
52
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# 2026.11.02 (2026-11-02)
|
|
2
|
+
|
|
3
|
+
## Changes
|
|
4
|
+
|
|
5
|
+
- Always write requested notes in synchronous and asynchronous `questions.update_internal_notes()` calls, including identical or empty notes.
|
|
6
|
+
Remove the `notes_equal` callback and equivalent-notes skip path while retaining exact read-back verification and preservation of other question fields.
|
|
@@ -51,7 +51,7 @@ dev = [
|
|
|
51
51
|
"doccmd==2026.9.16.1",
|
|
52
52
|
"furo==2025.12.19",
|
|
53
53
|
"interrogate==1.7.0",
|
|
54
|
-
"mypy==2.4.
|
|
54
|
+
"mypy==2.4.1",
|
|
55
55
|
"mypy-pytest-parametrize==2026.10.5.1",
|
|
56
56
|
"mypy-strict-kwargs==2026.10.19",
|
|
57
57
|
"myst-parser==5.1.0",
|
|
@@ -68,7 +68,7 @@ dev = [
|
|
|
68
68
|
"pyrefly==1.4.0",
|
|
69
69
|
"pyright==1.1.414",
|
|
70
70
|
"pyroma==5.0.1",
|
|
71
|
-
"pytest==9.
|
|
71
|
+
"pytest==9.2.0",
|
|
72
72
|
"pytest-asyncio==1.4.1",
|
|
73
73
|
"pytest-beartype==0.3.0",
|
|
74
74
|
"pytest-cov==7.1.0",
|
|
@@ -94,7 +94,7 @@ dev = [
|
|
|
94
94
|
"strict-kwargs==2026.10.9",
|
|
95
95
|
"sybil==10.1.0",
|
|
96
96
|
"towncrier==26.9.0",
|
|
97
|
-
"ty==0.0.
|
|
97
|
+
"ty==0.0.95",
|
|
98
98
|
"vale==3.25.1.0",
|
|
99
99
|
"vulture==2.16",
|
|
100
100
|
"yamlfix==1.19.1",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Prepare and verify updates that change only question notes."""
|
|
2
|
+
|
|
3
|
+
from dataclasses import replace
|
|
4
|
+
|
|
5
|
+
from hackerrank.types import JSONValue, Question
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def check_question_id(*, question: Question, question_id: str) -> None:
|
|
9
|
+
"""Reject a response for a different question before any update."""
|
|
10
|
+
if question.id != question_id:
|
|
11
|
+
message = f"Expected question {question_id}, received {question.id}"
|
|
12
|
+
raise ValueError(message)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def internal_notes_body(
|
|
16
|
+
*, question: Question, internal_notes: str
|
|
17
|
+
) -> dict[str, JSONValue]:
|
|
18
|
+
"""Resend required update fields unchanged and omit optional
|
|
19
|
+
changes.
|
|
20
|
+
"""
|
|
21
|
+
if (
|
|
22
|
+
question.problem_statement is None
|
|
23
|
+
or question.recommended_duration is None
|
|
24
|
+
):
|
|
25
|
+
message = (
|
|
26
|
+
f"Question {question.id} lacks fields required to update notes"
|
|
27
|
+
)
|
|
28
|
+
raise ValueError(message)
|
|
29
|
+
return {
|
|
30
|
+
"name": question.name,
|
|
31
|
+
"type": question.type,
|
|
32
|
+
"internal_notes": internal_notes,
|
|
33
|
+
"languages": []
|
|
34
|
+
if question.languages is None
|
|
35
|
+
else list(question.languages),
|
|
36
|
+
"problem_statement": question.problem_statement,
|
|
37
|
+
"recommended_duration": question.recommended_duration,
|
|
38
|
+
"tags": [] if question.tags is None else list(question.tags),
|
|
39
|
+
"options": [] if question.options is None else list(question.options),
|
|
40
|
+
"answer": [] if question.answer is None else question.answer,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _without_notes(*, question: Question) -> Question:
|
|
45
|
+
"""Normalize optional required lists while retaining scalar
|
|
46
|
+
answers.
|
|
47
|
+
"""
|
|
48
|
+
return replace(
|
|
49
|
+
question,
|
|
50
|
+
internal_notes=None,
|
|
51
|
+
languages=[] if question.languages is None else question.languages,
|
|
52
|
+
tags=[] if question.tags is None else question.tags,
|
|
53
|
+
options=[] if question.options is None else question.options,
|
|
54
|
+
answer=[] if question.answer is None else question.answer,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def verify_internal_notes(
|
|
59
|
+
*,
|
|
60
|
+
before: Question,
|
|
61
|
+
after: Question,
|
|
62
|
+
internal_notes: str,
|
|
63
|
+
) -> None:
|
|
64
|
+
"""Verify saved notes and every other modeled question field."""
|
|
65
|
+
actual = "" if after.internal_notes is None else after.internal_notes
|
|
66
|
+
if actual != internal_notes:
|
|
67
|
+
message = f"HackerRank did not retain notes for question {before.id}"
|
|
68
|
+
raise ValueError(message)
|
|
69
|
+
if _without_notes(question=before) != _without_notes(question=after):
|
|
70
|
+
message = f"Question {before.id} changed fields other than notes"
|
|
71
|
+
raise ValueError(message)
|
|
@@ -29,6 +29,11 @@ from hackerrank._dict_types import (
|
|
|
29
29
|
UserDict,
|
|
30
30
|
UserTeamMembershipDict,
|
|
31
31
|
)
|
|
32
|
+
from hackerrank._internal_notes import (
|
|
33
|
+
check_question_id,
|
|
34
|
+
internal_notes_body,
|
|
35
|
+
verify_internal_notes,
|
|
36
|
+
)
|
|
32
37
|
from hackerrank._project_archive import project_archive
|
|
33
38
|
from hackerrank._request_types import MultipartFiles
|
|
34
39
|
from hackerrank._responses import (
|
|
@@ -1307,6 +1312,51 @@ class AsyncQuestionsNamespace(_AsyncNamespace):
|
|
|
1307
1312
|
)
|
|
1308
1313
|
return None
|
|
1309
1314
|
|
|
1315
|
+
async def update_internal_notes(
|
|
1316
|
+
self,
|
|
1317
|
+
*,
|
|
1318
|
+
question_id: str,
|
|
1319
|
+
internal_notes: str,
|
|
1320
|
+
) -> Question:
|
|
1321
|
+
"""Update notes and verify that other question fields are
|
|
1322
|
+
preserved.
|
|
1323
|
+
|
|
1324
|
+
Reads the current question, sends the requested notes with required
|
|
1325
|
+
fields unchanged, and reads back the saved question.
|
|
1326
|
+
Every call writes notes, including when the text is unchanged.
|
|
1327
|
+
|
|
1328
|
+
Safe to retry: the request replaces notes and required fields.
|
|
1329
|
+
|
|
1330
|
+
Args:
|
|
1331
|
+
question_id: The id of the question.
|
|
1332
|
+
internal_notes: Desired private interviewer notes.
|
|
1333
|
+
|
|
1334
|
+
Returns:
|
|
1335
|
+
The verified updated question.
|
|
1336
|
+
|
|
1337
|
+
Raises:
|
|
1338
|
+
ValueError: If required fields are absent or verification fails.
|
|
1339
|
+
"""
|
|
1340
|
+
current = await self.get(question_id=question_id)
|
|
1341
|
+
check_question_id(question=current, question_id=question_id)
|
|
1342
|
+
_ = await self._request(
|
|
1343
|
+
method="PUT",
|
|
1344
|
+
url=f"{_API_V3}/questions/{question_id}",
|
|
1345
|
+
json=internal_notes_body(
|
|
1346
|
+
question=current, internal_notes=internal_notes
|
|
1347
|
+
),
|
|
1348
|
+
params=None,
|
|
1349
|
+
files=None,
|
|
1350
|
+
repeatable=True,
|
|
1351
|
+
)
|
|
1352
|
+
after = await self.get(question_id=question_id)
|
|
1353
|
+
verify_internal_notes(
|
|
1354
|
+
before=current,
|
|
1355
|
+
after=after,
|
|
1356
|
+
internal_notes=internal_notes,
|
|
1357
|
+
)
|
|
1358
|
+
return after
|
|
1359
|
+
|
|
1310
1360
|
async def upload_project_directory(
|
|
1311
1361
|
self,
|
|
1312
1362
|
*,
|
|
@@ -28,6 +28,11 @@ from hackerrank._dict_types import (
|
|
|
28
28
|
UserDict,
|
|
29
29
|
UserTeamMembershipDict,
|
|
30
30
|
)
|
|
31
|
+
from hackerrank._internal_notes import (
|
|
32
|
+
check_question_id,
|
|
33
|
+
internal_notes_body,
|
|
34
|
+
verify_internal_notes,
|
|
35
|
+
)
|
|
31
36
|
from hackerrank._project_archive import project_archive
|
|
32
37
|
from hackerrank._request_types import MultipartFiles
|
|
33
38
|
from hackerrank._responses import (
|
|
@@ -1270,6 +1275,51 @@ class QuestionsNamespace(_Namespace):
|
|
|
1270
1275
|
)
|
|
1271
1276
|
return None
|
|
1272
1277
|
|
|
1278
|
+
def update_internal_notes(
|
|
1279
|
+
self,
|
|
1280
|
+
*,
|
|
1281
|
+
question_id: str,
|
|
1282
|
+
internal_notes: str,
|
|
1283
|
+
) -> Question:
|
|
1284
|
+
"""Update notes and verify that other question fields are
|
|
1285
|
+
preserved.
|
|
1286
|
+
|
|
1287
|
+
Reads the current question, sends the requested notes with required
|
|
1288
|
+
fields unchanged, and reads back the saved question.
|
|
1289
|
+
Every call writes notes, including when the text is unchanged.
|
|
1290
|
+
|
|
1291
|
+
Safe to retry: the request replaces notes and required fields.
|
|
1292
|
+
|
|
1293
|
+
Args:
|
|
1294
|
+
question_id: The id of the question.
|
|
1295
|
+
internal_notes: Desired private interviewer notes.
|
|
1296
|
+
|
|
1297
|
+
Returns:
|
|
1298
|
+
The verified updated question.
|
|
1299
|
+
|
|
1300
|
+
Raises:
|
|
1301
|
+
ValueError: If required fields are absent or verification fails.
|
|
1302
|
+
"""
|
|
1303
|
+
current = self.get(question_id=question_id)
|
|
1304
|
+
check_question_id(question=current, question_id=question_id)
|
|
1305
|
+
_ = self._request(
|
|
1306
|
+
method="PUT",
|
|
1307
|
+
url=f"{_API_V3}/questions/{question_id}",
|
|
1308
|
+
json=internal_notes_body(
|
|
1309
|
+
question=current, internal_notes=internal_notes
|
|
1310
|
+
),
|
|
1311
|
+
params=None,
|
|
1312
|
+
files=None,
|
|
1313
|
+
repeatable=True,
|
|
1314
|
+
)
|
|
1315
|
+
after = self.get(question_id=question_id)
|
|
1316
|
+
verify_internal_notes(
|
|
1317
|
+
before=current,
|
|
1318
|
+
after=after,
|
|
1319
|
+
internal_notes=internal_notes,
|
|
1320
|
+
)
|
|
1321
|
+
return after
|
|
1322
|
+
|
|
1273
1323
|
def upload_project_directory(
|
|
1274
1324
|
self,
|
|
1275
1325
|
*,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hackerrank
|
|
3
|
-
Version: 2026.
|
|
3
|
+
Version: 2026.11.2
|
|
4
4
|
Summary: Interact with the HackerRank for Work API.
|
|
5
5
|
Author-email: Adam Dangoor <adamdangoor@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -63,6 +63,16 @@ Generate an API token from the `HackerRank for Work tokens page`_ and pass it as
|
|
|
63
63
|
|
|
64
64
|
.. _HackerRank for Work tokens page: https://www.hackerrank.com/work/settings/token
|
|
65
65
|
|
|
66
|
+
Updating private notes
|
|
67
|
+
----------------------
|
|
68
|
+
|
|
69
|
+
Use ``client.questions.update_internal_notes(question_id=..., internal_notes=...)`` to change private interviewer notes.
|
|
70
|
+
The same operation is available on ``AsyncHackerRank``.
|
|
71
|
+
Every call writes the requested notes, resends required fields unchanged, and reads back the saved question.
|
|
72
|
+
It raises ``ValueError`` if required fields are absent or verification finds changes to other modeled fields.
|
|
73
|
+
The default compares exact text and treats absent notes as empty.
|
|
74
|
+
HTML comparison policies and question-type restrictions remain with the caller.
|
|
75
|
+
|
|
66
76
|
HTTPX2 transports
|
|
67
77
|
-----------------
|
|
68
78
|
|
|
@@ -41,11 +41,14 @@ docs/source/changelog/2026.08.28.md
|
|
|
41
41
|
docs/source/changelog/2026.09.07.md
|
|
42
42
|
docs/source/changelog/2026.09.16.md
|
|
43
43
|
docs/source/changelog/2026.10.09.md
|
|
44
|
+
docs/source/changelog/2026.10.30.1.md
|
|
44
45
|
docs/source/changelog/2026.10.30.md
|
|
46
|
+
docs/source/changelog/2026.11.02.md
|
|
45
47
|
newsfragments/.gitkeep
|
|
46
48
|
newsfragments/README.md
|
|
47
49
|
src/hackerrank/__init__.py
|
|
48
50
|
src/hackerrank/_dict_types.py
|
|
51
|
+
src/hackerrank/_internal_notes.py
|
|
49
52
|
src/hackerrank/_project_archive.py
|
|
50
53
|
src/hackerrank/_request_types.py
|
|
51
54
|
src/hackerrank/_responses.py
|
|
@@ -72,6 +75,7 @@ tests/openapi_helpers.py
|
|
|
72
75
|
tests/test_candidate_search.py
|
|
73
76
|
tests/test_custom_system_prompt.py
|
|
74
77
|
tests/test_documented_request_params.py
|
|
78
|
+
tests/test_internal_notes.py
|
|
75
79
|
tests/test_newsfragments.py
|
|
76
80
|
tests/test_openapi.py
|
|
77
81
|
tests/test_project_directory.py
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
"docs/source/changelog/2026.09.07.md",
|
|
33
33
|
"docs/source/changelog/2026.09.16.md",
|
|
34
34
|
"docs/source/changelog/2026.10.09.md",
|
|
35
|
+
"docs/source/changelog/2026.10.30.1.md",
|
|
35
36
|
"docs/source/changelog/2026.10.30.md",
|
|
37
|
+
"docs/source/changelog/2026.11.02.md",
|
|
36
38
|
"docs/source/conf.py",
|
|
37
39
|
"docs/source/contributing.rst",
|
|
38
40
|
"docs/source/index.rst",
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"spelling_private_dict.txt",
|
|
48
50
|
"src/hackerrank/__init__.py",
|
|
49
51
|
"src/hackerrank/_dict_types.py",
|
|
52
|
+
"src/hackerrank/_internal_notes.py",
|
|
50
53
|
"src/hackerrank/_project_archive.py",
|
|
51
54
|
"src/hackerrank/_request_types.py",
|
|
52
55
|
"src/hackerrank/_responses.py",
|
|
@@ -105,6 +108,7 @@
|
|
|
105
108
|
"tests/test_candidate_search.py",
|
|
106
109
|
"tests/test_custom_system_prompt.py",
|
|
107
110
|
"tests/test_documented_request_params.py",
|
|
111
|
+
"tests/test_internal_notes.py",
|
|
108
112
|
"tests/test_newsfragments.py",
|
|
109
113
|
"tests/test_openapi.py",
|
|
110
114
|
"tests/test_project_directory.py",
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"""Notes-only updates preserve question state in both API clients."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
import pytest
|
|
7
|
+
import respx
|
|
8
|
+
from beartype import beartype
|
|
9
|
+
|
|
10
|
+
from hackerrank.async_client import AsyncHackerRank
|
|
11
|
+
from hackerrank.client import HackerRank
|
|
12
|
+
from hackerrank.transports import AsyncHTTPXTransport, HTTPXTransport
|
|
13
|
+
from hackerrank.types import JSONValue, Question
|
|
14
|
+
|
|
15
|
+
_URL = "https://www.hackerrank.com/x/api/v3/questions/q1"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _question() -> dict[str, JSONValue]:
|
|
19
|
+
"""Supply required fields and unrelated project configuration."""
|
|
20
|
+
return {
|
|
21
|
+
"id": "q1",
|
|
22
|
+
"name": "Question",
|
|
23
|
+
"type": "code",
|
|
24
|
+
"problem_statement": "Candidate prompt",
|
|
25
|
+
"recommended_duration": 60,
|
|
26
|
+
"internal_notes": "Previous notes",
|
|
27
|
+
"languages": ["python3"],
|
|
28
|
+
"tags": ["AI"],
|
|
29
|
+
"options": ["choice"],
|
|
30
|
+
"answer": [1],
|
|
31
|
+
"max_score": 100.0,
|
|
32
|
+
"environment_id": 112,
|
|
33
|
+
"custom_system_prompt": " Keep this prompt.\n",
|
|
34
|
+
"fullstack_project_details": {
|
|
35
|
+
"configuration": {"menu": {"run": "python3 solution.py"}}
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@beartype
|
|
41
|
+
def _json_object(*, value: dict[str, JSONValue]) -> dict[str, JSONValue]:
|
|
42
|
+
"""Check JSON at the outgoing request boundary."""
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def _update(
|
|
47
|
+
*,
|
|
48
|
+
use_async: bool,
|
|
49
|
+
notes: str,
|
|
50
|
+
) -> Question:
|
|
51
|
+
"""Exercise the same public operation through either transport."""
|
|
52
|
+
if use_async:
|
|
53
|
+
async with (
|
|
54
|
+
AsyncHTTPXTransport() as async_transport,
|
|
55
|
+
AsyncHackerRank(
|
|
56
|
+
api_key="test-key", transport=async_transport
|
|
57
|
+
) as async_client,
|
|
58
|
+
):
|
|
59
|
+
return await async_client.questions.update_internal_notes(
|
|
60
|
+
question_id="q1",
|
|
61
|
+
internal_notes=notes,
|
|
62
|
+
)
|
|
63
|
+
with (
|
|
64
|
+
HTTPXTransport() as transport,
|
|
65
|
+
HackerRank(api_key="test-key", transport=transport) as client,
|
|
66
|
+
):
|
|
67
|
+
return client.questions.update_internal_notes(
|
|
68
|
+
question_id="q1",
|
|
69
|
+
internal_notes=notes,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@pytest.mark.asyncio
|
|
74
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
75
|
+
@pytest.mark.parametrize(argnames="nullable", argvalues=[False, True])
|
|
76
|
+
async def test_notes_only_update(*, use_async: bool, nullable: bool) -> None:
|
|
77
|
+
"""Read current state, send required fields only, and read back
|
|
78
|
+
notes.
|
|
79
|
+
"""
|
|
80
|
+
before = _question()
|
|
81
|
+
after = {**before, "internal_notes": "New notes"}
|
|
82
|
+
if nullable:
|
|
83
|
+
for field in ("languages", "tags", "options", "answer"):
|
|
84
|
+
del before[field]
|
|
85
|
+
after[field] = []
|
|
86
|
+
with respx.mock(assert_all_called=True) as router:
|
|
87
|
+
get = router.get(url=_URL)
|
|
88
|
+
_ = get.mock(
|
|
89
|
+
side_effect=[
|
|
90
|
+
httpx.Response(status_code=200, json=before),
|
|
91
|
+
httpx.Response(status_code=200, json=after),
|
|
92
|
+
]
|
|
93
|
+
)
|
|
94
|
+
put = router.put(url=_URL).respond(status_code=204)
|
|
95
|
+
result = await _update(use_async=use_async, notes="New notes")
|
|
96
|
+
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
97
|
+
assert set(body) == {
|
|
98
|
+
"name",
|
|
99
|
+
"type",
|
|
100
|
+
"internal_notes",
|
|
101
|
+
"languages",
|
|
102
|
+
"problem_statement",
|
|
103
|
+
"recommended_duration",
|
|
104
|
+
"tags",
|
|
105
|
+
"options",
|
|
106
|
+
"answer",
|
|
107
|
+
}
|
|
108
|
+
assert body["internal_notes"] == "New notes"
|
|
109
|
+
for field in (
|
|
110
|
+
"name",
|
|
111
|
+
"type",
|
|
112
|
+
"problem_statement",
|
|
113
|
+
"recommended_duration",
|
|
114
|
+
):
|
|
115
|
+
assert body[field] == before[field]
|
|
116
|
+
for field in ("languages", "tags", "options", "answer"):
|
|
117
|
+
assert body[field] == before.get(field, [])
|
|
118
|
+
assert result.custom_system_prompt == " Keep this prompt.\n"
|
|
119
|
+
expected_reads = 2
|
|
120
|
+
assert get.call_count == expected_reads
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@pytest.mark.asyncio
|
|
124
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
125
|
+
async def test_unchanged_notes_are_written(*, use_async: bool) -> None:
|
|
126
|
+
"""Identical notes still receive a PUT and a verified read-back."""
|
|
127
|
+
question = _question()
|
|
128
|
+
with respx.mock(assert_all_called=True) as router:
|
|
129
|
+
get = router.get(url=_URL).respond(status_code=200, json=question)
|
|
130
|
+
put = router.put(url=_URL).respond(status_code=204)
|
|
131
|
+
result = await _update(use_async=use_async, notes="Previous notes")
|
|
132
|
+
assert result.internal_notes == "Previous notes"
|
|
133
|
+
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
134
|
+
assert body["internal_notes"] == "Previous notes"
|
|
135
|
+
expected_reads = 2
|
|
136
|
+
assert get.call_count == expected_reads
|
|
137
|
+
assert put.call_count == 1
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@pytest.mark.asyncio
|
|
141
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
142
|
+
@pytest.mark.parametrize(
|
|
143
|
+
argnames="invalid",
|
|
144
|
+
argvalues=["id", "problem_statement", "recommended_duration"],
|
|
145
|
+
)
|
|
146
|
+
async def test_invalid_current_question_prevents_write(
|
|
147
|
+
*, use_async: bool, invalid: str
|
|
148
|
+
) -> None:
|
|
149
|
+
"""Reject mismatched identities and incomplete required fields."""
|
|
150
|
+
before = _question()
|
|
151
|
+
if invalid == "id":
|
|
152
|
+
before["id"] = "other"
|
|
153
|
+
else:
|
|
154
|
+
del before[invalid]
|
|
155
|
+
with respx.mock(assert_all_called=True) as router:
|
|
156
|
+
get = router.get(url=_URL).respond(status_code=200, json=before)
|
|
157
|
+
with pytest.raises(
|
|
158
|
+
expected_exception=ValueError,
|
|
159
|
+
match="Expected question" if invalid == "id" else "lacks fields",
|
|
160
|
+
):
|
|
161
|
+
_ = await _update(use_async=use_async, notes="New notes")
|
|
162
|
+
assert get.call_count == 1
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@pytest.mark.asyncio
|
|
166
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
167
|
+
@pytest.mark.parametrize(
|
|
168
|
+
argnames="changed",
|
|
169
|
+
argvalues=["internal_notes", "custom_system_prompt", "answer"],
|
|
170
|
+
)
|
|
171
|
+
async def test_unexpected_readback_fails(
|
|
172
|
+
*, use_async: bool, changed: str
|
|
173
|
+
) -> None:
|
|
174
|
+
"""Check saved text and every modeled field, including scalar zero."""
|
|
175
|
+
before = {**_question(), "answer": 0}
|
|
176
|
+
after = {**before, "internal_notes": "New notes"}
|
|
177
|
+
after[changed] = [] if changed == "answer" else "Unexpected"
|
|
178
|
+
with respx.mock(assert_all_called=True) as router:
|
|
179
|
+
get = router.get(url=_URL)
|
|
180
|
+
_ = get.mock(
|
|
181
|
+
side_effect=[
|
|
182
|
+
httpx.Response(status_code=200, json=before),
|
|
183
|
+
httpx.Response(status_code=200, json=after),
|
|
184
|
+
]
|
|
185
|
+
)
|
|
186
|
+
_ = router.put(url=_URL).respond(status_code=204)
|
|
187
|
+
with pytest.raises(
|
|
188
|
+
expected_exception=ValueError,
|
|
189
|
+
match="did not retain notes"
|
|
190
|
+
if changed == "internal_notes"
|
|
191
|
+
else "changed fields other than notes",
|
|
192
|
+
):
|
|
193
|
+
_ = await _update(use_async=use_async, notes="New notes")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
@pytest.mark.asyncio
|
|
197
|
+
@pytest.mark.parametrize(argnames="use_async", argvalues=[False, True])
|
|
198
|
+
async def test_absent_notes_are_empty(*, use_async: bool) -> None:
|
|
199
|
+
"""Clearing absent notes still writes and verifies an empty result."""
|
|
200
|
+
question = _question()
|
|
201
|
+
del question["internal_notes"]
|
|
202
|
+
with respx.mock(assert_all_called=True) as router:
|
|
203
|
+
get = router.get(url=_URL).respond(status_code=200, json=question)
|
|
204
|
+
put = router.put(url=_URL).respond(status_code=204)
|
|
205
|
+
result = await _update(use_async=use_async, notes="")
|
|
206
|
+
assert result.internal_notes is None
|
|
207
|
+
body = _json_object(value=json.loads(s=put.calls.last.request.content))
|
|
208
|
+
assert body["internal_notes"] == ""
|
|
209
|
+
expected_reads = 2
|
|
210
|
+
assert get.call_count == expected_reads
|
|
211
|
+
assert put.call_count == 1
|
|
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.10.30 → hackerrank-2026.11.2}/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
|