Mercurial > hg > martINI
annotate martini/utils.py @ 11:c77259f467a3
hopefully OrderedDict preservation actually works now
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 23 Aug 2016 18:17:11 -0700 |
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 |