allpy
changeset 1049:3cc7ef543da5
allpy: do not print debugging messages, unless allpy.config.debug
Note: new config variable was introduced: allpy.config.debug.
By default, allpy.config.debug=False
This is draft commit, since this feature was not properly discussed
see 152
author | Boris Nagaev <bnagaev@gmail.com> |
---|---|
date | Sun, 25 Mar 2012 22:54:35 +0400 |
parents | 7477ef0120e1 |
children | 13d03f81b42f d3605c58a377 |
files | allpy/config.py allpy/graph.py allpy/structure.py |
diffstat | 3 files changed, 10 insertions(+), 3 deletions(-) [+] |
line diff
1.1 --- a/allpy/config.py Fri Mar 23 16:52:31 2012 +0400 1.2 +++ b/allpy/config.py Sun Mar 25 22:54:35 2012 +0400 1.3 @@ -1,3 +1,5 @@ 1.4 + 1.5 +debug = False 1.6 1.7 delta = 2.0 # for geometrical core building 1.8 minsize = 20 # min size of returning cores
2.1 --- a/allpy/graph.py Fri Mar 23 16:52:31 2012 +0400 2.2 +++ b/allpy/graph.py Sun Mar 25 22:54:35 2012 +0400 2.3 @@ -1,6 +1,8 @@ 2.4 from datetime import datetime, timedelta 2.5 from copy import copy 2.6 2.7 +import config 2.8 + 2.9 class TimeoutError(Exception): 2.10 pass 2.11 2.12 @@ -84,7 +86,8 @@ 2.13 """ 2.14 if timeout == 0: 2.15 raise TimeoutError() 2.16 - print 'Bron and Kerbosh algorithm started' 2.17 + if config.debug: 2.18 + print 'Bron and Kerbosh algorithm started' 2.19 cliques = [] 2.20 2.21 class ExtendCall(object): 2.22 @@ -180,7 +183,8 @@ 2.23 2.24 clique is frozenset 2.25 """ 2.26 - print 'Fast algorithm started' 2.27 + if config.debug: 2.28 + print 'Fast algorithm started' 2.29 cliques = [] 2.30 while True: 2.31 graph = self.copy()
3.1 --- a/allpy/structure.py Fri Mar 23 16:52:31 2012 +0400 3.2 +++ b/allpy/structure.py Sun Mar 25 22:54:35 2012 +0400 3.3 @@ -61,7 +61,8 @@ 3.4 def __call__(self, code): 3.5 code = code.lower() 3.6 url = self.pdb_url % code 3.7 - print "Download %s" % url 3.8 + if config.debug: 3.9 + print "Download %s" % url 3.10 return urllib2.urlopen(url) 3.11 download_pdb = DownloadPdb() 3.12