Deja is an indexed, hierarchical data structure designed for efficient categorization and retrieval of data. It enables structured storage using a dictionary-based mapping, where each entry is assigned a unique index, allowing systematic organization and quick access.
- Indexed Storage – Organizes data efficiently using unique indexes.
- Flexible Management – Easily add, update, and remove categories.
- Error Handling – Prevents duplicate entries and invalid operations.
- Efficient Deletion – Supports category-based and index-based removal
from deja import Deja
# Initialize Deja instance
ds = Deja()
# Add categories with items
ds.add("Fruit", ["Apple", "Banana", "Mango"])
ds.add("Dairy", ["Milk", "Cheese"])
ds.add("Tech", ["Laptop", "Phone"])
ds.add("Movies", ["Inception", "Interstellar"])
ds.display() # Show current structure
# Find a category
print(ds.find_category("Tech"))
# Rename a category
print(ds.rename_category("Movies", "Films"))
ds.display() # Verify renaming worked
# Update an item within a category
print(ds.update_item("Fruit", "Banana", "Blueberry"))
ds.display() # Verify update
# Remove a category by name
ds.removeby_cat("Dairy")
ds.display() # Verify removal
# Remove an item by index and reindex
ds.removeby_idx(0) # Remove "Fruit"
ds.display() # Verify reindexingDeja is a hierarchical, index-driven data structure that organizes information efficiently, allowing structured storage and quick retrieval.
Each entry is mapped to an index, with categories acting as keys containing associated item lists. This allows precise lookups and modifications.
Yes! Deja supports removal by category name and removal by index, giving flexibility when managing stored data.
Yes. If a category already exists, Deja raises an error to maintain structured storage.
Yes! While lightweight, it can be expanded for sorting, searching, serialization, and persistent storage.
If you encounter issues, feel free to open an issue or reach out in discussions.