author info added

This commit is contained in:
rasbt 2014-06-28 16:17:42 -04:00
parent 8ecab48e20
commit 5739472a48
2 changed files with 57 additions and 12 deletions

View File

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:b293f22eb716f74ec27869a5122812437e0a7f4743ddfe8c06a94c39f31c7d3e"
"signature": "sha256:0b017c7b1bd605534beb62287fd7916407f3782284c44ee02093a73e4a9896a8"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -173,14 +173,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<pre>%watermark [-d] [-n] [-t] [-z] [-u] [-c CUSTOM_TIME] [-v] [-p PACKAGES]\n",
" [-m]\n",
"<pre>%watermark [-a AUTHOR] [-e AUTHOR_EMAIL] [-d] [-n] [-t] [-z] [-u]\n",
" [-c CUSTOM_TIME] [-v] [-p PACKAGES] [-m]\n",
"\n",
" \n",
"IPython magic function to print date/time stamps \n",
"and various system information.\n",
"\n",
"watermark version 1.0.2\n",
"\n",
"optional arguments:\n",
" -a AUTHOR, --author AUTHOR\n",
" prints author name\n",
" -e AUTHOR_EMAIL, --author_email AUTHOR_EMAIL\n",
" prints author name and link to email address\n",
" -d, --date prints current date\n",
" -n, --datename prints date with abbrv. day and month names\n",
" -t, --time prints current time\n",
@ -225,10 +231,9 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"28/06/2014 15:29:14\n",
"28/06/2014 16:16:36\n",
"\n",
"Python 3.4.1\n",
"Python implementationCPython\n",
"CPython 3.4.1\n",
"IPython 2.1.0\n",
"\n",
"compiler : GCC 4.2.1 (Apple Inc. build 5577)\n",
@ -263,7 +268,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"28/06/2014 14:08:09 \n"
"28/06/2014 16:16:36 \n"
]
}
],
@ -289,7 +294,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"Last updated: Sat Jun 08 2014 14:08:09 EDT\n"
"Last updated: Sat Jun 16 2014 16:16:37 EDT\n"
]
}
],
@ -315,7 +320,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"Python 3.4.1\n",
"CPython 3.4.1\n",
"IPython 2.1.0\n"
]
}
@ -374,7 +379,7 @@
"output_type": "stream",
"stream": "stdout",
"text": [
"Python 3.4.1\n",
"CPython 3.4.1\n",
"IPython 2.1.0\n",
"\n",
"numpy 1.8.1\n",
@ -391,6 +396,43 @@
}
],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<br>"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%watermark -a \"John Doe\" -d -v -m "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"John Doe 28/06/2014 \n",
"\n",
"CPython 3.4.1\n",
"IPython 2.1.0\n",
"\n",
"compiler : GCC 4.2.1 (Apple Inc. build 5577)\n",
"system : Darwin\n",
"release : 13.2.0\n",
"machine : x86_64\n",
"processor : i386\n",
"CPU cores : 2\n",
"interpreter: 64bit\n"
]
}
],
"prompt_number": 12
}
],
"metadata": {}

View File

@ -2,7 +2,7 @@
Sebastian Raschka 2014
watermark.py
version 1.0.1
version 1.0.2
IPython magic function to print date/time stamps and various system information.
@ -53,6 +53,7 @@ class WaterMark(Magics):
"""
@magic_arguments()
@argument('-a', '--author', type=str, help='prints author name')
@argument('-d', '--date', action='store_true', help='prints current date')
@argument('-n', '--datename', action='store_true', help='prints date with abbrv. day and month names')
@argument('-t', '--time', action='store_true', help='prints current time')
@ -68,7 +69,7 @@ class WaterMark(Magics):
IPython magic function to print date/time stamps
and various system information.
watermark version 1.0.1
watermark version 1.0.2
"""
self.out = ''
@ -80,6 +81,8 @@ class WaterMark(Magics):
self._get_sysinfo()
else:
if args.author:
self.out += '% s ' %args.author.strip('\'"')
if args.updated:
self.out += 'Last updated: '
if args.custom_time: