style: apply black and isort formatting across entire codebase
- Standardize quote style (single to double quotes) - Reorder and group imports alphabetically - Fix line breaks and indentation for consistency - Apply PEP 8 formatting standards Also updated Makefile to exclude both venv and .venv from code quality checks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,17 +12,18 @@ from pathlib import Path
|
||||
# Add project root to path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
import sqlite3
|
||||
from datetime import datetime, UTC
|
||||
import os
|
||||
import sqlite3
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
# Get database URL
|
||||
database_url = os.getenv('DATABASE_URL', 'wizamart.db')
|
||||
db_path = database_url.replace('sqlite:///', '')
|
||||
database_url = os.getenv("DATABASE_URL", "wizamart.db")
|
||||
db_path = database_url.replace("sqlite:///", "")
|
||||
|
||||
print(f"📦 Creating inventory entries in {db_path}...")
|
||||
|
||||
@@ -30,12 +31,14 @@ conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Get products without inventory
|
||||
cursor.execute("""
|
||||
cursor.execute(
|
||||
"""
|
||||
SELECT p.id, p.vendor_id, p.product_id
|
||||
FROM products p
|
||||
LEFT JOIN inventory i ON p.id = i.product_id
|
||||
WHERE i.id IS NULL
|
||||
""")
|
||||
"""
|
||||
)
|
||||
products_without_inventory = cursor.fetchall()
|
||||
|
||||
if not products_without_inventory:
|
||||
@@ -47,7 +50,8 @@ print(f"📦 Creating inventory for {len(products_without_inventory)} products..
|
||||
|
||||
# Create inventory entries
|
||||
for product_id, vendor_id, sku in products_without_inventory:
|
||||
cursor.execute("""
|
||||
cursor.execute(
|
||||
"""
|
||||
INSERT INTO inventory (
|
||||
vendor_id,
|
||||
product_id,
|
||||
@@ -57,15 +61,17 @@ for product_id, vendor_id, sku in products_without_inventory:
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (
|
||||
vendor_id,
|
||||
product_id,
|
||||
'Main Warehouse',
|
||||
100, # Total quantity
|
||||
0, # Reserved quantity
|
||||
datetime.now(UTC),
|
||||
datetime.now(UTC)
|
||||
))
|
||||
""",
|
||||
(
|
||||
vendor_id,
|
||||
product_id,
|
||||
"Main Warehouse",
|
||||
100, # Total quantity
|
||||
0, # Reserved quantity
|
||||
datetime.now(UTC),
|
||||
datetime.now(UTC),
|
||||
),
|
||||
)
|
||||
|
||||
conn.commit()
|
||||
|
||||
@@ -76,7 +82,9 @@ cursor.execute("SELECT COUNT(*) FROM inventory")
|
||||
total_count = cursor.fetchone()[0]
|
||||
print(f"\n📊 Total inventory entries: {total_count}")
|
||||
|
||||
cursor.execute("SELECT product_id, location, quantity, reserved_quantity FROM inventory LIMIT 5")
|
||||
cursor.execute(
|
||||
"SELECT product_id, location, quantity, reserved_quantity FROM inventory LIMIT 5"
|
||||
)
|
||||
print("\n📦 Sample inventory:")
|
||||
for row in cursor.fetchall():
|
||||
available = row[2] - row[3]
|
||||
|
||||
Reference in New Issue
Block a user