mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-09-22 04:50:46 +02:00
cleanup: removed unneeded debug scripts that were accidentally left behind
This commit is contained in:
parent
fe220c53f3
commit
6fe8a7af89
6 changed files with 0 additions and 213 deletions
|
@ -1,52 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Check for banned cards in our popular/iconic card lists.
|
||||
"""
|
||||
|
||||
from code.file_setup.setup_constants import BANNED_CARDS
|
||||
from code.deck_builder.builder_constants import POPULAR_CARDS, ICONIC_CARDS
|
||||
|
||||
def check_banned_overlap():
|
||||
"""Check which cards in our lists are banned in Commander."""
|
||||
|
||||
# Convert banned cards to set for faster lookup
|
||||
banned_set = set(BANNED_CARDS)
|
||||
|
||||
print("Checking for banned cards in our card priority lists...")
|
||||
print("=" * 60)
|
||||
|
||||
# Check POPULAR_CARDS
|
||||
popular_banned = POPULAR_CARDS & banned_set
|
||||
print(f"POPULAR_CARDS ({len(POPULAR_CARDS)} total):")
|
||||
if popular_banned:
|
||||
print("❌ Found banned cards:")
|
||||
for card in sorted(popular_banned):
|
||||
print(f" - {card}")
|
||||
else:
|
||||
print("✅ No banned cards found")
|
||||
print()
|
||||
|
||||
# Check ICONIC_CARDS
|
||||
iconic_banned = ICONIC_CARDS & banned_set
|
||||
print(f"ICONIC_CARDS ({len(ICONIC_CARDS)} total):")
|
||||
if iconic_banned:
|
||||
print("❌ Found banned cards:")
|
||||
for card in sorted(iconic_banned):
|
||||
print(f" - {card}")
|
||||
else:
|
||||
print("✅ No banned cards found")
|
||||
print()
|
||||
|
||||
# Summary
|
||||
all_banned = popular_banned | iconic_banned
|
||||
if all_banned:
|
||||
print(f"SUMMARY: Found {len(all_banned)} banned cards that need to be removed:")
|
||||
for card in sorted(all_banned):
|
||||
print(f" - {card}")
|
||||
return list(all_banned)
|
||||
else:
|
||||
print("✅ No banned cards found in either list!")
|
||||
return []
|
||||
|
||||
if __name__ == "__main__":
|
||||
banned_found = check_banned_overlap()
|
|
@ -1,54 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Debug the normalization and scoring for Lightning Bolt specifically"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'code'))
|
||||
|
||||
from deck_builder.include_exclude_utils import normalize_punctuation, fuzzy_match_card_name
|
||||
import pandas as pd
|
||||
|
||||
# Test normalize_punctuation function
|
||||
print("=== Testing normalize_punctuation ===")
|
||||
test_names = ["Lightning Bolt", "lightning bolt", "Lightning-Bolt", "Lightning, Bolt"]
|
||||
for name in test_names:
|
||||
normalized = normalize_punctuation(name)
|
||||
print(f"'{name}' → '{normalized}'")
|
||||
|
||||
# Load cards and test fuzzy matching
|
||||
print(f"\n=== Loading cards ===")
|
||||
cards_df = pd.read_csv('csv_files/cards.csv')
|
||||
available_cards = set(cards_df['name'].dropna().unique())
|
||||
|
||||
print(f"Cards loaded: {len(available_cards)}")
|
||||
print(f"Lightning Bolt in cards: {'Lightning Bolt' in available_cards}")
|
||||
|
||||
# Test fuzzy matching for 'bolt'
|
||||
print(f"\n=== Testing fuzzy match for 'bolt' ===")
|
||||
result = fuzzy_match_card_name('bolt', available_cards)
|
||||
print(f"Input: bolt")
|
||||
print(f"Matched: {result.matched_name}")
|
||||
print(f"Confidence: {result.confidence:.3f}")
|
||||
print(f"Auto-accepted: {result.auto_accepted}")
|
||||
print(f"Top suggestions: {result.suggestions[:5]}")
|
||||
|
||||
# Test fuzzy matching for 'lightn'
|
||||
print(f"\n=== Testing fuzzy match for 'lightn' ===")
|
||||
result = fuzzy_match_card_name('lightn', available_cards)
|
||||
print(f"Input: lightn")
|
||||
print(f"Matched: {result.matched_name}")
|
||||
print(f"Confidence: {result.confidence:.3f}")
|
||||
print(f"Auto-accepted: {result.auto_accepted}")
|
||||
print(f"Top suggestions: {result.suggestions[:5]}")
|
||||
|
||||
# Manual check of scores for Lightning cards
|
||||
print(f"\n=== Manual scoring for Lightning cards ===")
|
||||
from difflib import SequenceMatcher
|
||||
|
||||
input_test = "lightn"
|
||||
lightning_cards = [name for name in available_cards if 'lightning' in name.lower()][:10]
|
||||
|
||||
for card in lightning_cards:
|
||||
normalized_card = normalize_punctuation(card)
|
||||
score = SequenceMatcher(None, input_test.lower(), normalized_card.lower()).ratio()
|
||||
print(f"{score:.3f} - {card}")
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Debug the confirmation_needed response structure"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
test_data = {
|
||||
"include_cards": "lightn",
|
||||
"exclude_cards": "",
|
||||
"commander": "",
|
||||
"enforcement_mode": "warn",
|
||||
"allow_illegal": "false",
|
||||
"fuzzy_matching": "true"
|
||||
}
|
||||
|
||||
response = requests.post(
|
||||
"http://localhost:8080/build/validate/include_exclude",
|
||||
data=test_data,
|
||||
timeout=10
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print("Full response:")
|
||||
print(json.dumps(data, indent=2))
|
||||
print("\nConfirmation needed items:")
|
||||
for i, item in enumerate(data.get('confirmation_needed', [])):
|
||||
print(f"Item {i}: {json.dumps(item, indent=2)}")
|
||||
else:
|
||||
print(f"HTTP {response.status_code}: {response.text}")
|
|
@ -1,42 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Debug what Lightning cards are in the dataset"""
|
||||
|
||||
import pandas as pd
|
||||
|
||||
# Load the cards CSV
|
||||
cards_df = pd.read_csv('csv_files/cards.csv')
|
||||
print(f"Total cards loaded: {len(cards_df)}")
|
||||
|
||||
# Find cards that contain "light" (case insensitive)
|
||||
light_cards = cards_df[cards_df['name'].str.contains('light', case=False, na=False)]['name'].unique()
|
||||
print(f"\nCards containing 'light': {len(light_cards)}")
|
||||
for card in sorted(light_cards)[:20]: # Show first 20
|
||||
print(f" - {card}")
|
||||
|
||||
# Find cards that start with "light"
|
||||
light_start = cards_df[cards_df['name'].str.lower().str.startswith('light', na=False)]['name'].unique()
|
||||
print(f"\nCards starting with 'Light': {len(light_start)}")
|
||||
for card in sorted(light_start):
|
||||
print(f" - {card}")
|
||||
|
||||
# Find specific Lightning cards
|
||||
lightning_cards = cards_df[cards_df['name'].str.contains('lightning', case=False, na=False)]['name'].unique()
|
||||
print(f"\nCards containing 'Lightning': {len(lightning_cards)}")
|
||||
for card in sorted(lightning_cards):
|
||||
print(f" - {card}")
|
||||
|
||||
print(f"\nTesting direct matches for 'lightn':")
|
||||
test_input = "lightn"
|
||||
candidates = []
|
||||
for name in cards_df['name'].dropna().unique():
|
||||
# Test similarity to lightn
|
||||
from difflib import SequenceMatcher
|
||||
similarity = SequenceMatcher(None, test_input.lower(), name.lower()).ratio()
|
||||
if similarity > 0.6:
|
||||
candidates.append((similarity, name))
|
||||
|
||||
# Sort by similarity
|
||||
candidates.sort(key=lambda x: x[0], reverse=True)
|
||||
print("Top 10 matches for 'lightn':")
|
||||
for score, name in candidates[:10]:
|
||||
print(f" {score:.3f} - {name}")
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Debug what specific Lightning/Bolt cards exist"""
|
||||
|
||||
import pandas as pd
|
||||
|
||||
cards_df = pd.read_csv('csv_files/cards.csv')
|
||||
|
||||
print("=== Lightning cards that start with 'Light' ===")
|
||||
lightning_prefix = cards_df[cards_df['name'].str.lower().str.startswith('lightning', na=False)]['name'].unique()
|
||||
for card in sorted(lightning_prefix):
|
||||
print(f" - {card}")
|
||||
|
||||
print(f"\n=== Cards containing 'bolt' ===")
|
||||
bolt_cards = cards_df[cards_df['name'].str.contains('bolt', case=False, na=False)]['name'].unique()
|
||||
for card in sorted(bolt_cards):
|
||||
print(f" - {card}")
|
||||
|
||||
print(f"\n=== Cards containing 'warp' ===")
|
||||
warp_cards = cards_df[cards_df['name'].str.contains('warp', case=False, na=False)]['name'].unique()
|
||||
for card in sorted(warp_cards):
|
||||
print(f" - {card}")
|
||||
|
||||
print(f"\n=== Manual test of 'lightn' against Lightning cards ===")
|
||||
test_input = "lightn"
|
||||
lightning_scores = []
|
||||
from difflib import SequenceMatcher
|
||||
|
||||
for card in lightning_prefix:
|
||||
score = SequenceMatcher(None, test_input.lower(), card.lower()).ratio()
|
||||
lightning_scores.append((score, card))
|
||||
|
||||
lightning_scores.sort(key=lambda x: x[0], reverse=True)
|
||||
print("Top Lightning matches for 'lightn':")
|
||||
for score, card in lightning_scores[:5]:
|
||||
print(f" {score:.3f} - {card}")
|
Loading…
Add table
Add a link
Reference in a new issue