This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
import tempfile | |
class TemporaryDirectory(object): | |
""" | |
Context manager for tempfile.mkdtemp(). | |
This class is available in python +v3.2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == "__main__": | |
from subprocess import Popen, PIPE | |
with Popen( | |
[ | |
"pytest", | |
# '--tb=short', # shorter traceback format | |
# '--hypothesis-show-statistics', | |
str(__file__), | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{listings} | |
\usepackage{lstautogobble} % Fix relative indenting | |
\usepackage{color} % Code coloring | |
\usepackage{zi4} % Nice font | |
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1} | |
\definecolor{greencomments}{rgb}{0, 0.5, 0} | |
\definecolor{redstrings}{rgb}{0.9, 0, 0} | |
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""A code snippet creator. Convert code files to cropped PDFs. | |
Copy this file to the folder containing your code-snippets. | |
A "pdf" folder will be created containing the rendered snippets. | |
Will convert "*.py" and "*.txt" files by default. | |
Needs pdflatex and minted installed. | |
""" | |
from pathlib import Path |