<jupyter_start><jupyter_text>Reprint cell magicThis is a minimal jupyter notebook to show how to define and use the `reprint` magic.The `reprint` cell magic will both print in output the content of the cell (properly formatted as python code)and also run the cell.This magic is particularly useful to show some code in combination with [appmode](https://github.com/oschuett/appmode).Below a demonstration follows.<jupyter_code># We need to register the magic by hand
# Probably there is a better way to do it automatically with setup.py?
# One would need to edit a file in the ipython configuration file and add something like:
# c.InteractiveShellApp.extensions = ['reprint_magic']
%load_ext reprint_magic<jupyter_output><empty_output><jupyter_text>Tutorial: write a function that doubles a number given in inputThe following function does the job:<jupyter_code>%%reprint
def double_number(number):
    return 2*number<jupyter_output><empty_output><jupyter_text>Checking the resultsWe can try if it works now, with the following code:<jupyter_code>%%reprint
for number in range(9):
    double = double_number(number)
    print("Number: {}; computed double: {}".format(
        number, double
    ))<jupyter_output><empty_output><jupyter_text>Stylistic detailsYou can also avoid showing the box around the code using `%%reprint --no-box` or `reprint -n`. The result will look like this:<jupyter_code>%%reprint -n
print("Hello world")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08270676691729323, 'fraction_numerical': 0.001367053998632946, 'mean_word_length': 5.873239436619718, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '165860', 'license': 'MIT', 'n_tokens_mistral': 439, 'n_tokens_neox': 427, 'n_words': 164, 'path': 'demo/demo.ipynb', 'repo_name': 'giovannipizzi/reprint-magic', 'size': '1463'}