Python 测线仪仅显示少量测线

Python 测线仪仅显示少量测线,python,profiler,line-profiler,Python,Profiler,Line Profiler,在使用联机分析器之后,我可以很好地分析代码,但是当我使用python-m line\u profiler script\u to_profile.py.lprof查看输出时,我只看到27行代码。我希望看到大约250个,因为这是我添加了@profile装饰器的函数的长度。我的输出如下所示: Timer unit: 1e-06 s Total time: 831.023 s File: /Users/will/Repos/Beyond12/src/student_table.py Function

在使用联机分析器之后,我可以很好地分析代码,但是当我使用
python-m line\u profiler script\u to_profile.py.lprof
查看输出时,我只看到27行代码。我希望看到大约250个,因为这是我添加了
@profile
装饰器的函数的长度。我的输出如下所示:

Timer unit: 1e-06 s

Total time: 831.023 s
File: /Users/will/Repos/Beyond12/src/student_table.py
Function: aggregate_student_data at line 191

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
   191                                               # load files
   192                                               files = os.listdir(datadir)
   193
   194                                               tabs = ['Contact', 'Costs_Contributions', 'Course', 'EducationalHistory', 'Events', 'FinancialAidScholarship',
   195         1          764    764.0      0.0              'PreCollegiateExam', 'QualitativeInformation', 'Student_Performance', 'Task', 'Term']
   196                                               special_contact_id = {'Contact': 'Id',
   197         1            7      7.0      0.0                            'Events': 'WhoId',
   198         1            6      6.0      0.0                            'QualitativeInformation': 'Alumni',
   199         1            6      6.0      0.0                            'Student_Performance': 'Contact',
   200         1            6      6.0      0.0                            'PreCollegiateExam': 'Contact ID'}
   201         1            6      6.0      0.0
   202         1            5      5.0      0.0      # todo: make dictionary of the columns that we'll be using, along with their types?
   203
   204                                               df = {}
   205                                               for tab in tabs:
   206         1            6      6.0      0.0          # match tab titles to files by matching first 5 non-underscore characters
   207        12          115      9.6      0.0          filename = filter(lambda x: tab.replace('_', '')[:5] in x.replace('_', '')[:5], files)[0]

它在for循环的中间被切断。

您可能在创建配置文件结果文件后修改了源文件,尝试重新运行。 由于打印的源代码行_分析器是从磁盘上的文件读取的,请参阅:


它似乎接收了一些其他代码。通常-循环的
执行n+1次。你能试着打个电话吗?这将使您更容易获得帮助。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会无效。@DonaldDuck感谢您的建议,但在这种情况下很难提取出相关的代码片段。@adler会回答您的问题吗?