PyKubeGrader 0.2.13__tar.gz → 0.2.22__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/.gitignore +1 -0
  2. {pykubegrader-0.2.13/src/PyKubeGrader.egg-info → pykubegrader-0.2.22}/PKG-INFO +1 -1
  3. {pykubegrader-0.2.13 → pykubegrader-0.2.22/src/PyKubeGrader.egg-info}/PKG-INFO +1 -1
  4. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/SOURCES.txt +1 -0
  5. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/build/api_notebook_builder.py +6 -0
  6. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/build/build_folder.py +71 -14
  7. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/tokens/tokens.py +8 -11
  8. pykubegrader-0.2.22/src/pykubegrader/tokens/validate_token.py +138 -0
  9. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/.coveragerc +0 -0
  10. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/.github/workflows/main.yml +0 -0
  11. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/.readthedocs.yml +0 -0
  12. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/AUTHORS.rst +0 -0
  13. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/CHANGELOG.rst +0 -0
  14. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/CONTRIBUTING.rst +0 -0
  15. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/LICENSE.txt +0 -0
  16. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/README.rst +0 -0
  17. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/Makefile +0 -0
  18. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/_static/Drexel_blue_Logo_square_Dark.png +0 -0
  19. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/_static/Drexel_blue_Logo_square_Light.png +0 -0
  20. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/_static/custom.css +0 -0
  21. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/authors.rst +0 -0
  22. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/changelog.rst +0 -0
  23. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/conf.py +0 -0
  24. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/contributing.rst +0 -0
  25. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/index.rst +0 -0
  26. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/license.rst +0 -0
  27. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/readme.rst +0 -0
  28. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/docs/requirements.txt +0 -0
  29. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/examples/.responses.json +0 -0
  30. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/examples/true_false.ipynb +0 -0
  31. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/pyproject.toml +0 -0
  32. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/setup.cfg +0 -0
  33. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/setup.py +0 -0
  34. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/dependency_links.txt +0 -0
  35. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/entry_points.txt +0 -0
  36. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/not-zip-safe +0 -0
  37. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/requires.txt +0 -0
  38. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/PyKubeGrader.egg-info/top_level.txt +0 -0
  39. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/__init__.py +0 -0
  40. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/build/__init__.py +0 -0
  41. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/build/clean_folder.py +0 -0
  42. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/graders/__init__.py +0 -0
  43. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/graders/late_assignments.py +0 -0
  44. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/initialize.py +0 -0
  45. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/log_parser/__init__.py +0 -0
  46. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/log_parser/parse.ipynb +0 -0
  47. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/log_parser/parse.py +0 -0
  48. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/submit/submit_assignment.py +0 -0
  49. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/telemetry.py +0 -0
  50. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/utils.py +0 -0
  51. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/validate.py +0 -0
  52. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/__init__.py +0 -0
  53. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/multiple_choice.py +0 -0
  54. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/reading_question.py +0 -0
  55. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/select_many.py +0 -0
  56. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/student_info.py +0 -0
  57. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/style.py +0 -0
  58. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/true_false.py +0 -0
  59. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets/types_question.py +0 -0
  60. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets_base/__init__.py +0 -0
  61. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets_base/multi_select.py +0 -0
  62. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets_base/reading.py +0 -0
  63. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/src/pykubegrader/widgets_base/select.py +0 -0
  64. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/tests/conftest.py +0 -0
  65. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/tests/import_test.py +0 -0
  66. {pykubegrader-0.2.13 → pykubegrader-0.2.22}/tox.ini +0 -0
@@ -57,3 +57,4 @@ MANIFEST
57
57
  .ruff_cache/
58
58
  password.py
59
59
  passwords.py
60
+ src/pykubegrader/tokens/token_test.ipynb
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.13
3
+ Version: 0.2.22
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyKubeGrader
3
- Version: 0.2.13
3
+ Version: 0.2.22
4
4
  Summary: Add a short description here!
5
5
  Home-page: https://github.com/pyscaffold/pyscaffold/
6
6
  Author: jagar2
