Skip to content

Commit

Permalink
Configure typos, fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Jul 26, 2024
1 parent ea36dc0 commit 02ebf81
Show file tree
Hide file tree
Showing 43 changed files with 224 additions and 197 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- name: "Ruff"
run: |
poetry run ruff check
- uses: crate-ci/typos@master
- name: "Mypy"
run: poetry run mypy relate course
- name: "Safety"
Expand Down
2 changes: 1 addition & 1 deletion accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def check_email_appellation_priority_list(self):
priority_list = []
not_supported_appels = []

# filter out not allowd appellations in customized list
# filter out not allowed appellations in customized list
for appell in custom_email_appellation_priority_list:
if appell in DEFAULT_EMAIL_APPELLATION_PRIORITY_LIST:
priority_list.append(appell)
Expand Down
2 changes: 1 addition & 1 deletion course/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class participation_permission: # noqa
"Recalculate flow session grade")),
(participation_permission.batch_recalculate_flow_session_grade,
pgettext_lazy("Participation permission",
"Batch-recalculate flow sesssion grades")),
"Batch-recalculate flow session grades")),

(participation_permission.reopen_flow_session,
pgettext_lazy("Participation permission", "Reopen flow session")),
Expand Down
2 changes: 1 addition & 1 deletion course/enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def email_suffix_matches(email: str, suffix: str) -> bool:
msg.send()

