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": { "metadata": {
"name": "", "name": "",
"signature": "sha256:b293f22eb716f74ec27869a5122812437e0a7f4743ddfe8c06a94c39f31c7d3e" "signature": "sha256:0b017c7b1bd605534beb62287fd7916407f3782284c44ee02093a73e4a9896a8"
}, },
"nbformat": 3, "nbformat": 3,
"nbformat_minor": 0, "nbformat_minor": 0,
@ -173,14 +173,20 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"<pre>%watermark [-d] [-n] [-t] [-z] [-u] [-c CUSTOM_TIME] [-v] [-p PACKAGES]\n", "<pre>%watermark [-a AUTHOR] [-e AUTHOR_EMAIL] [-d] [-n] [-t] [-z] [-u]\n",
" [-m]\n", " [-c CUSTOM_TIME] [-v] [-p PACKAGES] [-m]\n",
"\n", "\n",
" \n", " \n",
"IPython magic function to print date/time stamps \n", "IPython magic function to print date/time stamps \n",
"and various system information.\n", "and various system information.\n",
"\n", "\n",
"watermark version 1.0.2\n",
"\n",
"optional arguments:\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", " -d, --date prints current date\n",
" -n, --datename prints date with abbrv. day and month names\n", " -n, --datename prints date with abbrv. day and month names\n",
" -t, --time prints current time\n", " -t, --time prints current time\n",
@ -225,10 +231,9 @@
"output_type": "stream", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "text": [
"28/06/2014 15:29:14\n", "28/06/2014 16:16:36\n",
"\n", "\n",
"Python 3.4.1\n", "CPython 3.4.1\n",
"Python implementationCPython\n",
"IPython 2.1.0\n", "IPython 2.1.0\n",
"\n", "\n",
"compiler : GCC 4.2.1 (Apple Inc. build 5577)\n", "compiler : GCC 4.2.1 (Apple Inc. build 5577)\n",
@ -263,7 +268,7 @@
"output_type": "stream", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "text": [
"28/06/2014 14:08:09 \n" "28/06/2014 16:16:36 \n"
] ]
} }
], ],
@ -289,7 +294,7 @@
"output_type": "stream", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "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", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "text": [
"Python 3.4.1\n", "CPython 3.4.1\n",
"IPython 2.1.0\n" "IPython 2.1.0\n"
] ]
} }
@ -374,7 +379,7 @@
"output_type": "stream", "output_type": "stream",
"stream": "stdout", "stream": "stdout",
"text": [ "text": [
"Python 3.4.1\n", "CPython 3.4.1\n",
"IPython 2.1.0\n", "IPython 2.1.0\n",
"\n", "\n",
"numpy 1.8.1\n", "numpy 1.8.1\n",
@ -391,6 +396,43 @@
} }
], ],
"prompt_number": 9 "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": {} "metadata": {}

View File

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