code: def _compile_all_contracts(self) -> Dict:
          
          ret = {}
          old_working_dir = Path.cwd()
          chdir(_BASE)
  
          def relativise(path):
              return path.relative_to(_BASE)
          import_dir_map = [
              '%s=%s' % (k, relativise(v))
              for k, v in self.contracts_source_dirs.items()
          ]
          import_dir_map.insert(0, '.=.')  # allow solc to compile contracts in all subdirs
          try:
              for contracts_dir in self.contracts_source_dirs.values():
                  res = compile_files(
                      [str(relativise(file)) for file in contracts_dir.glob('*.sol')],
                      output_values=PRECOMPILED_DATA_FIELDS + ['ast'],
                      import_remappings=import_dir_map,
                      optimize=False,
                  )
  
                  # Strip `ast` part from result
                  # TODO: Remove after https://github.com/ethereum/py-solc/issues/56 is fixed
                  res = {
                      contract_name: {
                          content_key: content_value
                          for content_key, content_value in contract_content.items()
                          if content_key != 'ast'
                      } for contract_name, contract_content in res.items()
                  }
                  ret.update(_fix_contract_key_names(res))
          except FileNotFoundError as ex:
              raise ContractSourceManagerCompilationError(
                  'Could not compile the contract. Check that solc is available.',
              ) from ex
          finally:
              chdir(old_working_dir)
          return ret
docs: Compile solidity contracts into ABI and BIN. This requires solc somewhere in the $PATH
          and also the :ref:`ethereum.tools` python library.  The return value is a dict that
          should be written into contracts.json.