Last active
August 29, 2015 14:24
-
-
Save soh-i/4011eb2b4f106c4b9dc6 to your computer and use it in GitHub Desktop.
@header_info decorator
This file contains hidden or 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 inspect | |
| import os | |
| import os.path | |
| import datetime | |
| def header_info(func): | |
| def _header(*args, **kwargs): | |
| exec_path = inspect.currentframe().f_back.f_code.co_filename | |
| print "# Run '%s' function in %s" % (func.__name__, os.path.abspath(exec_path)) | |
| print "# Host: %s" % (os.uname()[1]) | |
| now = datetime.datetime.now() | |
| print "# Created at %s" % (now.strftime('%Y/%m/%d %H:%M:%S')) | |
| return func(*args, **kwargs) | |
| return _header |
Author
soh-i
commented
Jul 4, 2015
Author
# Run 'run_algorithm_or_experiments' function in /Users/yukke/dev/project/scripts/test_analysis.py
# Host: aichan
# Created at 2015/07/04 16:27:30
A,921.000
B,900.002
C,900.002
....
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment