Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5739472

Browse files
committed
author info added
1 parent 8ecab48 commit 5739472

File tree

2 files changed

+57
-12
lines changed

2 files changed

+57
-12
lines changed

ipython_magic/watermark.ipynb

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"name": "",
4-
"signature": "sha256:b293f22eb716f74ec27869a5122812437e0a7f4743ddfe8c06a94c39f31c7d3e"
4+
"signature": "sha256:0b017c7b1bd605534beb62287fd7916407f3782284c44ee02093a73e4a9896a8"
55
},
66
"nbformat": 3,
77
"nbformat_minor": 0,
@@ -173,14 +173,20 @@
173173
"cell_type": "markdown",
174174
"metadata": {},
175175
"source": [
176-
"<pre>%watermark [-d] [-n] [-t] [-z] [-u] [-c CUSTOM_TIME] [-v] [-p PACKAGES]\n",
177-
" [-m]\n",
176+
"<pre>%watermark [-a AUTHOR] [-e AUTHOR_EMAIL] [-d] [-n] [-t] [-z] [-u]\n",
177+
" [-c CUSTOM_TIME] [-v] [-p PACKAGES] [-m]\n",
178178
"\n",
179179
" \n",
180180
"IPython magic function to print date/time stamps \n",
181181
"and various system information.\n",
182182
"\n",
183+
"watermark version 1.0.2\n",
184+
"\n",
183185
"optional arguments:\n",
186+
" -a AUTHOR, --author AUTHOR\n",
187+
" prints author name\n",
188+
" -e AUTHOR_EMAIL, --author_email AUTHOR_EMAIL\n",
189+
" prints author name and link to email address\n",
184190
" -d, --date prints current date\n",
185191
" -n, --datename prints date with abbrv. day and month names\n",
186192
" -t, --time prints current time\n",
@@ -225,10 +231,9 @@
225231
"output_type": "stream",
226232
"stream": "stdout",
227233
"text": [
228-
"28/06/2014 15:29:14\n",
234+
"28/06/2014 16:16:36\n",
229235
"\n",
230-
"Python 3.4.1\n",
231-
"Python implementationCPython\n",
236+
"CPython 3.4.1\n",
232237
"IPython 2.1.0\n",
233238
"\n",
234239
"compiler : GCC 4.2.1 (Apple Inc. build 5577)\n",
@@ -263,7 +268,7 @@
263268
"output_type": "stream",
264269
"stream": "stdout",
265270
"text": [
266-
"28/06/2014 14:08:09 \n"
271+
"28/06/2014 16:16:36 \n"
267272
]
268273
}
269274
],
@@ -289,7 +294,7 @@
289294
"output_type": "stream",
290295
"stream": "stdout",
291296
"text": [
292-
"Last updated: Sat Jun 08 2014 14:08:09 EDT\n"
297+
"Last updated: Sat Jun 16 2014 16:16:37 EDT\n"
293298
]
294299
}
295300
],
@@ -315,7 +320,7 @@
315320
"output_type": "stream",
316321
"stream": "stdout",
317322
"text": [
318-
"Python 3.4.1\n",
323+
"CPython 3.4.1\n",
319324
"IPython 2.1.0\n"
320325
]
321326
}
@@ -374,7 +379,7 @@
374379
"output_type": "stream",
375380
"stream": "stdout",
376381
"text": [
377-
"Python 3.4.1\n",
382+
"CPython 3.4.1\n",
378383
"IPython 2.1.0\n",
379384
"\n",
380385
"numpy 1.8.1\n",
@@ -391,6 +396,43 @@
391396
}
392397
],
393398
"prompt_number": 9
399+
},
400+
{
401+
"cell_type": "markdown",
402+
"metadata": {},
403+
"source": [
404+
"<br>"
405+
]
406+
},
407+
{
408+
"cell_type": "code",
409+
"collapsed": false,
410+
"input": [
411+
"%watermark -a \"John Doe\" -d -v -m "
412+
],
413+
"language": "python",
414+
"metadata": {},
415+
"outputs": [
416+
{
417+
"output_type": "stream",
418+
"stream": "stdout",
419+
"text": [
420+
"John Doe 28/06/2014 \n",
421+
"\n",
422+
"CPython 3.4.1\n",
423+
"IPython 2.1.0\n",
424+
"\n",
425+
"compiler : GCC 4.2.1 (Apple Inc. build 5577)\n",
426+
"system : Darwin\n",
427+
"release : 13.2.0\n",
428+
"machine : x86_64\n",
429+
"processor : i386\n",
430+
"CPU cores : 2\n",
431+
"interpreter: 64bit\n"
432+
]
433+
}
434+
],
435+
"prompt_number": 12
394436
}
395437
],
396438
"metadata": {}

ipython_magic/watermark.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Sebastian Raschka 2014
33
44
watermark.py
5-
version 1.0.1
5+
version 1.0.2
66
77
88
IPython magic function to print date/time stamps and various system information.
@@ -53,6 +53,7 @@ class WaterMark(Magics):
5353
5454
"""
5555
@magic_arguments()
56+
@argument('-a', '--author', type=str, help='prints author name')
5657
@argument('-d', '--date', action='store_true', help='prints current date')
5758
@argument('-n', '--datename', action='store_true', help='prints date with abbrv. day and month names')
5859
@argument('-t', '--time', action='store_true', help='prints current time')
@@ -68,7 +69,7 @@ def watermark(self, line):
6869
IPython magic function to print date/time stamps
6970
and various system information.
7071
71-
watermark version 1.0.1
72+
watermark version 1.0.2
7273
7374
"""
7475
self.out = ''
@@ -80,6 +81,8 @@ def watermark(self, line):
8081
self._get_sysinfo()
8182

8283
else:
84+
if args.author:
85+
self.out += '% s ' %args.author.strip('\'"')
8386
if args.updated:
8487
self.out += 'Last updated: '
8588
if args.custom_time:

0 commit comments

Comments
 (0)