Skip to content

Commit

Permalink
run linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Apr 19, 2024
1 parent 03f71b7 commit 9c8c917
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
args: [--unsafe]
Expand Down Expand Up @@ -35,10 +35,10 @@ repos:
exclude: tests/
args:
- --max-line-length=99
- select=E,F,W
- ignore=E203,E501,E741,W503,W504
- per-file-ignores=*/__init__.py:F401
additional_dependencies: [flaky]
- --select=E,F,W
- --ignore=E203,E501,E741,W503,W504
- --per-file-ignores=*/__init__.py:F401
additional_dependencies: [flaky]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
Expand Down
12 changes: 6 additions & 6 deletions dbt/adapters/redshift/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class UserSSLMode(StrEnum):
@classmethod
def default(cls) -> "UserSSLMode":
# default for `psycopg2`, which aligns with dbt-redshift 1.4 and provides backwards compatibility
return cls.prefer
return cls("prefer")


class RedshiftSSLMode(StrEnum):
Expand All @@ -60,11 +60,11 @@ class RedshiftSSLMode(StrEnum):

SSL_MODE_TRANSLATION = {
UserSSLMode.disable: None,
UserSSLMode.allow: RedshiftSSLMode.verify_ca,
UserSSLMode.prefer: RedshiftSSLMode.verify_ca,
UserSSLMode.require: RedshiftSSLMode.verify_ca,
UserSSLMode.verify_ca: RedshiftSSLMode.verify_ca,
UserSSLMode.verify_full: RedshiftSSLMode.verify_full,
UserSSLMode.allow: RedshiftSSLMode("verify_ca"),
UserSSLMode.prefer: RedshiftSSLMode("verify_ca"),
UserSSLMode.require: RedshiftSSLMode("verify_ca"),
UserSSLMode.verify_ca: RedshiftSSLMode("verify_ca"),
UserSSLMode.verify_full: RedshiftSSLMode("verify_full"),
}


Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/redshift/relation_configs/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RedshiftDistStyle(StrEnum):

@classmethod
def default(cls) -> "RedshiftDistStyle":
return cls.auto
return cls("auto")


@dataclass(frozen=True, eq=True, unsafe_hash=True)
Expand Down Expand Up @@ -103,7 +103,7 @@ def parse_relation_config(cls, relation_config: RelationConfig) -> dict:
config = {"diststyle": diststyle}

else:
config = {"diststyle": RedshiftDistStyle.key.value, "distkey": dist}
config = {"diststyle": RedshiftDistStyle.key.value, "distkey": dist} # type: ignore

return config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class RedshiftMaterializedViewConfig(RedshiftRelationConfigBase, RelationConfigV
database_name: str
query: str
backup: bool = field(default=True, compare=False, hash=False)
dist: RedshiftDistConfig = RedshiftDistConfig(diststyle=RedshiftDistStyle.even)
dist: RedshiftDistConfig = RedshiftDistConfig(diststyle=RedshiftDistStyle("even"))
sort: RedshiftSortConfig = RedshiftSortConfig()
autorefresh: bool = False

Expand Down
4 changes: 2 additions & 2 deletions dbt/adapters/redshift/relation_configs/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class RedshiftSortStyle(StrEnum):

@classmethod
def default(cls) -> "RedshiftSortStyle":
return cls.auto
return cls("auto")

@classmethod
def default_with_columns(cls) -> "RedshiftSortStyle":
return cls.compound
return cls("compound")


@dataclass(frozen=True, eq=True, unsafe_hash=True)
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/relation_configs/test_materialized_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def test_redshift_materialized_view_config_handles_all_valid_bools(bool_value):
query="select * from sometable",
)
model_node = Mock()
model_node.config.extra.get = (
lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue"
model_node.config.extra.get = lambda x, y=None: (
bool_value if x in ["auto_refresh", "backup"] else "someDistValue"
)
config_dict = config.parse_relation_config(model_node)
assert isinstance(config_dict["autorefresh"], bool)
Expand All @@ -33,8 +33,8 @@ def test_redshift_materialized_view_config_throws_expected_exception_with_invali
query="select * from sometable",
)
model_node = Mock()
model_node.config.extra.get = (
lambda x, y=None: bool_value if x in ["auto_refresh", "backup"] else "someDistValue"
model_node.config.extra.get = lambda x, y=None: (
bool_value if x in ["auto_refresh", "backup"] else "someDistValue"
)
with pytest.raises(TypeError):
config.parse_relation_config(model_node)
Expand All @@ -48,8 +48,8 @@ def test_redshift_materialized_view_config_throws_expected_exception_with_invali
query="select * from sometable",
)
model_node = Mock()
model_node.config.extra.get = (
lambda x, y=None: "notABool" if x in ["auto_refresh", "backup"] else "someDistValue"
model_node.config.extra.get = lambda x, y=None: (
"notABool" if x in ["auto_refresh", "backup"] else "someDistValue"
)
with pytest.raises(ValueError):
config.parse_relation_config(model_node)
1 change: 1 addition & 0 deletions tests/unit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Note that all imports should be inside the functions to avoid import/mocking
issues.
"""

import string
import os
from unittest import mock
Expand Down

0 comments on commit 9c8c917

Please sign in to comment.