Return a `dict` of repo name to repo absolute path and repo type Parameters: skip_validation (bool): Returns repos in config even if their path do not exists.
(skip_validation: bool = False)
| 40 | |
| 41 | @lru_cache() |
| 42 | def get_repos(skip_validation: bool = False) -> Dict[str, Dict[str, str]]: |
| 43 | """ |
| 44 | Return a `dict` of repo name to repo absolute path and repo type |
| 45 | |
| 46 | Parameters: |
| 47 | skip_validation (bool): Returns repos in config even if their path do not exists. |
| 48 | """ |
| 49 | path_file = common.get_config_fname("repos.csv") |
| 50 | repos = {} |
| 51 | if os.path.isfile(path_file) and os.stat(path_file).st_size > 0: |
| 52 | with open(path_file) as f: |
| 53 | rows = csv.DictReader( |
| 54 | f, ["path", "name", "type", "flags"], restval="" |
| 55 | ) # it's actually a reader |
| 56 | for r in rows: |
| 57 | if skip_validation or is_git(r["path"], include_bare=True): |
| 58 | repos[r["name"]] = { |
| 59 | "path": r["path"], |
| 60 | "type": r["type"], |
| 61 | "flags": r["flags"].split(), |
| 62 | } |
| 63 | return repos |
| 64 | |
| 65 | |
| 66 | @lru_cache() |
no test coverage detected