Mercurial > hg > martINI
annotate martini/utils.py @ 14:904bb82c3308
py35
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 20 Feb 2017 14:46:42 -0800 |
parents | 3c3522ce6e3a |
children |
rev | line source |
---|---|
0
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
1 def getlist(string, separator=','): |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
2 if not string: |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
3 return [] |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
4 _list = [ i.strip() for i in string.split(',') ] |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
5 if not _list: |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
6 return _list |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
7 if not _list[-1]: |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
8 return _list[:-1] |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
9 return _list |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
10 |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
11 def getbool(string): |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
12 return string.strip().lower() == 'true' |
3c3522ce6e3a
initial import of martINI from https://svn.openplans.org/svn/standalone/martINI/
k0s <k0scist@gmail.com>
parents:
diff
changeset
|
13 |