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:
@@ -7,7 +7,7 @@ Usage: python route_diagnostics.py
|
||||
"""
|
||||
|
||||
import sys
|
||||
from typing import List, Dict
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
def check_route_order():
|
||||
@@ -29,23 +29,23 @@ def check_route_order():
|
||||
html_routes = []
|
||||
|
||||
for route in routes:
|
||||
if hasattr(route, 'path'):
|
||||
if hasattr(route, "path"):
|
||||
path = route.path
|
||||
methods = getattr(route, 'methods', set())
|
||||
methods = getattr(route, "methods", set())
|
||||
|
||||
# Determine if JSON or HTML based on common patterns
|
||||
if 'login' in path or 'dashboard' in path or 'products' in path:
|
||||
if "login" in path or "dashboard" in path or "products" in path:
|
||||
# Check response class if available
|
||||
if hasattr(route, 'response_class'):
|
||||
if hasattr(route, "response_class"):
|
||||
response_class = str(route.response_class)
|
||||
if 'HTML' in response_class:
|
||||
if "HTML" in response_class:
|
||||
html_routes.append((path, methods))
|
||||
else:
|
||||
json_routes.append((path, methods))
|
||||
else:
|
||||
# Check endpoint name/tags
|
||||
endpoint = getattr(route, 'endpoint', None)
|
||||
if endpoint and 'page' in endpoint.__name__.lower():
|
||||
endpoint = getattr(route, "endpoint", None)
|
||||
if endpoint and "page" in endpoint.__name__.lower():
|
||||
html_routes.append((path, methods))
|
||||
else:
|
||||
json_routes.append((path, methods))
|
||||
@@ -57,8 +57,10 @@ def check_route_order():
|
||||
# Check for specific vendor info route
|
||||
vendor_info_found = False
|
||||
for route in routes:
|
||||
if hasattr(route, 'path'):
|
||||
if '/{vendor_code}' == route.path and 'GET' in getattr(route, 'methods', set()):
|
||||
if hasattr(route, "path"):
|
||||
if "/{vendor_code}" == route.path and "GET" in getattr(
|
||||
route, "methods", set()
|
||||
):
|
||||
vendor_info_found = True
|
||||
print("✅ Found vendor info endpoint: GET /{vendor_code}")
|
||||
break
|
||||
@@ -100,14 +102,14 @@ def test_vendor_endpoint():
|
||||
print(f" Content-Type: {response.headers.get('content-type', 'N/A')}")
|
||||
|
||||
# Check if response is JSON
|
||||
content_type = response.headers.get('content-type', '')
|
||||
if 'application/json' in content_type:
|
||||
content_type = response.headers.get("content-type", "")
|
||||
if "application/json" in content_type:
|
||||
print("✅ Response is JSON")
|
||||
data = response.json()
|
||||
print(f" Vendor: {data.get('name', 'N/A')}")
|
||||
print(f" Code: {data.get('vendor_code', 'N/A')}")
|
||||
return True
|
||||
elif 'text/html' in content_type:
|
||||
elif "text/html" in content_type:
|
||||
print("❌ ERROR: Response is HTML, not JSON!")
|
||||
print(" This confirms the route ordering issue")
|
||||
print(" The HTML page route is catching the API request")
|
||||
|
||||
Reference in New Issue
Block a user