##// END OF EJS Templates
Clean up some dosctrings, remove unused function
Fernando Perez -
Show More
@@ -476,11 +476,12 b' class SystemExec:'
476 - bq: alias to getoutput
476 - bq: alias to getoutput
477
477
478 An instance can then be created as:
478 An instance can then be created as:
479 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
479 >>> sysexec = SystemExec(verbose=1,debug=0,header='Calling: ')
480
480
481 And used as:
481 And used as:
482 >>> sysexec.xsys('pwd')
482 >>> sysexec.xsys('echo "Hello Python"')
483 >>> dirlist = sysexec.bq('ls -l')
483 Calling: echo "Hello Python"
484 Hello Python
484 """
485 """
485
486
486 def __init__(self,verbose=0,debug=0,header='',split=0):
487 def __init__(self,verbose=0,debug=0,header='',split=0):
@@ -684,7 +685,6 b' def optstr2types(ostr):'
684
685
685 #----------------------------------------------------------------------------
686 #----------------------------------------------------------------------------
686 def read_dict(filename,type_conv=None,**opt):
687 def read_dict(filename,type_conv=None,**opt):
687
688 """Read a dictionary of key=value pairs from an input file, optionally
688 """Read a dictionary of key=value pairs from an input file, optionally
689 performing conversions on the resulting values.
689 performing conversions on the resulting values.
690
690
@@ -1306,9 +1306,12 b' class EvalDict:'
1306 Emulate a dict which evaluates its contents in the caller's frame.
1306 Emulate a dict which evaluates its contents in the caller's frame.
1307
1307
1308 Usage:
1308 Usage:
1309 >>>number = 19
1309 >>> number = 19
1310 >>>text = "python"
1310
1311 >>>print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1311 >>> text = "python"
1312
1313 >>> print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
1314 Python 2.1 rules!
1312 """
1315 """
1313
1316
1314 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
1317 # This version is due to sismex01@hebmex.com on c.l.py, and is basically a
@@ -1328,15 +1331,20 b' def qw(words,flat=0,sep=None,maxsplit=-1):'
1328 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1331 qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
1329
1332
1330 words can also be a list itself, and with flat=1, the output will be
1333 words can also be a list itself, and with flat=1, the output will be
1331 recursively flattened. Examples:
1334 recursively flattened.
1335
1336 Examples:
1332
1337
1333 >>> qw('1 2')
1338 >>> qw('1 2')
1334 ['1', '2']
1339 ['1', '2']
1340
1335 >>> qw(['a b','1 2',['m n','p q']])
1341 >>> qw(['a b','1 2',['m n','p q']])
1336 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1342 [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
1337 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1338 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """
1339
1343
1344 >>> qw(['a b','1 2',['m n','p q']],flat=1)
1345 ['a', 'b', '1', '2', 'm', 'n', 'p', 'q']
1346 """
1347
1340 if type(words) in StringTypes:
1348 if type(words) in StringTypes:
1341 return [word.strip() for word in words.split(sep,maxsplit)
1349 return [word.strip() for word in words.split(sep,maxsplit)
1342 if word and not word.isspace() ]
1350 if word and not word.isspace() ]
@@ -1804,20 +1812,6 b' def sort_compare(lst1,lst2,inplace = 1):'
1804 return lst1 == lst2
1812 return lst1 == lst2
1805
1813
1806 #----------------------------------------------------------------------------
1814 #----------------------------------------------------------------------------
1807 def mkdict(**kwargs):
1808 """Return a dict from a keyword list.
1809
1810 It's just syntactic sugar for making ditcionary creation more convenient:
1811 # the standard way
1812 >>>data = { 'red' : 1, 'green' : 2, 'blue' : 3 }
1813 # a cleaner way
1814 >>>data = dict(red=1, green=2, blue=3)
1815
1816 If you need more than this, look at the Struct() class."""
1817
1818 return kwargs
1819
1820 #----------------------------------------------------------------------------
1821 def list2dict(lst):
1815 def list2dict(lst):
1822 """Takes a list of (key,value) pairs and turns it into a dict."""
1816 """Takes a list of (key,value) pairs and turns it into a dict."""
1823
1817
General Comments 0
You need to be logged in to leave comments. Login now