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

Function load_source

scripts/bytecodecompare/prepare_report.py:141–150  ·  view source on GitHub ↗
(path: Union[Path, str], smt_use: SMTUse)

Source from the content-addressed store, hash-verified

139
140
141def load_source(path: Union[Path, str], smt_use: SMTUse) -> str:
142 # NOTE: newline='' disables newline conversion.
143 # We want the file exactly as is because changing even a single byte in the source affects metadata.
144 with open(path, mode='r', encoding='utf8', newline='') as source_file:
145 file_content = source_file.read()
146
147 if smt_use == SMTUse.STRIP_PRAGMAS:
148 return file_content.replace('pragma experimental SMTChecker;', '', 1)
149
150 return file_content
151
152
153def clean_string(value: Optional[str]) -> Optional[str]:

Calls 1

replaceMethod · 0.80