messages.add_message(request, messages.INFO,
_("Enrollment request sent. You will receive notifcation "
_("Enrollment request sent. You will receive notification "
"by email once your request has been acted upon."))
else:
handle_enrollment_request(course, user, participation_status.active,
Expand Down
6 changes: 3 additions & 3 deletions course/grades.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def __init__(self,
whether the instance is created by a flow-session-related opportunity.
:param grades: optional, a :class:`list:` of float or None, representing the
percentage grades of each page in the flow session.
:param has_finished_session: a :class:`bool:`, respresent whether
:param has_finished_session: a :class:`bool:`, represent whether
the related participation has finished a flow-session, if the opportunity
is a flow-session related one. This is used to correctly order flow state,
if the participation has at least one finished flow session, the in-progress
Expand Down Expand Up @@ -1409,9 +1409,9 @@ def import_grades(pctx):
else:
if total_count != len(grade_changes):
messages.add_message(pctx.request, messages.INFO,
_("%(total)d grades found, %(unchaged)d unchanged.")
_("%(total)d grades found, %(unchanged)d unchanged.")
% {"total": total_count,
"unchaged": total_count - len(grade_changes)})
"unchanged": total_count - len(grade_changes)})

from django.template.loader import render_to_string

Expand Down
2 changes: 1 addition & 1 deletion course/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ class GradingOpportunity(models.Model):

aggregation_strategy = models.CharField(max_length=20,
choices=GRADE_AGGREGATION_STRATEGY_CHOICES,
# Translators: strategy on how the grading of mutiple sessioins
# Translators: strategy on how the grading of multiple sessioins
# are aggregated.
verbose_name=_("Aggregation strategy"))

Expand Down
10 changes: 5 additions & 5 deletions course/page/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(
self.may_change_answer = may_change_answer

def __bool__(self):
# This is for compatiblity: page_behavior used to be a bool argument
# This is for compatibility: page_behavior used to be a bool argument
# 'answer_is_final'.
return not self.may_change_answer

Expand Down Expand Up @@ -479,7 +479,7 @@ def initialize_page_data(self, page_context: PageContext) -> dict:
data = self.make_page_data()
if data:
from warnings import warn
warn(_("%s is using the make_page_data compatiblity hook, which "
warn(_("%s is using the make_page_data compatibility hook, which "
"is deprecated.") % type(self).__name__,
DeprecationWarning)

Expand Down Expand Up @@ -590,7 +590,7 @@ def process_form_post(
"""

from warnings import warn
warn(_("%s is using the post_form compatiblity hook, which "
warn(_("%s is using the post_form compatibility hook, which "
"is deprecated.") % type(self).__name__,
DeprecationWarning)

Expand Down Expand Up @@ -662,7 +662,7 @@ def update_grade_data_from_grading_form_v2(

from warnings import warn
warn(_("%s is using the update_grade_data_from_grading_form "
"compatiblity hook, which "
"compatibility hook, which "
"is deprecated.") % type(self).__name__,
DeprecationWarning)

Expand Down Expand Up @@ -753,7 +753,7 @@ def normalized_bytes_answer(
to be stuffed in a zip file.
:returns: a tuple of ``(file_ext, data)`` where *file_ext* is a suggested
file extension (inlcuding the leading period, if applicable).
file extension (including the leading period, if applicable).
May also return *None*.
One use case of this function is to work as input for a plagiarism
Expand Down
6 changes: 3 additions & 3 deletions course/page/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def is_nuisance_failure(result):
if "BadStatusLine" in result["traceback"]:

# Occasionally, we fail to send a POST to the container, even after
# the inital ping GET succeeded, for (for now) mysterious reasons.
# the initial ping GET succeeded, for (for now) mysterious reasons.
# Just try again.

return True
Expand Down Expand Up @@ -590,11 +590,11 @@ def __init__(self, vctx, location, page_desc, language_mode):
if not is_multi_submit:
vctx.add_warning(location, _("code question does not explicitly "
"allow multiple submission. Either add "
"access_rules/add_permssions/change_answer "
"access_rules/add_permissions/change_answer "
"or add 'single_submission: True' to confirm that you intend "
"for only a single submission to be allowed. "
"While you're at it, consider adding "
"access_rules/add_permssions/see_correctness."))
"access_rules/add_permissions/see_correctness."))

def required_attrs(self):
return (
Expand Down
6 changes: 3 additions & 3 deletions course/page/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def get_form_field(self, page_context):

# length unit used is "em"
DEFAULT_WIDTH = 10
MINIMUN_WIDTH = 4
MINIMUM_WIDTH = 4

EM_LEN_DICT = {
"em": 1,
Expand Down Expand Up @@ -308,7 +308,7 @@ def __init__(self, vctx, location, name, answers_desc):

self.width = 0
if parsed_length is not None:
self.width = max(MINIMUN_WIDTH, parsed_length)
self.width = max(MINIMUM_WIDTH, parsed_length)
else:
self.width = DEFAULT_WIDTH

Expand All @@ -320,7 +320,7 @@ def __init__(self, vctx, location, name, answers_desc):
string_concat("%s, ",
# Translators: refers to optional
# correct answer for checking
# correctness sumbitted by students.
# correctness submitted by students.
_("answer"),
" %d") % (location, i+1),
answer)
Expand Down
2 changes: 1 addition & 1 deletion course/templates/course/flow-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
relate-bookmarked
{% endif %}
"
title="{% trans "Boomark this page" %}">
title="{% trans "Bookmark this page" %}">
<i id="label_bookmark_indicator" class="fa
{% if page_data.bookmarked %}
bi-star-fill
Expand Down
2 changes: 1 addition & 1 deletion course/templates/course/flow-start.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ <h3 class="start-well-title">{% trans "Past sessions" %}</h3>
{% blocktrans trimmed %}
You're not currently signed in. Access to the resource is restricted,
and since the site has no way of knowing who you are, it may have denied
you accesss.
you access.
Once you're signed in, navigate back to your course from the
<a href="{{ relate-home }}"> home page </a> and retry your last
action.
Expand Down
2 changes: 1 addition & 1 deletion course/templatetags/coursetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def do_get_current_js_lang_name(parser, token):
"""
This will store the current language in the context, in js lang format.
This is different with built-in do_get_current_language, which returns
languange name like "en-us", "zh-hans". This method return lang name
language name like "en-us", "zh-hans". This method return lang name
"en-US", "zh-Hans", with the country code capitallized if country code
has 2 characters, and capitalize first if country code has more than 2
characters.
Expand Down
6 changes: 3 additions & 3 deletions course/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def instantiate_flow_page_with_ctx(
# }}}


# {{{ utilties for course-based views
# {{{ utilities for course-based views

def course_view(f):
def wrapper(request, course_identifier, *args, **kwargs):
Expand Down Expand Up @@ -1137,12 +1137,12 @@ def will_use_masked_profile_for_email(
if not isinstance(recipient_email, list):
recipient_email = [recipient_email]
from course.models import Participation
recepient_participations = (
recipient_participations = (
Participation.objects.filter(
user__email__in=recipient_email
))
from course.constants import participation_permission as pperm
for part in recepient_participations:
for part in recipient_participations:
if part.has_permission(pperm.view_participant_masked_profile):
return True
return False
Expand Down
8 changes: 4 additions & 4 deletions doc/content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export :ref:`markup` to essentially any other markup format under the sun,
including LaTeX, HTML, MediaWiki, Microsoft Word, and many more.

Further, YAML files are quite easy to read and traverse in most programming languages,
facilitating automated coversion. `This example Python script
facilitating automated conversion. `This example Python script
<https://github.com/inducer/relate/blob/main/contrib/flow-to-worksheet>`_
provided as part of RELATE takes a flow and converts it to a paper-based
worksheet. To do so, it makes use of `pypandoc
Expand Down Expand Up @@ -485,7 +485,7 @@ Here's an example:

.. attribute:: id

An identifer used as page anchors and for tracking. Not
An identifier used as page anchors and for tracking. Not
user-visible otherwise.

.. attribute:: rules
Expand Down Expand Up @@ -565,7 +565,7 @@ Events serve two purposes:
* They are (optionally) shown in the class calendar.

For example, to create contiguously numbered ``lecture`` events for a
lecture occuring on a Tuesday/Thursday schedule, perform the following
lecture occurring on a Tuesday/Thursday schedule, perform the following
sequence of steps:

* Create a recurring, weekly event for the Tuesday lectures, with a
Expand Down Expand Up @@ -648,7 +648,7 @@ by the 'ordinal' of each event.

The secondsection, ``events``, can be used to provide a more verbose
description for each event that appears below the main calendar. Titles and
colors can also be overriden for each event specifically.
colors can also be overridden for each event specifically.

All attributes in each section (as well as the entire calendar information
file) are optional.
Expand Down
4 changes: 2 additions & 2 deletions doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Getting everything set up

- Now you are ready to click that 'Set up new course' button.
Fill in the form that pops up. For the 'Git source' field,
use the SSH clone URL provided by your Git host. It shoud look
use the SSH clone URL provided by your Git host. It should look
like this::

git@hostingsite.com:yourusername/yourreponame.git
Expand Down Expand Up @@ -256,7 +256,7 @@ Here's an example page to give you an idea::
I wrote a Yes/No question, but RELATE shows "True/False" instead of "Yes/No"--why on earth would it do that?
------------------------------------------------------------------------------------------------------------

This is a bit of a misfeature in YAML (which relate uses), wich parses ``No`` as
This is a bit of a misfeature in YAML (which relate uses), which parses ``No`` as
a :class:`bool` instead of a literal string. Once that has happened, relate can't
recover the original string representation. To avoid that, just put quotes
around the ``"No"``.
Expand Down
2 changes: 1 addition & 1 deletion doc/flow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ The rules for this can be written as follows::
message: |
You have marked your session to roll over to 50% credit at the due
date. If you would like to have your current answers graded as-is
(and recieve full credit for them), please select 'End session
(and receive full credit for them), please select 'End session
and grade'.
permissions: [view, submit_answer, end_session, see_correctness, change_answer, set_roll_over_expiration_mode]

Expand Down
2 changes: 1 addition & 1 deletion doc/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ Next, install Relate and its dependencies::

poetry install

In order to use the ``relate`` comand, you need to activate the virtualenv that
In order to use the ``relate`` command, you need to activate the virtualenv that
was created::

source ~/path/to/relate/checkout/.venv/bin/activate
Expand Down
10 changes: 5 additions & 5 deletions local_settings_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@

# If set to False, user won't be able to edit institutional ID
# after submission. Set to False only when you trust your students
# or you don't want to verfiy insitutional ID they submit.
# or you don't want to verify insitutional ID they submit.
RELATE_EDITABLE_INST_ID_BEFORE_VERIFICATION = True

# If set to False, these fields will be hidden in the user profile form.
Expand All @@ -275,7 +275,7 @@

# RELATE's default full_name format is "'%s %s' % (first_name, last_name)",
# you can override it by supply a customized method/fuction, with
# "firstname" and "lastname" as its paramaters, and return a string.
# "firstname" and "lastname" as its parameters, and return a string.

# For example, you can define it like this:

Expand Down Expand Up @@ -316,7 +316,7 @@
# When a participation, for example, teaching assistant, has limited access to
# students' profile (i.e., has_permission(pperm.view_participant_masked_profile)),
# a built-in mask method (which is based on pk of user instances) is used be
# default. The mask method can be overriden by the following a custom method, with
# default. The mask method can be overridden by the following a custom method, with
# user as the args.

# RELATE_USER_PROFILE_MASK_METHOD = "path.tomy_method
Expand All @@ -339,7 +339,7 @@

# {{{ extra checks

# This allow user to add customized startup checkes for user-defined modules
# This allow user to add customized startup checks for user-defined modules
# using Django's system checks (https://docs.djangoproject.com/en/dev/ref/checks/)
# For example, define a `my_check_func in `my_module` with
# <code>
Expand Down Expand Up @@ -529,7 +529,7 @@
}

SAML_CONFIG = {
# full path to the xmlsec1 binary programm
# full path to the xmlsec1 binary program
"xmlsec_binary": "/usr/bin/xmlsec1",

# your entity id, usually your subdomain plus the url to the metadata view
Expand Down
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -264,4 +264,30 @@ markers = [
"postgres: mark test as postgres specific",
]

[tool.typos.default]
extend-ignore-re = [
"(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line"
]

[tool.typos.default.extend-words]
# opps as in 'grading opportunities'
opps = "opps"
# fre, short for flow rule exception
fre = "fre"
# short for 'stipulation'
stip = "stip"
# as in documen.tician.de
documen = "documen"
# like sur_name in SAML
sur = "sur"

[tool.typos.files]
extend-exclude = [
"locale/**/*.po",
# migrations reflect the past, don't attempt to alter them.
"*/migrations/**/*.py",
# not ours
"saml-config/**/*.py",
]

# vim: foldmethod=marker
2 changes: 1 addition & 1 deletion relate/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@

# {{{ database

# default, likely overriden by local_settings.py
# default, likely overridden by local_settings.py
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
Expand Down
2 changes: 1 addition & 1 deletion relate/templates/403.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>{% trans "403 Forbidden" %}</h1>
{% url "relate-home" as relate-home %}
{% blocktrans trimmed %}
You're not currently signed in. Access to the resource is restricted,
and since the site has no way of knowing who you are, it denied you accesss.
and since the site has no way of knowing who you are, it denied you access.
Once you're signed in, navigate back to your course from the
<a href="{{ relate-home }}"> home page </a> and retry your last
action.
Expand Down
2 changes: 1 addition & 1 deletion relate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def format_datetime_local(
Note: The datetime rendered in template is itself locale aware.
A custom format must be defined in settings.py.
When a custom format uses a same name with an existing built-in
format, it will be overrided by built-in format if l10n
format, it will be overridden by built-in format if l10n
is enabled.
"""

Expand Down
Loading

0 comments on commit 02ebf81

Please sign in to comment.