From 2f867c28b4d16bbdab2ea70c68a7318f6ec670c9 Mon Sep 17 00:00:00 2001 From: Brandon Nguyen <112731698+bxngyn@users.noreply.github.com> Date: Tue, 5 Aug 2025 15:50:44 -0400 Subject: [PATCH 1/6] vietnamese support --- submit50/locale/vi/LC_MESSAGES/submit50.po | 113 +++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 submit50/locale/vi/LC_MESSAGES/submit50.po diff --git a/submit50/locale/vi/LC_MESSAGES/submit50.po b/submit50/locale/vi/LC_MESSAGES/submit50.po new file mode 100644 index 0000000..53c910a --- /dev/null +++ b/submit50/locale/vi/LC_MESSAGES/submit50.po @@ -0,0 +1,113 @@ +# Vietnamese translations for submit50. +# Copyright (C) 2025 ORGANIZATION +# This file is distributed under the same license as the submit50 project. +# FIRST AUTHOR , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: submit50 3.2.1\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2025-08-05 13:04-0400\n" +"PO-Revision-Date: 2025-08-05 13:06-0400\n" +"Last-Translator: FULL NAME \n" +"Language: vi\n" +"Language-Team: vi \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.17.0\n" + +#: submit50/__main__.py:71 +msgid "" +"Could not connect to submit.cs50.io.Please visit our status page " +"https://cs50.statuspage.io for more information." +msgstr "" +"Không kết nối đến submit.cs50.io được. Vui lòng xem " +"https://cs50.statuspage.io để biết thêm thông tin." + +#: submit50/__main__.py:135 +msgid "Files that will be submitted:" +msgstr "Các tập tin sẽ nộp:" + +#: submit50/__main__.py:139 +msgid "No files in this directory are expected for submission." +msgstr "Không có tập tin nào trong thư mục này để nộp." + +#: submit50/__main__.py:143 +msgid "Files that won't be submitted:" +msgstr "Các tập tin sẽ không nộp:" + +#: submit50/__main__.py:156 +msgid "" +"Keeping in mind the course's policy on academic honesty, including its " +"restrictions on AI use, are you sure you want to submit these files " +"(yes/no)? " +msgstr "" +"Cân nhắc quy định về tính trung thực trong học thuật, bao gồm cả " +"các hạn chế về việc sử dụng AI, bạn có chắc chắn muốn nộp các tập tin này không?" +"(có/không)? " + +#: submit50/__main__.py:174 submit50/__main__.py:194 +msgid "y|yes" +msgstr "c|có" + +#: submit50/__main__.py:189 +msgid "" +"You are submitting to a previous year's CS50x course. Your submission " +"will not be counted towards this year's course." +msgstr "" +"Bạn đang nộp bài cho khóa học CS50x của năm trước." +"Bài này sẽ không được tính vào khóa học năm nay." + +#: submit50/__main__.py:190 +msgid "" +"If you are looking to submit to this year's course, please use the " +"following slug:" +msgstr "" +"Nếu bạn muốn nộp bài cho khóa học năm nay, vui lòng sử dụng slug này: " + +#: submit50/__main__.py:194 +msgid "Do you want to continue with this submission (yes/no)? " +msgstr "Bạn có muốn tiếp tục nộp bài này không (có/không)?" + +#: submit50/__main__.py:195 +msgid "User aborted submission." +msgstr "Việc nộp bài bị hủy bỏ." + +#: submit50/__main__.py:207 +msgid "" +"Sorry, something's wrong, please try again. If the problem persists, " +"please visit our status page https://cs50.statuspage.io for more " +"information." +msgstr "" +"Rất tiếc, có gì xảy ra, vui lòng thử nộp lại. Nếu vấn đề này còn tiếp nữa, " +"vui lòng xem https://cs50.statuspage.io để biết thêm thông tin." + +#: submit50/__main__.py:212 +msgid "Submission cancelled." +msgstr "Việc nộp bài bị hủy bỏ" + +#: submit50/__main__.py:218 +msgid "logout of submit50" +msgstr "đăng xuất khỏi submit50" + +#: submit50/__main__.py:225 +msgid "failed to logout" +msgstr "không đăng xuất được" + +#: submit50/__main__.py:227 +msgid "logged out successfully" +msgstr "đăng xuất thành công" + +#: submit50/__main__.py:242 +msgid "" +"warning: displays usage warnings.\n" +"info: adds all commands run.\n" +"debug: adds the output of all commands run." +msgstr "" + +#: submit50/__main__.py:253 +msgid "prescribed identifier of work to submit" +msgstr "" + From b2ebb8c77e4af730917aad80e8768f9e4b20a019 Mon Sep 17 00:00:00 2001 From: ivanharvard <144486839+ivanharvard@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:08:33 -0400 Subject: [PATCH 2/6] add authentication flag and debug support --- submit50/__main__.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/submit50/__main__.py b/submit50/__main__.py index 0a3a72e..63eb148 100755 --- a/submit50/__main__.py +++ b/submit50/__main__.py @@ -23,6 +23,8 @@ # Internationalization gettext.install("submit50", str(files("submit50").joinpath("locale"))) +LOGGER = logging.getLogger("submit50") + SUBMIT_URL = "https://submit.cs50.io" class LogLevel(enum.IntEnum): @@ -193,7 +195,7 @@ def check_slug_year(slug): # Ask if they want to continue if not re.match(f"^\s*(?:{_('y|yes')})\s*$", input(_("Do you want to continue with this submission (yes/no)? ")), re.I): raise Error(_("User aborted submission.")) - + except ValueError: pass @@ -243,6 +245,12 @@ def main(): '\ninfo: adds all commands run.' '\ndebug: adds the output of all commands run.') ) + parser.add_argument("--https", + action="store_true", + help=_("force authentication via HTTPS")) + parser.add_argument("--ssh", + action="store_true", + help=_("force authentication via SSH")) parser.add_argument( "-V", "--version", action="version", @@ -260,8 +268,26 @@ def main(): check_announcements() check_version() check_slug_year(args.slug) - - user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt) + + # Decide whether to force HTTPS or SSH authentication + if args.https and args.ssh: + LOGGER.warning(_("--https and --ssh have no effect when used together")) + auth_method = None + elif args.https: + auth_method = "https" + elif args.ssh: + auth_method = "ssh" + else: + auth_method = None + + try: + user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt, auth_method=auth_method) + except lib50.ConnectionError: + LOGGER.debug(traceback.format_exc()) # log the traceback + raise Error(_( + "check50 failed to authenticate your Github account. Try running check50 again with --https or --ssh, " + "or try restarting your codespace. If the problem persists, please email us at sysadmins@cs50.harvard.edu." + )) print(message) if __name__ == "__main__": From e836ff17044e0676062e5b6dfb97c6dff5c30ae7 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Thu, 7 Aug 2025 00:02:48 -0400 Subject: [PATCH 3/6] improve error handling for GitHub authentication failures in codespaces --- submit50/__main__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/submit50/__main__.py b/submit50/__main__.py index 63eb148..b000684 100755 --- a/submit50/__main__.py +++ b/submit50/__main__.py @@ -195,7 +195,7 @@ def check_slug_year(slug): # Ask if they want to continue if not re.match(f"^\s*(?:{_('y|yes')})\s*$", input(_("Do you want to continue with this submission (yes/no)? ")), re.I): raise Error(_("User aborted submission.")) - + except ValueError: pass @@ -283,11 +283,15 @@ def main(): try: user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt, auth_method=auth_method) except lib50.ConnectionError: - LOGGER.debug(traceback.format_exc()) # log the traceback - raise Error(_( - "check50 failed to authenticate your Github account. Try running check50 again with --https or --ssh, " - "or try restarting your codespace. If the problem persists, please email us at sysadmins@cs50.harvard.edu." - )) + LOGGER.debug(traceback.format_exc()) + if not os.environ.get("CODESPACES"): + raise Error(_( + "submit50 failed to authenticate your Github account. Please make sure you are connected to the internet and try again." + )) + except Exception as e: + LOGGER.debug(traceback.format_exc()) + raise Error(_("Sorry, something's wrong, please try again.\n" + "If the problem persists, please visit our status page https://cs50.statuspage.io for more information.")) from e print(message) if __name__ == "__main__": From 6ee8c4bfbdea03683ce4923c7b6655b186754f0f Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Thu, 7 Aug 2025 00:08:19 -0400 Subject: [PATCH 4/6] bump version to 3.2.2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 57eaec9..35bbcd8 100755 --- a/setup.py +++ b/setup.py @@ -26,6 +26,6 @@ entry_points={ "console_scripts": ["submit50=submit50.__main__:main"] }, - version="3.2.1", + version="3.2.2", include_package_data=True ) From f4ee8f0e4513ed425e3c97f53afb37afe6793ba7 Mon Sep 17 00:00:00 2001 From: Brandon Nguyen <112731698+bxngyn@users.noreply.github.com> Date: Thu, 7 Aug 2025 10:02:49 -0400 Subject: [PATCH 5/6] add compiled file --- submit50/locale/vi/LC_MESSAGES/submit50.mo | Bin 0 -> 2651 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 submit50/locale/vi/LC_MESSAGES/submit50.mo diff --git a/submit50/locale/vi/LC_MESSAGES/submit50.mo b/submit50/locale/vi/LC_MESSAGES/submit50.mo new file mode 100644 index 0000000000000000000000000000000000000000..f6b45096fed5ba24f3a468c9bf821fffb2309035 GIT binary patch literal 2651 zcmb_dU29xL7#_8L?UfWnkyc&>X$v_go3ydv^fOPyu%XKLkDryav1i-(LaW!+PISj70AB(= z0KNibPcwEN@G9^(;6>n3VBs0Yz5{*)bavyHEDwy5J6xfxv(IHoG7VI|h8(x<^X4;3zzPax9~Qjc{p z5;dxe*hphd-}HYH%A!+YCWDZxP(+a^`RuF_G4Y~~T@`~BoCjHsw2U8UDs3@GnxY{! zJ=WBoc18j9U}2rnS*U-0$o*fVi}-< z4Lrha7z$&`Nfb5RzT4B~Zh~WZ*1QOHv-w!Ri=KG1CGVVLQmdeELI?d(eZsS7 zGZk6#CX0 zAuoR@pNFBh07hJ(N87!g*%i34-crn!i8%BV(5bV90-c$do1vpSLLbi+xT+)=`T%!C zf8i|&UUNHiv`{!1Nngj6)G~C1P*` z7MlT0@}h_c1Rq8ScDmaB5t>=9lT!KAlS>MeQGO zY87+v4>utkwJuXproL^p{Y?#GO2a{?KAY@pURM;h?@}#6U`(#Ftds4uZiOzFYjrBN z*Cna;dXtv3llx&moIM{n!KT{RL)dR_;1ovRbT)s^4hD~W)%B6O4%it)OQ@J;(am5W zXjs)Q=3P$JPU{oovvs*fisQCu^y@dB)&`Z3F1T>lW149|h|mLCB5|$SVUI6Jnz^mszeBaG zZLU{Y Date: Thu, 7 Aug 2025 11:04:58 -0400 Subject: [PATCH 6/6] simplified error handling for GitHub authentication --- submit50/__main__.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/submit50/__main__.py b/submit50/__main__.py index b000684..08bc52d 100755 --- a/submit50/__main__.py +++ b/submit50/__main__.py @@ -280,18 +280,7 @@ def main(): else: auth_method = None - try: - user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt, auth_method=auth_method) - except lib50.ConnectionError: - LOGGER.debug(traceback.format_exc()) - if not os.environ.get("CODESPACES"): - raise Error(_( - "submit50 failed to authenticate your Github account. Please make sure you are connected to the internet and try again." - )) - except Exception as e: - LOGGER.debug(traceback.format_exc()) - raise Error(_("Sorry, something's wrong, please try again.\n" - "If the problem persists, please visit our status page https://cs50.statuspage.io for more information.")) from e + user_name, commit_hash, message = lib50.push("submit50", args.slug, CONFIG_LOADER, prompt=prompt, auth_method=auth_method) print(message) if __name__ == "__main__":