Skip to content

Instantly share code, notes, and snippets.

@numpde
Last active October 25, 2018 03:57
Show Gist options
  • Save numpde/4b26439d15ce4f7112565cc2c1b46501 to your computer and use it in GitHub Desktop.
Save numpde/4b26439d15ce4f7112565cc2c1b46501 to your computer and use it in GitHub Desktop.
A python template for a data science script
#!/usr/bin/python3
# AUTHOR, DATE
## ================== IMPORTS :
pass
import inspect
## ==================== NOTES :
pass
## ==================== INPUT :
IFILE = {
'' : "",
}
## =================== OUTPUT :
OFILE = {
'' : "",
}
# Create output directories
#for f in OFILE.values() : if f : os.makedirs(os.path.dirname(f), exist_ok=True)
## ==================== PARAM :
PARAM = {
'' : 0,
}
## ====================== AUX :
# https://stackoverflow.com/questions/34491808/how-to-get-the-current-scripts-code-in-python
THIS = inspect.getsource(inspect.getmodule(inspect.currentframe()))
# Log which files are opened
def logged_open(filename, mode='r', *argv, **kwargs) :
print("({}):\t{}".format(mode, filename))
return open(filename, mode, *argv, **kwargs)
## ===================== WORK :
pass
## ==================== ENTRY :
if (__name__ == "__main__") :
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment