MCPcopy Create free account
hub / github.com/argotorg/solidity / format_percent

Function format_percent

scripts/gas_diff_stats.py:122–131  ·  view source on GitHub ↗
(percentage)

Source from the content-addressed store, hash-verified

120 return result if result is not None else 0
121
122 def format_percent(percentage):
123 if percentage is None:
124 return ''
125 prefix = (
126 # Distinguish actual zero from very small differences
127 '+' if round(percentage) == 0 and percentage > 0 else
128 '-' if round(percentage) == 0 and percentage < 0 else
129 ''
130 )
131 return f'{prefix}{round(percentage)}%'
132
133 def stat(old, new):
134 return format_percent(percent(old, new))

Callers 1

statFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected