PyKubeGrader 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: PyKubeGrader
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -6,7 +6,7 @@ pykubegrader/utils.py,sha256=jlJklKvRhY3O7Hz2aaU1m0y3p_n9eMAXNnAF7LUEaPY,1275
6
6
  pykubegrader/validate.py,sha256=OKnItGyd-L8QPKcsE0KRuwBI_IxKiJzMLJKZiA2j3II,11184
7
7
  pykubegrader/build/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
8
  pykubegrader/build/api_notebook_builder.py,sha256=EZG4Ow4YATzOWPPNLkdQEdWt7hkpbaI5ZD1Bf2KEWeY,25622
9
- pykubegrader/build/build_folder.py,sha256=9aewc4dcYKS5kNaDS3gTwCnzRTmHT6Ooio5TF258q_8,86963
9
+ pykubegrader/build/build_folder.py,sha256=HDccW597shBhAd-jxvMUPpsiNj2S4DlKRGMDH_6U9nQ,87590
10
10
  pykubegrader/build/clean_folder.py,sha256=8N0KyL4eXRs0DCw-V_2jR9igtFs_mOFMQufdL6tD-38,1323
11
11
  pykubegrader/build/collate.py,sha256=cVvF7tf2U3iiH4R_dbghTcieedIx5w3Fyw9L_llInM8,6754
12
12
  pykubegrader/build/markdown_questions.py,sha256=cSh8mkHK3hh-etJdgrZu9UQi1WPrKQtofkzLCUp1Z-w,4676
@@ -16,7 +16,7 @@ pykubegrader/graders/late_assignments.py,sha256=_2-rA5RqO0BWY9WAQA_mbCxxPKTOiJOl
16
16
  pykubegrader/log_parser/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
17
17
  pykubegrader/log_parser/parse.ipynb,sha256=5e-9dzUbJk2M8kPP55lVeksm86lSY5ocKfWOP2RSWH0,11921
18
18
  pykubegrader/log_parser/parse.py,sha256=dXzTEOTI6VTRNoHFDAjg6hZUhvB3kHtMb10_KW3NPrw,7641
19
- pykubegrader/submit/submit_assignment.py,sha256=cqVu7US8GVaCdJdaU2yjawlVBtAKP5XJc4oAvX5FeRU,2575
19
+ pykubegrader/submit/submit_assignment.py,sha256=Cx9hc2A--ts95dFLvn7Fw--ekRwPXqHKKVChnGFgw_Y,2670
20
20
  pykubegrader/tokens/token_panel.py,sha256=NNA5ZV3Q9jB_lz2aSwMyViXV0ESu6V_7T92Qji7UpSQ,1377
21
21
  pykubegrader/tokens/tokens.py,sha256=qcYMFgNPimbfeS7lXOtbgquGgeJCgOGx5hvXewIs0oQ,1474
22
22
  pykubegrader/tokens/validate_token.py,sha256=kvHX0NJBm21xzb2p67j7vq1La6J1XbmobEJQ3fTMdZA,3289
@@ -33,9 +33,9 @@ pykubegrader/widgets_base/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-
33
33
  pykubegrader/widgets_base/multi_select.py,sha256=KtfAP0PyEbcjWlKNpI5_5-PLMtcUbbNX0Es_-w-H34Q,4226
34
34
  pykubegrader/widgets_base/reading.py,sha256=ChUS3NOTa_HLtNpxR8hGX80LPKMvYMypnR6dFknfxus,5430
35
35
  pykubegrader/widgets_base/select.py,sha256=uMncmVIqjvJkffMQY1L_PokrFCidK1PeVITX0i70fho,2750
36
- PyKubeGrader-0.3.6.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
37
- PyKubeGrader-0.3.6.dist-info/METADATA,sha256=RVMHbbz9895jEBhpogU7TM5keqyf-kUKhKJhJ1Hk168,2729
38
- PyKubeGrader-0.3.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
- PyKubeGrader-0.3.6.dist-info/entry_points.txt,sha256=RR57KvzDRJrP4omy5heS5cZ3E7g56YxcxJhDnp57ZU0,253
40
- PyKubeGrader-0.3.6.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
41
- PyKubeGrader-0.3.6.dist-info/RECORD,,
36
+ PyKubeGrader-0.3.7.dist-info/LICENSE.txt,sha256=YTp-Ewc8Kems8PJEE27KnBPFnZSxoWvSg7nnknzPyYw,1546
37
+ PyKubeGrader-0.3.7.dist-info/METADATA,sha256=Ht8G9VvFfGBa9YD9PoBSbd_Cee6tuGZ2RTBjFN0Z5pk,2729
38
+ PyKubeGrader-0.3.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
+ PyKubeGrader-0.3.7.dist-info/entry_points.txt,sha256=RR57KvzDRJrP4omy5heS5cZ3E7g56YxcxJhDnp57ZU0,253
40
+ PyKubeGrader-0.3.7.dist-info/top_level.txt,sha256=e550Klfze6higFxER1V62fnGOcIgiKRbsrl9CC4UdtQ,13
41
+ PyKubeGrader-0.3.7.dist-info/RECORD,,
@@ -578,7 +578,7 @@ class NotebookProcessor:
578
578
 
