parameters: (cargo_toml_file, dep_to_git)
return_statement: return deps_to_crates
docstring: This functions reads content of provided cargo toml file and extracts
          crate names per each dependency. The extraction is done by a heuristic
          so it might be incorrect.
docstring_summary: This functions reads content of provided cargo toml file and extracts
          crate names per each dependency. The extraction is done by a heuristic
          so it might be incorrect.
docstring_tokens: This functions reads content of provided cargo toml file and extracts crate names per each dependency . The extraction is done by a heuristic so it might be incorrect .
function: def _extract_crates(cargo_toml_file, dep_to_git):
          """
          This functions reads content of provided cargo toml file and extracts
          crate names per each dependency. The extraction is done by a heuristic
          so it might be incorrect.
          """
          deps_to_crates = {}
          with open(cargo_toml_file, "r") as f:
              for line in f.readlines():
                  if line.startswith("#") or "git = " not in line:
                      continue  # filter out commented lines and ones without git deps
                  for name, conf in dep_to_git.items():
                      if 'git = "{}"'.format(conf["repo_url"]) in line:
                          pkg_template = ' package = "'
                          if pkg_template in line:
                              crate_name, _, _ = line.partition(pkg_template)[
                                  2
                              ].partition('"')
                          else:
                              crate_name, _, _ = line.partition("=")
                          deps_to_crates.setdefault(name, set()).add(crate_name.strip())
          return deps_to_crates
function_tokens: def _extract_crates ( cargo_toml_file , dep_to_git ) : deps_to_crates = { } with open ( cargo_toml_file , "r" ) as f : for line in f . readlines ( ) : if line . startswith ( "#" ) or "git = " not in line : continue # filter out commented lines and ones without git deps for name , conf in dep_to_git . items ( ) : if 'git = "{}"' . format ( conf [ "repo_url" ] ) in line : pkg_template = ' package = "' if pkg_template in line : crate_name , _ , _ = line . partition ( pkg_template ) [ 2 ] . partition ( '"' ) else : crate_name , _ , _ = line . partition ( "=" ) deps_to_crates . setdefault ( name , set ( ) ) . add ( crate_name . strip ( ) ) return deps_to_crates