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

Function split_sources

scripts/splitSources.py:54–74  ·  view source on GitHub ↗
(filePath, suppress_output = False)

Source from the content-addressed store, hash-verified

52 return [srcName]
53
54def split_sources(filePath, suppress_output = False):
55 sys.excepthook = uncaught_exception_hook
56
57 try:
58 # decide if file has multiple sources
59 with open(filePath, mode='r', encoding='utf8', newline='') as f:
60 lines = f.read().splitlines()
61 if len(lines) >= 1 and lines[0][:12] == "==== Source:":
62 srcString = ""
63 for src in writeSourceToFile(lines):
64 srcString += src + ' '
65 if not suppress_output:
66 print(srcString)
67 return 0
68 return 1
69
70 except UnicodeDecodeError as ude:
71 print("UnicodeDecodeError in '" + filePath + "': " + str(ude))
72 print("This is expected for some tests containing invalid utf8 sequences. "
73 "Exception will be ignored.")
74 return 2
75
76
77if __name__ == '__main__':

Callers 3

splitSources.pyFile · 0.85

Calls 1

writeSourceToFileFunction · 0.85

Tested by 2