579
579
  if self.require_key:
580
580
  # Add an additional line for validate_token()
581
- validate_token_line = "from pykubegrader.tokens.validate_token import validate_token\nvalidate_token()\n"
581
+ validate_token_line =f"from pykubegrader.tokens.validate_token import validate_token\nvalidate_token(assignment = '{self.assignment_tag}')\n"
582
582
 
583
583
  # Define the Code cell
584
584
  code_cell = nbformat.v4.new_code_cell(
@@ -681,6 +681,7 @@ class NotebookProcessor:
681
681
  self.week,
682
682
  self.assignment_type,
683
683
  require_key=self.require_key,
684
+ assignment_tag = self.assignment_tag,
684
685
  )
685
686
 
686
687
  NotebookProcessor.replace_temp_in_notebook(
@@ -711,6 +712,7 @@ class NotebookProcessor:
711
712
  self.week,
712
713
  self.assignment_type,
713
714
  require_key=self.require_key,
715
+ assignment_tag = self.assignment_tag
714
716
  )
715
717
  NotebookProcessor.replace_temp_no_otter(
716
718
  temp_notebook_path, temp_notebook_path
@@ -742,7 +744,7 @@ class NotebookProcessor:
742
744
  nbformat.write(notebook, f)
743
745
 
744
746
  @staticmethod
745
- def add_validate_token_cell(notebook_path: str, require_key: bool) -> None:
747
+ def add_validate_token_cell(notebook_path: str, require_key: bool, **kwargs) -> None:
746
748
  """
747
749
  Adds a new code cell at the top of a Jupyter notebook if require_key is True.
748
750
 
@@ -756,18 +758,24 @@ class NotebookProcessor:
756
758
  if not require_key:
757
759
  print("require_key is False. No changes made to the notebook.")
758
760
  return
759
-
760
- NotebookProcessor.add_validate_block(notebook_path, require_key)
761
+
762
+ NotebookProcessor.add_validate_block(notebook_path, require_key, assignment_tag = kwargs.get("assignment_tag", None))
761
763
 
762
764
  # Load the notebook
763
765
  with open(notebook_path, "r", encoding="utf-8") as f:
764
766
  notebook = nbformat.read(f, as_version=4)
765
767
 
766
768
  # Create the new code cell
767
- new_cell = nbformat.v4.new_code_cell(
769
+ if kwargs.get("assignment_tag", None):
770
+ new_cell = nbformat.v4.new_code_cell(
771
+ "from pykubegrader.tokens.validate_token import validate_token\n"
772
+ f"validate_token('type the key provided by your instructor here', assignment = '{kwargs.get('assignment_tag')}')\n"
773
+ )
774
+ else:
775
+ new_cell = nbformat.v4.new_code_cell(
768
776
  "from pykubegrader.tokens.validate_token import validate_token\n"
769
777
  "validate_token('type the key provided by your instructor here')\n"
770
- )
778
+ )
771
779
 
772
780
  # Add the new cell to the top of the notebook
773
781
  notebook.cells.insert(0, new_cell)
@@ -777,7 +785,7 @@ class NotebookProcessor:
777
785
  nbformat.write(notebook, f)
778
786
 
779
787
  @staticmethod
780
- def add_validate_block(notebook_path: str, require_key: bool) -> None:
788
+ def add_validate_block(notebook_path: str, require_key: bool, **kwargs) -> None:
781
789
  """
782
790
  Modifies the first code cell of a Jupyter notebook to add the validate_token call if require_key is True.
783
791
 
@@ -811,7 +819,7 @@ class NotebookProcessor:
811
819
 
812
820
  @staticmethod
813
821
  def add_initialization_code(
814
- notebook_path, week, assignment_type, require_key=False
822
+ notebook_path, week, assignment_type, require_key=False, **kwargs,
815
823
  ):
816
824
  # finds the first code cell
817
825
  index, cell = find_first_code_cell(notebook_path)
@@ -823,7 +831,7 @@ class NotebookProcessor:
823
831
  replace_cell_source(notebook_path, index, cell)
824
832
 
825
833
  if require_key:
826
- NotebookProcessor.add_validate_token_cell(notebook_path, require_key)
834
+ NotebookProcessor.add_validate_token_cell(notebook_path, require_key, assignment_tag = kwargs.get("assignment_tag", None))
827
835
 
828
836
  def multiple_choice_parser(self, temp_notebook_path, new_notebook_path):
829
837
  ### Parse the notebook for multiple choice questions
@@ -42,6 +42,9 @@ def call_score_assignment(
42
42
  "assignment_title": assignment_title,
43
43
  "notebook_title": notebook_title,
44
44
  }
45
+
46
+ if os.environ["TOKEN"] is not None:
47
+ params["key_used"] = os.environ["TOKEN"]
45
48
 
46
49
  username, password = get_credentials().values()
47
50