annotate python/find_str_format.py @ 726:541560ed190f

foo
author Jeff Hammel <k0scist@gmail.com>
date Tue, 02 Dec 2014 13:57:02 -0800
parents
children 03b66f90916f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
726
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 """
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 find str format options
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6 """
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 import argparse
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 import os
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 import subprocess
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 import sys
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13 __all__ = ['main']
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 def find_keys(string):
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 retval = set()
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 while True:
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 try:
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 string.format(**{i:'' for i in retval})
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20 return retval
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21 except KeyError:
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
22 import pdb; pdb.set_trace()
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
23
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
24 def main(args=sys.argv[1:]):
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
25
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
26 # parse command line
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
27 string = ' '.join(args)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
28
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
29 if __name__ == '__main__':
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
30 main()