Replace .format with f-strings

main
Aurélien Geron 2021-11-22 10:17:46 +13:00
parent 599758a1bb
commit c4280cc354
1 changed files with 5 additions and 6 deletions

View File

@ -2259,10 +2259,9 @@
" return email\n", " return email\n",
" payload = email.get_payload()\n", " payload = email.get_payload()\n",
" if isinstance(payload, list):\n", " if isinstance(payload, list):\n",
" return \"multipart({})\".format(\", \".join([\n", " multipart = \", \".join([get_email_structure(sub_email)\n",
" get_email_structure(sub_email)\n", " for sub_email in payload])\n",
" for sub_email in payload\n", " return f\"multipart({multipart})\"\n",
" ]))\n",
" else:\n", " else:\n",
" return email.get_content_type()" " return email.get_content_type()"
] ]
@ -2742,8 +2741,8 @@
"\n", "\n",
"y_pred = log_clf.predict(X_test_transformed)\n", "y_pred = log_clf.predict(X_test_transformed)\n",
"\n", "\n",
"print(\"Precision: {:.2f}%\".format(100 * precision_score(y_test, y_pred)))\n", "print(f\"Precision: {precision_score(y_test, y_pred):.2%}\")\n",
"print(\"Recall: {:.2f}%\".format(100 * recall_score(y_test, y_pred)))" "print(f\"Recall: {recall_score(y_test, y_pred):.2%}\")"
] ]
}, },
{ {