Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cs50/submit50
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.5
Choose a base ref
...
head repository: cs50/submit50
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Dec 29, 2024

  1. Update dependencies and submission prompt for CS50x course

    rongxin-liu committed Dec 29, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    368aa26 View commit details

Commits on Dec 30, 2024

  1. Merge pull request #375 from cs50/update/prompts

    Update submission prompt for CS50x course
    rongxin-liu authored Dec 30, 2024
    1
    Copy the full SHA
    f9707d4 View commit details
Showing with 31 additions and 8 deletions.
  1. +2 −2 setup.py
  2. +25 −2 submit50/__main__.py
  3. +4 −4 submit50/locale/es/LC_MESSAGES/submit50.po
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
},
description="This is submit50, with which you can submit solutions to problems for CS50.",
long_description="This is submit50, with which you can submit solutions to problems for CS50.",
install_requires=["lib50>=3,<4", "packaging", "requests>=2.19", "setuptools", "termcolor>=1.1"],
install_requires=["lib50>=3,<4", "packaging", "pytz", "requests>=2.19", "setuptools", "termcolor>=1.1"],
keywords=["submit", "submit50"],
name="submit50",
python_requires=">=3.6",
@@ -26,6 +26,6 @@
entry_points={
"console_scripts": ["submit50=submit50.__main__:main"]
},
version="3.1.5",
version="3.2.0",
include_package_data=True
)
27 changes: 25 additions & 2 deletions submit50/__main__.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@

from importlib.resources import files
from packaging import version
from datetime import datetime
from pytz import timezone
from . import __version__, CONFIG_LOADER

# Internationalization
@@ -137,7 +139,7 @@ def prompt(honesty, included, excluded):
# Show default message
if honesty == True:
honesty_question = _(
"Keeping in mind the course's policy on academic honesty, "
"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)? "
)
# If a custom message is configured, show that instead
@@ -162,6 +164,26 @@ def prompt(honesty, included, excluded):
return True


def check_slug_year(slug):
"""Warn if the slug is for previous year's CS50x course."""

# extract the year from the slug
try:
year = re.search(r"cs50/problems/(\d{4})/x", slug)
if year and int(year.group(1)) < int(datetime.now(timezone("US/Eastern")).year):
suggested_slug = re.sub(r"cs50/problems/\d{4}/x", f"cs50/problems/{datetime.now(timezone('US/Eastern')).year}/x", slug)
cprint(_("You are submitting to a previous year's CS50x course. Your submission will not be counted towards this year's course."), "yellow")
cprint(_("If you are looking to submit to this year's course, please use the following slug:"), "yellow")
cprint(suggested_slug, "yellow")

# 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


def excepthook(type, value, tb):
"""Report an exception."""
if (issubclass(type, Error) or issubclass(type, lib50.Error)) and str(value):
@@ -223,7 +245,8 @@ 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)
print(message)

8 changes: 4 additions & 4 deletions submit50/locale/es/LC_MESSAGES/submit50.po
Original file line number Diff line number Diff line change
@@ -15,11 +15,11 @@ msgid "Sorry, something's wrong! Let sysadmins@cs50.harvard.edu know!"
msgstr "¡Lo siento, algo está mal! ¡Déjale saber a sysadmins@cs50.harvard.edu!"

msgid ""
"Keeping in mind the course's policy on academic honesty, are you sure you "
"want to submit these files (yes/no)? "
"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 ""
"Teniendo en cuenta la política de honestidad académica del curso, ¿estás "
"seguro que quieres enviar estos archivos (sí/no)? "
"Teniendo en cuenta la política de honestidad académica del curso, incluidas sus restricciones sobre el uso de IA, "
"¿estás seguro que quieres enviar estos archivos (sí/no)? "

msgid "y|yes"
msgstr "s|s[ií]"