docs: Various cleanup of outdated comments and docstrings (#31754)

- Remove pylint warning suppression from SHAKE-128 hexdigest calls; these
  are no longer needed as of astroid 2.12.12. For background, see issue
  <https://github.com/PyCQA/pylint/issues/4039>. Also, correct a comment
  that referred to SHAKE-256 instead of SHAKE-128.
- Replace "released" with "beta" in several places where there was a copy
  & paste error in dark_lang. Add mention of `beta_lang` to a docstring
  where it was omitted.
- Remove comment regarding Mongo startup; the code it referred to has since
  been removed.
- Fix typos.
This commit is contained in:
Tim McCormack
2023-02-14 18:11:57 +00:00
committed by GitHub
parent 4697adc681
commit 197fef9c2b
9 changed files with 9 additions and 23 deletions

View File

@@ -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(

View File

@@ -196,7 +196,7 @@ class TrackMiddleware(MiddlewareMixin):
# 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.
@@ -209,9 +209,7 @@ class TrackMiddleware(MiddlewareMixin):
# 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"""