@@ -48,6 +48,7 @@ src/pykubegrader/log_parser/parse.ipynb
48
48
  src/pykubegrader/log_parser/parse.py
49
49
  src/pykubegrader/submit/submit_assignment.py
50
50
  src/pykubegrader/tokens/tokens.py
51
+ src/pykubegrader/tokens/validate_token.py
51
52
  src/pykubegrader/widgets/__init__.py
52
53
  src/pykubegrader/widgets/multiple_choice.py
53
54
  src/pykubegrader/widgets/reading_question.py
@@ -14,6 +14,7 @@ class FastAPINotebookBuilder:
14
14
  notebook_path: str
15
15
  temp_notebook: Optional[str] = None
16
16
  assignment_tag: Optional[str] = ""
17
+ require_key: Optional[bool] = False
17
18
 
18
19
  def __post_init__(self):
19
20
  self.root_path, self.filename = FastAPINotebookBuilder.get_filename_and_root(
@@ -119,6 +120,11 @@ class FastAPINotebookBuilder:
119
120
  f"os.environ['TOTAL_POINTS_FREE_RESPONSE'] = str({self.total_points})\n"
120
121
  )
121
122
 
123
+ if self.require_key:
124
+ first_cell_header.append(
125
+ "from pykubegrader.tokens.validate_token import validate_token\nvalidate_token()\n"
126
+ )
127
+
122
128
  short_filename = self.filename.split(".")[0].replace("_temp", "")
