Skip to content

Commit

Permalink
chore: updates include_models/exclude_models to model_names
Browse files Browse the repository at this point in the history
Using the term include_models/exclude_models could leave confusion about what
is being filtered in this instance (model vs model instance). Updating
to model_names to be more precise.

Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Jan 12, 2024
1 parent a4a72c1 commit 45d6302
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions tests/trestlebot/entrypoints/test_sync_upstreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def test_sync_upstreams(
clean(source, None)


def test_with_include_models(
def test_with_include_model_names(
tmp_repo: Tuple[str, Repo], valid_args_dict: Dict[str, str]
) -> None:
"""Test sync upstreams with include models flag."""
"""Test sync upstreams with include model names flag."""
repo_path, repo = tmp_repo
repo.create_remote("origin", url=test_repo_url)

args_dict = valid_args_dict
args_dict["include-models"] = test_cat
args_dict["include-model-names"] = test_cat
args_dict["working-dir"] = repo_path

source: str = prepare_upstream_repo()
Expand All @@ -108,15 +108,15 @@ def test_with_include_models(
clean(source, None)


def test_with_exclude_models(
def test_with_exclude_model_names(
tmp_repo: Tuple[str, Repo], valid_args_dict: Dict[str, str]
) -> None:
"""Test sync upstreams with exclude models flag."""
"""Test sync upstreams with exclude model names flag."""
repo_path, repo = tmp_repo
repo.create_remote("origin", url=test_repo_url)

args_dict = valid_args_dict
args_dict["exclude-models"] = test_prof
args_dict["exclude-model-names"] = test_prof
args_dict["working-dir"] = repo_path

source: str = prepare_upstream_repo()
Expand Down
18 changes: 9 additions & 9 deletions trestlebot/entrypoints/sync_upstreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ def setup_sync_upstreams_arguments(self) -> None:
of the form <repo_url>@<ref> where ref is a git ref such as a tag or branch.",
)
self.parser.add_argument(
"--include-models",
"--include-model-names",
type=str,
required=False,
help="Comma-separated list of glob patterns for models by name to include when running \
help="Comma-separated list of glob patterns for model names to include when running \
tasks (e.g. --include-models=component_x,profile_y*)",
)
self.parser.add_argument(
"--exclude-models",
"--exclude-model-names",
type=str,
required=False,
help="Comma-separated list of glob patterns for models by name to exclude when running \
help="Comma-separated list of glob patterns for model names to exclude when running \
tasks (e.g. --exclude-models=component_x,profile_y*)",
)
self.parser.add_argument(
Expand All @@ -88,13 +88,13 @@ def run(self, args: argparse.Namespace) -> None:
"--sources", "Must set at least one source to sync from."
)

# Assume that if exclude_models is not set, then
# skip nothing and if include_models is not set, then include all.
# Assume that if exclude_model_names is not set, then
# skip nothing and if include_model_names is not set, then include all.
include_model_list: List[str] = ["*"]
if args.include_models:
include_model_list = comma_sep_to_list(args.include_models)
if args.include_model_names:
include_model_list = comma_sep_to_list(args.include_model_names)
model_filter: ModelFilter = ModelFilter(
skip_patterns=comma_sep_to_list(args.exclude_models),
skip_patterns=comma_sep_to_list(args.exclude_model_names),
include_patterns=include_model_list,
)

Expand Down

0 comments on commit 45d6302

Please sign in to comment.