1010REPORT_HEADER_REGEX = re .compile (r'''
1111 ^[|\s]+ Solc[ ]version:\s*(?P<solc_version>[\w\d.]+)
1212 [|\s]+ Optimizer[ ]enabled:\s*(?P<optimize>[\w]+)
13- [|\s]+ Runs:\s*(?P<runs>[\d]+)
14- [|\s]+ Block[ ]limit:\s*(?P<block_limit>[\d]+)\s*gas
13+ [|\s]+ Runs:\s*(?P<runs>[\d, ]+)
14+ [|\s]+ Block[ ]limit:\s*(?P<block_limit>[\d, ]+)\s*gas
1515 [|\s]+$
1616''' , re .VERBOSE )
1717METHOD_HEADER_REGEX = re .compile (r'^[|\s]+Methods[|\s]+$' )
@@ -122,10 +122,11 @@ def parse_bool(input_string: str) -> bool:
122122
123123
124124def parse_optional_int (input_string : str , default : Optional [int ] = None ) -> Optional [int ]:
125- if input_string .strip () == '-' :
125+ stripped = input_string .strip ().replace (',' , '' )
126+ if stripped == '-' :
126127 return default
127128
128- return int (input_string )
129+ return int (stripped )
129130
130131
131132def parse_report_header (line : str ) -> Optional [dict ]:
@@ -136,8 +137,8 @@ def parse_report_header(line: str) -> Optional[dict]:
136137 return {
137138 'solc_version' : match .group ('solc_version' ),
138139 'optimize' : parse_bool (match .group ('optimize' )),
139- 'runs' : int (match .group ('runs' )),
140- 'block_limit' : int (match .group ('block_limit' )),
140+ 'runs' : int (match .group ('runs' ). replace ( ',' , '' ) ),
141+ 'block_limit' : int (match .group ('block_limit' ). replace ( ',' , '' ) ),
141142 }
142143
143144
@@ -147,7 +148,7 @@ def parse_method_row(line: str, line_number: int) -> Optional[Tuple[str, str, Me
147148 raise ReportParsingError ("Expected a table row with method details." , line , line_number )
148149
149150 avg_gas = parse_optional_int (match ['avg' ])
150- call_count = int (match ['call_count' ])
151+ call_count = int (match ['call_count' ]. strip (). replace ( ',' , '' ) )
151152
152153 if avg_gas is None and call_count == 0 :
153154 # No calls, no gas values. Uninteresting. Skip the row.
@@ -174,7 +175,7 @@ def parse_deployment_row(line: str, line_number: int) -> Tuple[str, int, int, in
174175 match ['contract' ].strip (),
175176 parse_optional_int (match ['min' ].strip ()),
176177 parse_optional_int (match ['max' ].strip ()),
177- int (match ['avg' ].strip ()),
178+ int (match ['avg' ].strip (). replace ( ',' , '' ) ),
178179 )
179180
180181
0 commit comments