Skip to content

Commit aed1178

Browse files
committed
refactor(athena): make _is_positive_int a module-level function
1 parent 90e494f commit aed1178

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

dbt-athena/src/dbt/adapters/athena/connections.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
from dbt.adapters.sql import SQLConnectionManager
4646

4747

48+
def _is_positive_int(value: Any) -> bool:
49+
try:
50+
return int(value) >= 1
51+
except (TypeError, ValueError):
52+
return False
53+
54+
4855
@dataclass
4956
class AthenaAdapterResponse(AdapterResponse):
5057
data_scanned_in_bytes: Optional[int] = None
@@ -88,20 +95,13 @@ def __post_init__(self) -> None:
8895
raw = getattr(self, field_name)
8996
if raw is None:
9097
continue
91-
if not self._is_positive_int(raw):
98+
if not _is_positive_int(raw):
9299
raise DbtRuntimeError(
93100
f"{field_name} must be a positive integer (got {raw!r}). "
94101
"Omit the field to use the default."
95102
)
96103
setattr(self, field_name, int(raw))
97104

98-
@staticmethod
99-
def _is_positive_int(value: Any) -> bool:
100-
try:
101-
return int(value) >= 1
102-
except (TypeError, ValueError):
103-
return False
104-
105105
@property
106106
def type(self) -> str:
107107
return "athena"

0 commit comments

Comments
 (0)