1111from __future__ import print_function
1212
1313import copy
14+ import inspect
1415import os
1516import os .path as op
1617from collections import namedtuple
2021##==============================================================#
2122
2223#: Library version string.
23- __version__ = "0.3.0 "
24+ __version__ = "0.3.1 "
2425
2526#: Contains information for a single checked item.
2627VerInfo = namedtuple ("VerInfo" , "path linenum string" )
@@ -47,6 +48,7 @@ def __init__(self, name, root):
4748 self ._vinfos = []
4849 self ._string = None
4950 self ._checks = []
51+ self .debug = False
5052 def string (self ):
5153 """Returns the string if `run()` found no inconsistencies,
5254 otherwise None is returned. Always calls `run()`."""
@@ -73,16 +75,19 @@ def include(self, path, func=None, opts=None, updatable=True, **kwargs):
7375 def iter_vinfo (self , get_updatable = False ):
7476 """Iterates over the associated VerInfo objects. Optionally returns if
7577 the associated file is updatable."""
78+ dprint = get_vprint (self .debug )
7679 for c in self ._checks :
7780 path = c .path
7881 if not op .isabs (path ):
7982 path = op .join (self .root , path )
8083 path = op .normpath (path )
8184 vinfos = c .func (path , ** c .opts )
85+ dprint ((inspect .stack ()[0 ][3 ], c , vinfos ))
8286 if list != type (vinfos ):
8387 vinfos = [vinfos ]
8488 for vi in vinfos :
85- yield (vi , c .updatable ) if get_updatable else vi
89+ if vi :
90+ yield (vi , c .updatable ) if get_updatable else vi
8691 def run (self , verbose = True ):
8792 """Runs checks on all included items, reports any inconsistencies.
8893 Returns string if consistent else None."""
0 commit comments