Skip to content
Snippets Groups Projects
Commit 83f47098 authored by tuhe's avatar tuhe
Browse files

updates

parent 11b1ee00
No related branches found
No related tags found
No related merge requests found
Pipeline #13392 passed
...@@ -80,7 +80,10 @@ def _block_fun(lines, start_extra, end_extra, keep=False, permute=False, questio ...@@ -80,7 +80,10 @@ def _block_fun(lines, start_extra, end_extra, keep=False, permute=False, questio
if len(ee) >= 2 and ee[0] == '"': if len(ee) >= 2 and ee[0] == '"':
ee = ee[1:-1] ee = ee[1:-1]
if len(ee) == 0: if len(ee) == 0:
if not permute:
ee = "Insert your solution and remove this error." ee = "Insert your solution and remove this error."
else:
ee = "Remove this exception after the above lines have been uncommented and rearranged."
start_extra = start_extra.strip() start_extra = start_extra.strip()
if keep: if keep:
l2 = ['GARBAGE'] * cc l2 = ['GARBAGE'] * cc
...@@ -93,15 +96,21 @@ def _block_fun(lines, start_extra, end_extra, keep=False, permute=False, questio ...@@ -93,15 +96,21 @@ def _block_fun(lines, start_extra, end_extra, keep=False, permute=False, questio
insert_lines = False insert_lines = False
msg = [] msg = []
if permute: if permute:
msg = [id + "# TODO: The following lines have been permuted. Can you put them back in order?"] sperm = f"# TODO: Oy veh, the following {cc} lines below have been permuted. Uncomment, rearrange to the correct order and remove the error."
msg = [id + f"#"+sperm, id + "#"+"-"*len(sperm)]
# Permute all lines. # Permute all lines.
lines = f1(lines) lines = f1(lines)
insert_lines = True insert_lines = True
pass pass
if questionmarks: if questionmarks:
sperm = f"# TODO: The following {cc} lines have been obfuscated by having characters replaced by questionmarks. Make it work and remove the error."
msg = [id + f"#" + sperm, id + "#" + "-" * len(sperm)]
lines = f2(lines) lines = f2(lines)
insert_lines = True insert_lines = True
elif halfquestionmarks: elif halfquestionmarks:
sperm = f"# TODO: Half of each line of code in the following {cc} lines have been replaced by garbage. Make it work and remove the error."
msg = [id + f"#" + sperm, id + "#" + "-" * len(sperm)]
lines = f3(lines) lines = f3(lines)
insert_lines = True insert_lines = True
if not insert_lines: if not insert_lines:
......
...@@ -71,7 +71,7 @@ def snip_dir(source_dir, # Sources ...@@ -71,7 +71,7 @@ def snip_dir(source_dir, # Sources
if os.path.isdir(f) or str(f).endswith("_grade.py"): if os.path.isdir(f) or str(f).endswith("_grade.py"):
continue continue
if accept and (str(f).endswith(".py") or str(f).endswith(".rst")): if accept and (str(f).endswith(".py") or str(f).endswith(".rst") or str(f).endswith(".md")):
# if f.endswith("rst"): # if f.endswith("rst"):
# pass # pass
solution_list = [] solution_list = []
......
...@@ -36,8 +36,10 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True, ...@@ -36,8 +36,10 @@ def censor_file(file, run_files=True, run_out_dirs=None, cut_files=True,
license_head=None): license_head=None):
if str(file).endswith("rst"): if str(file).endswith("rst"):
assert not run_files and not cut_files and not censor_files assert not run_files and not cut_files and not censor_files
print(file) print(file)
# if str(file).endswith("md"):
# assert not run_files and not cut_files
if references == None: if references == None:
references = {} references = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment