Update app.py
Browse files
app.py
CHANGED
|
@@ -305,26 +305,26 @@ def find_block_in_all(opcode: str, all_catalogs: list[dict]) -> dict | None:
|
|
| 305 |
|
| 306 |
# --- Global variable for the block catalog ---
|
| 307 |
ALL_SCRATCH_BLOCKS_CATALOG = {}
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
BLOCK_CATALOG_PATH = BLOCKS_DIR / "blocks.json"
|
| 317 |
-
HAT_BLOCKS_PATH = BLOCKS_DIR / "hat_blocks.json"
|
| 318 |
-
STACK_BLOCKS_PATH = BLOCKS_DIR / "stack_blocks.json"
|
| 319 |
-
REPORTER_BLOCKS_PATH = BLOCKS_DIR / "reporter_blocks.json"
|
| 320 |
-
BOOLEAN_BLOCKS_PATH = BLOCKS_DIR / "boolean_blocks.json"
|
| 321 |
-
C_BLOCKS_PATH = BLOCKS_DIR / "c_blocks.json"
|
| 322 |
-
CAP_BLOCKS_PATH = BLOCKS_DIR / "cap_blocks.json"
|
| 323 |
|
| 324 |
# Load the block catalogs from their respective JSON files
|
| 325 |
hat_block_data = _load_block_catalog(HAT_BLOCKS_PATH)
|
| 326 |
-
|
| 327 |
-
hat_description = hat_block_data.get("description", "No description available")
|
| 328 |
# hat_opcodes_functionalities = "\n".join([f" - Opcode: {block['op_code']}, functionality: {block['functionality']} example: standalone use: {block['example_standalone']}" for block in hat_block_data["blocks"]])
|
| 329 |
hat_opcodes_functionalities = "\n".join([
|
| 330 |
f" - Opcode: {block.get('op_code', 'N/A')}, functionality: {block.get('functionality', 'N/A')}, example: standalone use {block.get('example_standalone', 'N/A')}"
|
|
|
|
| 305 |
|
| 306 |
# --- Global variable for the block catalog ---
|
| 307 |
ALL_SCRATCH_BLOCKS_CATALOG = {}
|
| 308 |
+
BLOCK_CATALOG_PATH = "blocks" # Define the path to your JSON file
|
| 309 |
+
HAT_BLOCKS_PATH = "hat_blocks" # Path to the hat blocks JSON file
|
| 310 |
+
STACK_BLOCKS_PATH = "stack_blocks" # Path to the stack blocks JSON file
|
| 311 |
+
REPORTER_BLOCKS_PATH = "reporter_blocks" # Path to the reporter blocks JSON file
|
| 312 |
+
BOOLEAN_BLOCKS_PATH = "boolean_blocks" # Path to the boolean blocks JSON file
|
| 313 |
+
C_BLOCKS_PATH = "c_blocks" # Path to the C blocks JSON file
|
| 314 |
+
CAP_BLOCKS_PATH = "cap_blocks" # Path to the cap blocks JSON file
|
| 315 |
+
|
| 316 |
+
# BLOCK_CATALOG_PATH = BLOCKS_DIR / "blocks.json"
|
| 317 |
+
# HAT_BLOCKS_PATH = BLOCKS_DIR / "hat_blocks.json"
|
| 318 |
+
# STACK_BLOCKS_PATH = BLOCKS_DIR / "stack_blocks.json"
|
| 319 |
+
# REPORTER_BLOCKS_PATH = BLOCKS_DIR / "reporter_blocks.json"
|
| 320 |
+
# BOOLEAN_BLOCKS_PATH = BLOCKS_DIR / "boolean_blocks.json"
|
| 321 |
+
# C_BLOCKS_PATH = BLOCKS_DIR / "c_blocks.json"
|
| 322 |
+
# CAP_BLOCKS_PATH = BLOCKS_DIR / "cap_blocks.json"
|
| 323 |
|
| 324 |
# Load the block catalogs from their respective JSON files
|
| 325 |
hat_block_data = _load_block_catalog(HAT_BLOCKS_PATH)
|
| 326 |
+
hat_description = hat_block_data["description"]
|
| 327 |
+
#hat_description = hat_block_data.get("description", "No description available")
|
| 328 |
# hat_opcodes_functionalities = "\n".join([f" - Opcode: {block['op_code']}, functionality: {block['functionality']} example: standalone use: {block['example_standalone']}" for block in hat_block_data["blocks"]])
|
| 329 |
hat_opcodes_functionalities = "\n".join([
|
| 330 |
f" - Opcode: {block.get('op_code', 'N/A')}, functionality: {block.get('functionality', 'N/A')}, example: standalone use {block.get('example_standalone', 'N/A')}"
|