Skip to content

Commit bbb7b3f

Browse files
Fix flake8 linting errors in Python scripts
- Remove extra blank lines in memory-leak-monitor.py (E303) - Fix continuation line indentation in memory-leak-monitor.py (E128) - Remove whitespace from blank lines in performance-regression-detector.py (W293) - Replace print() with logger.info() in apply-db-migration.py (NP100) All scripts now pass flake8 linting checks. Co-Authored-By: Alex Peng <[email protected]>
1 parent df5e290 commit bbb7b3f

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

scripts/apply-db-migration.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def apply_migration(db_path: str, migration_sql_path: str, dry_run: bool = False
3737

3838
if dry_run:
3939
logger.info("Dry run mode - migration would execute:")
40-
print(migration_sql)
40+
logger.info(migration_sql)
4141
return True
4242

4343
try:
@@ -150,12 +150,12 @@ def main():
150150

151151
if args.check:
152152
status = check_migration_status(args.database)
153-
print(f"Database exists: {status.get('exists', False)}")
154-
print(f"Migration applied: {status.get('migrated', False)}")
153+
logger.info(f"Database exists: {status.get('exists', False)}")
154+
logger.info(f"Migration applied: {status.get('migrated', False)}")
155155
if status.get('tables'):
156-
print(f"Tables present: {', '.join(status['tables'])}")
156+
logger.info(f"Tables present: {', '.join(status['tables'])}")
157157
if status.get('migration_tables_present'):
158-
print(f"Migration tables: {', '.join(status['migration_tables_present'])}")
158+
logger.info(f"Migration tables: {', '.join(status['migration_tables_present'])}")
159159
sys.exit(0 if status.get('migrated', False) else 1)
160160

161161
success = apply_migration(args.database, str(args.migration), args.dry_run)

scripts/memory-leak-monitor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def parse_benchmark_output(self, output_file: str) -> List[Dict]:
6464
with open(output_file, 'r') as f:
6565
content = f.read()
6666

67-
6867
size_pattern = r'model size:\s+(\d+\.?\d*)\s+(GiB|MiB|GB|MB)'
6968
usage_pattern = r'memory usage:\s+(\d+)\s+(MB|KB|GB)'
7069
peak_pattern = r'peak memory:\s+(\d+\.?\d*)\s+(GB|MB)'
@@ -276,7 +275,7 @@ def store_results(self, build_commit: str):
276275
conn.commit()
277276
conn.close()
278277
logger.info(f"Stored {len(self.leaks_detected)} leak records and "
279-
f"{len(self.memory_issues)} excessive usage records")
278+
f"{len(self.memory_issues)} excessive usage records")
280279

281280
except sqlite3.Error as e:
282281
logger.error(f"Error storing results: {e}")

scripts/performance-regression-detector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def analyze(self) -> Dict[str, Any]:
238238
self.stable.append(result)
239239

240240
status = "regression" if self.regressions else "pass"
241-
241+
242242
return {
243243
"status": status,
244244
"threshold": self.threshold,
@@ -307,7 +307,7 @@ def generate_report(self, output_path: str, analysis: Dict[str, Any]):
307307
def _write_benchmark_section(self, f, result: Dict[str, Any], section_type: str):
308308
"""Write a benchmark comparison section to the report."""
309309
f.write(f"### {result['benchmark_key']}\n\n")
310-
310+
311311
for metric_name, change in result["changes"].items():
312312
if not change.get("is_regression") and section_type == "Regression":
313313
continue

0 commit comments

Comments
 (0)