def _iter_matching_models(model_ref, cwd_guildfile): for model in modellib.iter_models(): if model_ref is None: if cwd_guildfile and _is_default_cwd_model(model, cwd_guildfile): yield model break else: if _match_model_ref(model_ref, model): yield model
def main(args): cmd_impl_support.init_model_path(args) formatted = [_format_model(m) for m in model.iter_models()] filtered = [m for m in formatted if _filter_model(m, args)] cli.table( sorted(filtered, key=lambda m: m["fullname"]), cols=["fullname", "description"], detail=(["source", "operations", "details"] if args.verbose else []) )
def _iter_matching_models(model_ref, cwd_guildfile): for model in modellib.iter_models(): if not model_ref: if cwd_guildfile and _is_default_cwd_model(model, cwd_guildfile): yield model break if not model.name: yield model else: if _match_model_ref(model_ref, model): yield model
def _matching_packages(ref): from guild import model as modellib matches = {} for model in modellib.iter_models(): if model.reference.dist_type != "package": continue name = model.reference.dist_name gf = model.modeldef.guildfile # If exact match, return one if ref == name: return [(name, gf)] # otherwise check for match in full name of model elif ref in model.fullname: matches[name] = gf return sorted(matches.items())
def iter_models(dirs=None, include_anonymous=False): dirs = dirs or [] abs_dirs = [os.path.abspath(d) for d in dirs] for m in model.iter_models(): if (m.modeldef.name or include_anonymous) and _match_dirs(m, abs_dirs): yield m