123
129
  first_cell_header.extend(
124
130
  [
@@ -28,6 +28,19 @@ from .api_notebook_builder import FastAPINotebookBuilder
28
28
  from typing import Optional
29
29
 
30
30
 
31
+ import os
32
+
33
+ os.environ["JUPYTERHUB_USER"] = "jca92"
34
+ os.environ["TOKEN"] = "token"
35
+ os.environ["DB_URL"] = "https://engr-131-api.eastus.cloudapp.azure.com/"
36
+ os.environ["keys_student"] = "capture"
37
+ os.environ["user_name_student"] = "student"
38
+
39
+ from pykubegrader.tokens.tokens import add_token
40
+
41
+ add_token("token", duration=20)
42
+
43
+
31
44
  @dataclass
32
45
  class NotebookProcessor:
33
46
  """
@@ -46,6 +59,7 @@ class NotebookProcessor:
46
59
  solutions_folder: str = field(init=False)
47
60
  verbose: bool = False
48
61
  log: bool = True
62
+ require_key: bool = False
49
63
 
50
64
  def __post_init__(self):
51
65
  """
@@ -559,14 +573,26 @@ class NotebookProcessor:
559
573
  "you should see your score."
560
574
  )
561
575
 
562
- # Define the Code cell
563
- code_cell = nbformat.v4.new_code_cell(
564
- "from pykubegrader.submit.submit_assignment import submit_assignment\n\n"
565
- f'submit_assignment("week{self.week_num}-{self.assignment_type}", "{os.path.basename(notebook_path).replace(".ipynb", "")}")'
566
- )
576
+ if self.require_key:
577
+ # Add an additional line for validate_token()
578
+ validate_token_line = "from pykubegrader.submit.submit_assignment import validate_token\nvalidate_token()\n"
579
+
580
+ # Define the Code cell
581
+ code_cell = nbformat.v4.new_code_cell(
582
+ f"{validate_token_line}\n\n" # Add the validate_token() line
583
+ "from pykubegrader.submit.submit_assignment import submit_assignment\n\n"
584
+ f'submit_assignment("week{self.week_num}-{self.assignment_type}", "{os.path.basename(notebook_path).replace(".ipynb", "")}")'
585
+ )
586
+ else:
587
+ # Define the Code cell without validate_token()
588
+ code_cell = nbformat.v4.new_code_cell(
589
+ "from pykubegrader.submit.submit_assignment import submit_assignment\n\n"
590
+ f'submit_assignment("week{self.week_num}-{self.assignment_type}", "{os.path.basename(notebook_path).replace(".ipynb", "")}")'
591
+ )
567
592
 
568
593
  # Make the code cell non-editable and non-deletable
569
594
  code_cell.metadata = {"editable": False, "deletable": False}
595
+ code_cell.metadata["tags"] = ["skip-execution"]
570
596
 
571
597
  # Add the cells to the notebook
572
598
  notebook.cells.append(markdown_cell)
@@ -606,7 +632,9 @@ class NotebookProcessor:
606
632
  shutil.copy("./keys/.server_public_key.bin", server_public_key)
607
633
 
608
634
  out = FastAPINotebookBuilder(
609
- notebook_path=temp_notebook_path, assignment_tag=self.assignment_tag
635
+ notebook_path=temp_notebook_path,
636
+ assignment_tag=self.assignment_tag,
637
+ require_key=self.require_key,
610
638
  )
611
639
 
612
640
  debug_notebook = os.path.join(
@@ -631,7 +659,10 @@ class NotebookProcessor:
631
659
  )
632
660
 
633
661
  NotebookProcessor.add_initialization_code(
634
- student_notebook, self.week, self.assignment_type
662
+ student_notebook,
663
+ self.week,
664
+ self.assignment_type,
665
+ require_key=self.require_key,
635
666
  )
636
667
 
637
668
  NotebookProcessor.replace_temp_in_notebook(
@@ -658,7 +689,10 @@ class NotebookProcessor:
658
689
  return student_notebook, out.total_points
659
690
  else:
660
691
  NotebookProcessor.add_initialization_code(
661
- temp_notebook_path, self.week, self.assignment_type
692
+ temp_notebook_path,
693
+ self.week,
694
+ self.assignment_type,
695
+ require_key=self.require_key,
662
696
  )
663
697
  NotebookProcessor.replace_temp_no_otter(
664
698
  temp_notebook_path, temp_notebook_path
@@ -690,11 +724,19 @@ class NotebookProcessor:
690
724
  nbformat.write(notebook, f)
691
725
 
692
726
  @staticmethod
693
- def add_initialization_code(notebook_path, week, assignment_type):
727
+ def add_initialization_code(
728
+ notebook_path, week, assignment_type, require_key=False
729
+ ):
694
730
  # finds the first code cell
695
731
  index, cell = find_first_code_cell(notebook_path)
696
732
  cell = cell["source"]
697
- import_text = "from pykubegrader.initialize import initialize_assignment\n"
733
+ import_text = "# You must make sure to run all cells in sequence using shift + enter or you might encounter errors\n"
734
+ import_text += "from pykubegrader.initialize import initialize_assignment\n"
735
+ if require_key:
736
+ import_text += (
737
+ "from pykubegrader.token.validate_token import validate_token\n"
738
+ )
739
+ import_text += "validate_token('type the key provided by your TA here')\n"
698
740
  import_text += f'\nresponses = initialize_assignment("{os.path.splitext(os.path.basename(notebook_path))[0]}", "{week}", "{assignment_type}" )\n'
699
741
  cell = f"{import_text}\n" + cell
700
742
  replace_cell_source(notebook_path, index, cell)
@@ -1739,7 +1781,9 @@ def generate_mcq_file(data_dict, output_file="mc_questions.py"):
1739
1781
  )
1740
1782
  f.write(" def __init__(self):\n")
1741
1783
  f.write(" super().__init__(\n")
1742
- f.write(f' title=f"{q_value['question_text']}",\n')
1784
+ f.write(
1785
+ f' title=f"Question{q_value['question number']}: {q_value['title']}",\n'
1786
+ )
1743
1787
  f.write(" style=MCQ,\n")
1744
1788
  f.write(
1745
1789
  f" question_number={q_value['question number']},\n"
@@ -1810,7 +1854,9 @@ def generate_select_many_file(data_dict, output_file="select_many_questions.py")
1810
1854
  )
1811
1855
  f.write(" def __init__(self):\n")
1812
1856
  f.write(" super().__init__(\n")
1813
- f.write(f" title=f'{q_value['question_text']}',\n")
1857
+ f.write(
1858
+ f' title=f"Question{q_value['question number']}: {q_value['title']}",\n'
1859
+ )
1814
1860
  f.write(" style=MultiSelect,\n")
1815
1861
  f.write(
1816
1862
  f" question_number={q_value['question number']},\n"
@@ -1887,7 +1933,9 @@ def generate_tf_file(data_dict, output_file="tf_questions.py"):
1887
1933
  )
1888
1934
  f.write(" def __init__(self):\n")
1889
1935
  f.write(" super().__init__(\n")
1890
- f.write(f" title=f'{q_value['question_text']}',\n")
1936
+ f.write(
1937
+ f' title=f"Question{q_value['question number']}: {q_value['title']}",\n'
1938
+ )
1891
1939
  f.write(" style=TFStyle,\n")
1892
1940
  f.write(
1893
1941
  f" question_number={q_value['question number']},\n"
@@ -2059,9 +2107,18 @@ def main():
2059
2107
  default="Reading-Week-X",
2060
2108
  )
2061
2109
 
2110
+ parser.add_argument(
2111
+ "--require-key",
2112
+ type=bool,
2113
+ help="Require a key to be generated for the assignment",
2114
+ default=False,
2115
+ )
2116
+
2062
2117
  args = parser.parse_args()
2063
2118
  processor = NotebookProcessor(
2064
- root_folder=args.root_folder, assignment_tag=args.assignment_tag
2119
+ root_folder=args.root_folder,
2120
+ assignment_tag=args.assignment_tag,
2121
+ require_key=args.require_key,
2065
2122
  )
2066
2123
  processor.process_notebooks()
2067
2124
 
@@ -1,26 +1,23 @@
1
1
  import requests
2
-
3
- try:
4
- from pykubegrader.build.passwords import password, user, juptyerhub_user
5
- except: # noqa: E722
6
- print("Passwords not found, cannot access database")
2
+ import os
3
+ import json
7
4
 
8
5
 
9
6
  def build_token_payload(token: str, duration: int) -> dict:
10
7
 
11
- if juptyerhub_user() is None:
8
+ if os.getenv("JUPYTERHUB_USER", None) is None:
12
9
  raise ValueError("JupyterHub user not found")
13
10
 
14
11
  # Return the extracted details as a dictionary
15
12
  return {
16
13
  "value": token,
17
- "requester": juptyerhub_user(),
14
+ "requester": os.getenv("JUPYTERHUB_USER", None),
18
15
  "duration": duration,
19
16
  }
20
17
 
21
18
 
22
19
  # Need to do for add token as well
23
- def add_token(self, token, duration=20):
20
+ def add_token(token, duration=20):
24
21
  """
25
22
  Sends a POST request to add a notebook.
26
23
  """
@@ -28,16 +25,16 @@ def add_token(self, token, duration=20):
28
25
  url = "https://engr-131-api.eastus.cloudapp.azure.com/tokens"
29
26
 
30
27
  # Build the payload
31
- payload = self.build_token_payload(token= token, duration=duration)
28
+ payload = build_token_payload(token=token, duration=duration)
32
29
 
33
30
  # Define HTTP Basic Authentication
34
- auth = (user(), password())
31
+ auth = ("user", "password")
35
32
 
36
33
  # Define headers
37
34
  headers = {"Content-Type": "application/json"}
38
35
 
39
36
  # Serialize the payload with the custom JSON encoder
40
- serialized_payload = json.dumps(payload, default=self.json_serial)
37
+ serialized_payload = json.dumps(payload)
41
38
 
42
39
  # Send the POST request
43
40
  response = requests.post(url, data=serialized_payload, headers=headers, auth=auth)
@@ -0,0 +1,138 @@
1
+ import os
2
+ import base64
3
+ import httpx
4
+ import asyncio
5
+ import nest_asyncio
6
+
7
+ # Apply nest_asyncio for environments like Jupyter
8
+ nest_asyncio.apply()
9
+
10
+
11
+ class TokenValidationError(Exception):
12
+ """
13
+ Custom exception raised when the token validation fails.
14
+ """
15
+
16
+ def __init__(self, message=None):
17
+ """
18
+ Initialize the exception with an optional message.
19
+
20
+ Args:
21
+ message (str, optional): The error message to display. Defaults to None.
22
+ """
23
+ super().__init__(message)
24
+
25
+
26
+ def get_credentials():
27
+ """
28
+ Fetch the username and password from environment variables.
29
+
30
+ Returns:
31
+ dict: A dictionary containing 'username' and 'password'.
32
+ """
33
+ username = os.getenv("user_name_student")
34
+ password = os.getenv("keys_student")
35
+ if not username or not password:
36
+ raise ValueError(
37
+ "Environment variables 'user_name_student' or 'keys_student' are not set."
38
+ )
39
+ return {"username": username, "password": password}
40
+
41
+
42
+ async def async_validate_token(token: str = None) -> None:
43
+ """
44
+ Asynchronously validate a token by making a GET request to the validation endpoint.
45
+
46
+ Args:
47
+ token (str): The token to validate.
48
+
49
+ Raises:
50
+ TokenValidationError: If the token is invalid or if there is an error in the validation process.
51
+
52
+ Returns:
53
+ None: If the token is valid, the function will pass silently.
54
+ """
55
+
56
+ if token is not None:
57
+ os.environ["TOKEN"] = token
58
+
59
+ if token is None:
60
+ token = os.getenv("TOKEN", None)
61
+
62
+ if token is None:
63
+ raise TokenValidationError("No token provided")
64
+
65
+ # Fetch the endpoint URL
66
+ base_url = os.getenv("DB_URL")
67
+ if not base_url:
68
+ raise ValueError("Environment variable 'DB_URL' is not set.")
69
+ endpoint = f"{base_url}validate-token/{token}"
70
+
71
+ # Get credentials
72
+ credentials = get_credentials()
73
+ username = credentials["username"]
74
+ password = credentials["password"]
75
+
76
+ # Encode credentials for Basic Authentication
77
+ auth_header = (
78
+ f"Basic {base64.b64encode(f'{username}:{password}'.encode()).decode()}"
79
+ )
80
+
81
+ # Make the GET request
82
+ async with httpx.AsyncClient() as client:
83
+ try:
84
+ response = await client.get(
85
+ endpoint, headers={"Authorization": auth_header}, timeout=10
86
+ )
87
+
88
+ if response.status_code == 200:
89
+ # If the response is 200, the token is valid
90
+ return # Pass silently
91
+ elif response.status_code == 404:
92
+ # If the response is 404, the token is invalid
93
+ detail = response.json().get("detail", "Token not found")
94
+ raise TokenValidationError(detail)
95
+ else:
96
+ # Handle unexpected status codes
97
+ raise TokenValidationError(
98
+ f"Unexpected response code: {response.status_code}"
99
+ )
100
+ except httpx.RequestError as e:
101
+ raise TokenValidationError(f"Request failed: {e}")
102
+ except Exception as e:
103
+ raise TokenValidationError(f"An unexpected error occurred: {e}")
104
+
105
+
106
+ def validate_token(token: str = None) -> None:
107
+ """
108
+ Synchronous wrapper for the `async_validate_token` function.
109
+
110
+ Args:
111
+ token (str): The token to validate.
112
+
113
+ Raises:
114
+ TokenValidationError: If the token is invalid or if there is an error in the validation process.
115
+
116
+ Returns:
117
+ None: If the token is valid, the function will pass silently.
118
+ """
119
+
120
+ # Get the current event loop or create one
121
+ try:
122
+ loop = asyncio.get_event_loop()
123
+ except RuntimeError:
124
+ loop = asyncio.new_event_loop()
125
+ asyncio.set_event_loop(loop)
126
+
127
+ # Run the async function in the event loop
128
+ loop.run_until_complete(async_validate_token(token))
129
+
130
+
131
+ # Example usage
132
+ if __name__ == "__main__":
133
+ token = "test"
134
+ try:
135
+ validate_token(token)
136
+ print("Token is valid.")
137
+ except TokenValidationError as e:
138
+ print(f"Token validation failed: {e}")
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes