Skip to content

Commit

Permalink
Merge pull request #187 from DigiKlausur/configurable_hash_subfolders
Browse files Browse the repository at this point in the history
Add configurable trait to exclude subfolders from hash
  • Loading branch information
tmetzl authored Feb 12, 2025
2 parents 7e0426c + 78717dc commit 8071a1e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions e2xgrader/exchange/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from nbgrader.exchange.default import ExchangeSubmit
from nbgrader.utils import check_mode, get_username
from traitlets import Type
from traitlets import List, Type

from ..exporters import SubmissionExporter
from ..utils.mode import E2xGraderMode, infer_e2xgrader_mode
Expand All @@ -46,6 +46,15 @@ class E2xExchangeSubmit(E2xExchange, ExchangeSubmit):
),
).tag(config=True)

exclude_hashcode_subfolders = List(
[".ipynb_checkpoints", ".history"],
help=dedent(
"""
List of subfolders to exclude from the hash calculation.
"""
),
).tag(config=True)

def init_dest(self):
if self.coursedir.course_id == "":
self.fail("No course id specified. Re-run with --course flag.")
Expand Down Expand Up @@ -148,7 +157,7 @@ def create_exam_files(self):
self.src_path,
method="sha1",
exclude_files=[self.timestamp_file, f"{username}_info.txt", "*.html"],
exclude_subfolders=[".ipynb_checkpoints"],
exclude_subfolders=self.exclude_hashcode_subfolders,
output_file="SHA1SUM.txt",
)
hashcode = truncate_hashcode(
Expand Down

0 comments on commit 8071a1e

Please sign in to comment.