Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2@file 

3@brief Starts an app locally to test it. 

4""" 

5from ..helpers import enumerate_inspect_source_code 

6 

7 

8def inspect_source_code(folder, file_pattern=".*[.]((py)|(ipynb))$", 

9 line_patterns="from sklearn[_0-9a-zA-Z.]* import ([_a-zA-Z0-9]+);;import sklearn[.]([_a-z]+)", 

10 neg_pattern=".*(([-]checkpoint)|(_todo)|(_temp)).*", 

11 fullname=False, fLOG=print): 

12 """ 

13 Counts groups extracted from source file. We assume all selected files 

14 can be opened as text files encoded in :epkg:`utf-8` character set. 

15 Prints the results on the standard output. First line is a header. 

16 

17 :param folder: folder to dig into 

18 :param file_pattern: files to consider 

19 :param neg_pattern: negative patterns for filenames 

20 :param line_patterns: patterns to look into, separated by ``;;`` 

21 :param fullname: if True, include the subfolder while checking the regex 

22 :param fLOG: logging function 

23 :return: list of dictionaries 

24 """ 

25 cols = None 

26 for obs in enumerate_inspect_source_code(folder, file_pattern=file_pattern, 

27 neg_pattern=neg_pattern, 

28 line_patterns=line_patterns, 

29 fullname=fullname): 

30 if cols is None: 

31 cols = list(sorted(obs)) 

32 fLOG(",".join(cols)) 

33 values = [str(obs[k]) for k in cols] 

34 fLOG(",".join(values))