@staticmethod<EOL><INDENT>def _compile(source_code, contract_name, libraries=None, solc_bin=None, solc_remaps=[], working_dir=None):<DEDENT>
if isinstance(source_code, str):<EOL><INDENT>with tempfile.NamedTemporaryFile('<STR_LIT>') as temp:<EOL><INDENT>temp.write(source_code)<EOL>temp.flush()<EOL>output, warnings = ManticoreEVM._run_solc(temp, solc_bin, solc_remaps, working_dir=working_dir)<EOL><DEDENT><DEDENT>elif isinstance(source_code, io.IOBase):<EOL><INDENT>output, warnings = ManticoreEVM._run_solc(source_code, solc_bin, solc_remaps, working_dir=working_dir)<EOL>source_code.seek(<NUM_LIT:0>)<EOL>source_code = source_code.read()<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(f'<STR_LIT>')<EOL><DEDENT>contracts = output.get('<STR_LIT>', [])<EOL>if len(contracts) != <NUM_LIT:1> and contract_name is None:<EOL><INDENT>raise EthereumError(f'<STR_LIT>')<EOL><DEDENT>name, contract = None, None<EOL>if contract_name is None:<EOL><INDENT>name, contract = list(contracts.items())[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>for n, c in contracts.items():<EOL><INDENT>if n == contract_name or n.split("<STR_LIT::>")[<NUM_LIT:1>] == contract_name:<EOL><INDENT>name, contract = n, c<EOL>break<EOL><DEDENT><DEDENT><DEDENT>if name is None:<EOL><INDENT>raise ValueError(f'<STR_LIT>')<EOL><DEDENT>name = name.split('<STR_LIT::>')[<NUM_LIT:1>]<EOL>if contract['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>raise EthereumError('<STR_LIT>')<EOL><DEDENT>bytecode = ManticoreEVM._link(contract['<STR_LIT>'], libraries)<EOL>srcmap = contract['<STR_LIT>'].split('<STR_LIT:;>')<EOL>srcmap_runtime = contract['<STR_LIT>'].split('<STR_LIT:;>')<EOL>hashes = {str(x): str(y) for x, y in contract['<STR_LIT>'].items()}<EOL>abi = json.loads(contract['<STR_LIT>'])<EOL>runtime = ManticoreEVM._link(contract['<STR_LIT>'], libraries)<EOL>return name, source_code, bytecode, runtime, srcmap, srcmap_runtime, hashes, abi, warnings<EOL>
Compile a Solidity contract, used internally

            :param source_code: solidity source as either a string or a file handle
            :param contract_name: a string with the name of the contract to analyze
            :param libraries: an itemizable of pairs (library_name, address)
            :param solc_bin: path to solc binary
            :param solc_remaps: solc import remaps
            :param working_dir: working directory for solc compilation (defaults to current)
            :return: name, source_code, bytecode, srcmap, srcmap_runtime, hashes
            :return: name, source_code, bytecode, runtime, srcmap, srcmap_runtime, hashes, abi, warnings