Skip to content

Commit 66b9362

Browse files
committed
style: Fix flake8 errors in database module and tests
- Remove whitespace from blank lines (W293) - Fix trailing whitespace (W291) - Add proper newline at end of file (W292) - Fix import order with noqa comment (E402) - Remove unused variable assignment - Maintain proper spacing in function definitions All timestamp parsing tests still pass after formatting fixes. Clean flake8 output for database.py and test_database.py.
1 parent 6b4638d commit 66b9362

File tree

2 files changed

+87
-86
lines changed

2 files changed

+87
-86
lines changed

src/database.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,32 +162,32 @@ def parse_snowflake_timestamp(timestamp_str: str) -> str:
162162
"""Parse Snowflake timestamp format and convert to ISO format"""
163163
if not timestamp_str or not isinstance(timestamp_str, str):
164164
return timestamp_str
165-
165+
166166
try:
167167
# Handle format like "1753767533.658000000 1440"
168168
parts = timestamp_str.strip().split()
169169
if len(parts) >= 2:
170170
timestamp_part = parts[0]
171171
timezone_offset_minutes = int(parts[1])
172-
172+
173173
# Convert to float to handle decimal seconds
174174
timestamp_float = float(timestamp_part)
175-
175+
176176
# Create datetime from timestamp
177177
dt = datetime.fromtimestamp(timestamp_float, tz=timezone.utc)
178-
178+
179179
# Apply timezone offset (offset is in minutes)
180180
offset_timedelta = timedelta(minutes=timezone_offset_minutes)
181181
dt_with_offset = dt + offset_timedelta
182-
182+
183183
# Return in ISO format
184184
return dt_with_offset.isoformat()
185185
else:
186186
# Try parsing as simple timestamp
187187
timestamp_float = float(timestamp_str)
188188
dt = datetime.fromtimestamp(timestamp_float, tz=timezone.utc)
189189
return dt.isoformat()
190-
190+
191191
except (ValueError, TypeError) as e:
192192
logger.debug(f"Could not parse timestamp '{timestamp_str}': {e}")
193193
return timestamp_str
@@ -201,20 +201,20 @@ def format_snowflake_row(row_data: List[Any], columns: List[str]) -> Dict[str, A
201201
result = {}
202202
# Date/time columns that should be parsed
203203
timestamp_columns = {
204-
'CREATED', 'UPDATED', 'DUEDATE', 'RESOLUTIONDATE',
204+
'CREATED', 'UPDATED', 'DUEDATE', 'RESOLUTIONDATE',
205205
'ARCHIVEDDATE', '_FIVETRAN_SYNCED'
206206
}
207-
207+
208208
for i in range(len(columns)):
209209
column_name = columns[i].upper()
210210
value = row_data[i]
211-
211+
212212
# Parse timestamp columns
213213
if column_name in timestamp_columns and value:
214214
result[columns[i]] = parse_snowflake_timestamp(str(value))
215215
else:
216216
result[columns[i]] = value
217-
217+
218218
return result
219219

220220

0 commit comments

Comments
 (0)