Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Various cleanup of outdated comments and docstrings #31754

Merged
merged 1 commit into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,6 @@ jobs:
- name: checkout repo
uses: actions/checkout@v3

# This gives Mongo several chances to start. We started getting flakiness
# around 2022-02-15 wherein the start command would sometimes exit with:
#
# * Starting database mongodb
# ...fail!
#
# ...not having produced any logs or other output. We couldn't figure out
# what was causing Mongo to fail, so this is a (temporary?) hack to get
# PRs unblocked.
- name: start mongod server for tests
run: |
sudo mkdir -p /data/db
Expand Down
2 changes: 1 addition & 1 deletion common/djangoapps/student/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def anonymous_id_for_user(user, course_id):
hasher.update(str(user.id).encode('utf8'))
if course_id:
hasher.update(str(course_id).encode('utf-8'))
anonymous_user_id = hasher.hexdigest(16) # pylint: disable=too-many-function-args
anonymous_user_id = hasher.hexdigest(16)

try:
AnonymousUserId.objects.create(
Expand Down
6 changes: 2 additions & 4 deletions common/djangoapps/track/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def substitute_session_key(self, session_key):
# This assumes that session_key is high-entropy and unpredictable (which
# it should be anyway.)
#
# Use SHAKE256 from SHA-3 hash family to generate a hash of arbitrary
# Use SHAKE-128 from SHA-3 hash family to generate a hash of arbitrary
# length.
hasher = hashlib.shake_128()
# This is one of several uses of SECRET_KEY.
Expand All @@ -209,9 +209,7 @@ def substitute_session_key(self, session_key):
# heads-up to data researchers.
hasher.update(settings.SECRET_KEY.encode())
hasher.update(session_key.encode())
# pylint doesn't know that SHAKE's hexdigest takes an arg:
# https://github.com/PyCQA/pylint/issues/4039
return hasher.hexdigest(16) # pylint: disable=too-many-function-args
return hasher.hexdigest(16)

def get_user_primary_key(self, request):
"""Gets the primary key of the logged in Django user"""
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/hooks/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Receiving events
^^^^^^^^^^^^^^^^

This is one of the most common use cases for plugins. The edx-platform will send
and event and you want to react to it in your plugin.
an event and you want to react to it in your plugin.

For this you need to:

Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/cors_csrf/tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def fake_view(request):


class TestEnsureCsrfCookieCrossDomain(TestCase):
"""Test the `ensucre_csrf_cookie_cross_domain` decorator. """
"""Test the `ensure_csrf_cookie_cross_domain` decorator. """

def test_ensure_csrf_cookie_cross_domain(self):
request = mock.Mock()
Expand Down
4 changes: 2 additions & 2 deletions openedx/core/djangoapps/dark_lang/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def released_langs(self):
@property
def beta_langs(self):
"""
Current list of released languages
Current list of beta languages
"""
language_options = DarkLangConfig.current().beta_languages_list
if settings.LANGUAGE_CODE not in language_options:
Expand Down Expand Up @@ -123,7 +123,7 @@ def _fuzzy_match(self, lang_code):

def _clean_accept_headers(self, request):
"""
Remove any language that is not either in ``self.released_langs`` or
Remove any language that is not either in ``self.released_langs`` or ``self.beta_langs`` (if enabled) or
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Author's note: See the implementation of _fuzzy_match a few lines above.

a territory of one of those languages.
"""
accept = request.META.get('HTTP_ACCEPT_LANGUAGE', None)
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/dark_lang/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def released_languages_list(self):
@property
def beta_languages_list(self):
"""
``released_languages`` as a list of language codes.
``beta_languages`` as a list of language codes.

Example: ['it', 'de-at', 'es', 'pt-br']
"""
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _get_user_by_email_or_username(request, api_version):
user = _get_user_by_username(email_or_username)

if not user:
digest = hashlib.shake_128(email_or_username.encode('utf-8')).hexdigest(16) # pylint: disable=too-many-function-args
digest = hashlib.shake_128(email_or_username.encode('utf-8')).hexdigest(16)
AUDIT_LOG.warning(f"Login failed - Unknown user email or username {digest}")

return user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ def test_login_success_unicode_email(self):

def test_login_fail_no_user_exists(self):
nonexistent_email = 'not_a_user@edx.org'
# pylint: disable=too-many-function-args
email_hash = hashlib.shake_128(nonexistent_email.encode('utf-8')).hexdigest(16)
response, mock_audit_log = self._login_response(
nonexistent_email,
Expand Down Expand Up @@ -442,7 +441,6 @@ def test_login_inactivated_user_with_incorrect_credentials(self, mock_inactive_u
the system does *not* send account activation email notification to the user.
"""
nonexistent_email = 'incorrect@email.com'
# pylint: disable=too-many-function-args
email_hash = hashlib.shake_128(nonexistent_email.encode('utf-8')).hexdigest(16)
self.user.is_active = False
self.user.save()
Expand All @@ -454,7 +452,6 @@ def test_login_inactivated_user_with_incorrect_credentials(self, mock_inactive_u

def test_login_unicode_email(self):
unicode_email = self.user_email + chr(40960)
# pylint: disable=too-many-function-args
email_hash = hashlib.shake_128(unicode_email.encode('utf-8')).hexdigest(16)
response, mock_audit_log = self._login_response(
unicode_email,
Expand Down