-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
154 lines (125 loc) · 4.57 KB
/
__init__.py
File metadata and controls
154 lines (125 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
"""
Voodoo Box - Modular Utility Collection
=============================================
A comprehensive collection of reusable utilities extracted from extendo and NadeStacked projects.
Organized into functional modules for maximum code reusability across different projects.
Project Philosophy:
- Modular: Each module focuses on a specific domain
- Reusable: Code designed for use across multiple projects
- Well-documented: Clear usage examples and integration patterns
- Robust: Comprehensive error handling and logging
- Performance-oriented: Caching and optimization utilities included
"""
# Version information
__version__ = "1.0.0"
__author__ = "Extracted from extendo and NadeStacked projects"
# Import main utility classes for easy access
from .utils.logging import LoggerSetup, setup_project_logging
from .utils.caching import TimedLRUCache, simple_cache
from .utils.error_handling import ErrorHandler, retry_with_backoff, CircuitBreaker
# Define what gets imported with "from voodoo_box import *"
__all__ = [
# API utilities
'FaceitClient',
'BaseAPIClient',
# Data processing
'StatsAggregator',
'DataCleaner',
'DataNormalizer',
# File management
'FileManager',
'JSONHandler',
'OutputManager',
# Gaming utilities
'DemoPositionAnalyzer',
# Cross-cutting utilities
'LoggerSetup',
'setup_project_logging',
'TimedLRUCache',
'simple_cache',
'ErrorHandler',
'retry_with_backoff',
'CircuitBreaker',
]
# Module imports (these will be available when importing the package)
try:
from .api.faceit_client import FaceitClient
from .api.base_client import BaseAPIClient
except ImportError:
pass
try:
from .data.stats_aggregators import StatsAggregator
from .data.transformers import DataCleaner, DataNormalizer
except ImportError:
pass
try:
from .files.file_manager import FileManager, JSONHandler, OutputManager
except ImportError:
pass
try:
from .gaming.demo_analyzer import DemoPositionAnalyzer
except ImportError:
pass
def get_module_info():
"""Get information about available modules and their status."""
modules = {
'api': 'Faceit API client and generic HTTP utilities',
'data': 'Data processing, aggregation, and transformation utilities',
'files': 'File management, JSON handling, and output organization',
'web': 'Browser extension utilities and DOM manipulation',
'gaming': 'CS2 demo analysis and gaming-specific utilities',
'utils': 'Cross-cutting utilities (logging, caching, error handling)'
}
available_modules = {}
for module_name, description in modules.items():
try:
__import__(f'voodoo_box.{module_name}')
available_modules[module_name] = {
'description': description,
'status': 'available'
}
except ImportError as e:
available_modules[module_name] = {
'description': description,
'status': f'unavailable ({str(e)})'
}
return available_modules
def print_module_status():
"""Print the status of all modules."""
print(f"Voodoo Box v{__version__}")
print("=" * 50)
modules = get_module_info()
for name, info in modules.items():
status_indicator = "[+]" if info['status'] == 'available' else "[-]"
print(f"{status_indicator} {name:10} - {info['description']}")
if info['status'] != 'available':
print(f" Status: {info['status']}")
# Quick setup function for common usage patterns
def quick_setup(project_name: str, enable_debug: bool = False):
"""
Quick setup for common voodoo-box usage patterns.
Args:
project_name: Name of your project
enable_debug: Whether to enable debug logging
Returns:
Dictionary with commonly used utilities
"""
# Set up logging
loggers = setup_project_logging(project_name, debug=enable_debug)
# Set up error handler
error_handler = ErrorHandler(loggers['main'])
return {
'loggers': loggers,
'logger': loggers['main'], # Main logger for convenience
'error_handler': error_handler,
'cache': TimedLRUCache, # Cache decorator
'retry': retry_with_backoff, # Retry decorator
}
if __name__ == "__main__":
print_module_status()
# Example usage
print("\nExample usage:")
print("from voodoo_box import quick_setup")
print("utils = quick_setup('my_project')")
print("logger = utils['logger']")
print("logger.info('Project started')")