parameters: (crate, git_conf)
docstring: Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
          keyword followed by name = "<crate>".
docstring_summary: Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
          keyword followed by name = "<crate>".
docstring_tokens: Tries to find <crate > in git_conf [ inst_dir ] by searching a [ package ] keyword followed by name = <crate > .
function: def _resolve_crate_to_path(crate, git_conf):
          """
          Tries to find <crate> in git_conf["inst_dir"] by searching a [package]
          keyword followed by name = "<crate>".
          """
          source_dir = git_conf["source_dir"]
          search_pattern = '[package]\nname = "{}"'.format(crate)
  
          for root, _, files in os.walk(source_dir):
              for fname in files:
                  if fname == "Cargo.toml":
                      with open(os.path.join(root, fname), "r") as f:
                          if search_pattern in f.read():
                              return root
  
          raise Exception("Failed to found crate {} in path {}".format(crate, source_dir))
function_tokens: def _resolve_crate_to_path ( crate , git_conf ) : source_dir = git_conf [ "source_dir" ] search_pattern = '[package]\nname = "{}"' . format ( crate ) for root , _ , files in os . walk ( source_dir ) : for fname in files : if fname == "Cargo.toml" : with open ( os . path . join ( root , fname ) , "r" ) as f : if search_pattern in f . read ( ) : return root raise Exception ( "Failed to found crate {} in path {}" . format ( crate , source_dir ) )