unrealon 1.0.9__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unrealon/__init__.py +23 -21
- unrealon-1.1.1.dist-info/METADATA +722 -0
- unrealon-1.1.1.dist-info/RECORD +82 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info}/WHEEL +1 -1
- unrealon-1.1.1.dist-info/entry_points.txt +9 -0
- {unrealon-1.0.9.dist-info → unrealon-1.1.1.dist-info/licenses}/LICENSE +1 -1
- unrealon_bridge/__init__.py +114 -0
- unrealon_bridge/cli.py +316 -0
- unrealon_bridge/client/__init__.py +93 -0
- unrealon_bridge/client/base.py +78 -0
- unrealon_bridge/client/commands.py +89 -0
- unrealon_bridge/client/connection.py +90 -0
- unrealon_bridge/client/events.py +65 -0
- unrealon_bridge/client/health.py +38 -0
- unrealon_bridge/client/html_parser.py +146 -0
- unrealon_bridge/client/logging.py +139 -0
- unrealon_bridge/client/proxy.py +70 -0
- unrealon_bridge/client/scheduler.py +450 -0
- unrealon_bridge/client/session.py +70 -0
- unrealon_bridge/configs/__init__.py +14 -0
- unrealon_bridge/configs/bridge_config.py +212 -0
- unrealon_bridge/configs/bridge_config.yaml +39 -0
- unrealon_bridge/models/__init__.py +138 -0
- unrealon_bridge/models/base.py +28 -0
- unrealon_bridge/models/command.py +41 -0
- unrealon_bridge/models/events.py +40 -0
- unrealon_bridge/models/html_parser.py +79 -0
- unrealon_bridge/models/logging.py +55 -0
- unrealon_bridge/models/parser.py +63 -0
- unrealon_bridge/models/proxy.py +41 -0
- unrealon_bridge/models/requests.py +95 -0
- unrealon_bridge/models/responses.py +88 -0
- unrealon_bridge/models/scheduler.py +592 -0
- unrealon_bridge/models/session.py +28 -0
- unrealon_bridge/server/__init__.py +91 -0
- unrealon_bridge/server/base.py +171 -0
- unrealon_bridge/server/handlers/__init__.py +23 -0
- unrealon_bridge/server/handlers/command.py +110 -0
- unrealon_bridge/server/handlers/html_parser.py +139 -0
- unrealon_bridge/server/handlers/logging.py +95 -0
- unrealon_bridge/server/handlers/parser.py +95 -0
- unrealon_bridge/server/handlers/proxy.py +75 -0
- unrealon_bridge/server/handlers/scheduler.py +545 -0
- unrealon_bridge/server/handlers/session.py +66 -0
- unrealon_browser/__init__.py +61 -18
- unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
- unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
- unrealon_browser/{src/core → core}/browser_manager.py +2 -2
- unrealon_browser/{src/managers → managers}/captcha.py +1 -1
- unrealon_browser/{src/managers → managers}/cookies.py +1 -1
- unrealon_browser/managers/logger_bridge.py +231 -0
- unrealon_browser/{src/managers → managers}/profile.py +1 -1
- unrealon_driver/__init__.py +73 -19
- unrealon_driver/browser/__init__.py +8 -0
- unrealon_driver/browser/config.py +74 -0
- unrealon_driver/browser/manager.py +416 -0
- unrealon_driver/exceptions.py +28 -0
- unrealon_driver/parser/__init__.py +55 -0
- unrealon_driver/parser/cli_manager.py +141 -0
- unrealon_driver/parser/daemon_manager.py +227 -0
- unrealon_driver/parser/managers/__init__.py +46 -0
- unrealon_driver/parser/managers/browser.py +51 -0
- unrealon_driver/parser/managers/config.py +281 -0
- unrealon_driver/parser/managers/error.py +412 -0
- unrealon_driver/parser/managers/html.py +732 -0
- unrealon_driver/parser/managers/logging.py +609 -0
- unrealon_driver/parser/managers/result.py +321 -0
- unrealon_driver/parser/parser_manager.py +628 -0
- unrealon/sdk_config.py +0 -88
- unrealon-1.0.9.dist-info/METADATA +0 -810
- unrealon-1.0.9.dist-info/RECORD +0 -246
- unrealon_browser/pyproject.toml +0 -182
- unrealon_browser/src/__init__.py +0 -62
- unrealon_browser/src/managers/logger_bridge.py +0 -395
- unrealon_driver/README.md +0 -204
- unrealon_driver/pyproject.toml +0 -187
- unrealon_driver/src/__init__.py +0 -90
- unrealon_driver/src/cli/__init__.py +0 -10
- unrealon_driver/src/cli/main.py +0 -66
- unrealon_driver/src/cli/simple.py +0 -510
- unrealon_driver/src/config/__init__.py +0 -11
- unrealon_driver/src/config/auto_config.py +0 -478
- unrealon_driver/src/core/__init__.py +0 -18
- unrealon_driver/src/core/exceptions.py +0 -289
- unrealon_driver/src/core/parser.py +0 -638
- unrealon_driver/src/dto/__init__.py +0 -66
- unrealon_driver/src/dto/cli.py +0 -119
- unrealon_driver/src/dto/config.py +0 -18
- unrealon_driver/src/dto/events.py +0 -237
- unrealon_driver/src/dto/execution.py +0 -313
- unrealon_driver/src/dto/services.py +0 -311
- unrealon_driver/src/execution/__init__.py +0 -23
- unrealon_driver/src/execution/daemon_mode.py +0 -317
- unrealon_driver/src/execution/interactive_mode.py +0 -88
- unrealon_driver/src/execution/modes.py +0 -45
- unrealon_driver/src/execution/scheduled_mode.py +0 -209
- unrealon_driver/src/execution/test_mode.py +0 -250
- unrealon_driver/src/logging/__init__.py +0 -24
- unrealon_driver/src/logging/driver_logger.py +0 -512
- unrealon_driver/src/services/__init__.py +0 -24
- unrealon_driver/src/services/browser_service.py +0 -726
- unrealon_driver/src/services/llm/__init__.py +0 -15
- unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
- unrealon_driver/src/services/llm/llm.py +0 -195
- unrealon_driver/src/services/logger_service.py +0 -232
- unrealon_driver/src/services/metrics_service.py +0 -185
- unrealon_driver/src/services/scheduler_service.py +0 -489
- unrealon_driver/src/services/websocket_service.py +0 -362
- unrealon_driver/src/utils/__init__.py +0 -16
- unrealon_driver/src/utils/service_factory.py +0 -317
- unrealon_driver/src/utils/time_formatter.py +0 -338
- unrealon_llm/README.md +0 -44
- unrealon_llm/__init__.py +0 -26
- unrealon_llm/pyproject.toml +0 -154
- unrealon_llm/src/__init__.py +0 -228
- unrealon_llm/src/cli/__init__.py +0 -0
- unrealon_llm/src/core/__init__.py +0 -11
- unrealon_llm/src/core/smart_client.py +0 -438
- unrealon_llm/src/dto/__init__.py +0 -155
- unrealon_llm/src/dto/models/__init__.py +0 -0
- unrealon_llm/src/dto/models/config.py +0 -343
- unrealon_llm/src/dto/models/core.py +0 -328
- unrealon_llm/src/dto/models/enums.py +0 -123
- unrealon_llm/src/dto/models/html_analysis.py +0 -345
- unrealon_llm/src/dto/models/statistics.py +0 -473
- unrealon_llm/src/dto/models/translation.py +0 -383
- unrealon_llm/src/dto/models/type_conversion.py +0 -462
- unrealon_llm/src/dto/schemas/__init__.py +0 -0
- unrealon_llm/src/exceptions.py +0 -392
- unrealon_llm/src/llm_config/__init__.py +0 -20
- unrealon_llm/src/llm_config/logging_config.py +0 -178
- unrealon_llm/src/llm_logging/__init__.py +0 -42
- unrealon_llm/src/llm_logging/llm_events.py +0 -107
- unrealon_llm/src/llm_logging/llm_logger.py +0 -466
- unrealon_llm/src/managers/__init__.py +0 -15
- unrealon_llm/src/managers/cache_manager.py +0 -67
- unrealon_llm/src/managers/cost_manager.py +0 -107
- unrealon_llm/src/managers/request_manager.py +0 -298
- unrealon_llm/src/modules/__init__.py +0 -0
- unrealon_llm/src/modules/html_processor/__init__.py +0 -25
- unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
- unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
- unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
- unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
- unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
- unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
- unrealon_llm/src/modules/html_processor/processor.py +0 -102
- unrealon_llm/src/modules/llm/__init__.py +0 -0
- unrealon_llm/src/modules/translator/__init__.py +0 -0
- unrealon_llm/src/provider.py +0 -116
- unrealon_llm/src/utils/__init__.py +0 -95
- unrealon_llm/src/utils/common.py +0 -64
- unrealon_llm/src/utils/data_extractor.py +0 -188
- unrealon_llm/src/utils/html_cleaner.py +0 -767
- unrealon_llm/src/utils/language_detector.py +0 -308
- unrealon_llm/src/utils/models_cache.py +0 -592
- unrealon_llm/src/utils/smart_counter.py +0 -229
- unrealon_llm/src/utils/token_counter.py +0 -189
- unrealon_sdk/README.md +0 -25
- unrealon_sdk/__init__.py +0 -30
- unrealon_sdk/pyproject.toml +0 -231
- unrealon_sdk/src/__init__.py +0 -150
- unrealon_sdk/src/cli/__init__.py +0 -12
- unrealon_sdk/src/cli/commands/__init__.py +0 -22
- unrealon_sdk/src/cli/commands/benchmark.py +0 -42
- unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
- unrealon_sdk/src/cli/commands/health.py +0 -46
- unrealon_sdk/src/cli/commands/integration.py +0 -498
- unrealon_sdk/src/cli/commands/reports.py +0 -43
- unrealon_sdk/src/cli/commands/security.py +0 -36
- unrealon_sdk/src/cli/commands/server.py +0 -483
- unrealon_sdk/src/cli/commands/servers.py +0 -56
- unrealon_sdk/src/cli/commands/tests.py +0 -55
- unrealon_sdk/src/cli/main.py +0 -126
- unrealon_sdk/src/cli/utils/reporter.py +0 -519
- unrealon_sdk/src/clients/openapi.yaml +0 -3347
- unrealon_sdk/src/clients/python_http/__init__.py +0 -3
- unrealon_sdk/src/clients/python_http/api_config.py +0 -228
- unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
- unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
- unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
- unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
- unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
- unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
- unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
- unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
- unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
- unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
- unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
- unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
- unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
- unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
- unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
- unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
- unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
- unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
- unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
- unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
- unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
- unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
- unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
- unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
- unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
- unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
- unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
- unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
- unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
- unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
- unrealon_sdk/src/clients/python_websocket/client.py +0 -490
- unrealon_sdk/src/clients/python_websocket/events.py +0 -732
- unrealon_sdk/src/clients/python_websocket/example.py +0 -136
- unrealon_sdk/src/clients/python_websocket/types.py +0 -871
- unrealon_sdk/src/core/__init__.py +0 -64
- unrealon_sdk/src/core/client.py +0 -556
- unrealon_sdk/src/core/config.py +0 -465
- unrealon_sdk/src/core/exceptions.py +0 -239
- unrealon_sdk/src/core/metadata.py +0 -191
- unrealon_sdk/src/core/models.py +0 -142
- unrealon_sdk/src/core/types.py +0 -68
- unrealon_sdk/src/dto/__init__.py +0 -268
- unrealon_sdk/src/dto/authentication.py +0 -108
- unrealon_sdk/src/dto/cache.py +0 -208
- unrealon_sdk/src/dto/common.py +0 -19
- unrealon_sdk/src/dto/concurrency.py +0 -393
- unrealon_sdk/src/dto/events.py +0 -108
- unrealon_sdk/src/dto/health.py +0 -339
- unrealon_sdk/src/dto/load_balancing.py +0 -336
- unrealon_sdk/src/dto/logging.py +0 -230
- unrealon_sdk/src/dto/performance.py +0 -165
- unrealon_sdk/src/dto/rate_limiting.py +0 -295
- unrealon_sdk/src/dto/resource_pooling.py +0 -128
- unrealon_sdk/src/dto/structured_logging.py +0 -112
- unrealon_sdk/src/dto/task_scheduling.py +0 -121
- unrealon_sdk/src/dto/websocket.py +0 -55
- unrealon_sdk/src/enterprise/__init__.py +0 -59
- unrealon_sdk/src/enterprise/authentication.py +0 -401
- unrealon_sdk/src/enterprise/cache_manager.py +0 -578
- unrealon_sdk/src/enterprise/error_recovery.py +0 -494
- unrealon_sdk/src/enterprise/event_system.py +0 -549
- unrealon_sdk/src/enterprise/health_monitor.py +0 -747
- unrealon_sdk/src/enterprise/load_balancer.py +0 -964
- unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
- unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
- unrealon_sdk/src/enterprise/logging/development.py +0 -744
- unrealon_sdk/src/enterprise/logging/service.py +0 -410
- unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
- unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
- unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
- unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
- unrealon_sdk/src/enterprise/resource_pool.py +0 -763
- unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
- unrealon_sdk/src/internal/__init__.py +0 -10
- unrealon_sdk/src/internal/command_router.py +0 -497
- unrealon_sdk/src/internal/connection_manager.py +0 -397
- unrealon_sdk/src/internal/http_client.py +0 -446
- unrealon_sdk/src/internal/websocket_client.py +0 -420
- unrealon_sdk/src/provider.py +0 -471
- unrealon_sdk/src/utils.py +0 -234
- /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
- /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
- /unrealon_browser/{src/cli → cli}/main.py +0 -0
- /unrealon_browser/{src/core → core}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
- /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
- /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Time Formatter Utility - UnrealOn Driver v3.0
|
|
3
|
-
|
|
4
|
-
Beautiful time formatting for CLI applications with HH:MM:SS display,
|
|
5
|
-
duration calculations, and human-readable intervals.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import asyncio
|
|
9
|
-
import time
|
|
10
|
-
from datetime import datetime, timedelta
|
|
11
|
-
from typing import Optional, Union
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class TimeFormatter:
|
|
15
|
-
"""
|
|
16
|
-
Beautiful time formatting utility for CLI applications.
|
|
17
|
-
|
|
18
|
-
Features:
|
|
19
|
-
- HH:MM:SS format display
|
|
20
|
-
- Duration calculations
|
|
21
|
-
- Human-readable intervals
|
|
22
|
-
- Elapsed time tracking
|
|
23
|
-
- Next run time display
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
@staticmethod
|
|
27
|
-
def format_duration(seconds: Union[int, float]) -> str:
|
|
28
|
-
"""
|
|
29
|
-
Format duration in HH:MM:SS format.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
seconds: Duration in seconds
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
Formatted string like "01:23:45" or "00:05:30"
|
|
36
|
-
"""
|
|
37
|
-
if seconds < 0:
|
|
38
|
-
return "00:00:00"
|
|
39
|
-
|
|
40
|
-
hours = int(seconds // 3600)
|
|
41
|
-
minutes = int((seconds % 3600) // 60)
|
|
42
|
-
secs = int(seconds % 60)
|
|
43
|
-
|
|
44
|
-
return f"{hours:02d}:{minutes:02d}:{secs:02d}"
|
|
45
|
-
|
|
46
|
-
@staticmethod
|
|
47
|
-
def format_time(dt: Optional[datetime] = None) -> str:
|
|
48
|
-
"""
|
|
49
|
-
Format datetime in HH:MM:SS format.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
dt: Datetime object (current time if None)
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
Time string like "14:30:45"
|
|
56
|
-
"""
|
|
57
|
-
if dt is None:
|
|
58
|
-
dt = datetime.now()
|
|
59
|
-
return dt.strftime("%H:%M:%S")
|
|
60
|
-
|
|
61
|
-
@staticmethod
|
|
62
|
-
def format_datetime(dt: Optional[datetime] = None) -> str:
|
|
63
|
-
"""
|
|
64
|
-
Format datetime in full format.
|
|
65
|
-
|
|
66
|
-
Args:
|
|
67
|
-
dt: Datetime object (current time if None)
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
Full datetime string like "2024-01-15 14:30:45"
|
|
71
|
-
"""
|
|
72
|
-
if dt is None:
|
|
73
|
-
dt = datetime.now()
|
|
74
|
-
return dt.strftime("%Y-%m-%d %H:%M:%S")
|
|
75
|
-
|
|
76
|
-
@staticmethod
|
|
77
|
-
def parse_interval(interval: str) -> int:
|
|
78
|
-
"""
|
|
79
|
-
Parse human-readable interval to seconds.
|
|
80
|
-
|
|
81
|
-
Args:
|
|
82
|
-
interval: Human-readable interval like "30m", "1h", "daily"
|
|
83
|
-
|
|
84
|
-
Returns:
|
|
85
|
-
Interval in seconds
|
|
86
|
-
|
|
87
|
-
Raises:
|
|
88
|
-
ValueError: If interval format is invalid
|
|
89
|
-
"""
|
|
90
|
-
interval = interval.lower().strip()
|
|
91
|
-
|
|
92
|
-
# Natural language
|
|
93
|
-
interval_map = {
|
|
94
|
-
"minutely": 60,
|
|
95
|
-
"hourly": 3600,
|
|
96
|
-
"daily": 86400,
|
|
97
|
-
"weekly": 604800,
|
|
98
|
-
"monthly": 2592000, # 30 days
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if interval in interval_map:
|
|
102
|
-
return interval_map[interval]
|
|
103
|
-
|
|
104
|
-
# Time units with numbers
|
|
105
|
-
if interval.endswith('s'):
|
|
106
|
-
return int(interval[:-1])
|
|
107
|
-
elif interval.endswith('m'):
|
|
108
|
-
return int(interval[:-1]) * 60
|
|
109
|
-
elif interval.endswith('h'):
|
|
110
|
-
return int(interval[:-1]) * 3600
|
|
111
|
-
elif interval.endswith('d'):
|
|
112
|
-
return int(interval[:-1]) * 86400
|
|
113
|
-
elif interval.endswith('w'):
|
|
114
|
-
return int(interval[:-1]) * 604800
|
|
115
|
-
elif interval.endswith('mo'):
|
|
116
|
-
return int(interval[:-2]) * 2592000
|
|
117
|
-
|
|
118
|
-
# Try parsing as plain seconds
|
|
119
|
-
try:
|
|
120
|
-
return int(interval)
|
|
121
|
-
except ValueError:
|
|
122
|
-
raise ValueError(f"Invalid interval format: {interval}")
|
|
123
|
-
|
|
124
|
-
@staticmethod
|
|
125
|
-
def format_interval(seconds: int) -> str:
|
|
126
|
-
"""
|
|
127
|
-
Format seconds back to human-readable interval.
|
|
128
|
-
|
|
129
|
-
Args:
|
|
130
|
-
seconds: Interval in seconds
|
|
131
|
-
|
|
132
|
-
Returns:
|
|
133
|
-
Human-readable string like "30m", "2h", "1d"
|
|
134
|
-
"""
|
|
135
|
-
if seconds < 60:
|
|
136
|
-
return f"{seconds}s"
|
|
137
|
-
elif seconds < 3600:
|
|
138
|
-
return f"{seconds // 60}m"
|
|
139
|
-
elif seconds < 86400:
|
|
140
|
-
return f"{seconds // 3600}h"
|
|
141
|
-
elif seconds < 604800:
|
|
142
|
-
return f"{seconds // 86400}d"
|
|
143
|
-
else:
|
|
144
|
-
return f"{seconds // 604800}w"
|
|
145
|
-
|
|
146
|
-
@staticmethod
|
|
147
|
-
def time_until(target_time: datetime) -> str:
|
|
148
|
-
"""
|
|
149
|
-
Calculate time remaining until target time.
|
|
150
|
-
|
|
151
|
-
Args:
|
|
152
|
-
target_time: Target datetime
|
|
153
|
-
|
|
154
|
-
Returns:
|
|
155
|
-
Time remaining in HH:MM:SS format
|
|
156
|
-
"""
|
|
157
|
-
now = datetime.now()
|
|
158
|
-
if target_time <= now:
|
|
159
|
-
return "00:00:00"
|
|
160
|
-
|
|
161
|
-
diff = target_time - now
|
|
162
|
-
return TimeFormatter.format_duration(diff.total_seconds())
|
|
163
|
-
|
|
164
|
-
@staticmethod
|
|
165
|
-
def elapsed_since(start_time: float) -> str:
|
|
166
|
-
"""
|
|
167
|
-
Calculate elapsed time since start timestamp.
|
|
168
|
-
|
|
169
|
-
Args:
|
|
170
|
-
start_time: Start timestamp from time.time()
|
|
171
|
-
|
|
172
|
-
Returns:
|
|
173
|
-
Elapsed time in HH:MM:SS format
|
|
174
|
-
"""
|
|
175
|
-
elapsed = time.time() - start_time
|
|
176
|
-
return TimeFormatter.format_duration(elapsed)
|
|
177
|
-
|
|
178
|
-
@staticmethod
|
|
179
|
-
async def countdown_sleep(duration_seconds: int, callback=None, interval: float = 1.0):
|
|
180
|
-
"""
|
|
181
|
-
Sleep with live countdown display that updates in place.
|
|
182
|
-
|
|
183
|
-
Args:
|
|
184
|
-
duration_seconds: Total sleep duration in seconds
|
|
185
|
-
callback: Optional callback function to call with remaining time
|
|
186
|
-
interval: Update interval in seconds (default 1.0)
|
|
187
|
-
"""
|
|
188
|
-
import sys
|
|
189
|
-
|
|
190
|
-
slept = 0
|
|
191
|
-
while slept < duration_seconds:
|
|
192
|
-
remaining = duration_seconds - slept
|
|
193
|
-
|
|
194
|
-
if remaining > 0 and callback:
|
|
195
|
-
remaining_time = TimeFormatter.format_duration(remaining)
|
|
196
|
-
current_time = TimeFormatter.format_time()
|
|
197
|
-
# Use \r to return to beginning of line and overwrite
|
|
198
|
-
callback(current_time, remaining_time, remaining, update_in_place=True)
|
|
199
|
-
|
|
200
|
-
sleep_chunk = min(interval, duration_seconds - slept)
|
|
201
|
-
await asyncio.sleep(sleep_chunk)
|
|
202
|
-
slept += sleep_chunk
|
|
203
|
-
|
|
204
|
-
# Print newline after countdown finishes
|
|
205
|
-
if callback:
|
|
206
|
-
print() # Move to next line when done
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
class ScheduleTimer:
|
|
210
|
-
"""
|
|
211
|
-
Timer for scheduled operations with beautiful display.
|
|
212
|
-
|
|
213
|
-
Features:
|
|
214
|
-
- Real-time countdown
|
|
215
|
-
- Elapsed time tracking
|
|
216
|
-
- Next run calculation
|
|
217
|
-
- Progress display
|
|
218
|
-
"""
|
|
219
|
-
|
|
220
|
-
def __init__(self, interval: str):
|
|
221
|
-
"""
|
|
222
|
-
Initialize timer with interval.
|
|
223
|
-
|
|
224
|
-
Args:
|
|
225
|
-
interval: Human-readable interval like "30m"
|
|
226
|
-
"""
|
|
227
|
-
self.interval = interval
|
|
228
|
-
self.interval_seconds = TimeFormatter.parse_interval(interval)
|
|
229
|
-
self.start_time = time.time()
|
|
230
|
-
self.last_run = None
|
|
231
|
-
self.next_run = None
|
|
232
|
-
self.run_count = 0
|
|
233
|
-
|
|
234
|
-
def start_run(self):
|
|
235
|
-
"""Mark start of new run."""
|
|
236
|
-
self.last_run = datetime.now()
|
|
237
|
-
self.next_run = self.last_run + timedelta(seconds=self.interval_seconds)
|
|
238
|
-
self.run_count += 1
|
|
239
|
-
|
|
240
|
-
def get_elapsed_total(self) -> str:
|
|
241
|
-
"""Get total elapsed time since timer start."""
|
|
242
|
-
return TimeFormatter.elapsed_since(self.start_time)
|
|
243
|
-
|
|
244
|
-
def get_time_until_next(self) -> str:
|
|
245
|
-
"""Get time remaining until next run."""
|
|
246
|
-
if self.next_run is None:
|
|
247
|
-
return "00:00:00"
|
|
248
|
-
return TimeFormatter.time_until(self.next_run)
|
|
249
|
-
|
|
250
|
-
def get_next_run_time(self) -> str:
|
|
251
|
-
"""Get next run time formatted."""
|
|
252
|
-
if self.next_run is None:
|
|
253
|
-
return "Not scheduled"
|
|
254
|
-
return TimeFormatter.format_datetime(self.next_run)
|
|
255
|
-
|
|
256
|
-
def get_status_display(self) -> str:
|
|
257
|
-
"""
|
|
258
|
-
Get beautiful status display.
|
|
259
|
-
|
|
260
|
-
Returns:
|
|
261
|
-
Multi-line status string with timer info
|
|
262
|
-
"""
|
|
263
|
-
lines = [
|
|
264
|
-
f"⏱️ Interval: {self.interval} ({TimeFormatter.format_interval(self.interval_seconds)})",
|
|
265
|
-
f"🔄 Runs completed: {self.run_count}",
|
|
266
|
-
f"⏰ Total elapsed: {self.get_elapsed_total()}",
|
|
267
|
-
]
|
|
268
|
-
|
|
269
|
-
if self.next_run:
|
|
270
|
-
lines.extend([
|
|
271
|
-
f"🕐 Next run at: {TimeFormatter.format_time(self.next_run)}",
|
|
272
|
-
f"⏳ Time remaining: {self.get_time_until_next()}",
|
|
273
|
-
])
|
|
274
|
-
|
|
275
|
-
return "\n".join(lines)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
class DaemonTimer:
|
|
279
|
-
"""
|
|
280
|
-
Timer for daemon operations with uptime tracking.
|
|
281
|
-
|
|
282
|
-
Features:
|
|
283
|
-
- Uptime display
|
|
284
|
-
- Heartbeat counting
|
|
285
|
-
- Status monitoring
|
|
286
|
-
- Connection time tracking
|
|
287
|
-
"""
|
|
288
|
-
|
|
289
|
-
def __init__(self):
|
|
290
|
-
"""Initialize daemon timer."""
|
|
291
|
-
self.start_time = time.time()
|
|
292
|
-
self.heartbeat_count = 0
|
|
293
|
-
self.last_heartbeat = None
|
|
294
|
-
self.connection_time = None
|
|
295
|
-
|
|
296
|
-
def heartbeat(self):
|
|
297
|
-
"""Record heartbeat."""
|
|
298
|
-
self.heartbeat_count += 1
|
|
299
|
-
self.last_heartbeat = datetime.now()
|
|
300
|
-
|
|
301
|
-
def connect(self):
|
|
302
|
-
"""Mark connection established."""
|
|
303
|
-
self.connection_time = datetime.now()
|
|
304
|
-
|
|
305
|
-
def get_uptime(self) -> str:
|
|
306
|
-
"""Get daemon uptime."""
|
|
307
|
-
return TimeFormatter.elapsed_since(self.start_time)
|
|
308
|
-
|
|
309
|
-
def get_connection_duration(self) -> str:
|
|
310
|
-
"""Get connection duration."""
|
|
311
|
-
if self.connection_time is None:
|
|
312
|
-
return "Not connected"
|
|
313
|
-
|
|
314
|
-
elapsed = time.time() - self.connection_time.timestamp()
|
|
315
|
-
return TimeFormatter.format_duration(elapsed)
|
|
316
|
-
|
|
317
|
-
def get_status_display(self) -> str:
|
|
318
|
-
"""
|
|
319
|
-
Get beautiful daemon status display.
|
|
320
|
-
|
|
321
|
-
Returns:
|
|
322
|
-
Multi-line status string with daemon info
|
|
323
|
-
"""
|
|
324
|
-
lines = [
|
|
325
|
-
f"⏰ Uptime: {self.get_uptime()}",
|
|
326
|
-
f"💓 Heartbeats: {self.heartbeat_count}",
|
|
327
|
-
]
|
|
328
|
-
|
|
329
|
-
if self.last_heartbeat:
|
|
330
|
-
lines.append(f"🕐 Last heartbeat: {TimeFormatter.format_time(self.last_heartbeat)}")
|
|
331
|
-
|
|
332
|
-
if self.connection_time:
|
|
333
|
-
lines.extend([
|
|
334
|
-
f"🔌 Connected at: {TimeFormatter.format_time(self.connection_time)}",
|
|
335
|
-
f"📡 Connection time: {self.get_connection_duration()}",
|
|
336
|
-
])
|
|
337
|
-
|
|
338
|
-
return "\n".join(lines)
|
unrealon_llm/README.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# UnrealOn LLM SDK
|
|
2
|
-
|
|
3
|
-
AI-powered modular platform for content processing with cost control and accuracy guarantees.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Universal LLM Client**: Support for OpenRouter, OpenAI, Anthropic
|
|
8
|
-
- **HTML Pattern Detection**: AI-powered analysis and selector generation
|
|
9
|
-
- **Smart Translation**: Language detection with caching
|
|
10
|
-
- **JSON Processing**: Intelligent data transformation
|
|
11
|
-
- **Type Generation**: Pydantic and TypeScript schema creation
|
|
12
|
-
- **Cost Control**: Real-time budget tracking and limits
|
|
13
|
-
- **Type Safety**: 100% Pydantic v2 compliance
|
|
14
|
-
|
|
15
|
-
## Quick Start
|
|
16
|
-
|
|
17
|
-
```python
|
|
18
|
-
from unrealon_llm import UnrealOnLLM, LLMConfig
|
|
19
|
-
|
|
20
|
-
# Initialize with API keys
|
|
21
|
-
config = LLMConfig(
|
|
22
|
-
openrouter_api_key="sk-or-v1-...",
|
|
23
|
-
daily_cost_limit_usd=10.0
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
llm = UnrealOnLLM(config)
|
|
27
|
-
|
|
28
|
-
# Analyze HTML and generate selectors
|
|
29
|
-
result = await llm.process_html_to_types(
|
|
30
|
-
html_content="<div class='product'>...</div>",
|
|
31
|
-
target_elements=["title", "price"],
|
|
32
|
-
target_language="en"
|
|
33
|
-
)
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pip install unrealon-llm
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Documentation
|
|
43
|
-
|
|
44
|
-
See the full documentation in the `@docs` directory.
|
unrealon_llm/__init__.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
🤖 UnrealOn LLM v1.0 - Large Language Model Integration
|
|
3
|
-
|
|
4
|
-
Advanced LLM integration tools for AI-powered parsing and data processing.
|
|
5
|
-
Service-based architecture following KISS principles.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
# Import everything from src
|
|
9
|
-
from .src import *
|
|
10
|
-
|
|
11
|
-
# Description
|
|
12
|
-
__description__ = "Large Language Model integration tools for UnrealOn SDK"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# Import from centralized config
|
|
16
|
-
from unrealon.sdk_config import (
|
|
17
|
-
VERSION as __version__,
|
|
18
|
-
AUTHOR as __author__,
|
|
19
|
-
AUTHOR_EMAIL as __email__,
|
|
20
|
-
LICENSE as __license__,
|
|
21
|
-
PROJECT_URL as __url__,
|
|
22
|
-
VERSION_INFO,
|
|
23
|
-
PROJECT_INFO,
|
|
24
|
-
get_version,
|
|
25
|
-
is_debug_mode,
|
|
26
|
-
)
|
unrealon_llm/pyproject.toml
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "unrealon-llm"
|
|
3
|
-
version = "2.0.0"
|
|
4
|
-
description = "UnrealOn LLM - Modular AI-Powered Processing Platform for HTML analysis, translation, and type conversion"
|
|
5
|
-
authors = ["UnrealOn Team <dev@unrealon.com>"]
|
|
6
|
-
license = "MIT"
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
homepage = "https://github.com/unrealon/unrealon-llm"
|
|
9
|
-
repository = "https://github.com/unrealon/unrealon-llm"
|
|
10
|
-
documentation = "https://docs.unrealon.com/llm"
|
|
11
|
-
keywords = ["llm", "ai", "html-analysis", "translation", "openrouter", "claude", "gpt"]
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Development Status :: 4 - Beta",
|
|
14
|
-
"Intended Audience :: Developers",
|
|
15
|
-
"License :: OSI Approved :: MIT License",
|
|
16
|
-
"Programming Language :: Python :: 3",
|
|
17
|
-
"Programming Language :: Python :: 3.8",
|
|
18
|
-
"Programming Language :: Python :: 3.9",
|
|
19
|
-
"Programming Language :: Python :: 3.10",
|
|
20
|
-
"Programming Language :: Python :: 3.11",
|
|
21
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
-
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
23
|
-
"Topic :: Text Processing :: Linguistic",
|
|
24
|
-
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
25
|
-
]
|
|
26
|
-
packages = [{include = "*", from = "src"}]
|
|
27
|
-
|
|
28
|
-
[tool.poetry.dependencies]
|
|
29
|
-
python = "^3.9"
|
|
30
|
-
pydantic = "^2.0.0"
|
|
31
|
-
aiohttp = "^3.8.0"
|
|
32
|
-
beautifulsoup4 = "^4.12.0"
|
|
33
|
-
openai = "^1.0.0"
|
|
34
|
-
tiktoken = "^0.9.0"
|
|
35
|
-
fast-langdetect = "^0.3.2"
|
|
36
|
-
langid = "^1.1.6"
|
|
37
|
-
langdetect = "^1.0.9"
|
|
38
|
-
cachetools = "^5.3.0"
|
|
39
|
-
python-dotenv = "^1.0.0"
|
|
40
|
-
|
|
41
|
-
[tool.poetry.group.dev.dependencies]
|
|
42
|
-
pytest = "^7.4.0"
|
|
43
|
-
pytest-asyncio = "^0.21.0"
|
|
44
|
-
pytest-cov = "^4.1.0"
|
|
45
|
-
pytest-mock = "^3.11.0"
|
|
46
|
-
aioresponses = "^0.7.4"
|
|
47
|
-
black = "^23.7.0"
|
|
48
|
-
isort = "^5.12.0"
|
|
49
|
-
mypy = "^1.5.0"
|
|
50
|
-
flake8 = "^6.0.0"
|
|
51
|
-
pre-commit = "^3.3.0"
|
|
52
|
-
|
|
53
|
-
[tool.poetry.group.test.dependencies]
|
|
54
|
-
pytest-benchmark = "^4.0.0"
|
|
55
|
-
pytest-xdist = "^3.3.0"
|
|
56
|
-
pytest-html = "^3.2.0"
|
|
57
|
-
factory-boy = "^3.3.0"
|
|
58
|
-
freezegun = "^1.2.0"
|
|
59
|
-
|
|
60
|
-
[tool.poetry.group.docs.dependencies]
|
|
61
|
-
mkdocs = "^1.5.0"
|
|
62
|
-
mkdocs-material = "^9.1.0"
|
|
63
|
-
mkdocs-mermaid2-plugin = "^1.1.0"
|
|
64
|
-
|
|
65
|
-
[tool.poetry.scripts]
|
|
66
|
-
unrealon-llm = "unrealon_llm.cli.main:main"
|
|
67
|
-
|
|
68
|
-
[build-system]
|
|
69
|
-
requires = ["poetry-core"]
|
|
70
|
-
build-backend = "poetry.core.masonry.api"
|
|
71
|
-
|
|
72
|
-
[tool.pytest.ini_options]
|
|
73
|
-
minversion = "7.0"
|
|
74
|
-
addopts = "-ra -q --strict-markers --disable-warnings"
|
|
75
|
-
testpaths = ["tests"]
|
|
76
|
-
markers = [
|
|
77
|
-
"unit: Unit tests",
|
|
78
|
-
"integration: Integration tests",
|
|
79
|
-
"performance: Performance tests",
|
|
80
|
-
"real_api: Tests that use real APIs (cost money)",
|
|
81
|
-
"mock_only: Tests that only use mocks",
|
|
82
|
-
"ai_validation: AI output quality tests",
|
|
83
|
-
"cost_controlled: Tests with cost limits",
|
|
84
|
-
]
|
|
85
|
-
asyncio_mode = "auto"
|
|
86
|
-
|
|
87
|
-
[tool.coverage.run]
|
|
88
|
-
source = ["unrealon_llm"]
|
|
89
|
-
omit = [
|
|
90
|
-
"*/tests/*",
|
|
91
|
-
"*/test_*",
|
|
92
|
-
"*/__pycache__/*",
|
|
93
|
-
"*/migrations/*",
|
|
94
|
-
]
|
|
95
|
-
|
|
96
|
-
[tool.coverage.report]
|
|
97
|
-
exclude_lines = [
|
|
98
|
-
"pragma: no cover",
|
|
99
|
-
"def __repr__",
|
|
100
|
-
"if self.debug:",
|
|
101
|
-
"if settings.DEBUG",
|
|
102
|
-
"raise AssertionError",
|
|
103
|
-
"raise NotImplementedError",
|
|
104
|
-
"if 0:",
|
|
105
|
-
"if __name__ == .__main__.:",
|
|
106
|
-
"class .*\\bProtocol\\):",
|
|
107
|
-
"@(abc\\.)?abstractmethod",
|
|
108
|
-
]
|
|
109
|
-
|
|
110
|
-
[tool.black]
|
|
111
|
-
line-length = 88
|
|
112
|
-
target-version = ['py38', 'py39', 'py310', 'py311']
|
|
113
|
-
include = '\.pyi?$'
|
|
114
|
-
extend-exclude = '''
|
|
115
|
-
/(
|
|
116
|
-
\.eggs
|
|
117
|
-
| \.git
|
|
118
|
-
| \.hg
|
|
119
|
-
| \.mypy_cache
|
|
120
|
-
| \.tox
|
|
121
|
-
| \.venv
|
|
122
|
-
| _build
|
|
123
|
-
| buck-out
|
|
124
|
-
| build
|
|
125
|
-
| dist
|
|
126
|
-
)/
|
|
127
|
-
'''
|
|
128
|
-
|
|
129
|
-
[tool.isort]
|
|
130
|
-
profile = "black"
|
|
131
|
-
multi_line_output = 3
|
|
132
|
-
line_length = 88
|
|
133
|
-
known_first_party = ["unrealon_llm"]
|
|
134
|
-
|
|
135
|
-
[tool.mypy]
|
|
136
|
-
python_version = "3.8"
|
|
137
|
-
check_untyped_defs = true
|
|
138
|
-
disallow_untyped_defs = true
|
|
139
|
-
disallow_incomplete_defs = true
|
|
140
|
-
disallow_untyped_decorators = true
|
|
141
|
-
no_implicit_optional = true
|
|
142
|
-
warn_return_any = true
|
|
143
|
-
warn_unused_ignores = true
|
|
144
|
-
warn_redundant_casts = true
|
|
145
|
-
strict_equality = true
|
|
146
|
-
|
|
147
|
-
[[tool.mypy.overrides]]
|
|
148
|
-
module = [
|
|
149
|
-
"langdetect.*",
|
|
150
|
-
"tiktoken.*",
|
|
151
|
-
"beautifulsoup4.*",
|
|
152
|
-
"bs4.*",
|
|
153
|
-
]
|
|
154
|
-
ignore_missing_imports = true
|