Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #6 from databricks-academy/dev
Browse files Browse the repository at this point in the history
Update dbacademy_helper_class.py
  • Loading branch information
SireInsectus authored Oct 3, 2022
2 parents 29fff2f + 1a2ef0a commit c0cb169
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/dbacademy_helper/dbacademy_helper_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ def __init__(self, *,
if self.lesson_config.name is None and self.is_smoke_test():
# The developer did not define a lesson and this is a smoke
# test, so we can define a lesson here for the sake of testing
import re, hashlib

encoded_value = dbgems.get_notebook_path().encode('utf-8')
hashed_value = hashlib.sha3_512(encoded_value).hexdigest()
self.lesson_config.name = str(abs(int(re.sub(r"[a-z]", "", hashed_value))) & 10000)
lesson = str(abs(hash(dbgems.get_notebook_path())) % 10000)

# import re, hashlib
# encoded_value = dbgems.get_notebook_path().encode('utf-8')
# hash()
# hashed_value = hashlib.sha3_512(encoded_value).hexdigest()
# self.lesson_config.name = str(abs(int(re.sub(r"[a-z]", "", hashed_value))) & 10000)
# We don't need repeatable has values here - once the lesson is done, we are done with this value.
self.lesson_config.name = str(abs(hash(dbgems.get_notebook_path())) % 10000)
self.__smoke_test_lesson = True

# Convert any lesson value we have to lower case.
Expand Down

0 comments on commit c0cb169

Please sign in to comment.