Skip to content

Commit 2170103

Browse files
committed
fix: resolve flake8 error
1 parent 77a7423 commit 2170103

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

.pre-commit-config.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ repos:
99
rev: 6.1.0
1010
hooks:
1111
- id: flake8
12-
# Use .flake8 for configuration (separate file to avoid TOML parsing issues)
13-
# --exit-zero: show warnings but don't fail pre-commit
14-
args: ['--config', '.flake8', '--exit-zero']
12+
# Match GitHub CI: check for syntax errors and undefined names
13+
# E9: Runtime errors (IndentationError, SyntaxError)
14+
# F63: Assertion errors
15+
# F7: Various errors
16+
# F82: Undefined names
17+
args: ['--select=E9,F63,F7,F82', '--show-source', '--statistics']
18+

dashboard/utils/data_loader.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#!/usr/bin/env python3
22
"""Unified data loader for InfiniMetrics dashboard."""
33

4+
from __future__ import annotations
5+
46
import logging
57
from pathlib import Path
6-
from typing import Any, Dict, List, Optional
8+
from typing import Any, Dict, List, Optional, TYPE_CHECKING
9+
10+
if TYPE_CHECKING:
11+
from .mongo_data_source import MongoDataSource
712

813
from .data_sources import DataSource, FileDataSource
914
from .data_utils import extract_accelerator_types, extract_run_info, get_friendly_size
@@ -48,7 +53,7 @@ def __init__(
4853
else:
4954
self._source = FileDataSource(results_dir)
5055

51-
def _try_connect_mongo(self) -> Optional["MongoDataSource"]:
56+
def _try_connect_mongo(self) -> Optional[MongoDataSource]:
5257
"""
5358
Try to connect to MongoDB.
5459
@@ -65,7 +70,7 @@ def _try_connect_mongo(self) -> Optional["MongoDataSource"]:
6570
logger.warning(f"MongoDB dependencies not installed ({e})")
6671
return None
6772

68-
def _apply_mongo_or_fallback(self, mongo_source: Optional["MongoDataSource"]):
73+
def _apply_mongo_or_fallback(self, mongo_source: Optional[MongoDataSource]):
6974
"""Apply MongoDB source or fallback to files based on configuration."""
7075
if mongo_source:
7176
self._source = mongo_source

0 commit comments

Comments
 (0)