Repository navigation
Releases: YoungLionOrganization/YoungLionPythonLibrary
Release list
Version v0.1.1
YoungLion Release History
YoungLion follows semantic versioning for the public package line. Patch releases
may improve documentation, type information, packaging, diagnostics and bug fixes
without intentionally changing the established public behavior of the minor line.
0.1.1 — Runtime documentation and discoverability patch — 2026-08-22
Release intent
v0.1.1 is a documentation-first patch over the v0.1 native architecture. The
runtime algorithms, public method signatures and data/search/file semantics are
intentionally preserved. The primary goal is to make YoungLion understandable
from inside Python itself: users should be able to discover a class in IDLE,
call help(), inspect a method in a REPL or hover it in an IDE and receive
useful guidance without first opening the external documentation tree.
This is particularly important for YoungLion because the package intentionally
contains several broad tool families—DDM modeling, high-throughput collections,
search, File helpers and application utilities. A short one-line docstring is not
enough to communicate mutation behavior, nested-path semantics, index lifetime,
thread-safety, format limitations or the difference between similar-looking
classes.
Runtime docstring coverage
The Python implementation now carries comprehensive runtime documentation across
the complete discoverable public surface:
- package and subpackage module overviews;
- all public classes;
- public constructors where they are part of normal interactive discovery;
- public methods and properties;
- public module-level helper functions.
The documentation style is intentionally optimized for help(), IDLE and IDE
introspection. A typical entry starts with a concise summary and then expands into
parameters, return behavior, exceptions where relevant, operational notes and
examples for the APIs where an example materially clarifies usage.
The release audit covers 14 Python implementation modules and 612 discoverable
public class/function/method entries, with no missing or intentionally tiny
placeholder docstrings in that audited surface.
DDM and domain-model documentation
DDM documentation now explains both the dynamic mapping use case and the
subclass-oriented domain-model pattern expected in real applications. In
particular, the runtime help demonstrates nested typed models such as:
from YoungLion import DDM
class UserProfile(DDM):
def __init__(self, data):
super().__init__(data)
self.name: str = str(data.get("name", "Unknown"))
self.country: str = str(data.get("country", "Unknown"))
class User(DDM):
def __init__(self, data):
super().__init__(data)
self.id: int = int(data.get("id", 0))
self.profile: UserProfile = UserProfile(data.get("profile", {}))The DDM runtime documentation now describes:
- the single-store
__dict__data layout; - recursive serialization and JSON conversion;
- dotted-path read/write/existence checks;
- subclass-aware cloning and nested typed model reconstruction;
- merge/update/diff behavior;
- schema validation;
- flattening, filtering, mapping, grouping and aggregation;
- memory inspection and compaction;
- when external DDM search indexes must be refreshed after mutation.
Specialized variants—FrozenDDM, IdentityDDM, PackedDDM, SchemaDDM, DefaultDDM,
LazyDDM and ViewDDM—now explain the semantic trade-off each variant introduces
instead of appearing as unexplained alternative constructors.
High-throughput collection documentation
ListDDM, SetDDM, DictDDM, DDMTable, DDMCollectionOps and BatchPlan now document
their record-oriented behavior in detail. Runtime help covers nested dotted-path
operations, numeric mutation/reduction, filtering, grouping, deduplication,
partitioning, chunking, sorting and binary-search-style algorithms.
BatchPlan explicitly documents its one-pass purpose: multiple simple mutations
can be queued and sent to the native collection implementation together instead
of repeatedly scanning the same record pool.
SetDDM documentation now calls out its uniqueness model and the importance of a
stable key_path for large mutable datasets, including when rehash() is
needed after direct external mutations.
Search documentation
The search stack now has runtime explanations for the relationship between
SearchIndex, BM25Index, AutocompleteIndex, MultiPatternSearch, NumericSearch,
StructuredSearch, FileSearchEngine, ApplicationSearch and DDMSearchEngine.
The DDM search documentation explains:
- dotted paths such as
profile.nameandeconomy.balance; - exact hash indexes versus sorted range indexes;
- text/fuzzy indexes;
- composite exact indexes;
- scan fallback versus reusable index behavior;
- the shared source/object snapshot used to reduce repeated index memory;
refresh()and targetedinvalidate()responsibilities after external
mutations.
ApplicationSearch documentation describes document CRUD, ranked results, payload
retrieval, autocomplete, facets and the intended command-palette/help-center/
settings/catalog use cases.
File and format documentation
The File runtime surface now explains core filesystem operations, text/binary and
JSON persistence, checksums, directory sizing, chunked reads, backups and atomic
replacement behavior. Atomic-write documentation calls out the same-filesystem
assumption and the same-directory temporary-file/flush/replace strategy.
Format helpers now state their scope rather than implying unlimited standards
coverage. In particular, the dependency-free PDF and YAML-like helpers are
explicitly documented as practical subsets; applications requiring advanced PDF
layout/OCR or full YAML anchors/tags/custom types should use a dedicated parser.
Application utility documentation
The utility layer now provides IDLE/help-friendly explanations for:
ScriptRunnerandCommandResult;TaskSchedulerandTaskInfo;Loggerwith context binding and size-based rotation;EmailManager;FileTransferManager;TextProcessor;EventBus;TTLCache;RateLimiter;RetryPolicy;CircuitBreaker;Stopwatch;TerminalandColors.
Thread-sensitive classes document what YoungLion protects internally and what
remains the caller's synchronization responsibility. EventBus notes that emission
is synchronous; TaskScheduler notes that work runs in in-process daemon threads;
TTLCache documents lazy expiry/LRU-style recency; RateLimiter notes that its token
bucket is process-local; RetryPolicy warns that retries are appropriate only when
repeating the operation is safe.
API and behavior compatibility
No intentional runtime feature or algorithm change is part of v0.1.1. Public
Python method signatures remain unchanged. The documentation pass was verified by
comparing the original and updated Python ASTs after removing docstring expression
nodes; the resulting runtime structure is identical.
A small formatting consequence exists for methods that previously placed their
entire body on the same physical source line: those definitions are expanded to a
normal indented suite so Python can expose a real function docstring. The executed
statements and AST semantics remain unchanged.
The package version metadata and YoungLion.__version__ are updated to
0.1.1 as required for the patch release.
Packaging and release expectations
YoungLion remains dependency-free at runtime. Native C++ sources remain source-
distribution material and are not intended to be bundled as source files inside
prebuilt wheels. py.typed and the public .pyi stubs remain part of the
wheel so static typing and runtime introspection complement one another.
The v0.1 release workflow continues to build distribution artifacts rather than
publishing directly to PyPI. Maintainers should validate the generated pypi/
folder with Twine before manual upload.
Upgrade notes
There are no intended application-code migrations from v0.1.0 to v0.1.1. Normal
upgrade:
python -m pip install --upgrade YoungLion==0.1.1Interactive users are encouraged to try:
import YoungLion
from YoungLion import DDM, ListDDM, DDMSearchEngine, File, Logger
help(YoungLion)
help(DDM)
help(DDM.get_path)
help(ListDDM.filter_path)
help(DDMSearchEngine.create_index)
help(File.atomic_write_json)
help(Logger.bind)These runtime help pages are now a supported part of YoungLion's developer
experience rather than an afterthought.
0.1.0 — Native architecture foundation
v0.1.0 established the native-accelerated architecture on which the 0.1 line is
built.
Native core
- Added a C++17 CPython extension with no pybind11 runtime requirement.
- Added optimized release builds with optional LTO, strict warning mode and
portable CPU settings. - Added native JSON, filesystem, binary/file, DDM collection and search
primitives.
Dynamic Data Model
- Removed duplicate
_dataplus public-field dictionary storage;_datais
a zero-copy compatibility view of__dict__. - Added native recursive serialization, clone data, dotted paths, deep merge,
diff, flattening and schema checks. - Added native-driven recursive memory inspection and optional key interning.
- Added typed-subclass-aware clone reconstruction and specialized clone state for
built-in DDM variants. - Added FrozenDDM, IdentityDDM, PackedDDM, SchemaDDM, DefaultDDM, LazyDDM and
ViewDDM. - Added ListDDM, SetDDM, DictDDM, DDMTable and one-pass BatchPlan operations.
File
- Removed mandatory third-party runtime dependencies from normal File operation.
- Added native binary read/write, CRC32, directory ...
Version v0.1
Changelog
0.1.0 — in development
0.1.0 is the first native-architecture release line and has not been declared final in this repository yet.
Native core
- Added a C++17 CPython extension with no pybind11 runtime requirement.
- Added optimized release builds with optional LTO, strict warning mode and portable CPU settings.
- Added native JSON, filesystem, binary/file, vector/cache and search primitives.
DDM
- Removed duplicate
_data+ public-field dictionary storage;_datais now a zero-copy compatibility view of__dict__. - Added native recursive serialization, clone data, dotted paths, deep merge, diff, flattening and schema checks.
- Added native-driven recursive memory inspection and optional key interning.
- Hardened native JSON parsing for surrogate pairs, control characters and invalid number grammar.
- Added a fast flat-model
to_dictpath usingPyDict_Copywhen all public values are immutable leaves. - Removed an unnecessary second recursive copy from native clone data.
File
- Removed mandatory third-party runtime dependencies from normal File operation.
- Added native binary read/write, CRC32, directory size, line count, file comparison and touch.
- Added SHA/standard-library checksums, atomic text/JSON/binary replacement, backups, chunked reads and filtered file discovery.
- Hardened CSV quoted-newline handling.
- Atomic replacement now uses unique same-directory temporary files, file
fsync, and best-effort POSIX parent-directoryfsync.
Search
- Rebuilt Search around typed documents, results and query objects.
- Added native Unicode Levenshtein, Damerau-Levenshtein, Jaro-Winkler, trigram and substring-position primitives.
- Added persistent inverted indexes and posting-list BM25 scoring for repeated queries.
- Added hybrid ranking, autocomplete, Aho-Corasick multi-pattern matching, structured, numeric and file search.
- Preserved historical
SearchData,Search,SearchFileandGenerateTagsAPIs. - Added a maximum generated-tag limit to prevent factorial memory explosions.
- Added lazily sorted prefix-vocabulary caching and full-recall pure-prefix candidate expansion.
Packaging and CI
- Runtime
dependencies = []. - Added typed package metadata and richer PyPI project metadata.
- Corrected the stable interpreter boundary to CPython 3.10–3.14; CPython 3.15 stays in a separate manually triggered prerelease artifact job.
- Kept C++ sources in the sdist while excluding them from prebuilt wheels, reducing wheel size significantly.
- Added Windows/Linux/macOS native CI plus clean Debian/Arch/Fedora/Rocky/openSUSE/Alpine source builds.
- Added manylinux/musllinux, Windows, macOS and source artifact workflow.
- PyPI publishing is intentionally not automated; artifacts are downloaded and published manually by the maintainer.
v0.0.9.9
YoungLion v0.0.9.9 Release Notes
Release Date: December 6, 2025
Status: Stable Release
Python Support: 3.7 - 3.12
🎉 Major Update: Massive DataModel Expansion
This release introduces a complete overhaul of the DataModel module with 100+ new methods, 5 new specialized classes, and an ultra-fast data completion system.
✨ What's New
1. 60+ New DDM Methods 🚀
The core DDM (Dynamic Data Model) class has been expanded with professional-grade data management capabilities:
Path-Based Access
ddm = DDM({"user": {"address": {"city": "New York"}}})
ddm.get_path("user.address.city") # "New York"
ddm.set_path("user.address.zip", "10001")
ddm.has_path("user.address") # TrueDeep Cloning & Merging
clone = ddm.clone() # Deep copy
merged = ddm.merge(other_ddm) # Non-destructive merge
ddm.update(name="Alice", age=30) # In-place updateAdvanced Filtering
filtered = ddm.filter_keys(["name", "age"]) # Keep only these
excluded = ddm.exclude_keys(["password"]) # Remove these
found = ddm.search("john") # Search by value
by_type = ddm.find_by_type(str) # Find stringsTransformation & Sorting
transformed = ddm.transform(lambda v: v.upper() if isinstance(v, str) else v)
sorted_by_key = ddm.sort_by_key()
sorted_by_value = ddm.sort_by_value()Organization & Analytics
grouped = ddm.group_by(lambda k, v: type(v).__name__)
aggregated = ddm.aggregate({"age": sum, "score": max})
flat = ddm.to_flat_dict() # Flatten nested structureValidation & Comparison
is_valid = ddm.validate_schema(schema)
differences = ddm.diff(other_ddm) # Detailed diff report
types = ddm.get_types() # Type analysisExport Formats
json_str = ddm.to_json(indent=2) # JSON export
csv_line = ddm.to_csv_line() # CSV row
xml_like = ddm.to_xml_like() # XML-like formatDict-Like Interface
ddm["name"] = "Alice"
if "age" in ddm:
print(ddm["age"])
for key, value in ddm.items():
process(key, value)2. Four New Utility Classes 🎯
All built on DDM for seamless integration.
Range - Bounded Interval Management
from YoungLion import Range
# Create bounded range
price_range = Range(min_val=10, max_val=1000)
# Basic operations
price_range.contains(500) # True
price_range.clamp(2000) # 1000 (clamped)
price_range.span() # 990
# Normalization (map to [0, 1])
normalized = price_range.normalize(500) # 0.495...
original = price_range.denormalize(0.5) # 505.0
# Advanced
price_range.subdivide(5) # Split into 5 parts
price_range.intersect(other) # Find intersection
price_range.overlaps(other) # Check overlapVector - N-Dimensional Mathematics
from YoungLion import Vector
# Create vectors
v1 = Vector(components=[1, 2, 3])
v2 = Vector(components=[4, 5, 6])
# Measurements
v1.magnitude() # 3.74...
v1.distance_to(v2) # 5.196...
v1.angle_to(v2) # Angle in degrees
# Operations
v1.normalize() # Unit vector
v1.dot(v2) # Dot product
v1.cross(v2) # Cross product (3D)
# Transformations
v1.project_onto(v2) # Project onto another vector
v1.perpendicular() # Perpendicular vector (2D)
v1.lerp(v2, 0.5) # Linear interpolation to midpoint
# Operator support
v3 = v1 + v2 # Vector addition
v4 = v1 * 2 # Scalar multiplicationTimeline - Event Management
from YoungLion import Timeline
# Create timeline
tl = Timeline(start_time=0, end_time=100)
# Add events
tl.add_event(0, "start", {"data": "initial"})
tl.add_event(50, "midpoint", {"data": "middle"})
tl.add_event(100, "end", {"data": "final"})
# Query events
tl.events_at(50) # Events at time 50
tl.events_between(25, 75) # Events in range
tl.get_event("midpoint") # Get specific event
# Timeline analysis
tl.duration() # Total duration
tl.get_progress(50) # 0.5 (50% complete)Dataset - Tabular Data with Statistics
from YoungLion import Dataset
# Create dataset
ds = Dataset(columns=["product", "quantity", "price"])
# Add data
ds.add_row({"product": "Laptop", "quantity": 5, "price": 1000})
ds.add_row({"product": "Mouse", "quantity": 50, "price": 25})
# Filter & sort
expensive = ds.filter_rows(lambda r: r["price"] > 50)
by_quantity = ds.sort_by("quantity")
# Organization
by_price = ds.group_by("price")
# Statistics
stats = ds.stats("price") # {count, sum, mean, min, max, std, variance}
avg = stats["mean"]
total = ds.aggregate("price", sum)
# Export
csv = ds.to_csv()
transposed = ds.transpose() # Swap rows/columns3. SmartCache (SC) - Ultra-Fast Data Completion ⚡
O(n) complexity template-based data completion system for high-frequency processing.
from YoungLion import SmartCache
# Setup
template = {
"user_id": None,
"username": "guest",
"verified": False,
"email": ""
}
sc = SmartCache(template=template)
# Single completion
raw_data = {"user_id": 123, "username": "alice"}
completed = sc.complete(raw_data)
# → {"user_id": 123, "username": "alice", "verified": False, "email": ""}
# Batch processing (ultra-efficient)
records = [
{"user_id": 1},
{"username": "bob", "verified": True},
{"email": "charlie@example.com"}
]
completed_batch = sc.complete_batch(records)
# Analysis
missing = sc.get_missing_keys(raw_data) # Keys not in raw_data
extra = sc.get_extra_keys(raw_data) # Extra keys in raw_data
report = sc.completion_report(raw_data) # Detailed analysis
# Statistics
stats = sc.get_stats() # {completed_count, total_keys, efficiency_percent}
# Dynamic updates
sc.update_template(new_template)
sc.reset_stats()Key Features:
- ✨ O(n) Time Complexity - Only processes missing keys
- 🔒 Template Protection - Default values never modified
- 🧠 Memory Optimized - Hash-based O(1) key lookup
- 📊 Statistics Tracking - Monitor efficiency and performance
- 🔄 Batch Mode - Handle thousands of records efficiently
4. DDMBuilder - Fluent API 🏗️
Build complex DDM instances with chainable syntax:
from YoungLion import DDMBuilder
builder = DDMBuilder()
person = (builder
.set("name", "Alice")
.set("age", 30)
.set_many(city="New York", country="USA")
.nest("address", lambda b:
b.set("street", "123 Main St")
.set("zip", "10001")
)
.add_list("hobbies", ["reading", "coding"])
.build()
)5. 10+ Helper Functions 🔧
Professional batch processing utilities:
from YoungLion import (
merge_ddms,
compare_ddms,
batch_transform,
batch_filter,
validate_ddm_batch,
analyze_ddm_structure,
get_ddm_size_info,
create_smart_cache,
fast_complete,
batch_complete_fast
)
# Merge multiple DDMs
merged = merge_ddms(ddm1, ddm2, ddm3)
# Compare two DDMs
diff = compare_ddms(ddm1, ddm2)
# Batch operations
transformed = batch_transform(ddms, lambda d: d.to_upper())
filtered = batch_filter(ddms, lambda d: d["age"] > 18)
# Validation
validate_ddm_batch(ddms, schema)
# Analysis
structure = analyze_ddm_structure(ddm)
size_info = get_ddm_size_info(ddm)
# SmartCache shortcuts
sc = create_smart_cache(template)
completed = fast_complete(template, raw_data)
batch = batch_complete_fast(template, records)📊 Statistics
- 100+ New Methods across all classes
- 5 New Specialized Classes - Range, Vector, Timeline, Dataset, SmartCache
- 3000+ Lines of Code professionally written with full type hints
- 30+ Code Examples in documentation
- 60+ DDM Methods for comprehensive data management
- Cross-Platform - Windows (.pyd), Linux (.so), macOS (Mach-O)
🔧 Build System Improvements
Automatic Cross-Platform Compilation
When users install YoungLion:
- Windows →
.pydbinary extensions auto-compiled - Linux →
.soshared libraries auto-compiled - macOS → Universal binaries (ARM64 + Intel)
pip install YoungLion
# Automatically detects platform and compiles optimized binaries!Professional Configuration Files
- pyproject.toml - PEP 517/518 compliant, all metadata
- setup.py - Platform-specific compiler settings
- BUILD.md - Comprehensive 5000+ word build guide
📝 Enhanced Documentation
README.md Updates
- ✅ Version 0.0.9.9 changelog entry
- ✅ 350+ lines of professional DataModel documentation
- ✅ All new classes documented with examples
- ✅ Updated module descriptions
- ✅ Professional formatting with emojis
Code Documentation
- ✅ Full docstrings for all classes and methods
- ✅ Type hints throughout codebase
- ✅ Usage examples for every major class
- ✅ Parameter descriptions and return values
🐛 Bug Fixes & Improvements
- ✅ Enhanced ANSI color support across all platforms
- ✅ Improved error messages with context
- ✅ Better nested DDM handling
- ✅ Optimized memory usage in batch operations
- ✅ Fixed edge cases in path-based access
- ✅ Consistent type handling across operations
📦 Dependency Updates
All dependencies version-pinned for stability:
PyYAML>=5.4
PyPDF2>=2.0.0
reportlab>=3.6.0
Pillow>=8.0.0
matplotlib>=3.3.0
tqdm>=4.50.0
paramiko>=2.7.0
pylatexenc>=2.0
markdown2>=2.3.0
🚀 Installation
From PyPI (Recommended)
pip install YoungLionFrom Source
g...v0.0.9.8
Young Lion Python Library
The Young Lion Python Library is designed to simplify the work of developers, especially Young Lion Developers. This library provides a wide range of functionalities for handling various file formats, managing directories, and executing file-related operations efficiently.
This library is under development and will be expanded with more features in the future.
Unlike 0.0.7:
- We fixed some minor bugs in VISTA in version 0.0.7.1. We did not make the version 0.0.8 because there were no major changes. (0.0.7.2, 0.0.7.3)
- In 0.0.7.4 we colored some terminal text.
- In 0.0.7.6 New functions have been added to the File class. move_folder move_file copy_file create_folder
- In 0.0.7.8 We optimized functions
Unlike 0.0.8:
- 0.0.8 We add new search module
- 0.0.8.2 Added some small functions to File class
Unlike 0.0.9:
- 0.0.9 We add minigames in library
- 0.0.9.1 Some bugs have been fixed and hangman word data has been improved.
- 0.0.9.2 A custom feature has arrived for you to integrate XOX and Hangman games into your own interface and applications.
- 0.0.9.4 We add Terminal Module in library
- 0.0.9.6 We added ANCI and untils to the terminal module.
- 0.0.9.7 I came to the decision to divide the library into categories
- 0.0.9.8 We add Debugger, DDM (Dynamic Data Model) and Colors
Table of Contents
- Installation
- Modules
- Usage Examples
- Changelog
- License
- Contributing (Optional: Add details if applicable)
Installation
To install the Young Lion library, run the following command:
pip install YoungLionAttention! If an error or problem occurs during the installation, you may need to run these commands in the terminal:
pip cache purge
python -m pip install --upgrade pip
pip install YoungLion --no-cache-dirModules
The library is organized into the following modules:
-
Functions
-
Search
-
DataModel
-
Colors
Functions Features and Overview
This module contains a very comprehensive set of Python classes that perform various functions. Below is a general summary of these classes and the main features they offer:
1. File Class
- Purpose: File processing (JSON, TXT, CSV, LOG, PDF, XML, YAML, INI, etc.) and directory management.
- Supported Operations:
- Reading and writing JSON, TXT, LOG files.
- Reading, writing, adding and updating CSV files.
- Reading, writing, and creating PDF content.
- Read, write and edit XML files.
- Compressing and extracting compressed files (
.zip). - Read/write HTML, CSS, and JS files.
- Python File Management:
- Executing Python files with argument and terminal options.
- Adding code blocks to Python files (start, end, or specific line).
- Validating and preparing Python file paths.
- Executing SQL queries and creating tables.
- JavaScript File Management:
- Reading, writing, and executing JavaScript files.
- Terminal-based or background execution.
- LaTeX Processing:
- Converting Markdown to LaTeX.
- Reading and writing
.texfiles. - Compiling LaTeX to plain text.
- Converting LaTeX to Markdown.
- Appending content to
.texfiles. - Converting LaTeX to HTML with MathJax support.
- Rendering LaTeX as images.
- Directory & File Operations: (Added in 0.0.7.6)
move_folder,move_file,copy_file,create_folder,delete_file,delete_folder(Added in 0.0.8.2)
2. ScriptRunner Class
- Objective: Execute scripts in Node.js or a specified interpreter.
- Key Features:
- Run a script in the terminal or in the background.
- Providing input data for the script.
- Capture and process outputs.
3. TaskScheduler Class
- Purpose: Schedule, pause, resume and cancel tasks.
- Supported Functions:
- Create one-off or repetitive tasks.
- Prioritizing tasks.
- CLI-based task listing.
4. Logger Class
- Purpose**: Flexible logging at the application level.
- Features:
- Write information, error and warning messages to log file.
- Support for different log levels (INFO, DEBUG, ERROR, etc.).
- Console and file logging support.
5. EmailManager Class
- Purpose: Email sending and management.
- Basic Functions:
- Sending email instantly.
- Scheduling email based on a specific time.
- Check the last messages in your inbox.
6. FileTransferManager Class
- Purpose: Uploading and downloading files using FTP and SFTP.
- Features:
- File upload and download.
- Track transfer status.
- Supported protocols: FTP and SFTP.
7. TextProcessor Class
- Purpose: Text analysis and editing.
- Key Features:
- Word and character counting.
- Keyword search.
- Text replacement and summarization.
- Finding the most frequently used words.
- Readability score calculation.
8. Debugger Class
- Purpose: Easy Debugging
- Key Features:
- Colorized
- Symbolized
- Ready Debug Types
- Custom debugging function
With their modular structure and rich feature set, these classes provide powerful tools for many application development processes. Each one is optimized for a specific type of data processing or management operations.
Search Features and Overview
The Search module provides an advanced and efficient way to search through structured data using keyword-based matching. This module offers:
-
Tag Generation (
GenerateTagsclass):- Automatically generates keyword tags from input text.
- Supports custom replacements (e.g., "Minecraft" → "MC").
- Removes unnecessary stopwords for better efficiency.
- Supports case normalization and special character cleaning.
- Generates keyword combinations and permutations.
-
Data Organization (
SearchDataclass):- Stores searchable data with keyword-based mapping.
- Allows quick retrieval of associated data.
-
Advanced Search System (
Searchclass):- Finds relevant search results based on keywords.
- Uses fuzzy matching to suggest close alternatives.
- Supports exact-match searching if required.
Usage Example
from YoungLion import Search, SearchData, GenerateTags
# Create structured search data
search_entries = [
{"tags": ["Science", "Physics", "Quantum Mechanics"], "return": {"title": "Quantum Theory", "link": "example.com/qm"}},
{"tags": ["Programming", "Python", "Machine Learning"], "return": "Learn Python for ML"}
]
sdata = SearchData(search_entries)
search_engine = Search(sdata)
# Perform a search
results = search_engine.search("Physics")
print(results) # Output: [{'title': 'Quantum Theory', 'link': 'example.com/qm'}]With the Search module, you can implement a high-performance keyword search engine with minimal effort.
DataModel Features and Overview
The DataModel module provides a flexible and powerful system for managing hierarchical structured data in Python. It allows you to easily store, manipulate, and serialize nested data models while providing a readable, colorized console output.
Key Features
-
Dynamic Data Wrapping (
DDMclass):- Wraps input dictionaries into dynamic Python objects.
- Automatically assigns dictionary keys as object attributes.
- Handles nested dictionaries, lists, tuples, and other
DDMobjects. - Provides recursive serialization via
.to_dict().
-
Hierarchical Pretty Printing:
- Dynamic
__str__method generates human-readable, indented strings. - Nested
DDMobjects are automatically indented based on their level. - ANSI colors are supported for terminals (Windows, Linux, Mac).
- Keys and values are colorized for better readability.
- Dynamic
-
Subclassing for Custom Models:
- Easily extend
DDMto create application-specific data models. - Supports nested child objects as part of the parent model.
- Easily extend
-
Serialization Support:
to_dict()converts the object and all nested DDM instances into a JSON-serializable dictionary.- Ignored private attributes (those starting with
_) to avoid unnecessary clutter.
Classes
DDM: Base class for all dynamic data models.Colors: ANSI color definitions for console output (optional).- Extend
DDMto define your own structured models, e.g.Person,ClassData,UserData.
Usage Example
from YoungLion import DDM
# Define a custom model by subclassing DDM
class Child(DDM):
pass
class Person(DDM):
...