Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieucan committed May 28, 2024
1 parent c9deb50 commit c471c25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/dbt_score/dbt_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""dbt utilities."""

import contextlib
import logging
import os
from pathlib import Path
from typing import Iterator
from typing import Iterable, Iterator, cast

from dbt.cli.main import dbtRunner, dbtRunnerResult

Expand Down Expand Up @@ -41,7 +40,7 @@ def dbt_parse() -> dbtRunnerResult:
return result


def dbt_ls(select: list[str] | None) -> list[str]:
def dbt_ls(select: Iterable[str] | None) -> Iterable[str]:
"""Run dbt ls."""
cmd = ["ls", "--resource-type", "model", "--output", "name"]
if select:
Expand All @@ -53,7 +52,8 @@ def dbt_ls(select: list[str] | None) -> list[str]:
if not result.success:
raise DbtLsException("dbt ls failed") from result.exception

return result.result
selected = cast(Iterable[str], result.result) # mypy hint
return selected


def get_default_manifest_path() -> Path:
Expand Down
4 changes: 2 additions & 2 deletions src/dbt_score/lint.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Lint dbt models metadata."""

from pathlib import Path
from typing import Literal
from typing import Iterable, Literal

from dbt_score.config import Config
from dbt_score.evaluation import Evaluation
Expand All @@ -16,7 +16,7 @@ def lint_dbt_project(
manifest_path: Path,
config: Config,
format: Literal["plain", "manifest"],
select: list[str] | None = None,
select: Iterable[str] | None = None,
) -> None:
"""Lint dbt manifest."""
if not manifest_path.exists():
Expand Down
4 changes: 2 additions & 2 deletions src/dbt_score/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import defaultdict
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
from typing import Any, Iterable

from dbt_score.dbt_utils import dbt_ls

Expand Down Expand Up @@ -260,7 +260,7 @@ def _reindex_tests(self) -> None:
):
self.tests[attached_node].append(node_values)

def select_models(self, select: list[str]) -> None:
def select_models(self, select: Iterable[str]) -> None:
"""Filter models like dbt's --select."""
single_model_select = re.compile(r"[a-zA-Z0-9_]+")

Expand Down

0 comments on commit c471c25

Please sign in to comment.