dlai-grader 1.22.1__tar.gz → 1.22.2__tar.gz

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.
Files changed (21) hide show
  1. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/PKG-INFO +3 -12
  2. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/__init__.py +1 -1
  3. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/io.py +1 -1
  4. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/notebook.py +17 -13
  5. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/PKG-INFO +3 -12
  6. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/setup.py +3 -2
  7. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/LICENSE +0 -0
  8. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/README.md +0 -0
  9. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/cli.py +0 -0
  10. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/compiler.py +0 -0
  11. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/config.py +0 -0
  12. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/grading.py +0 -0
  13. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/py.typed +0 -0
  14. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/templates.py +0 -0
  15. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader/types.py +0 -0
  16. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/SOURCES.txt +0 -0
  17. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/dependency_links.txt +0 -0
  18. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/entry_points.txt +0 -0
  19. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/requires.txt +0 -0
  20. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/dlai_grader.egg-info/top_level.txt +0 -0
  21. {dlai_grader-1.22.1 → dlai_grader-1.22.2}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: dlai-grader
3
- Version: 1.22.1
3
+ Version: 1.22.2
4
4
  Summary: Grading utilities for DLAI courses
5
5
  Home-page: https://github.com/https-deeplearning-ai/grader
6
6
  Author: Andres Zarta
7
7
  Author-email: andrezb5@gmail.com
8
- License: MIT License
8
+ License: MIT
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
@@ -13,15 +13,6 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: nbformat>=5.1.3
15
15
  Requires-Dist: jupytext>=1.13.0
16
- Dynamic: author
17
- Dynamic: author-email
18
- Dynamic: classifier
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: license
23
- Dynamic: requires-dist
24
- Dynamic: summary
25
16
 
26
17
  # grader
27
18
  Automatic grading for DLAI courses. Designed to be compatible with Coursera's grading requirements.
@@ -6,6 +6,6 @@ from . import grading
6
6
  from . import types
7
7
 
8
8
 
9
- __version__ = "1.22.1"
9
+ __version__ = "1.22.2"
10
10
  __author__ = "Andres Zarta"
11
11
  __credits__ = "DeepLearning.AI"
@@ -70,7 +70,7 @@ def uneditable_notebook(path: str) -> None:
70
70
  path (str): Path to the notebook.
71
71
  """
72
72
  nb = read_notebook(path)
73
- nb = add_metadata_code_cells_without_pattern(nb, {"editable": False})
73
+ nb = add_metadata_code_cells_without_pattern(nb, {"editable": False}, ignore_pattern="^# EDITABLE")
74
74
  jupytext.write(nb, path)
75
75
 
76
76
 
@@ -238,27 +238,31 @@ def add_metadata_code_cells_with_pattern(
238
238
 
239
239
 
240
240
  def add_metadata_code_cells_without_pattern(
241
- notebook: NotebookNode, metadata: dict, regex_pattern: str = "^# GRADED "
241
+ notebook: NotebookNode,
242
+ metadata: dict,
243
+ match_pattern: str = "^# GRADED ",
244
+ ignore_pattern: str = None
242
245
  ) -> NotebookNode:
243
- """Adds metadata to code cells of a notebook that don't match a regexp pattern.
246
+ """Adds metadata to code cells of a notebook that don't match a regexp pattern and aren't ignored by another pattern.
247
+
244
248
  Args:
245
249
  notebook (NotebookNode): Notebook to filter.
246
250
  metadata (dict): The metadata which should be a key-value pair.
247
- regex_pattern (str, optional): Pattern to check. Defaults to "w[1-9]_unittest".
251
+ match_pattern (str, optional): Pattern to check which cells to add metadata to. Defaults to "^# GRADED ".
252
+ ignore_pattern (str, optional): Pattern to check which cells to ignore. If a cell matches this pattern, it will be skipped.
253
+
248
254
  Returns:
249
255
  NotebookNode: The notebook with the new metadata.
250
256
  """
251
- filtered_cells = []
252
-
253
257
  for cell in notebook["cells"]:
254
- if cell["cell_type"] == "code" and not re.search(regex_pattern, cell["source"]):
255
- current_metadata = cell["metadata"]
256
- current_metadata.update(metadata)
257
- cell["metadata"] = current_metadata
258
-
259
- filtered_cells.append(cell)
260
-
261
- notebook["cells"] = filtered_cells
258
+ if cell["cell_type"] == "code":
259
+ if ignore_pattern and re.search(ignore_pattern, cell["source"]):
260
+ continue
261
+
262
+ if not re.search(match_pattern, cell["source"]):
263
+ current_metadata = cell.get("metadata", {})
264
+ current_metadata.update(metadata)
265
+ cell["metadata"] = current_metadata
262
266
 
263
267
  return notebook
264
268
 
@@ -1,11 +1,11 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: dlai-grader
3
- Version: 1.22.1
3
+ Version: 1.22.2
4
4
  Summary: Grading utilities for DLAI courses
5
5
  Home-page: https://github.com/https-deeplearning-ai/grader
6
6
  Author: Andres Zarta
7
7
  Author-email: andrezb5@gmail.com
8
- License: MIT License
8
+ License: MIT
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
@@ -13,15 +13,6 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: nbformat>=5.1.3
15
15
  Requires-Dist: jupytext>=1.13.0
16
- Dynamic: author
17
- Dynamic: author-email
18
- Dynamic: classifier
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: license
23
- Dynamic: requires-dist
24
- Dynamic: summary
25
16
 
26
17
  # grader
27
18
  Automatic grading for DLAI courses. Designed to be compatible with Coursera's grading requirements.
@@ -5,14 +5,15 @@ with open("README.md", "r") as f:
5
5
 
6
6
  setup(
7
7
  name="dlai-grader",
8
- version="1.22.1",
8
+ version="1.22.2",
9
9
  description="Grading utilities for DLAI courses",
10
10
  url="https://github.com/https-deeplearning-ai/grader",
11
11
  author="Andres Zarta",
12
12
  author_email="andrezb5@gmail.com",
13
13
  long_description=long_description,
14
14
  long_description_content_type="text/markdown",
15
- license="MIT License",
15
+ license="MIT",
16
+ license_files=["LICENSE"],
16
17
  packages=find_packages(),
17
18
  package_data={"dlai_grader": ["py.typed"]},
18
19
  entry_points={
File without changes
File without changes
File without changes