Skip to content

Commit

Permalink
style: black/standard styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed Jan 16, 2025
1 parent 718d254 commit 732f453
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ietf/doc/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ def generate_draft_bibxml_files_task(days=7, process_all=False):
def investigate_fragment_task(name_fragment: str):
return {
"name_fragment": name_fragment,
"results": investigate_fragment(name_fragment)
"results": investigate_fragment(name_fragment),
}
10 changes: 4 additions & 6 deletions ietf/doc/tests_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,14 @@ def test_expire_last_calls_task(self, mock_get_expired, mock_expire):

def test_investigate_fragment_task(self):
investigation_results = object() # singleton
with mock.patch("ietf.doc.tasks.investigate_fragment", return_value=investigation_results) as mock_inv:
with mock.patch(
"ietf.doc.tasks.investigate_fragment", return_value=investigation_results
) as mock_inv:
retval = investigate_fragment_task("some fragment")
self.assertTrue(mock_inv.called)
self.assertEqual(mock_inv.call_args, mock.call("some fragment"))
self.assertEqual(
retval,
{
"name_fragment": "some fragment",
"results": investigation_results
}
retval, {"name_fragment": "some fragment", "results": investigation_results}
)


Expand Down
14 changes: 8 additions & 6 deletions ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2286,10 +2286,10 @@ def investigate(request):
POST with the task_id field empty starts an async task and returns a JSON response with
the ID needed to monitor the task for results.
GET with a querystring parameter "id" will poll the status of the async task and return "ready"
or "notready".
POST with the task_id field set to the id of a "ready" task will return its results or an error
if the task failed or the id is invalid (expired, never exited, etc).
"""
Expand All @@ -2306,7 +2306,9 @@ def investigate(request):
retval = task_result.get()
results = retval["results"]
form.data = form.data.copy()
form.data["name_fragment"] = retval["name_fragment"] # ensure consistency
form.data["name_fragment"] = retval[
"name_fragment"
] # ensure consistency
del form.data["task_id"] # do not request the task result again
else:
form.add_error(
Expand All @@ -2323,9 +2325,9 @@ def investigate(request):
if task_id is not None:
# Check status if we got the "id" parameter
task_result = AsyncResult(task_id)
return JsonResponse({
"status": "ready" if task_result.ready() else "notready"
})
return JsonResponse(
{"status": "ready" if task_result.ready() else "notready"}
)
else:
# Serve up an empty form
form = InvestigateForm()
Expand Down
3 changes: 1 addition & 2 deletions ietf/static/js/investigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ document.addEventListener('DOMContentLoaded', () => {
const runInvestigation = async () => {
// Submit the request
const response = await fetch('', {
method: investigateForm.method,
body: new FormData(investigateForm)
method: investigateForm.method, body: new FormData(investigateForm)
})
if (!response.ok) {
loadResultsFromTask('bogus-task-id') // bad task id will generate an error from Django
Expand Down

0 comments on commit 732f453

Please sign in to comment.