refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
2
dev/cache/.pytest_cache/.gitignore
vendored
Executable file
2
dev/cache/.pytest_cache/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
# Created by pytest automatically.
|
||||
*
|
||||
4
dev/cache/.pytest_cache/CACHEDIR.TAG
vendored
Executable file
4
dev/cache/.pytest_cache/CACHEDIR.TAG
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by pytest.
|
||||
# For information about cache directory tags, see:
|
||||
# https://bford.info/cachedir/spec.html
|
||||
8
dev/cache/.pytest_cache/README.md
vendored
Executable file
8
dev/cache/.pytest_cache/README.md
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
# pytest cache directory #
|
||||
|
||||
This directory contains data from the pytest's cache plugin,
|
||||
which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
|
||||
|
||||
**Do not** commit this to version control.
|
||||
|
||||
See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
|
||||
647
dev/cache/.pytest_cache/v/cache/lastfailed
vendored
Executable file
647
dev/cache/.pytest_cache/v/cache/lastfailed
vendored
Executable file
@@ -0,0 +1,647 @@
|
||||
{
|
||||
"tests/e2e/test_user_scenarios.py": true,
|
||||
"tests/e2e/test_wallet_daemon.py": true,
|
||||
"tests/integration/test_blockchain_node.py": true,
|
||||
"tests/unit/test_blockchain_node.py": true,
|
||||
"tests/unit/test_coordinator_api.py": true,
|
||||
"tests/unit/test_wallet_daemon.py": true,
|
||||
"tests/test_blockchain_nodes.py::test_node_connectivity": true,
|
||||
"tests/test_blockchain_nodes.py::test_chain_consistency": true,
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_validator_details": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_run_workflow": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_load_test": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_scenario_list": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_run_scenario": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_results": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_reset": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_api_error_handling": true,
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_nonexistent_commands": true,
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_register_and_list": true,
|
||||
"tests/integration/test_full_workflow.py::TestSecurityIntegration::test_end_to_end_encryption": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_client_receipts.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_confidential_transactions.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_exchange.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_gpu_marketplace.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_jobs.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_marketplace.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_miner_service.py": true,
|
||||
"AITBC/apps/coordinator-api/tests/test_zk_proofs.py": true,
|
||||
"AITBC/apps/pool-hub/tests": true,
|
||||
"AITBC/apps/wallet-daemon/tests/test_ledger.py": true,
|
||||
"AITBC/apps/wallet-daemon/tests/test_receipts.py": true,
|
||||
"AITBC/apps/wallet-daemon/tests/test_wallet_api.py": true,
|
||||
"AITBC/scripts/dev/ws_load_test.py": true,
|
||||
"AITBC/tests/cli/test_cli_integration.py": true,
|
||||
"AITBC/tests/e2e/test_user_scenarios.py": true,
|
||||
"AITBC/tests/e2e/test_wallet_daemon.py": true,
|
||||
"AITBC/tests/integration/test_blockchain_node.py": true,
|
||||
"AITBC/tests/security/test_confidential_transactions.py": true,
|
||||
"AITBC/tests/security/test_security_comprehensive.py": true,
|
||||
"AITBC/tests/unit/test_blockchain_node.py": true,
|
||||
"AITBC/tests/unit/test_coordinator_api.py": true,
|
||||
"AITBC/tests/unit/test_wallet_daemon.py": true,
|
||||
"cli/miner_gpu_test.py::test_miner_registration": true,
|
||||
"cli/miner_gpu_test.py::test_job_processing": true,
|
||||
"cli/miner_gpu_test.py::test_gpu_heartbeat": true,
|
||||
"cli/test_exchange_e2e.py::test_basic_exchange_workflow": true,
|
||||
"cli/test_exchange_e2e.py::test_market_statistics": true,
|
||||
"cli/test_exchange_e2e.py::test_wallet_operations": true,
|
||||
"cli/test_exchange_e2e.py::test_multiple_payments_scenario": true,
|
||||
"cli/test_exchange_e2e.py::test_error_scenarios": true,
|
||||
"cli/test_gpu_marketplace_bids.py::test_basic_workflow": true,
|
||||
"cli/test_gpu_marketplace_bids.py::test_competitive_bidding": true,
|
||||
"cli/test_gpu_marketplace_bids.py::test_marketplace_stats": true,
|
||||
"packages/py/aitbc-crypto/tests/test_receipt_signing.py::test_canonical_json_orders_keys": true,
|
||||
"packages/py/aitbc-crypto/tests/test_receipt_signing.py::test_receipt_sign_and_verify": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_verify_receipt_success": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_verify_receipt_failure": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_verify_receipts_batch": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_coordinator_receipt_client_latest": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_coordinator_receipt_client_history": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_coordinator_receipt_client_latest_404": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_fetch_receipts_page_list": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_fetch_receipts_page_dict_with_cursor": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_iter_receipts_handles_pagination": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_request_retries_on_transient": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_summarize_receipts_all_verified": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py::test_summarize_receipts_with_failures": true,
|
||||
"plugins/ollama/test_ollama_plugin.py::test_ollama_service": true,
|
||||
"plugins/ollama/test_ollama_plugin.py::test_plugin_service": true,
|
||||
"plugins/ollama/test_ollama_plugin.py::test_client_miner_flow": true,
|
||||
"tests/integration/test_blockchain_nodes.py::test_node_connectivity": true,
|
||||
"tests/integration/test_blockchain_nodes.py::test_chain_consistency": true,
|
||||
"tests/integration/test_working_integration.py::test_job_endpoint_structure": true,
|
||||
"tests/integration/test_working_integration.py::test_miner_endpoint_structure": true,
|
||||
"tests/integration/test_full_workflow.py::TestJobToBlockchainWorkflow::test_end_to_end_job_execution": true,
|
||||
"tests/integration/test_full_workflow.py::TestJobToBlockchainWorkflow::test_multi_tenant_isolation": true,
|
||||
"tests/integration/test_full_workflow.py::TestWalletToCoordinatorIntegration::test_job_payment_flow": true,
|
||||
"tests/integration/test_full_workflow.py::TestMarketplaceIntegration::test_service_listing_and_booking": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_register_and_poll_inflight": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_heartbeat_updates_metadata": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_capability_constrained_assignment": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_price_constraint": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_receipt_signing": true,
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_receipt_signing_with_attestation": true,
|
||||
"apps/wallet-daemon/tests/test_ledger.py::test_upsert_and_get_wallet": true,
|
||||
"apps/wallet-daemon/tests/test_ledger.py::test_event_ordering": true,
|
||||
"apps/pool-hub/tests/test_api.py": true,
|
||||
"apps/wallet-daemon/tests/test_receipts.py::test_verify_latest_success": true,
|
||||
"apps/wallet-daemon/tests/test_receipts.py::test_verify_latest_none": true,
|
||||
"apps/wallet-daemon/tests/test_receipts.py::test_verify_history": true,
|
||||
"apps/wallet-daemon/tests/test_wallet_api.py::test_wallet_workflow": true,
|
||||
"apps/wallet-daemon/tests/test_wallet_api.py::test_wallet_password_rules": true,
|
||||
"apps/pool-hub/tests/test_repositories.py::test_register_miner_persists_and_syncs": true,
|
||||
"apps/pool-hub/tests/test_repositories.py::test_match_request_flow": true,
|
||||
"apps/pool-hub/tests/test_repositories.py::test_feedback_repository": true,
|
||||
"apps/wallet-daemon/tests/test_ledger.py": true,
|
||||
"apps/wallet-daemon/tests/test_receipts.py": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_success": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_invalid_amounts": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_amount_mismatch": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_rounding_tolerance": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_success": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_not_found": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_expired": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_success": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_not_found": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_not_pending": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeMarketStatsEndpoint::test_get_market_stats_empty": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeMarketStatsEndpoint::test_get_market_stats_with_payments": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeWalletEndpoints::test_wallet_balance_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeWalletEndpoints::test_wallet_info_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeIntegration::test_complete_payment_lifecycle": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeIntegration::test_market_stats_update_after_payment": true,
|
||||
"apps/wallet-daemon/tests/test_wallet_api.py::TestClient": true,
|
||||
"apps/wallet-daemon/tests/test_wallet_api.py": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_service_initialization_without_files": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_basic_privacy": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_enhanced_privacy": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_service_disabled": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_invalid_privacy_level": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_hash_receipt": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_serialize_receipt": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofIntegration::test_receipt_creation_with_zk_proof": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofIntegration::test_settlement_with_zk_proof": true,
|
||||
"tests/cli/test_cli_integration.py": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_timing_attack_prevention": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_memory_sanitization": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_side_channel_leakage_prevention": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_quantum_resistance_preparation": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_regulatory_reporting": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_kyc_aml_integration": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_audit_trail_privacy": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_data_retention_policy": true,
|
||||
"tests/verification/test_block_import_complete.py::test_block_import_complete": true,
|
||||
"tests/verification/test_minimal.py::test_minimal": true,
|
||||
"tests/verification/test_simple_import.py::test_simple_block_import": true,
|
||||
"tests/verification/test_tx_import.py::test_transaction_import": true,
|
||||
"tests/integration/test_full_workflow.py::TestP2PNetworkSync::test_block_propagation": true,
|
||||
"tests/integration/test_full_workflow.py::TestP2PNetworkSync::test_transaction_propagation": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_encryption_confidentiality": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_viewing_key_generation": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_viewing_key_permissions": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_key_rotation_security": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_transaction_replay_protection": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_side_channel_resistance": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_zero_knowledge_proof_integration": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_audit_log_integrity": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_hsm_integration_security": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_multi_party_computation": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_forward_secrecy": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_deniable_encryption": true,
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_key_derivation_security": true,
|
||||
"apps/coordinator-api/tests/test_client_receipts.py::test_receipt_endpoint_returns_signed_receipt": true,
|
||||
"tests/integration/test_blockchain_sync.py": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_real_node_connectivity": true,
|
||||
"apps/zk-circuits/test/test_ml_circuits.py::test_ml_inference_circuit": true,
|
||||
"apps/zk-circuits/test/test_ml_circuits.py::test_circuit_performance": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager::test_create_security_policy": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager::test_execution_security_monitoring": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentIntegrationManager::test_zk_integration_with_failures": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentMonitoringManager::test_alerting_rules_creation": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentWorkflowCreation::test_workflow_steps_creation": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentStateManager::test_create_execution": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_workflow_execution_request": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_execution_status_retrieval": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_create_workflow_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_list_workflows_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_execute_workflow_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_get_execution_status_endpoint": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentProductionManager::test_production_deployment_with_failures": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURegister::test_register_gpu": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURegister::test_register_persists": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_list_empty": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_list_returns_registered": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_available": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_price_max": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_region": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUDetails::test_get_details": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUDetails::test_get_details_not_found": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_gpu": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_already_booked_returns_409": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_not_found": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURelease::test_release_booked_gpu": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURelease::test_release_not_booked_returns_400": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_add_review": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_get_reviews": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_review_not_found_gpu": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_list_orders_empty": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_list_orders_after_booking": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_filter_orders_by_status": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestPricing::test_pricing_for_model": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestPricing::test_pricing_not_found": true,
|
||||
"apps/coordinator-api/tests/test_jobs.py::test_create_and_fetch_job": true,
|
||||
"apps/coordinator-api/tests/test_jobs.py::test_acquire_next_job": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_encrypt_decrypt_success": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_audit_decrypt": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_encrypt_no_participants": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_generate_key_pair": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_key_rotation": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_get_public_key": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_client_access_own_data": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_miner_access_assigned_data": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_unauthorized_access": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_audit_access": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_log_access": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_log_key_operation": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_export_logs": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_create_confidential_transaction": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_access_confidential_data": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_register_key": true,
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionFlow::test_full_confidential_flow": true,
|
||||
"apps/coordinator-api/tests/test_edge_gpu.py::test_profiles_seed_and_filter": true,
|
||||
"apps/coordinator-api/tests/test_edge_gpu.py::test_metrics_ingest_and_list": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_service_initialization_with_files": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_success": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_failure": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_service_disabled": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofPerformance::test_proof_generation_time": true,
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofPerformance::test_proof_verification_time": true,
|
||||
"tests/cli/test_agent_commands.py": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentIntegrationManager::test_zk_system_integration": true,
|
||||
"tests/e2e": true,
|
||||
"apps/coordinator-api/tests/test_phase8_optional_endpoints.py::test_explorer_api_head": true,
|
||||
"apps/coordinator-api/tests/test_phase8_optional_endpoints.py::test_economics_stats": true,
|
||||
"tests/openclaw_marketplace/test_performance_optimization.py": true,
|
||||
"apps/coordinator-api/test_client_miner.py": true,
|
||||
"apps/coordinator-api/tests/test_edge_gpu.py": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhanced.py": true,
|
||||
"apps/coordinator-api/tests/test_multimodal_agent.py": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhanced.py": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestMarketplaceHealth::test_primary_marketplace_health": true,
|
||||
"tests/reputation/test_reputation_system.py": true,
|
||||
"tests/rewards/test_reward_system.py": true,
|
||||
"tests/trading/test_trading_system.py": true,
|
||||
"tests/integration/test_community_governance.py::test_developer_ecosystem": true,
|
||||
"tests/integration/test_community_governance.py::test_solution_marketplace": true,
|
||||
"tests/integration/test_community_governance.py::test_governance_lifecycle": true,
|
||||
"tests/e2e/test_advanced_features.py::test_multi_modal_fusion": true,
|
||||
"tests/e2e/test_advanced_features.py::test_adaptive_scaler_trigger": true,
|
||||
"tests/e2e/test_advanced_features.py::test_dao_governance_proposal": true,
|
||||
"tests/certification/test_certification_system.py": true,
|
||||
"tests/integration/test_agent_economics_integration.py": true,
|
||||
"tests/cli/test_optimize_commands.py::TestSelfOptCommands::test_self_opt_enable_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestSelfOptCommands::test_self_opt_status_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestSelfOptCommands::test_self_opt_objectives_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestSelfOptCommands::test_self_opt_recommendations_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestPredictCommands::test_predict_resources_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestPredictCommands::test_autoscale_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestPredictCommands::test_forecast_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestTuneCommands::test_tune_auto_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestTuneCommands::test_tune_status_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestTuneCommands::test_tune_results_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestOptimizeUtilities::test_optimize_disable_success": true,
|
||||
"tests/cli/test_optimize_commands.py::TestOptimizeUtilities::test_self_opt_apply_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestDeployCommands::test_deploy_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestDeployCommands::test_scale_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestDeployCommands::test_deploy_optimize_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestMonitorCommands::test_monitor_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestMonitorCommands::test_status_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEdgeCommands::test_edge_deploy_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEdgeCommands::test_edge_resources_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEdgeCommands::test_edge_optimize_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEdgeCommands::test_edge_compliance_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestRoutingCommands::test_routing_optimize_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestRoutingCommands::test_routing_status_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEcosystemCommands::test_ecosystem_create_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEcosystemCommands::test_ecosystem_list_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestEcosystemCommands::test_ecosystem_install_success": true,
|
||||
"tests/cli/test_openclaw_commands.py::TestOpenClawUtilities::test_terminate_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestModelsCommands::test_models_list_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestModelsCommands::test_models_mint_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestModelsCommands::test_models_update_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestModelsCommands::test_models_verify_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestAnalyticsCommands::test_analytics_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestAnalyticsCommands::test_benchmark_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestAnalyticsCommands::test_trends_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestAnalyticsCommands::test_report_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestTradingCommands::test_bid_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestTradingCommands::test_royalties_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestTradingCommands::test_execute_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestDisputeCommands::test_dispute_file_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestDisputeCommands::test_dispute_status_success": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py::TestDisputeCommands::test_dispute_resolve_success": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestMultiModalAgentArchitecture": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdaptiveLearningSystems": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestCollaborativeAgentCoordination": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAutonomousOptimization": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdvancedAIAgentsIntegration": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestPerformanceBenchmarks": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_create_deployment_config": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deploy_agent_workflow": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_health_monitoring": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_scaling": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_rollback": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentMonitoringManager::test_deployment_metrics_collection": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentProductionManager::test_production_deployment": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentIntegrationManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentMonitoringManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentProductionManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentWorkflowCreation::test_create_workflow": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentStateManager::test_update_execution_status": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_basic_verification": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_basic_verification_failure": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_full_verification": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_step_execution_order": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_circular_dependency_detection": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentWorkflowCreation": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentStateManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentAuditor": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentTrustManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager": true,
|
||||
"apps/coordinator-api/tests/test_client_receipts.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernanceValidation": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeRatesEndpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeMarketStatsEndpoint": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeWalletEndpoints": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeIntegration": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationPerformance": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationSecurity": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationDocumentation": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemValidation": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_list_offers_filters_by_status": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_stats": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_submit_bid_creates_record": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_service_list_offers_handles_limit_offset": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_list_bids_filters_by_status_and_provider": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_get_bid_details": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_service_list_bids_handles_limit_offset": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_stats_includes_bids": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_bid_validation": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementPerformance": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation": true,
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestMLZKIntegration": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_sophisticated_agent_skill_routing": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_intelligent_job_offloading": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_agent_collaboration_coordination": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_hybrid_execution_optimization": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_orchestration_performance_targets": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_deployment_infrastructure": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_to_cloud_coordination": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_specific_optimization": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_security_compliance": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_performance_targets": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_developer_tools_and_sdks": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_marketplace_solutions": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_community_platform": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_partnership_programs": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_ecosystem_metrics": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_agent_orchestration_performance": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_edge_computing_performance": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_ecosystem_scalability": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_integration_efficiency": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_phase_6_6_success_criteria": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_integration_maturity_assessment": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_integration_sustainability": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_future_readiness": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_competitive_advantages": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumSecurity": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumPerformance": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumIntegrationValidation": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestPerformanceBaselines": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationPerformance": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestClient": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestPerformanceBenchmarking": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLIntegration": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLPerformanceValidation": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLErrorHandling": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLInfrastructureIntegration": true,
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py": true,
|
||||
"apps/coordinator-api/tests/test_agent_integration.py": true,
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py": true,
|
||||
"apps/coordinator-api/tests/test_agent_security.py": true,
|
||||
"apps/coordinator-api/tests/test_client_receipts.py": true,
|
||||
"apps/coordinator-api/tests/test_community_governance.py": true,
|
||||
"apps/coordinator-api/tests/test_exchange.py": true,
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py": true,
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py": true,
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py": true,
|
||||
"apps/coordinator-api/tests/test_marketplace.py": true,
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py": true,
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py": true,
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py": true,
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py": true,
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py": true,
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py": true,
|
||||
"apps/coordinator-api/tests/test_core_services.py": true,
|
||||
"apps/coordinator-api/tests/test_integration.py::TestHealthEndpoints::test_health_check_basic": true,
|
||||
"apps/coordinator-api/tests/test_rate_limiting.py": true,
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitingComponents::test_slowapi_import": true,
|
||||
"apps/coordinator-api/tests/test_components.py::TestConfigurationValidation::test_environment_based_configuration": true,
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitingEnforcement::test_tiered_rate_limit_strategy": true,
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitMetrics::test_rate_limit_hit_logging": true,
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_endpoint_exists": true,
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_successful_response": true,
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_not_found": true,
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_invalid": true,
|
||||
"tests/test_explorer_integration.py::TestTestDiscovery::test_pytest_configuration": true,
|
||||
"apps/coordinator-api/tests/test_agent_identity_sdk.py": true,
|
||||
"apps/coordinator-api/tests/test_wallet_service.py": true,
|
||||
"apps/coordinator-api/tests/test_atomic_swap_service.py": true,
|
||||
"tests/cli/test_admin.py": true,
|
||||
"tests/cli/test_auth.py": true,
|
||||
"tests/cli/test_blockchain.py": true,
|
||||
"tests/cli/test_client.py": true,
|
||||
"tests/cli/test_config.py": true,
|
||||
"tests/cli/test_exchange.py": true,
|
||||
"tests/cli/test_governance.py": true,
|
||||
"tests/cli/test_marketplace.py": true,
|
||||
"tests/cli/test_marketplace_advanced_commands.py": true,
|
||||
"tests/cli/test_marketplace_bids.py": true,
|
||||
"tests/cli/test_multimodal_commands.py": true,
|
||||
"tests/cli/test_openclaw_commands.py": true,
|
||||
"tests/cli/test_optimize_commands.py": true,
|
||||
"tests/cli/test_simulate.py": true,
|
||||
"tests/cli/test_swarm_commands.py": true,
|
||||
"tests/cli/test_wallet.py": true,
|
||||
"tests/integration/test_community_governance.py": true,
|
||||
"tests/integration/test_pricing_integration.py": true,
|
||||
"tests/performance/test_pricing_performance.py": true,
|
||||
"tests/test_agent_wallet_security.py": true,
|
||||
"tests/unit/test_core_functionality.py": true,
|
||||
"tests/unit/test_dynamic_pricing.py": true,
|
||||
"tests/security/test_security_comprehensive.py::TestAuthenticationSecurity::test_api_key_validation": true,
|
||||
"tests/security/test_security_comprehensive.py::TestAuthenticationSecurity::test_token_security": true,
|
||||
"tests/security/test_security_comprehensive.py::TestAuthenticationSecurity::test_session_security": true,
|
||||
"tests/security/test_security_comprehensive.py::TestDataEncryption::test_sensitive_data_encryption": true,
|
||||
"tests/security/test_security_comprehensive.py::TestDataEncryption::test_data_integrity": true,
|
||||
"tests/security/test_security_comprehensive.py::TestDataEncryption::test_secure_storage": true,
|
||||
"tests/security/test_security_comprehensive.py::TestInputValidation::test_sql_injection_prevention": true,
|
||||
"tests/security/test_security_comprehensive.py::TestInputValidation::test_xss_prevention": true,
|
||||
"tests/security/test_security_comprehensive.py::TestInputValidation::test_file_upload_security": true,
|
||||
"tests/security/test_security_comprehensive.py::TestInputValidation::test_rate_limiting": true,
|
||||
"tests/security/test_security_comprehensive.py::TestNetworkSecurity::test_https_enforcement": true,
|
||||
"tests/security/test_security_comprehensive.py::TestNetworkSecurity::test_request_headers_security": true,
|
||||
"tests/security/test_security_comprehensive.py::TestNetworkSecurity::test_cors_configuration": true,
|
||||
"tests/security/test_security_comprehensive.py::TestAuditLogging::test_security_event_logging": true,
|
||||
"tests/security/test_security_comprehensive.py::TestAuditLogging::test_log_data_protection": true,
|
||||
"tests/test_websocket_stream_backpressure.py": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_slow_stream_detection": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBackpressureScenarios::test_slow_consumer_isolation": true,
|
||||
"tests/test_event_driven_cache.py": true,
|
||||
"packages/py/aitbc-core/tests/test_logging.py": true,
|
||||
"packages/py/aitbc-sdk/tests/test_receipts.py": true,
|
||||
"packages/py/aitbc-crypto/tests/test_receipt_signing.py": true,
|
||||
"tests/cli/test_chain.py": true,
|
||||
"tests/cli/test_deploy_commands.py": true,
|
||||
"tests/cli/test_deploy_commands_simple.py": true,
|
||||
"tests/cli/test_deploy_structure.py": true,
|
||||
"tests/cli/test_genesis.py": true,
|
||||
"tests/cli/test_marketplace_additional.py": true,
|
||||
"tests/cli/test_miner.py": true,
|
||||
"tests/cli/test_node.py": true,
|
||||
"tests/cli/test_wallet_additions.py": true,
|
||||
"tests/cli/test_wallet_remaining.py": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestMarketplaceHealth::test_secondary_marketplace_health": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestAgentRegistration::test_agent_registration_success": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestAgentRegistration::test_agent_reputation_tracking": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestResourceTrading::test_resource_listing_success": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestResourceTrading::test_ai_power_rental_success": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestSmartContracts::test_ai_power_rental_contract": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestSmartContracts::test_payment_processing_contract": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestPerformanceOptimization::test_performance_metrics_collection": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestPerformanceOptimization::test_geographic_load_balancing": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestAgentEconomics::test_aitbc_payment_processing": true,
|
||||
"tests/openclaw_marketplace/test_framework.py::TestAgentEconomics::test_agent_balance_tracking": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_critical_command_translation_disabled": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_high_security_local_only": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_medium_security_fallback_mode": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_low_security_full_translation": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_user_consent_requirement": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_external_api_failure_fallback": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_command_security_level_classification": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_unknown_command_default_security": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_local_translation_functionality": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_security_logging": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_security_summary_generation": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_translation_allowed_check": true,
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_get_security_policy_for_command": true,
|
||||
"tests/test_cli_translation_security.py::TestTranslationSecurityConfiguration::test_configure_translation_security": true,
|
||||
"tests/test_cli_translation_security.py::TestTranslationSecurityConfiguration::test_get_translation_security_report": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_empty_translation_request": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_unsupported_target_language": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_very_long_text_translation": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_concurrent_translation_requests": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_security_log_size_limit": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_critical_commands_never_use_external_apis": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_sensitive_data_never_sent_externally": true,
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_always_fallback_to_original_text": true,
|
||||
"tests/analytics/test_analytics_system.py::TestMarketplaceAnalytics::test_collect_market_data": true,
|
||||
"tests/analytics/test_analytics_system.py::TestMarketplaceAnalytics::test_generate_insights": true,
|
||||
"tests/analytics/test_analytics_system.py::TestMarketplaceAnalytics::test_create_dashboard": true,
|
||||
"tests/analytics/test_analytics_system.py::TestMarketplaceAnalytics::test_get_market_overview": true,
|
||||
"tests/analytics/test_analytics_system.py::TestMarketplaceAnalytics::test_different_periods": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsEngine::test_analyze_trends": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsEngine::test_detect_anomalies": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsEngine::test_identify_opportunities": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsEngine::test_assess_risks": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsEngine::test_generate_insights_comprehensive": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDashboardManager::test_create_default_dashboard": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDashboardManager::test_create_executive_dashboard": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDashboardManager::test_default_widgets_structure": true,
|
||||
"tests/analytics/test_analytics_system.py::TestReportingSystem::test_report_generation": true,
|
||||
"tests/analytics/test_analytics_system.py::TestReportingSystem::test_report_export": true,
|
||||
"tests/analytics/test_analytics_system.py::TestReportingSystem::test_report_scheduling": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_data_collection_metrics": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_transaction_volume": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_active_agents": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_average_prices": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_success_rates": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_supply_demand_ratio": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_collect_market_metrics_batch": true,
|
||||
"tests/analytics/test_analytics_system.py::TestDataCollector::test_different_periods": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsPerformance::test_bulk_metric_collection_performance": true,
|
||||
"tests/analytics/test_analytics_system.py::TestAnalyticsPerformance::test_insight_generation_performance": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_real_node_synchronization": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_cross_site_sync_status": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_transaction_propagation": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_sync_monitoring_metrics": true,
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_sync_health_check": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestMetaLearningCapabilities::test_meta_learning_setup": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestMetaLearningCapabilities::test_skill_acquisition_acceleration": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestSelfOptimization::test_resource_optimization": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestSelfOptimization::test_adaptive_resource_scaling": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestMultimodalFusion::test_multimodal_fusion_setup": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestMultimodalFusion::test_cross_modal_attention": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAdvancedReinforcementLearning::test_ppo_training": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAdvancedReinforcementLearning::test_policy_stability": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAgentCreativity::test_creativity_development": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAgentCreativity::test_novel_solution_generation": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAgentSpecialization::test_domain_specialization": true,
|
||||
"tests/openclaw_marketplace/test_advanced_agent_capabilities.py::TestAgentSpecialization::test_cross_domain_transfer": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentReputationSystem::test_reputation_calculation_accuracy": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentReputationSystem::test_trust_system_reliability": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestRewardMechanisms::test_performance_based_rewards": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestRewardMechanisms::test_volume_based_rewards": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentToAgentTrading::test_direct_p2p_trading": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentToAgentTrading::test_arbitrage_trading": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestMarketplaceAnalytics::test_monthly_analytics": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestMarketplaceAnalytics::test_weekly_analytics": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentCertification::test_gpu_expert_certification": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestAgentCertification::test_market_analyst_certification": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestEarningsAnalysis::test_monthly_earnings_analysis": true,
|
||||
"tests/openclaw_marketplace/test_agent_economics.py::TestEarningsAnalysis::test_earnings_projections": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestDevelopmentTools::test_sdk_completeness": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestDevelopmentTools::test_integration_examples": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestInnovationLabs::test_research_program_setup": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestInnovationLabs::test_performance_improvements": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestThirdPartyMarketplace::test_marketplace_setup": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestThirdPartyMarketplace::test_quality_requirements": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestCommunitySupport::test_support_platforms": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestCommunitySupport::test_collaboration_tools": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestTokenBasedVoting::test_voting_system_setup": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestTokenBasedVoting::test_vote_distribution": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestDAOFormation::test_dao_creation": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestDAOFormation::test_smart_contract_deployment": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestProposalSystems::test_proposal_creation": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestProposalSystems::test_voting_outcomes": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestGovernanceAnalytics::test_analytics_collection": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestGovernanceAnalytics::test_transparency_reporting": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestCertificationPrograms::test_certification_process": true,
|
||||
"tests/openclaw_marketplace/test_agent_governance.py::TestCertificationPrograms::test_partnership_approval": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestContractDeployment::test_all_contracts_deployment": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestAIPowerRentalContract::test_complete_rental_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestPaymentProcessingContract::test_complete_payment_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestEscrowServiceContract::test_complete_escrow_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestPerformanceVerificationContract::test_performance_verification_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestDisputeResolutionContract::test_dispute_resolution_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestDynamicPricingContract::test_dynamic_pricing_workflow": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestBlockchainPerformance::test_transaction_speed": true,
|
||||
"tests/openclaw_marketplace/test_blockchain_integration.py::TestBlockchainPerformance::test_payment_reliability": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestRegionHealth::test_all_regions_health": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestRegionHealth::test_edge_node_connectivity": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestGeographicLoadBalancing::test_geographic_optimization": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestGeographicLoadBalancing::test_cross_region_discovery": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestGlobalSynchronization::test_resource_synchronization": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestGlobalSynchronization::test_pricing_consistency": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestFailoverAndRedundancy::test_regional_failover": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestFailoverAndRedundancy::test_latency_optimization": true,
|
||||
"tests/openclaw_marketplace/test_multi_region_deployment.py::TestPerformanceMetrics::test_global_performance_tracking": true,
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_numeric": true,
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_iso_string": true,
|
||||
"tests/test_explorer_integration.py::TestFieldMapping::test_rpc_to_frontend_mapping": true,
|
||||
"tests/test_explorer_integration.py::TestTestDiscovery::test_test_files_exist": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_basic_operations": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_priority_ordering": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_backpressure_handling": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_stream_start_stop": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_message_sending": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_slow_consumer_detection": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_backpressure_handling": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_send_timeout_handling": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_manager_start_stop": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_stream_management": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_broadcast_to_all_streams": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_manager_metrics": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBackpressureScenarios::test_high_load_scenario": true,
|
||||
"tests/test_websocket_backpressure_core.py::TestBackpressureScenarios::test_mixed_priority_scenario": true
|
||||
}
|
||||
966
dev/cache/.pytest_cache/v/cache/nodeids
vendored
Executable file
966
dev/cache/.pytest_cache/v/cache/nodeids
vendored
Executable file
@@ -0,0 +1,966 @@
|
||||
[
|
||||
"apps/blockchain-node/tests/test_gossip_broadcast.py::test_broadcast_backend_decodes_cursorless_payload",
|
||||
"apps/blockchain-node/tests/test_gossip_broadcast.py::test_websocket_fanout_with_broadcast_backend",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestCircuitBreaker::test_half_open_after_timeout",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestCircuitBreaker::test_opens_after_threshold",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestCircuitBreaker::test_starts_closed",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestCircuitBreaker::test_success_resets",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestComputeTxHash::test_deterministic",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestComputeTxHash::test_different_for_different_tx",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestComputeTxHash::test_hex_prefix",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_add_and_list",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_drain_by_fee_priority",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_drain_respects_max_count",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_duplicate_ignored",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_max_size_eviction",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_min_fee_rejected",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_persistence",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestDatabaseMempool::test_remove",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_add_and_list",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_drain_by_fee_priority",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_drain_respects_max_bytes",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_drain_respects_max_count",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_duplicate_ignored",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_max_size_eviction",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_min_fee_accepted",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_min_fee_rejected",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_remove",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInMemoryMempool::test_size",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInitMempool::test_init_database",
|
||||
"apps/blockchain-node/tests/test_mempool.py::TestInitMempool::test_init_memory",
|
||||
"apps/blockchain-node/tests/test_models.py::test_hash_validation_accepts_hex",
|
||||
"apps/blockchain-node/tests/test_models.py::test_hash_validation_rejects_non_hex",
|
||||
"apps/blockchain-node/tests/test_models.py::test_relationships",
|
||||
"apps/blockchain-node/tests/test_observability_dashboards.py::test_generate_default_dashboards_creates_files",
|
||||
"apps/blockchain-node/tests/test_observability_dashboards.py::test_register_exporters_tracks_names",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_append_sequential",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_append_to_empty_chain",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_append_with_transactions",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_duplicate_rejected",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_gap_detected",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncAppend::test_stale_block_rejected",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncConflictResolution::test_fork_at_same_height_rejected",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncConflictResolution::test_sync_status",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncSignatureValidation::test_trusted_proposer_accepted_on_import",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncSignatureValidation::test_untrusted_proposer_rejected_on_import",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestChainSyncSignatureValidation::test_validation_disabled",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_add_remove_trusted",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_invalid_hash_format",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_invalid_hash_length",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_missing_proposer",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_missing_required_field",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_trusted_proposer_accepted",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_untrusted_proposer_rejected",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestProposerSignatureValidator::test_valid_block",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestSyncMetrics::test_accepted_block_increments_metrics",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestSyncMetrics::test_duplicate_increments_metrics",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestSyncMetrics::test_fork_increments_metrics",
|
||||
"apps/blockchain-node/tests/test_sync.py::TestSyncMetrics::test_rejected_block_increments_metrics",
|
||||
"apps/blockchain-node/tests/test_websocket.py::test_blocks_websocket_high_volume_load",
|
||||
"apps/blockchain-node/tests/test_websocket.py::test_blocks_websocket_multiple_subscribers_receive_all_payloads",
|
||||
"apps/blockchain-node/tests/test_websocket.py::test_blocks_websocket_stream",
|
||||
"apps/blockchain-node/tests/test_websocket.py::test_transactions_websocket_cleans_up_on_disconnect",
|
||||
"apps/coordinator-api/src/app/services/test_service.py::test_marketplace",
|
||||
"apps/coordinator-api/src/app/services/test_service.py::test_multimodal",
|
||||
"apps/coordinator-api/src/app/services/test_service.py::test_openclaw",
|
||||
"apps/coordinator-api/test_health_endpoints.py::test_deep_health",
|
||||
"apps/coordinator-api/test_health_endpoints.py::test_service_health",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdaptiveLearningSystems::test_adaptive_model_selection",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdaptiveLearningSystems::test_continuous_learning_algorithms",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdaptiveLearningSystems::test_knowledge_transfer_mechanisms",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdaptiveLearningSystems::test_performance_feedback_loops",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdvancedAIAgentsIntegration::test_adaptive_learning_integration",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdvancedAIAgentsIntegration::test_end_to_end_multimodal_workflow",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAdvancedAIAgentsIntegration::test_performance_validation",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAutonomousOptimization::test_continuous_improvement_loops",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAutonomousOptimization::test_performance_prediction_models",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAutonomousOptimization::test_resource_management_optimization",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestAutonomousOptimization::test_self_optimization_algorithms",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestCollaborativeAgentCoordination::test_agent_communication_protocols",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestCollaborativeAgentCoordination::test_distributed_consensus_mechanisms",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestCollaborativeAgentCoordination::test_load_balancing_strategies",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestCollaborativeAgentCoordination::test_multi_agent_task_decomposition",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestMultiModalAgentArchitecture::test_cross_modal_attention_mechanisms",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestMultiModalAgentArchitecture::test_modality_specific_optimization",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestMultiModalAgentArchitecture::test_performance_benchmarks",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestMultiModalAgentArchitecture::test_unified_multimodal_processing_pipeline",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestPerformanceBenchmarks::test_adaptive_learning_performance",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestPerformanceBenchmarks::test_autonomous_optimization_performance",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestPerformanceBenchmarks::test_collaborative_coordination_performance",
|
||||
"apps/coordinator-api/tests/test_advanced_ai_agents.py::TestPerformanceBenchmarks::test_multimodal_performance_benchmarks",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_create_deployment_config",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deploy_agent_workflow",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_health_monitoring",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_rollback",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentDeploymentManager::test_deployment_scaling",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentIntegrationManager::test_zk_integration_with_failures",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentIntegrationManager::test_zk_system_integration",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentMonitoringManager::test_alerting_rules_creation",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentMonitoringManager::test_deployment_metrics_collection",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentProductionManager::test_production_deployment",
|
||||
"apps/coordinator-api/tests/test_agent_integration.py::TestAgentProductionManager::test_production_deployment_with_failures",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_circular_dependency_detection",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_execution_status_retrieval",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_step_execution_order",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAIAgentOrchestrator::test_workflow_execution_request",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_create_workflow_endpoint",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_execute_workflow_endpoint",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_get_execution_status_endpoint",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentAPIEndpoints::test_list_workflows_endpoint",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentStateManager::test_create_execution",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentStateManager::test_update_execution_status",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_basic_verification",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_basic_verification_failure",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentVerifier::test_full_verification",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentWorkflowCreation::test_create_workflow",
|
||||
"apps/coordinator-api/tests/test_agent_orchestration.py::TestAgentWorkflowCreation::test_workflow_steps_creation",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentAuditor::test_cryptographic_hashing",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentAuditor::test_log_basic_event",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentAuditor::test_risk_score_calculation",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager::test_create_sandbox_environment",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager::test_sandbox_cleanup",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager::test_sandbox_monitoring",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager::test_security_level_sandbox_config",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSandboxManager::test_workflow_requirements_customization",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager::test_create_security_policy",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager::test_execution_security_monitoring",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentSecurityManager::test_workflow_security_validation",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentTrustManager::test_create_trust_score",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentTrustManager::test_reputation_score_calculation",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentTrustManager::test_security_violation_impact",
|
||||
"apps/coordinator-api/tests/test_agent_security.py::TestAgentTrustManager::test_trust_score_calculation",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestAdjustQuota::test_adjust_quota_negative_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestAdjustQuota::test_adjust_quota_no_active_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestAdjustQuota::test_adjust_quota_updates_limit",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCharge::test_charge_decreases_balance",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCharge::test_charge_insufficient_balance_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCharge::test_charge_unknown_tenant_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCharge::test_charge_zero_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCredit::test_credit_increases_balance",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCredit::test_credit_unknown_tenant_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestApplyCredit::test_credit_zero_or_negative_raises",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestExtractFromToken::test_invalid_signature_returns_none",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestExtractFromToken::test_malformed_token_returns_none",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestExtractFromToken::test_missing_tenant_id_returns_none",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestExtractFromToken::test_valid_token_returns_claims",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestGenerateMonthlyInvoices::test_generates_for_active_tenants_with_usage",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestGenerateMonthlyInvoices::test_skips_inactive_tenants",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestGenerateMonthlyInvoices::test_skips_tenants_without_usage",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestProcessPendingEvents::test_empty_queue_returns_zero",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestProcessPendingEvents::test_processes_credit_and_charge_events",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestResetDailyQuotas::test_does_not_reset_active_quotas",
|
||||
"apps/coordinator-api/tests/test_billing.py::TestResetDailyQuotas::test_resets_expired_daily_quotas",
|
||||
"apps/coordinator-api/tests/test_client_receipts.py::test_receipt_endpoint_returns_signed_receipt",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance::test_community_growth_metrics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance::test_developer_ecosystem_metrics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance::test_governance_efficiency",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance::test_governance_participation_metrics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernancePerformance::test_research_productivity_metrics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernanceValidation::test_future_readiness",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernanceValidation::test_governance_maturity_assessment",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernanceValidation::test_phase_8_success_criteria",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityGovernanceValidation::test_sustainability_metrics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation::test_community_feedback_system",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation::test_continuous_improvement",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation::test_innovation_challenges",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation::test_knowledge_sharing_platform",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestCommunityInnovation::test_mentorship_program",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_dao_structure_implementation",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_delegated_voting",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_governance_performance",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_governance_security",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_governance_transparency",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_proposal_lifecycle",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_proposal_system",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_token_based_voting_mechanisms",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDecentralizedGovernance::test_voting_interface",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_analytics",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_incentive_programs",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_marketplace",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_onboarding",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_support_channels",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_testing_framework",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_developer_tools_and_sdks",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestDeveloperEcosystem::test_documentation_and_tutorials",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_areas",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_collaboration_platform",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_community_engagement",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_funding_mechanism",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_impact_measurement",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_milestones",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_publication_system",
|
||||
"apps/coordinator-api/tests/test_community_governance.py::TestResearchLabs::test_research_quality_assurance",
|
||||
"apps/coordinator-api/tests/test_components.py::TestConfigurationValidation::test_environment_based_configuration",
|
||||
"apps/coordinator-api/tests/test_components.py::TestConfigurationValidation::test_rate_limit_format_validation",
|
||||
"apps/coordinator-api/tests/test_components.py::TestErrorHandlingComponents::test_429_error_response_structure",
|
||||
"apps/coordinator-api/tests/test_components.py::TestErrorHandlingComponents::test_error_response_model",
|
||||
"apps/coordinator-api/tests/test_components.py::TestErrorHandlingComponents::test_validation_error_structure",
|
||||
"apps/coordinator-api/tests/test_components.py::TestLoggingIntegration::test_audit_log_configuration",
|
||||
"apps/coordinator-api/tests/test_components.py::TestLoggingIntegration::test_shared_logging_import",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitTierStrategy::test_security_focused_limits",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitTierStrategy::test_tiered_rate_limits",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitingComponents::test_rate_limit_decorator_creation",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitingComponents::test_rate_limit_default_values",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitingComponents::test_settings_rate_limit_configuration",
|
||||
"apps/coordinator-api/tests/test_components.py::TestRateLimitingComponents::test_slowapi_import",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_audit_access",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_client_access_own_data",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_miner_access_assigned_data",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAccessController::test_unauthorized_access",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_export_logs",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_log_access",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestAuditLogger::test_log_key_operation",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_access_confidential_data",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_create_confidential_transaction",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionAPI::test_register_key",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestConfidentialTransactionFlow::test_full_confidential_flow",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_audit_decrypt",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_encrypt_decrypt_success",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestEncryptionService::test_encrypt_no_participants",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_generate_key_pair",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_get_public_key",
|
||||
"apps/coordinator-api/tests/test_confidential_transactions.py::TestKeyManager::test_key_rotation",
|
||||
"apps/coordinator-api/tests/test_edge_gpu.py::test_metrics_ingest_and_list",
|
||||
"apps/coordinator-api/tests/test_edge_gpu.py::test_profiles_seed_and_filter",
|
||||
"apps/coordinator-api/tests/test_edge_gpu_integration.py::TestEdgeGPUIntegration::test_consumer_gpu_discovery",
|
||||
"apps/coordinator-api/tests/test_edge_gpu_integration.py::TestEdgeGPUIntegration::test_consumer_gpu_profile_filtering",
|
||||
"apps/coordinator-api/tests/test_edge_gpu_integration.py::TestEdgeGPUIntegration::test_edge_latency_measurement",
|
||||
"apps/coordinator-api/tests/test_edge_gpu_integration.py::TestEdgeGPUIntegration::test_ollama_edge_optimization",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_not_found",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_not_pending",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeConfirmPaymentEndpoint::test_confirm_payment_success",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_amount_mismatch",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_invalid_amounts",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_rounding_tolerance",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeCreatePaymentEndpoint::test_create_payment_success",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeIntegration::test_complete_payment_lifecycle",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeIntegration::test_market_stats_update_after_payment",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeMarketStatsEndpoint::test_get_market_stats_empty",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeMarketStatsEndpoint::test_get_market_stats_with_payments",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_expired",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_not_found",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangePaymentStatusEndpoint::test_get_payment_status_success",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeRatesEndpoint::test_get_exchange_rates_success",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeWalletEndpoints::test_wallet_balance_endpoint",
|
||||
"apps/coordinator-api/tests/test_exchange.py::TestExchangeWalletEndpoints::test_wallet_info_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges::test_bridge_liquidity_pools",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges::test_bridge_monitoring",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges::test_bridge_security_features",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges::test_bridge_status_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestCrossChainBridges::test_bridge_transaction_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity::test_dapp_authentication",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity::test_dapp_rate_limiting",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity::test_dapp_webhook_support",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity::test_job_submission_dapp_api",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestDAppConnectivity::test_marketplace_dapp_api",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_block_data_completeness",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_explorer_api_standardization",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_get_account_transactions_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_get_block_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_get_transaction_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerDataAPI::test_transaction_data_completeness",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationDocumentation::test_api_documentation",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationDocumentation::test_community_support",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationDocumentation::test_integration_examples",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationDocumentation::test_sdk_availability",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationPerformance::test_api_response_times",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationPerformance::test_caching_strategy",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationPerformance::test_pagination_performance",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationPerformance::test_rate_limiting_effectiveness",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationSecurity::test_api_authentication",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationSecurity::test_audit_logging",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationSecurity::test_data_privacy",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestExplorerIntegrationSecurity::test_input_validation",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI::test_receipt_based_minting_tracking",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI::test_token_analytics_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI::test_token_balance_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI::test_token_holders_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestTokenAnalyticsAPI::test_token_transfers_endpoint",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration::test_wallet_balance_api",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration::test_wallet_receipt_tracking",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration::test_wallet_security_features",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration::test_wallet_token_portfolio",
|
||||
"apps/coordinator-api/tests/test_explorer_integrations.py::TestWalletIntegration::test_wallet_transaction_history",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_consulting_service_portfolio",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_case_studies",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_onboarding_process",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_partnership_program",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_success_metrics",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_support_tiers",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestEnterpriseConsultingServices::test_enterprise_training_programs",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_enterprise_customer_success",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_global_compliance_performance",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_global_ecosystem_maturity",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_global_scalability_targets",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_industry_adoption_metrics",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemPerformance::test_multi_region_latency_performance",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemValidation::test_ecosystem_innovation_metrics",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemValidation::test_ecosystem_sustainability",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemValidation::test_global_ecosystem_readiness",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestGlobalEcosystemValidation::test_phase_7_success_criteria",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_education_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_financial_services_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_healthcare_ai_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_industry_compliance_automation",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_industry_performance_metrics",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_industry_solution_templates",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_legal_tech_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_manufacturing_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestIndustrySpecificSolutions::test_retail_agents",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_content_delivery_optimization",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_cross_border_data_compliance",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_disaster_recovery_planning",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_edge_node_management",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_geographic_load_balancing",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_global_infrastructure_setup",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_global_performance_targets",
|
||||
"apps/coordinator-api/tests/test_global_ecosystem.py::TestMultiRegionDeployment::test_region_specific_optimizations",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_already_booked_returns_409",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_gpu",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUBook::test_book_not_found",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUDetails::test_get_details",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUDetails::test_get_details_not_found",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_available",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_price_max",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_filter_region",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_list_empty",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUList::test_list_returns_registered",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURegister::test_register_gpu",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURegister::test_register_persists",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURelease::test_release_booked_gpu",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPURelease::test_release_not_booked_returns_400",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_add_review",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_get_reviews",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestGPUReviews::test_review_not_found_gpu",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_filter_orders_by_status",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_list_orders_after_booking",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestOrders::test_list_orders_empty",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestPricing::test_pricing_for_model",
|
||||
"apps/coordinator-api/tests/test_gpu_marketplace.py::TestPricing::test_pricing_not_found",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestConfigurationValidation::test_api_key_validation_logic",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestConfigurationValidation::test_production_validation_logic",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestConfigurationValidation::test_secret_length_validation",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestDatabaseConfiguration::test_asyncpg_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestDatabaseConfiguration::test_sqlalchemy_async_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestErrorHandling::test_exception_handler_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestHealthEndpoints::test_health_check_basic",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestLoggingConfiguration::test_logger_functionality",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestLoggingConfiguration::test_logger_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestRateLimitingSetup::test_rate_limit_decorator",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestRateLimitingSetup::test_slowapi_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestServiceLogic::test_job_service_import",
|
||||
"apps/coordinator-api/tests/test_integration.py::TestServiceLogic::test_miner_service_import",
|
||||
"apps/coordinator-api/tests/test_jobs.py::test_acquire_next_job",
|
||||
"apps/coordinator-api/tests/test_jobs.py::test_create_and_fetch_job",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_bid_validation",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_get_bid_details",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_list_bids_filters_by_status_and_provider",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_list_offers_filters_by_status",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_service_list_bids_handles_limit_offset",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_service_list_offers_handles_limit_offset",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_stats",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_marketplace_stats_includes_bids",
|
||||
"apps/coordinator-api/tests/test_marketplace.py::test_submit_bid_creates_record",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_creator_royalty_tracking",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_dynamic_royalty_rates",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_royalty_dispute_resolution",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_royalty_payment_system",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_secondary_market_royalties",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedMarketplaceFeatures::test_sophisticated_royalty_distribution",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_automated_quality_scoring",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_compliance_checking",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_continuous_monitoring",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_performance_verification",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_quality_assurance_system",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_security_scanning",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestAdvancedModelVerification::test_verification_reporting",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_competitive_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_market_trend_analysis",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_marketplace_analytics_dashboard",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_model_performance_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_predictive_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_revenue_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceAnalytics::test_user_behavior_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementPerformance::test_data_processing_efficiency",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementPerformance::test_enhancement_cost_efficiency",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementPerformance::test_enhancement_performance_targets",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementPerformance::test_scalability_requirements",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation::test_enhancement_innovation_metrics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation::test_enhancement_maturity_assessment",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation::test_enhancement_sustainability",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation::test_enhancement_user_experience",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestMarketplaceEnhancementValidation::test_phase_6_5_success_criteria",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_ip_protection_mechanisms",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_license_analytics",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_license_compatibility",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_license_enforcement",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_license_templates",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_license_transfer_system",
|
||||
"apps/coordinator-api/tests/test_marketplace_enhancement.py::TestModelLicensing::test_usage_rights_management",
|
||||
"apps/coordinator-api/tests/test_marketplace_health.py::test_marketplace_health_primary",
|
||||
"apps/coordinator-api/tests/test_marketplace_health.py::test_marketplace_health_secondary",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_capability_constrained_assignment",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_heartbeat_updates_metadata",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_price_constraint",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_receipt_signing",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_receipt_signing_with_attestation",
|
||||
"apps/coordinator-api/tests/test_miner_service.py::test_register_and_poll_inflight",
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestMLZKIntegration::test_edge_gpu_api_integration",
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestMLZKIntegration::test_fhe_ml_inference",
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestMLZKIntegration::test_js_sdk_receipt_verification_e2e",
|
||||
"apps/coordinator-api/tests/test_ml_zk_integration.py::TestMLZKIntegration::test_ml_zk_proof_generation",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_agent_collaboration_coordination",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_hybrid_execution_optimization",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_intelligent_job_offloading",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_orchestration_performance_targets",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestAdvancedAgentOrchestration::test_sophisticated_agent_skill_routing",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_deployment_infrastructure",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_performance_targets",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_security_compliance",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_specific_optimization",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestEdgeComputingIntegration::test_edge_to_cloud_coordination",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_community_platform",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_developer_tools_and_sdks",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_ecosystem_metrics",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_marketplace_solutions",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawEcosystemDevelopment::test_partnership_programs",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_agent_orchestration_performance",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_ecosystem_scalability",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_edge_computing_performance",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationPerformance::test_integration_efficiency",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_competitive_advantages",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_future_readiness",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_integration_maturity_assessment",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_integration_sustainability",
|
||||
"apps/coordinator-api/tests/test_openclaw_enhancement.py::TestOpenClawIntegrationValidation::test_phase_6_6_success_criteria",
|
||||
"apps/coordinator-api/tests/test_phase8_optional_endpoints.py::test_economics_stats",
|
||||
"apps/coordinator-api/tests/test_phase8_optional_endpoints.py::test_explorer_api_head",
|
||||
"apps/coordinator-api/tests/test_phase8_optional_endpoints.py::test_market_stats",
|
||||
"apps/coordinator-api/tests/test_phase8_tasks.py::test_agent_api_health",
|
||||
"apps/coordinator-api/tests/test_phase8_tasks.py::test_blockchain_rpc_head",
|
||||
"apps/coordinator-api/tests/test_phase8_tasks.py::test_multi_region_primary_health",
|
||||
"apps/coordinator-api/tests/test_phase8_tasks.py::test_multi_region_secondary_health",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_circuit_simulation",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_classical_hybrid_agents",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_communication_agents",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_enhanced_algorithms",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_error_correction",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_machine_learning_agents",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_optimization_agents",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_performance_benchmarks",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumAgentProcessing::test_quantum_resource_management",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumIntegrationValidation::test_quantum_compatibility_matrix",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumIntegrationValidation::test_quantum_migration_timeline",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumIntegrationValidation::test_quantum_readiness_assessment",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumIntegrationValidation::test_quantum_success_criteria",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_computing_resources",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_interoperability",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_job_submission",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_model_marketplace",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_model_verification",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_pricing_model",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumMarketplaceIntegration::test_quantum_quality_assurance",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumPerformance::test_quantum_advantage_metrics",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumPerformance::test_quantum_error_rates",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumPerformance::test_quantum_resource_efficiency",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumPerformance::test_quantum_scalability",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_backward_compatibility",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_classic_mceliece_encryption",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_crystals_kyber_implementation",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_forward_secrecy_maintenance",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_hybrid_classical_quantum_protocols",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_layered_security_approach",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_migration_path_planning",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_mitigation_strategies",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_performance_optimization",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_quantum_threat_assessment",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_rainbow_signatures",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_risk_analysis_framework",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumResistantCryptography::test_sphincs_signatures",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumSecurity::test_quantum_cryptography_standards",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumSecurity::test_quantum_key_distribution",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumSecurity::test_quantum_random_number_generation",
|
||||
"apps/coordinator-api/tests/test_quantum_integration.py::TestQuantumSecurity::test_quantum_threat_monitoring",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitExceptionHandler::test_error_response_structure_for_rate_limit",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitExceptionHandler::test_rate_limit_error_response_serialization",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitExceptionHandler::test_rate_limit_exception_creation",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitIntegration::test_limiter_creation",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitIntegration::test_rate_limit_decorator_creation",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitIntegration::test_rate_limit_environment_configuration",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitMetrics::test_rate_limit_configuration_logging",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitMetrics::test_rate_limit_hit_logging",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitPerformance::test_lambda_function_performance",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitPerformance::test_rate_limit_decorator_performance",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitSecurity::test_admin_operation_rate_limits",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitSecurity::test_financial_operation_rate_limits",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitSecurity::test_rate_limit_prevents_brute_force",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitingEnforcement::test_rate_limit_configuration_loading",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitingEnforcement::test_rate_limit_format_validation",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitingEnforcement::test_rate_limit_lambda_functions",
|
||||
"apps/coordinator-api/tests/test_rate_limiting_comprehensive.py::TestRateLimitingEnforcement::test_tiered_rate_limit_strategy",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_batch_verification",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_double_spend_prevention",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_full_flow_simulation",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_proof_generation",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_proof_verification_rejects_zero_hash",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_proof_verification_stub",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_receipt_hash_generation",
|
||||
"apps/coordinator-api/tests/test_zk_integration.py::TestZKReceiptFlow::test_settlement_amount_calculation",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation::test_optimization_tools",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation::test_optimization_validation",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation::test_performance_benchmarks",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation::test_phase_1_implementations",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationImplementation::test_phase_2_implementations",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations::test_circuit_architecture_fixes",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations::test_circuit_size_prediction",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations::test_gas_cost_optimization",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations::test_memory_optimization_techniques",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestOptimizationRecommendations::test_performance_optimization_strategies",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestPerformanceBaselines::test_circuit_complexity_metrics",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestPerformanceBaselines::test_compilation_performance_scaling",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestPerformanceBaselines::test_critical_design_issues",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestPerformanceBaselines::test_infrastructure_readiness",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationPerformance::test_optimization_overhead",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationPerformance::test_optimization_performance_targets",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationPerformance::test_optimization_stability",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationPerformance::test_scalability_improvements",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation::test_optimization_documentation",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation::test_optimization_future_readiness",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation::test_optimization_maturity",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation::test_optimization_success_criteria",
|
||||
"apps/coordinator-api/tests/test_zk_optimization_findings.py::TestZKOptimizationValidation::test_optimization_sustainability",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofIntegration::test_receipt_creation_with_zk_proof",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofIntegration::test_settlement_with_zk_proof",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofPerformance::test_proof_generation_time",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofPerformance::test_proof_verification_time",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_basic_privacy",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_enhanced_privacy",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_invalid_privacy_level",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_generate_proof_service_disabled",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_hash_receipt",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_serialize_receipt",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_service_initialization_with_files",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_service_initialization_without_files",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_failure",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_service_disabled",
|
||||
"apps/coordinator-api/tests/test_zk_proofs.py::TestZKProofService::test_verify_proof_success",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_advanced_cryptographic_primitives",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_batch_verification",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_circuit_templates",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_memory_optimization",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_modular_circuit_design",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestCircuitArchitectureOptimization::test_recursive_proof_composition",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestPerformanceBenchmarking::test_circuit_complexity_analysis",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestPerformanceBenchmarking::test_circuit_size_prediction",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestPerformanceBenchmarking::test_gas_cost_analysis",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestPerformanceBenchmarking::test_proof_generation_optimization",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLErrorHandling::test_circuit_compilation_errors",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLErrorHandling::test_proof_generation_failures",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLErrorHandling::test_verification_failures",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLInfrastructureIntegration::test_coordinator_api_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLInfrastructureIntegration::test_gpu_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLInfrastructureIntegration::test_marketplace_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLInfrastructureIntegration::test_token_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLIntegration::test_circuit_compilation_pipeline",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLIntegration::test_fhe_service_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLIntegration::test_performance_monitoring",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLIntegration::test_zk_proof_service_integration",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLPerformanceValidation::test_compilation_performance_targets",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLPerformanceValidation::test_gas_efficiency_validation",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLPerformanceValidation::test_memory_usage_validation",
|
||||
"apps/coordinator-api/tests/test_zkml_optimization.py::TestZKMLPerformanceValidation::test_proof_size_optimization",
|
||||
"apps/zk-circuits/test/test_ml_circuits.py::test_circuit_performance",
|
||||
"apps/zk-circuits/test/test_ml_circuits.py::test_ml_inference_circuit",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetAuditLogger::test_audit_logger_level_info_by_default",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetAuditLogger::test_caching_consistent",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetAuditLogger::test_has_handlers_on_first_call",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetAuditLogger::test_returns_logger_with_audit_suffix",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetAuditLogger::test_returns_logger_with_suffix",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestGetLogger::test_returns_existing_logger",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_adds_console_handler",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_file_handler",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_file_handler_added_when_requested",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_formatter_is_structured",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_has_console_handler",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_idempotent",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_no_propagation",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_removes_existing_handlers",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_returns_logger_with_correct_level",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestSetupLogger::test_returns_logger_with_correct_name",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_basic_format",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_exception_info",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_extra_fields",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_format_basic",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_format_non_serializable_extra",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_format_with_exception",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_format_with_extra_fields",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_format_with_stack_info",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::TestStructuredLogFormatter::test_non_serializable_extra",
|
||||
"packages/py/aitbc-core/tests/test_logging.py::test_full_logging_output",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_analytics",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_api_error_handling",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_deactivate_miner",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_delete_job_cancelled",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_delete_job_confirmed",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_execute_custom_action",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_job_details_success",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_jobs_with_filter",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_logs_with_level",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_maintenance_cleanup",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_miners_list",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_prioritize_job",
|
||||
"tests/cli/test_admin.py::TestAdminCommands::test_status_success",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_import_env_not_set",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_import_env_success",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_keys_create",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_keys_list",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_keys_revoke",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_login_invalid_key",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_login_success",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_logout_success",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_refresh_no_key",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_refresh_success",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_status_authenticated",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_status_not_authenticated",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_token_hidden",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_token_not_found",
|
||||
"tests/cli/test_auth.py::TestAuthCommands::test_token_show",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_api_error_handling",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_block_details",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_blocks_success",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_info",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_node_status",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_peers",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_supply",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_sync_status",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_transaction",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_validator_details",
|
||||
"tests/cli/test_blockchain.py::TestBlockchainCommands::test_validators",
|
||||
"tests/cli/test_cli_integration.py::TestAdminCommands::test_list_jobs",
|
||||
"tests/cli/test_cli_integration.py::TestAdminCommands::test_list_miners",
|
||||
"tests/cli/test_cli_integration.py::TestAdminCommands::test_stats",
|
||||
"tests/cli/test_cli_integration.py::TestClientCommands::test_status_not_found",
|
||||
"tests/cli/test_cli_integration.py::TestClientCommands::test_submit_and_cancel",
|
||||
"tests/cli/test_cli_integration.py::TestClientCommands::test_submit_and_status",
|
||||
"tests/cli/test_cli_integration.py::TestClientCommands::test_submit_job",
|
||||
"tests/cli/test_cli_integration.py::TestEndToEnd::test_full_job_lifecycle",
|
||||
"tests/cli/test_cli_integration.py::TestExplorerCommands::test_blockchain_info",
|
||||
"tests/cli/test_cli_integration.py::TestExplorerCommands::test_blocks",
|
||||
"tests/cli/test_cli_integration.py::TestExplorerCommands::test_receipts",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_book_and_release",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_details",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_list_after_register",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_list_empty",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_register_and_list",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_register_cli",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_review",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_gpu_reviews",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_orders_empty",
|
||||
"tests/cli/test_cli_integration.py::TestMarketplaceGPUCommands::test_pricing",
|
||||
"tests/cli/test_cli_integration.py::TestMinerCommands::test_heartbeat",
|
||||
"tests/cli/test_cli_integration.py::TestMinerCommands::test_poll_no_jobs",
|
||||
"tests/cli/test_cli_integration.py::TestMinerCommands::test_register",
|
||||
"tests/cli/test_cli_integration.py::TestMinerCommands::test_status",
|
||||
"tests/cli/test_cli_integration.py::TestPaymentCommands::test_payment_status_not_found",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_api_error_handling",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_blocks_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_cancel_job_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_history_with_filters",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_pay_command_failure",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_pay_command_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_payment_receipt_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_payment_status_not_found",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_payment_status_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_refund_failure",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_refund_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_status_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_submit_job_from_file",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_submit_job_success",
|
||||
"tests/cli/test_client.py::TestClientCommands::test_submit_missing_required_args",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_edit_command",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_environments",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_export_empty_yaml",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_export_empty_yaml_yaml_format",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_export_json",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_export_no_config",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_export_yaml",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_import_config_json",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_import_config_yaml",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_import_merge",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_import_nonexistent_file",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_path_command",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_path_global",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_profiles_delete",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_profiles_delete_cancelled",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_profiles_list",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_profiles_load",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_profiles_save",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_reset_config_cancelled",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_reset_config_confirmed",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_reset_no_config",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_set_api_key",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_set_coordinator_url",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_set_invalid_key",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_set_invalid_timeout",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_set_timeout",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_show_config",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_validate_invalid_url",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_validate_missing_url",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_validate_no_api_key",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_validate_short_api_key",
|
||||
"tests/cli/test_config.py::TestConfigCommands::test_validate_valid_config",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_invalid_aitbc_amount",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_invalid_btc_amount",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_no_amount",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_rates_error",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_with_aitbc_amount",
|
||||
"tests/cli/test_exchange.py::TestExchangeCreatePaymentCommand::test_create_payment_with_btc_amount",
|
||||
"tests/cli/test_exchange.py::TestExchangeIntegration::test_complete_exchange_workflow",
|
||||
"tests/cli/test_exchange.py::TestExchangeMarketStatsCommand::test_market_stats_success",
|
||||
"tests/cli/test_exchange.py::TestExchangePaymentStatusCommand::test_payment_status_confirmed",
|
||||
"tests/cli/test_exchange.py::TestExchangePaymentStatusCommand::test_payment_status_expired",
|
||||
"tests/cli/test_exchange.py::TestExchangePaymentStatusCommand::test_payment_status_not_found",
|
||||
"tests/cli/test_exchange.py::TestExchangePaymentStatusCommand::test_payment_status_pending",
|
||||
"tests/cli/test_exchange.py::TestExchangeRatesCommand::test_rates_api_error",
|
||||
"tests/cli/test_exchange.py::TestExchangeRatesCommand::test_rates_success",
|
||||
"tests/cli/test_exchange.py::TestExchangeWalletCommands::test_wallet_balance_success",
|
||||
"tests/cli/test_exchange.py::TestExchangeWalletCommands::test_wallet_info_success",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_list_filter_by_status",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_list_proposals",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_propose_funding",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_propose_general",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_propose_parameter_change",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_result_command",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_result_invalid_proposal",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_vote_against",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_vote_duplicate_rejected",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_vote_for",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_vote_invalid_proposal",
|
||||
"tests/cli/test_governance.py::TestGovernanceCommands::test_vote_weighted",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_add_review",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_api_error_handling",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_book",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_details",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_list_all",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_list_available",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_list_with_filters",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_gpu_release",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_orders_list",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_pricing_info",
|
||||
"tests/cli/test_marketplace.py::TestMarketplaceCommands::test_reviews_list",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_details",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_details_not_found",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_list_all",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_list_with_filters",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_submit_api_error",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_submit_price_validation_error",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_submit_success",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidCommands::test_bid_submit_validation_error",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceBidIntegration::test_complete_bid_workflow",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceOffersCommands::test_offers_list_all",
|
||||
"tests/cli/test_marketplace_bids.py::TestMarketplaceOffersCommands::test_offers_list_with_filters",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_api_error_handling",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_create_user",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_fund_user",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_init_economy",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_init_with_reset",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_invalid_distribution_format",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_list_users",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_load_test",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_load_test_command",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_nonexistent_commands",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_reset",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_reset_command",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_results",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_results_command",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_run_scenario",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_run_workflow",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_scenario_commands",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_scenario_list",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_user_balance",
|
||||
"tests/cli/test_simulate.py::TestSimulateCommands::test_workflow_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_address_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_balance_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_balance_new_wallet",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_earn_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_history_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_liquidity_stake_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_liquidity_stake_gold_tier",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_liquidity_stake_insufficient_balance",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_liquidity_unstake_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_liquidity_unstake_invalid_id",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_request_payment_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_rewards_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_send_command_success",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_send_insufficient_balance",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_spend_command_success",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_spend_insufficient_balance",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_stake_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_stake_insufficient_balance",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_staking_info_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_stats_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_unstake_command",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_unstake_invalid_id",
|
||||
"tests/cli/test_wallet.py::TestWalletCommands::test_wallet_file_creation",
|
||||
"tests/e2e/test_advanced_features.py::test_adaptive_scaler_trigger",
|
||||
"tests/e2e/test_advanced_features.py::test_dao_governance_proposal",
|
||||
"tests/e2e/test_advanced_features.py::test_multi_modal_fusion",
|
||||
"tests/e2e/test_client_miner_workflow.py::test_client_to_miner_complete_workflow",
|
||||
"tests/e2e/test_client_miner_workflow.py::test_enhanced_services_integration",
|
||||
"tests/e2e/test_cross_container_marketplace.py::test_cross_container_marketplace_sync",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_config_files",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_helper_functions",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_import",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_paths_exist",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_structure",
|
||||
"tests/e2e/test_fixture_verification.py::test_fixture_wallet_files",
|
||||
"tests/e2e/test_mock_services.py::test_mock_integration",
|
||||
"tests/e2e/test_mock_services.py::test_mock_performance",
|
||||
"tests/e2e/test_mock_services.py::test_mock_workflow",
|
||||
"tests/integration/test_basic_integration.py::test_coordinator_client_fixture",
|
||||
"tests/integration/test_basic_integration.py::test_mock_coordinator_client",
|
||||
"tests/integration/test_basic_integration.py::test_pytest_markings",
|
||||
"tests/integration/test_basic_integration.py::test_pytest_markings_integration",
|
||||
"tests/integration/test_basic_integration.py::test_simple_job_creation_mock",
|
||||
"tests/integration/test_blockchain_final.py::test_nodes",
|
||||
"tests/integration/test_blockchain_nodes.py::test_block_production",
|
||||
"tests/integration/test_blockchain_nodes.py::test_chain_consistency",
|
||||
"tests/integration/test_blockchain_nodes.py::test_faucet_and_balances",
|
||||
"tests/integration/test_blockchain_nodes.py::test_node_connectivity",
|
||||
"tests/integration/test_blockchain_nodes.py::test_transaction_submission",
|
||||
"tests/integration/test_blockchain_simple.py::test_node_basic_functionality",
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_cross_site_sync_status",
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_real_node_connectivity",
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_sync_health_check",
|
||||
"tests/integration/test_blockchain_sync_simple.py::TestBlockchainSyncSimple::test_sync_monitoring_metrics",
|
||||
"tests/integration/test_community_governance.py::test_developer_ecosystem",
|
||||
"tests/integration/test_community_governance.py::test_governance_lifecycle",
|
||||
"tests/integration/test_community_governance.py::test_solution_marketplace",
|
||||
"tests/integration/test_full_workflow.py::TestJobToBlockchainWorkflow::test_end_to_end_job_execution",
|
||||
"tests/integration/test_full_workflow.py::TestJobToBlockchainWorkflow::test_multi_tenant_isolation",
|
||||
"tests/integration/test_full_workflow.py::TestMarketplaceIntegration::test_service_listing_and_booking",
|
||||
"tests/integration/test_full_workflow.py::TestP2PNetworkSync::test_block_propagation",
|
||||
"tests/integration/test_full_workflow.py::TestP2PNetworkSync::test_transaction_propagation",
|
||||
"tests/integration/test_full_workflow.py::TestSecurityIntegration::test_end_to_end_encryption",
|
||||
"tests/integration/test_full_workflow.py::TestWalletToCoordinatorIntegration::test_job_payment_flow",
|
||||
"tests/integration/test_integration_simple.py::test_api_key_validation",
|
||||
"tests/integration/test_integration_simple.py::test_coordinator_docs",
|
||||
"tests/integration/test_integration_simple.py::test_coordinator_health_check",
|
||||
"tests/integration/test_integration_simple.py::test_job_creation_with_mock",
|
||||
"tests/integration/test_integration_simple.py::test_miner_registration",
|
||||
"tests/integration/test_integration_simple.py::test_mock_services",
|
||||
"tests/integration/test_working_integration.py::test_api_key_validation",
|
||||
"tests/integration/test_working_integration.py::test_coordinator_app_imports",
|
||||
"tests/integration/test_working_integration.py::test_coordinator_health_check",
|
||||
"tests/integration/test_working_integration.py::test_import_structure",
|
||||
"tests/integration/test_working_integration.py::test_job_endpoint_structure",
|
||||
"tests/integration/test_working_integration.py::test_job_schema_validation",
|
||||
"tests/integration/test_working_integration.py::test_miner_endpoint_structure",
|
||||
"tests/openclaw_marketplace/test_framework.py::TestMarketplaceHealth::test_primary_marketplace_health",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_audit_trail_privacy",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_data_retention_policy",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_kyc_aml_integration",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionCompliance::test_regulatory_reporting",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_audit_log_integrity",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_deniable_encryption",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_encryption_confidentiality",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_forward_secrecy",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_hsm_integration_security",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_key_rotation_security",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_multi_party_computation",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_side_channel_resistance",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_transaction_replay_protection",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_viewing_key_generation",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_viewing_key_permissions",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionSecurity::test_zero_knowledge_proof_integration",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_key_derivation_security",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_memory_sanitization",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_quantum_resistance_preparation",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_side_channel_leakage_prevention",
|
||||
"tests/security/test_confidential_transactions.py::TestConfidentialTransactionVulnerabilities::test_timing_attack_prevention",
|
||||
"tests/test_basic_integration.py::test_coordinator_client_fixture",
|
||||
"tests/test_basic_integration.py::test_mock_coordinator_client",
|
||||
"tests/test_basic_integration.py::test_pytest_markings",
|
||||
"tests/test_basic_integration.py::test_pytest_markings_integration",
|
||||
"tests/test_basic_integration.py::test_simple_job_creation_mock",
|
||||
"tests/test_blockchain_final.py::test_nodes",
|
||||
"tests/test_blockchain_nodes.py::test_block_production",
|
||||
"tests/test_blockchain_nodes.py::test_chain_consistency",
|
||||
"tests/test_blockchain_nodes.py::test_faucet_and_balances",
|
||||
"tests/test_blockchain_nodes.py::test_node_connectivity",
|
||||
"tests/test_blockchain_nodes.py::test_transaction_submission",
|
||||
"tests/test_blockchain_simple.py::test_node_basic_functionality",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_command_security_level_classification",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_critical_command_translation_disabled",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_external_api_failure_fallback",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_get_security_policy_for_command",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_high_security_local_only",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_local_translation_functionality",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_low_security_full_translation",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_medium_security_fallback_mode",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_security_logging",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_security_summary_generation",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_translation_allowed_check",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_unknown_command_default_security",
|
||||
"tests/test_cli_translation_security.py::TestCLITranslationSecurityManager::test_user_consent_requirement",
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_always_fallback_to_original_text",
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_critical_commands_never_use_external_apis",
|
||||
"tests/test_cli_translation_security.py::TestSecurityCompliance::test_sensitive_data_never_sent_externally",
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_concurrent_translation_requests",
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_empty_translation_request",
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_security_log_size_limit",
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_unsupported_target_language",
|
||||
"tests/test_cli_translation_security.py::TestSecurityEdgeCases::test_very_long_text_translation",
|
||||
"tests/test_cli_translation_security.py::TestTranslationSecurityConfiguration::test_configure_translation_security",
|
||||
"tests/test_cli_translation_security.py::TestTranslationSecurityConfiguration::test_get_translation_security_report",
|
||||
"tests/test_discovery.py::test_another_discovery_test",
|
||||
"tests/test_discovery.py::test_pytest_discovery",
|
||||
"tests/test_explorer_fixes.py::TestExplorerFixes::test_explorer_contains_robust_timestamp_handling",
|
||||
"tests/test_explorer_fixes.py::TestExplorerFixes::test_explorer_file_contains_transaction_endpoint",
|
||||
"tests/test_explorer_fixes.py::TestExplorerFixes::test_explorer_search_functionality",
|
||||
"tests/test_explorer_fixes.py::TestExplorerFixes::test_field_mapping_completeness",
|
||||
"tests/test_explorer_fixes.py::TestExplorerFixes::test_pytest_configuration_restored",
|
||||
"tests/test_explorer_fixes.py::TestRPCIntegration::test_field_mapping_consistency",
|
||||
"tests/test_explorer_fixes.py::TestRPCIntegration::test_rpc_transaction_endpoint_exists",
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_endpoint_exists",
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_not_found",
|
||||
"tests/test_explorer_integration.py::TestExplorerTransactionAPI::test_transaction_successful_response",
|
||||
"tests/test_explorer_integration.py::TestFieldMapping::test_rpc_to_frontend_mapping",
|
||||
"tests/test_explorer_integration.py::TestTestDiscovery::test_pytest_configuration",
|
||||
"tests/test_explorer_integration.py::TestTestDiscovery::test_test_files_exist",
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_invalid",
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_iso_string",
|
||||
"tests/test_explorer_integration.py::TestTimestampHandling::test_format_timestamp_numeric",
|
||||
"tests/test_integration_simple.py::test_api_key_validation",
|
||||
"tests/test_integration_simple.py::test_coordinator_docs",
|
||||
"tests/test_integration_simple.py::test_coordinator_health_check",
|
||||
"tests/test_integration_simple.py::test_job_creation_with_mock",
|
||||
"tests/test_integration_simple.py::test_miner_registration",
|
||||
"tests/test_integration_simple.py::test_mock_services",
|
||||
"tests/test_websocket_backpressure_core.py::TestBackpressureScenarios::test_high_load_scenario",
|
||||
"tests/test_websocket_backpressure_core.py::TestBackpressureScenarios::test_slow_consumer_isolation",
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_backpressure_handling",
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_basic_operations",
|
||||
"tests/test_websocket_backpressure_core.py::TestBoundedQueue::test_priority_ordering",
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_broadcast_to_all_streams",
|
||||
"tests/test_websocket_backpressure_core.py::TestStreamManager::test_slow_stream_detection",
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_backpressure_handling",
|
||||
"tests/test_websocket_backpressure_core.py::TestWebSocketStream::test_slow_consumer_detection",
|
||||
"tests/test_windsurf_integration.py::test_multiplication[1-2]",
|
||||
"tests/test_windsurf_integration.py::test_multiplication[2-4]",
|
||||
"tests/test_windsurf_integration.py::test_multiplication[3-6]",
|
||||
"tests/test_windsurf_integration.py::test_pytest_discovery",
|
||||
"tests/test_windsurf_integration.py::test_windsurf_integration",
|
||||
"tests/test_working_integration.py::test_api_key_validation",
|
||||
"tests/test_working_integration.py::test_coordinator_app_imports",
|
||||
"tests/test_working_integration.py::test_coordinator_health_check",
|
||||
"tests/test_working_integration.py::test_import_structure",
|
||||
"tests/test_working_integration.py::test_job_endpoint_structure",
|
||||
"tests/test_working_integration.py::test_job_schema_validation",
|
||||
"tests/test_working_integration.py::test_miner_endpoint_structure",
|
||||
"tests/verification/test_block_import.py::test_block_import",
|
||||
"tests/verification/test_block_import_complete.py::test_block_import_complete",
|
||||
"tests/verification/test_minimal.py::test_minimal",
|
||||
"tests/verification/test_simple_import.py::test_simple_block_import",
|
||||
"tests/verification/test_tx_import.py::test_transaction_import"
|
||||
]
|
||||
1
dev/cache/.pytest_cache/v/cache/stepwise
vendored
Executable file
1
dev/cache/.pytest_cache/v/cache/stepwise
vendored
Executable file
@@ -0,0 +1 @@
|
||||
[]
|
||||
2
dev/cache/.ruff_cache/.gitignore
vendored
Executable file
2
dev/cache/.ruff_cache/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
# Automatically created by ruff.
|
||||
*
|
||||
BIN
dev/cache/.ruff_cache/0.12.5/12636701063661368402
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/12636701063661368402
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/1477393555047468492
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/1477393555047468492
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/16589746200122095695
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/16589746200122095695
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/18129734795962435222
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/18129734795962435222
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/3180469820014061218
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/3180469820014061218
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/7831227230606267255
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/7831227230606267255
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/7842963323778035915
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/7842963323778035915
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/8002053153017440285
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/8002053153017440285
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/8117472977419676393
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/8117472977419676393
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/9060229693256940902
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/9060229693256940902
vendored
Executable file
Binary file not shown.
BIN
dev/cache/.ruff_cache/0.12.5/938682881153324443
vendored
Executable file
BIN
dev/cache/.ruff_cache/0.12.5/938682881153324443
vendored
Executable file
Binary file not shown.
1
dev/cache/.ruff_cache/CACHEDIR.TAG
vendored
Executable file
1
dev/cache/.ruff_cache/CACHEDIR.TAG
vendored
Executable file
@@ -0,0 +1 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
61
dev/cache/.vscode/launch.json
vendored
Executable file
61
dev/cache/.vscode/launch.json
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug Python Tests",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/.venv/bin/pytest",
|
||||
"args": [
|
||||
"${input:testPath}",
|
||||
"--no-cov",
|
||||
"-vv"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"env": {
|
||||
"PYTHONPATH": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug All Tests",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/.venv/bin/pytest",
|
||||
"args": [
|
||||
"tests/",
|
||||
"--no-cov",
|
||||
"-vv"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"env": {
|
||||
"PYTHONPATH": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Debug Current Test File",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/.venv/bin/pytest",
|
||||
"args": [
|
||||
"${file}",
|
||||
"--no-cov",
|
||||
"-vv"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": false,
|
||||
"env": {
|
||||
"PYTHONPATH": "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "testPath",
|
||||
"description": "Test path or pattern",
|
||||
"default": "tests/",
|
||||
"type": "promptString"
|
||||
}
|
||||
]
|
||||
}
|
||||
50
dev/cache/.vscode/settings.json
vendored
Executable file
50
dev/cache/.vscode/settings.json
vendored
Executable file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"**/node_modules": true,
|
||||
"**/.pytest_cache": true,
|
||||
"**/.ruff_cache": true,
|
||||
"**/.venv": true,
|
||||
"**/logs": true,
|
||||
"**/cli_env": true
|
||||
},
|
||||
"files.watcherExclude": {
|
||||
"**/node_modules/**": true,
|
||||
"**/.pytest_cache/**": true,
|
||||
"**/.ruff_cache/**": true,
|
||||
"**/.venv/**": true,
|
||||
"**/logs/**": true,
|
||||
"**/cli_env/**": true
|
||||
},
|
||||
"python.linting.enabled": true,
|
||||
"python.linting.pylintEnabled": false,
|
||||
"python.linting.flake8Enabled": true,
|
||||
"python.formatting.provider": "black",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.py": "python",
|
||||
"*.sh": "shellscript",
|
||||
"*.yaml": "yaml",
|
||||
"*.yml": "yaml",
|
||||
"*.md": "markdown"
|
||||
},
|
||||
"python.defaultInterpreterPath": "./cli/venv/bin/python",
|
||||
"terminal.integrated.cwd": ".",
|
||||
"explorer.fileNesting.enabled": true,
|
||||
"explorer.fileNesting.patterns": {
|
||||
"*.py": "*.py",
|
||||
"*.sh": "*.sh",
|
||||
"*.md": "*.md",
|
||||
"package.json": "package-lock.json",
|
||||
"pyproject.toml": "poetry.lock",
|
||||
".env.example": ".env*"
|
||||
}
|
||||
}
|
||||
32
dev/cache/.vscode/tasks.json
vendored
Executable file
32
dev/cache/.vscode/tasks.json
vendored
Executable file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Check File Organization",
|
||||
"type": "shell",
|
||||
"command": "./scripts/check-file-organization.sh",
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared"
|
||||
},
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Move Misplaced Files",
|
||||
"type": "shell",
|
||||
"command": "./scripts/move-to-right-folder.sh",
|
||||
"args": ["--auto"],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
"reveal": "always",
|
||||
"focus": false,
|
||||
"panel": "shared"
|
||||
},
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
124
dev/cache/logs/host_gpu_miner.log
vendored
Executable file
124
dev/cache/logs/host_gpu_miner.log
vendored
Executable file
@@ -0,0 +1,124 @@
|
||||
2026-02-24 01:18:03,341 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:18:03,358 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:18:03,400 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:18:03,400 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:18:03,401 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:18:03,409 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:18:03,409 - INFO - Coordinator is available!
|
||||
2026-02-24 01:18:03,478 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=${MINER_API_KEY} "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:18:03,478 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:18:03,478 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:26:21,106 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:26:21,122 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:26:21,166 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:26:21,166 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:26:21,166 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:26:21,183 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:26:21,183 - INFO - Coordinator is available!
|
||||
2026-02-24 01:26:21,225 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=${MINER_API_KEY} "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:26:21,226 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:26:21,226 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:30:07,020 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:30:07,039 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:30:07,099 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:30:07,100 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:30:07,100 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:30:07,109 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:30:07,110 - INFO - Coordinator is available!
|
||||
2026-02-24 01:30:07,157 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=${MINER_API_KEY} "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:30:07,157 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:30:07,157 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:30:56,038 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:30:56,055 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:30:56,098 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:30:56,098 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:30:56,098 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:30:56,107 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:30:56,107 - INFO - Coordinator is available!
|
||||
2026-02-24 01:30:56,151 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=${MINER_API_KEY} "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:30:56,151 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:30:56,151 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:31:11,594 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:31:11,613 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:31:11,657 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:31:11,657 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:31:11,657 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:31:11,665 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:31:11,665 - INFO - Coordinator is available!
|
||||
2026-02-24 01:31:11,709 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=miner_test_abc123 "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:31:11,710 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:31:11,710 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:34:47,687 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:34:47,705 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:34:47,749 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:34:47,750 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:34:47,750 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:34:47,758 - INFO - HTTP Request: GET http://127.0.0.1:18000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:34:47,758 - INFO - Coordinator is available!
|
||||
2026-02-24 01:34:47,800 - INFO - HTTP Request: POST http://127.0.0.1:18000/v1/miners/register?miner_id=miner_test_abc123 "HTTP/1.1 401 Unauthorized"
|
||||
2026-02-24 01:34:47,801 - ERROR - Registration failed: 401 - {"detail":"invalid api key"}
|
||||
2026-02-24 01:34:47,801 - ERROR - Failed to register, exiting
|
||||
2026-02-24 01:38:15,668 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:38:15,685 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:38:15,697 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:38:15,698 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:38:15,698 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:38:15,707 - INFO - Waiting for coordinator... (1/10)
|
||||
2026-02-24 01:38:45,715 - INFO - Waiting for coordinator... (2/10)
|
||||
2026-02-24 01:39:15,723 - INFO - Waiting for coordinator... (3/10)
|
||||
2026-02-24 01:39:45,732 - INFO - Waiting for coordinator... (4/10)
|
||||
2026-02-24 01:39:48,945 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:39:48,963 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:39:49,006 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:39:49,006 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:39:49,006 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:39:49,013 - INFO - Waiting for coordinator... (1/10)
|
||||
2026-02-24 01:40:19,020 - INFO - Waiting for coordinator... (2/10)
|
||||
2026-02-24 01:40:49,027 - INFO - Waiting for coordinator... (3/10)
|
||||
2026-02-24 01:49:22,772 - INFO - Starting Real GPU Miner Client on Host...
|
||||
2026-02-24 01:49:22,790 - INFO - GPU detected: NVIDIA GeForce RTX 4060 Ti (16380MB)
|
||||
2026-02-24 01:49:22,802 - INFO - HTTP Request: GET http://localhost:11434/api/tags "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:22,803 - INFO - Ollama running with models: ['lauchacarro/qwen2.5-translator:latest', 'gemma3:1b']
|
||||
2026-02-24 01:49:22,803 - INFO - Ollama models available: lauchacarro/qwen2.5-translator:latest, gemma3:1b
|
||||
2026-02-24 01:49:22,812 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:22,812 - INFO - Coordinator is available!
|
||||
2026-02-24 01:49:22,942 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/register?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:22,943 - INFO - Successfully registered miner: {'status': 'ok', 'session_token': '679f256001e04bdd842beb18f6d83ac8'}
|
||||
2026-02-24 01:49:22,943 - INFO - Miner registered successfully, starting main loop...
|
||||
2026-02-24 01:49:22,972 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:23,173 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/heartbeat?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:23,173 - INFO - Heartbeat sent (GPU: 34%)
|
||||
2026-02-24 01:49:23,185 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:26,197 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:29,213 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:32,223 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:35,234 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:38,260 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:38,320 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/heartbeat?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:38,320 - INFO - Heartbeat sent (GPU: 38%)
|
||||
2026-02-24 01:49:38,330 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:41,340 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:44,351 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:47,361 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:50,372 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:53,409 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:53,508 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/heartbeat?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:49:53,514 - INFO - Heartbeat sent (GPU: 28%)
|
||||
2026-02-24 01:49:53,526 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:56,537 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:49:59,548 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:02,558 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:05,568 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:08,599 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:50:08,656 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/heartbeat?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:50:08,657 - INFO - Heartbeat sent (GPU: 32%)
|
||||
2026-02-24 01:50:08,666 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:11,676 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:14,686 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:17,697 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:20,708 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:23,746 - INFO - HTTP Request: GET http://127.0.0.1:8000/v1/health "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:50:23,802 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/heartbeat?miner_id=miner_test_abc123 "HTTP/1.1 200 OK"
|
||||
2026-02-24 01:50:23,803 - INFO - Heartbeat sent (GPU: 28%)
|
||||
2026-02-24 01:50:23,812 - INFO - HTTP Request: POST http://127.0.0.1:8000/v1/miners/poll "HTTP/1.1 204 No Content"
|
||||
2026-02-24 01:50:24,194 - INFO - Shutting down miner...
|
||||
2
dev/env/cli_env/.gitignore
vendored
Executable file
2
dev/env/cli_env/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
# Created by venv; see https://docs.python.org/3/library/venv.html
|
||||
*
|
||||
248
dev/env/cli_env/bin/Activate.ps1
vendored
Executable file
248
dev/env/cli_env/bin/Activate.ps1
vendored
Executable file
@@ -0,0 +1,248 @@
|
||||
<#
|
||||
.Synopsis
|
||||
Activate a Python virtual environment for the current PowerShell session.
|
||||
|
||||
.Description
|
||||
Pushes the python executable for a virtual environment to the front of the
|
||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
||||
in a Python virtual environment. Makes use of the command line switches as
|
||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
||||
|
||||
.Parameter VenvDir
|
||||
Path to the directory that contains the virtual environment to activate. The
|
||||
default value for this is the parent of the directory that the Activate.ps1
|
||||
script is located within.
|
||||
|
||||
.Parameter Prompt
|
||||
The prompt prefix to display when this virtual environment is activated. By
|
||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
||||
|
||||
.Example
|
||||
Activate.ps1
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Verbose
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and shows extra information about the activation as it executes.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
||||
Activates the Python virtual environment located in the specified location.
|
||||
|
||||
.Example
|
||||
Activate.ps1 -Prompt "MyPython"
|
||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
||||
and prefixes the current prompt with the specified string (surrounded in
|
||||
parentheses) while the virtual environment is active.
|
||||
|
||||
.Notes
|
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
||||
execution policy for the user. You can do this by issuing the following PowerShell
|
||||
command:
|
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
For more information on Execution Policies:
|
||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
||||
|
||||
#>
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$VenvDir,
|
||||
[Parameter(Mandatory = $false)]
|
||||
[String]
|
||||
$Prompt
|
||||
)
|
||||
|
||||
<# Function declarations --------------------------------------------------- #>
|
||||
|
||||
<#
|
||||
.Synopsis
|
||||
Remove all shell session elements added by the Activate script, including the
|
||||
addition of the virtual environment's Python executable from the beginning of
|
||||
the PATH variable.
|
||||
|
||||
.Parameter NonDestructive
|
||||
If present, do not remove this function from the global namespace for the
|
||||
session.
|
||||
|
||||
#>
|
||||
function global:deactivate ([switch]$NonDestructive) {
|
||||
# Revert to original values
|
||||
|
||||
# The prior prompt:
|
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
|
||||
# The prior PYTHONHOME:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
}
|
||||
|
||||
# The prior PATH:
|
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
||||
}
|
||||
|
||||
# Just remove the VIRTUAL_ENV altogether:
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV
|
||||
}
|
||||
|
||||
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
||||
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
||||
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
||||
}
|
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
||||
}
|
||||
|
||||
# Leave deactivate function in the global namespace if requested:
|
||||
if (-not $NonDestructive) {
|
||||
Remove-Item -Path function:deactivate
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.Description
|
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
||||
given folder, and returns them in a map.
|
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
||||
then it is considered a `key = value` line. The left hand string is the key,
|
||||
the right hand is the value.
|
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is
|
||||
stripped from the value before being captured.
|
||||
|
||||
.Parameter ConfigDir
|
||||
Path to the directory that contains the `pyvenv.cfg` file.
|
||||
#>
|
||||
function Get-PyVenvConfig(
|
||||
[String]
|
||||
$ConfigDir
|
||||
) {
|
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
||||
|
||||
# An empty map will be returned if no config file is found.
|
||||
$pyvenvConfig = @{ }
|
||||
|
||||
if ($pyvenvConfigPath) {
|
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines"
|
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
||||
|
||||
$pyvenvConfigContent | ForEach-Object {
|
||||
$keyval = $PSItem -split "\s*=\s*", 2
|
||||
if ($keyval[0] -and $keyval[1]) {
|
||||
$val = $keyval[1]
|
||||
|
||||
# Remove extraneous quotations around a string value.
|
||||
if ("'""".Contains($val.Substring(0, 1))) {
|
||||
$val = $val.Substring(1, $val.Length - 2)
|
||||
}
|
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val
|
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $pyvenvConfig
|
||||
}
|
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #>
|
||||
|
||||
# Determine the containing directory of this script
|
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
||||
# First, get the location of the virtual environment, it might not be
|
||||
# VenvExecDir if specified on the command line.
|
||||
if ($VenvDir) {
|
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
||||
Write-Verbose "VenvDir=$VenvDir"
|
||||
}
|
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
||||
# as `prompt`.
|
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
||||
|
||||
# Next, set the prompt from the command line, or the config file, or
|
||||
# just use the name of the virtual environment folder.
|
||||
if ($Prompt) {
|
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
||||
}
|
||||
else {
|
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
||||
$Prompt = $pyvenvCfg['prompt'];
|
||||
}
|
||||
else {
|
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Prompt = '$Prompt'"
|
||||
Write-Verbose "VenvDir='$VenvDir'"
|
||||
|
||||
# Deactivate any currently active virtual environment, but leave the
|
||||
# deactivate function in place.
|
||||
deactivate -nondestructive
|
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
||||
# that there is an activated venv.
|
||||
$env:VIRTUAL_ENV = $VenvDir
|
||||
|
||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'"
|
||||
|
||||
# Set the prompt to include the env name
|
||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
||||
|
||||
function global:prompt {
|
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
||||
_OLD_VIRTUAL_PROMPT
|
||||
}
|
||||
}
|
||||
|
||||
# Clear PYTHONHOME
|
||||
if (Test-Path -Path Env:PYTHONHOME) {
|
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
||||
Remove-Item -Path Env:PYTHONHOME
|
||||
}
|
||||
|
||||
# Add the venv to the PATH
|
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
||||
76
dev/env/cli_env/bin/activate
vendored
Executable file
76
dev/env/cli_env/bin/activate
vendored
Executable file
@@ -0,0 +1,76 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# You cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# Call hash to forget past locations. Without forgetting
|
||||
# past locations the $PATH changes we made may not be respected.
|
||||
# See "man bash" for more details. hash is usually a builtin of your shell
|
||||
hash -r 2> /dev/null
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
unset VIRTUAL_ENV_PROMPT
|
||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
# on Windows, a path can contain colons and backslashes and has to be converted:
|
||||
case "$(uname)" in
|
||||
CYGWIN*|MSYS*|MINGW*)
|
||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
|
||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
||||
VIRTUAL_ENV=$(cygpath /home/oib/windsurf/aitbc/cli_env)
|
||||
export VIRTUAL_ENV
|
||||
;;
|
||||
*)
|
||||
# use the path as-is
|
||||
export VIRTUAL_ENV=/home/oib/windsurf/aitbc/cli_env
|
||||
;;
|
||||
esac
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/"bin":$PATH"
|
||||
export PATH
|
||||
|
||||
VIRTUAL_ENV_PROMPT=cli_env
|
||||
export VIRTUAL_ENV_PROMPT
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
PS1="("cli_env") ${PS1:-}"
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# Call hash to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
hash -r 2> /dev/null
|
||||
27
dev/env/cli_env/bin/activate.csh
vendored
Executable file
27
dev/env/cli_env/bin/activate.csh
vendored
Executable file
@@ -0,0 +1,27 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV /home/oib/windsurf/aitbc/cli_env
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
|
||||
setenv VIRTUAL_ENV_PROMPT cli_env
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
set prompt = "("cli_env") $prompt:q"
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
69
dev/env/cli_env/bin/activate.fish
vendored
Executable file
69
dev/env/cli_env/bin/activate.fish
vendored
Executable file
@@ -0,0 +1,69 @@
|
||||
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
||||
# (https://fishshell.com/). You cannot run it directly.
|
||||
|
||||
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
# prevents error when using nested fish instances (Issue #93858)
|
||||
if functions -q _old_fish_prompt
|
||||
functions -e fish_prompt
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
set -e VIRTUAL_ENV_PROMPT
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self-destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV /home/oib/windsurf/aitbc/cli_env
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/"bin $PATH
|
||||
set -gx VIRTUAL_ENV_PROMPT cli_env
|
||||
|
||||
# Unset PYTHONHOME if set.
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# fish uses a function instead of an env var to generate the prompt.
|
||||
|
||||
# Save the current fish_prompt function as the function _old_fish_prompt.
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
# With the original prompt function renamed, we can override with our own.
|
||||
function fish_prompt
|
||||
# Save the return status of the last command.
|
||||
set -l old_status $status
|
||||
|
||||
# Output the venv prompt; color taken from the blue of the Python logo.
|
||||
printf "%s(%s)%s " (set_color 4B8BBE) cli_env (set_color normal)
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
# Output the original/"old" prompt.
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
8
dev/env/cli_env/bin/aitbc
vendored
Executable file
8
dev/env/cli_env/bin/aitbc
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from aitbc_cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/dotenv
vendored
Executable file
8
dev/env/cli_env/bin/dotenv
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from dotenv.__main__ import cli
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(cli())
|
||||
8
dev/env/cli_env/bin/httpx
vendored
Executable file
8
dev/env/cli_env/bin/httpx
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from httpx import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/keyring
vendored
Executable file
8
dev/env/cli_env/bin/keyring
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from keyring.cli import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/markdown-it
vendored
Executable file
8
dev/env/cli_env/bin/markdown-it
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from markdown_it.cli.parse import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/pip
vendored
Executable file
8
dev/env/cli_env/bin/pip
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/pip3
vendored
Executable file
8
dev/env/cli_env/bin/pip3
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/pip3.13
vendored
Executable file
8
dev/env/cli_env/bin/pip3.13
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
dev/env/cli_env/bin/pygmentize
vendored
Executable file
8
dev/env/cli_env/bin/pygmentize
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pygments.cmdline import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
BIN
dev/env/cli_env/bin/python
vendored
Executable file
BIN
dev/env/cli_env/bin/python
vendored
Executable file
Binary file not shown.
BIN
dev/env/cli_env/bin/python3
vendored
Executable file
BIN
dev/env/cli_env/bin/python3
vendored
Executable file
Binary file not shown.
BIN
dev/env/cli_env/bin/python3.13
vendored
Executable file
BIN
dev/env/cli_env/bin/python3.13
vendored
Executable file
Binary file not shown.
8
dev/env/cli_env/bin/tabulate
vendored
Executable file
8
dev/env/cli_env/bin/tabulate
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/home/oib/windsurf/aitbc/cli_env/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from tabulate import _main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(_main())
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/__editable__.aitbc_cli-0.1.0.pth
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/__editable__.aitbc_cli-0.1.0.pth
vendored
Executable file
@@ -0,0 +1 @@
|
||||
import __editable___aitbc_cli_0_1_0_finder; __editable___aitbc_cli_0_1_0_finder.install()
|
||||
85
dev/env/cli_env/lib/python3.13/site-packages/__editable___aitbc_cli_0_1_0_finder.py
vendored
Executable file
85
dev/env/cli_env/lib/python3.13/site-packages/__editable___aitbc_cli_0_1_0_finder.py
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
from __future__ import annotations
|
||||
import sys
|
||||
from importlib.machinery import ModuleSpec, PathFinder
|
||||
from importlib.machinery import all_suffixes as module_suffixes
|
||||
from importlib.util import spec_from_file_location
|
||||
from itertools import chain
|
||||
from pathlib import Path
|
||||
|
||||
MAPPING: dict[str, str] = {'aitbc_cli': '/home/oib/windsurf/aitbc/cli/aitbc_cli'}
|
||||
NAMESPACES: dict[str, list[str]] = {}
|
||||
PATH_PLACEHOLDER = '__editable__.aitbc_cli-0.1.0.finder' + ".__path_hook__"
|
||||
|
||||
|
||||
class _EditableFinder: # MetaPathFinder
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str, path=None, target=None) -> ModuleSpec | None: # type: ignore
|
||||
# Top-level packages and modules (we know these exist in the FS)
|
||||
if fullname in MAPPING:
|
||||
pkg_path = MAPPING[fullname]
|
||||
return cls._find_spec(fullname, Path(pkg_path))
|
||||
|
||||
# Handle immediate children modules (required for namespaces to work)
|
||||
# To avoid problems with case sensitivity in the file system we delegate
|
||||
# to the importlib.machinery implementation.
|
||||
parent, _, child = fullname.rpartition(".")
|
||||
if parent and parent in MAPPING:
|
||||
return PathFinder.find_spec(fullname, path=[MAPPING[parent]])
|
||||
|
||||
# Other levels of nesting should be handled automatically by importlib
|
||||
# using the parent path.
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def _find_spec(cls, fullname: str, candidate_path: Path) -> ModuleSpec | None:
|
||||
init = candidate_path / "__init__.py"
|
||||
candidates = (candidate_path.with_suffix(x) for x in module_suffixes())
|
||||
for candidate in chain([init], candidates):
|
||||
if candidate.exists():
|
||||
return spec_from_file_location(fullname, candidate)
|
||||
return None
|
||||
|
||||
|
||||
class _EditableNamespaceFinder: # PathEntryFinder
|
||||
@classmethod
|
||||
def _path_hook(cls, path) -> type[_EditableNamespaceFinder]:
|
||||
if path == PATH_PLACEHOLDER:
|
||||
return cls
|
||||
raise ImportError
|
||||
|
||||
@classmethod
|
||||
def _paths(cls, fullname: str) -> list[str]:
|
||||
paths = NAMESPACES[fullname]
|
||||
if not paths and fullname in MAPPING:
|
||||
paths = [MAPPING[fullname]]
|
||||
# Always add placeholder, for 2 reasons:
|
||||
# 1. __path__ cannot be empty for the spec to be considered namespace.
|
||||
# 2. In the case of nested namespaces, we need to force
|
||||
# import machinery to query _EditableNamespaceFinder again.
|
||||
return [*paths, PATH_PLACEHOLDER]
|
||||
|
||||
@classmethod
|
||||
def find_spec(cls, fullname: str, target=None) -> ModuleSpec | None: # type: ignore
|
||||
if fullname in NAMESPACES:
|
||||
spec = ModuleSpec(fullname, None, is_package=True)
|
||||
spec.submodule_search_locations = cls._paths(fullname)
|
||||
return spec
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def find_module(cls, _fullname) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def install():
|
||||
if not any(finder == _EditableFinder for finder in sys.meta_path):
|
||||
sys.meta_path.append(_EditableFinder)
|
||||
|
||||
if not NAMESPACES:
|
||||
return
|
||||
|
||||
if not any(hook == _EditableNamespaceFinder._path_hook for hook in sys.path_hooks):
|
||||
# PathEntryFinder is needed to create NamespaceSpec without private APIS
|
||||
sys.path_hooks.append(_EditableNamespaceFinder._path_hook)
|
||||
if PATH_PLACEHOLDER not in sys.path:
|
||||
sys.path.append(PATH_PLACEHOLDER) # Used just to trigger the path hook
|
||||
BIN
dev/env/cli_env/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so
vendored
Executable file
BIN
dev/env/cli_env/lib/python3.13/site-packages/_cffi_backend.cpython-313-x86_64-linux-gnu.so
vendored
Executable file
Binary file not shown.
33
dev/env/cli_env/lib/python3.13/site-packages/_yaml/__init__.py
vendored
Executable file
33
dev/env/cli_env/lib/python3.13/site-packages/_yaml/__init__.py
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
# This is a stub package designed to roughly emulate the _yaml
|
||||
# extension module, which previously existed as a standalone module
|
||||
# and has been moved into the `yaml` package namespace.
|
||||
# It does not perfectly mimic its old counterpart, but should get
|
||||
# close enough for anyone who's relying on it even when they shouldn't.
|
||||
import yaml
|
||||
|
||||
# in some circumstances, the yaml module we imoprted may be from a different version, so we need
|
||||
# to tread carefully when poking at it here (it may not have the attributes we expect)
|
||||
if not getattr(yaml, '__with_libyaml__', False):
|
||||
from sys import version_info
|
||||
|
||||
exc = ModuleNotFoundError if version_info >= (3, 6) else ImportError
|
||||
raise exc("No module named '_yaml'")
|
||||
else:
|
||||
from yaml._yaml import *
|
||||
import warnings
|
||||
warnings.warn(
|
||||
'The _yaml extension module is now located at yaml._yaml'
|
||||
' and its location is subject to change. To use the'
|
||||
' LibYAML-based parser and emitter, import from `yaml`:'
|
||||
' `from yaml import CLoader as Loader, CDumper as Dumper`.',
|
||||
DeprecationWarning
|
||||
)
|
||||
del warnings
|
||||
# Don't `del yaml` here because yaml is actually an existing
|
||||
# namespace member of _yaml.
|
||||
|
||||
__name__ = '_yaml'
|
||||
# If the module is top-level (i.e. not a part of any specific package)
|
||||
# then the attribute should be set to ''.
|
||||
# https://docs.python.org/3.8/library/types.html
|
||||
__package__ = ''
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/INSTALLER
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/INSTALLER
vendored
Executable file
@@ -0,0 +1 @@
|
||||
pip
|
||||
396
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/METADATA
vendored
Executable file
396
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/METADATA
vendored
Executable file
@@ -0,0 +1,396 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: aitbc-cli
|
||||
Version: 0.1.0
|
||||
Summary: AITBC Command Line Interface Tools
|
||||
Home-page: https://aitbc.net
|
||||
Author: AITBC Team
|
||||
Author-email: team@aitbc.net
|
||||
Project-URL: Homepage, https://aitbc.net
|
||||
Project-URL: Repository, https://github.com/aitbc/aitbc
|
||||
Project-URL: Documentation, https://docs.aitbc.net
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: System :: Distributed Computing
|
||||
Requires-Python: >=3.13
|
||||
Description-Content-Type: text/markdown
|
||||
Requires-Dist: click>=8.0.0
|
||||
Requires-Dist: httpx>=0.24.0
|
||||
Requires-Dist: pydantic>=1.10.0
|
||||
Requires-Dist: pyyaml>=6.0
|
||||
Requires-Dist: rich>=13.0.0
|
||||
Requires-Dist: keyring>=23.0.0
|
||||
Requires-Dist: cryptography>=3.4.8
|
||||
Requires-Dist: click-completion>=0.5.2
|
||||
Requires-Dist: tabulate>=0.9.0
|
||||
Requires-Dist: colorama>=0.4.4
|
||||
Requires-Dist: python-dotenv>=0.19.0
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
||||
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
||||
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
||||
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
||||
Requires-Dist: black>=22.0.0; extra == "dev"
|
||||
Requires-Dist: isort>=5.10.0; extra == "dev"
|
||||
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
||||
Dynamic: author
|
||||
Dynamic: author-email
|
||||
Dynamic: classifier
|
||||
Dynamic: description
|
||||
Dynamic: description-content-type
|
||||
Dynamic: home-page
|
||||
Dynamic: project-url
|
||||
Dynamic: provides-extra
|
||||
Dynamic: requires-dist
|
||||
Dynamic: requires-python
|
||||
Dynamic: summary
|
||||
|
||||
# AITBC CLI - Command Line Interface
|
||||
|
||||
A powerful and comprehensive command-line interface for interacting with the AITBC (AI Training & Blockchain Computing) network.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/aitbc/aitbc.git
|
||||
cd aitbc
|
||||
|
||||
# Install in development mode
|
||||
pip install -e .
|
||||
|
||||
# Or install from PyPI (when published)
|
||||
pip install aitbc-cli
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
1. **Set up your API key**:
|
||||
```bash
|
||||
export CLIENT_API_KEY=your_api_key_here
|
||||
# Or save permanently
|
||||
aitbc config set api_key your_api_key_here
|
||||
```
|
||||
|
||||
2. **Check your wallet**:
|
||||
```bash
|
||||
aitbc wallet balance
|
||||
```
|
||||
|
||||
3. **Submit your first job**:
|
||||
```bash
|
||||
aitbc client submit inference --prompt "What is AI?" --model gpt-4
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 **Fast & Efficient**: Optimized for speed with minimal overhead
|
||||
- 🎨 **Rich Output**: Beautiful tables, JSON, and YAML output formats
|
||||
- 🔐 **Secure**: Built-in credential management with keyring
|
||||
- 📊 **Comprehensive**: 40+ commands covering all aspects of the network
|
||||
- 🧪 **Testing Ready**: Full simulation environment for testing
|
||||
- 🔧 **Extensible**: Easy to add new commands and features
|
||||
|
||||
## Command Groups
|
||||
|
||||
### Client Operations
|
||||
Submit and manage inference jobs:
|
||||
```bash
|
||||
aitbc client submit inference --prompt "Your prompt here" --model gpt-4
|
||||
aitbc client status <job_id>
|
||||
aitbc client history --status completed
|
||||
```
|
||||
|
||||
### Mining Operations
|
||||
Register as a miner and process jobs:
|
||||
```bash
|
||||
aitbc miner register --gpu-model RTX4090 --memory 24 --price 0.5
|
||||
aitbc miner poll --interval 5
|
||||
```
|
||||
|
||||
### Wallet Management
|
||||
Manage your AITBC tokens:
|
||||
```bash
|
||||
aitbc wallet balance
|
||||
aitbc wallet send <address> <amount>
|
||||
aitbc wallet history
|
||||
```
|
||||
|
||||
### Authentication
|
||||
Manage API keys and authentication:
|
||||
```bash
|
||||
aitbc auth login your_api_key
|
||||
aitbc auth status
|
||||
aitbc auth keys create --name "My Key"
|
||||
```
|
||||
|
||||
### Blockchain Queries
|
||||
Query blockchain information:
|
||||
```bash
|
||||
aitbc blockchain blocks --limit 10
|
||||
aitbc blockchain transaction <tx_hash>
|
||||
aitbc blockchain sync-status
|
||||
```
|
||||
|
||||
### Marketplace
|
||||
GPU marketplace operations:
|
||||
```bash
|
||||
aitbc marketplace gpu list --available
|
||||
aitbc marketplace gpu book <gpu_id> --hours 2
|
||||
aitbc marketplace reviews <gpu_id>
|
||||
```
|
||||
|
||||
### System Administration
|
||||
Admin operations (requires admin privileges):
|
||||
```bash
|
||||
aitbc admin status
|
||||
aitbc admin analytics --period 24h
|
||||
aitbc admin logs --component coordinator
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Manage CLI configuration:
|
||||
```bash
|
||||
aitbc config show
|
||||
aitbc config set coordinator_url http://localhost:8000
|
||||
aitbc config profiles save production
|
||||
```
|
||||
|
||||
### Simulation
|
||||
Test and simulate operations:
|
||||
```bash
|
||||
aitbc simulate init --distribute 10000,5000
|
||||
aitbc simulate user create --type client --name testuser
|
||||
aitbc simulate workflow --jobs 10
|
||||
```
|
||||
|
||||
## Output Formats
|
||||
|
||||
All commands support multiple output formats:
|
||||
|
||||
```bash
|
||||
# Table format (default)
|
||||
aitbc wallet balance
|
||||
|
||||
# JSON format
|
||||
aitbc --output json wallet balance
|
||||
|
||||
# YAML format
|
||||
aitbc --output yaml wallet balance
|
||||
```
|
||||
|
||||
## Global Options
|
||||
|
||||
These options can be used with any command:
|
||||
|
||||
- `--url TEXT`: Override coordinator URL
|
||||
- `--api-key TEXT`: Override API key
|
||||
- `--output [table|json|yaml]`: Output format
|
||||
- `-v, --verbose`: Increase verbosity (use -vv, -vvv for more)
|
||||
- `--debug`: Enable debug mode
|
||||
- `--config-file TEXT`: Path to config file
|
||||
- `--help`: Show help
|
||||
- `--version`: Show version
|
||||
|
||||
## Shell Completion
|
||||
|
||||
Enable tab completion for bash/zsh:
|
||||
|
||||
```bash
|
||||
# For bash
|
||||
echo 'source /path/to/aitbc_shell_completion.sh' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
|
||||
# For zsh
|
||||
echo 'source /path/to/aitbc_shell_completion.sh' >> ~/.zshrc
|
||||
source ~/.zshrc
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The CLI can be configured in multiple ways:
|
||||
|
||||
1. **Environment variables**:
|
||||
```bash
|
||||
export CLIENT_API_KEY=your_key
|
||||
export AITBC_COORDINATOR_URL=http://localhost:8000
|
||||
export AITBC_OUTPUT_FORMAT=json
|
||||
```
|
||||
|
||||
2. **Config file**:
|
||||
```bash
|
||||
aitbc config set coordinator_url http://localhost:8000
|
||||
aitbc config set api_key your_key
|
||||
```
|
||||
|
||||
3. **Profiles**:
|
||||
```bash
|
||||
# Save a profile
|
||||
aitbc config profiles save production
|
||||
|
||||
# Switch profiles
|
||||
aitbc config profiles load production
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Workflow
|
||||
|
||||
```bash
|
||||
# 1. Configure
|
||||
export CLIENT_API_KEY=your_key
|
||||
|
||||
# 2. Check balance
|
||||
aitbc wallet balance
|
||||
|
||||
# 3. Submit job
|
||||
job_id=$(aitbc --output json client submit inference --prompt "What is AI?" | jq -r '.job_id')
|
||||
|
||||
# 4. Monitor progress
|
||||
watch -n 5 "aitbc client status $job_id"
|
||||
|
||||
# 5. Get results
|
||||
aitbc client receipts --job-id $job_id
|
||||
```
|
||||
|
||||
### Mining Setup
|
||||
|
||||
```bash
|
||||
# 1. Register as miner
|
||||
aitbc miner register \
|
||||
--gpu-model RTX4090 \
|
||||
--memory 24 \
|
||||
--price 0.5 \
|
||||
--region us-west
|
||||
|
||||
# 2. Start mining
|
||||
aitbc miner poll --interval 5
|
||||
|
||||
# 3. Check earnings
|
||||
aitbc wallet earn
|
||||
```
|
||||
|
||||
### Using the Marketplace
|
||||
|
||||
```bash
|
||||
# 1. Find available GPUs
|
||||
aitbc marketplace gpu list --available --price-max 1.0
|
||||
|
||||
# 2. Book a GPU
|
||||
gpu_id=$(aitbc marketplace gpu list --available --output json | jq -r '.[0].id')
|
||||
aitbc marketplace gpu book $gpu_id --hours 4
|
||||
|
||||
# 3. Use it for your job
|
||||
aitbc client submit inference \
|
||||
--prompt "Generate an image of a sunset" \
|
||||
--model stable-diffusion \
|
||||
--gpu $gpu_id
|
||||
|
||||
# 4. Release when done
|
||||
aitbc marketplace gpu release $gpu_id
|
||||
```
|
||||
|
||||
### Testing with Simulation
|
||||
|
||||
```bash
|
||||
# 1. Initialize test environment
|
||||
aitbc simulate init --distribute 10000,5000
|
||||
|
||||
# 2. Create test users
|
||||
aitbc simulate user create --type client --name alice --balance 1000
|
||||
aitbc simulate user create --type miner --name bob --balance 500
|
||||
|
||||
# 3. Run workflow simulation
|
||||
aitbc simulate workflow --jobs 10 --rounds 3
|
||||
|
||||
# 4. Check results
|
||||
aitbc simulate results sim_123
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **"API key not found"**
|
||||
```bash
|
||||
export CLIENT_API_KEY=your_key
|
||||
# or
|
||||
aitbc auth login your_key
|
||||
```
|
||||
|
||||
2. **"Connection refused"**
|
||||
```bash
|
||||
# Check coordinator URL
|
||||
aitbc config show
|
||||
# Update if needed
|
||||
aitbc config set coordinator_url http://localhost:8000
|
||||
```
|
||||
|
||||
3. **"Permission denied"**
|
||||
```bash
|
||||
# Check key permissions
|
||||
aitbc auth status
|
||||
# Refresh if needed
|
||||
aitbc auth refresh
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
Enable debug mode for detailed error information:
|
||||
|
||||
```bash
|
||||
aitbc --debug client status <job_id>
|
||||
```
|
||||
|
||||
### Verbose Output
|
||||
|
||||
Increase verbosity for more information:
|
||||
|
||||
```bash
|
||||
aitbc -vvv wallet balance
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions! Please see our [Contributing Guide](../CONTRIBUTING.md) for details.
|
||||
|
||||
### Development Setup
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/aitbc/aitbc.git
|
||||
cd aitbc
|
||||
|
||||
# Create virtual environment
|
||||
python -m venv venv
|
||||
source venv/bin/activate # On Windows: venv\Scripts\activate
|
||||
|
||||
# Install in development mode
|
||||
pip install -e .[dev]
|
||||
|
||||
# Run tests
|
||||
pytest tests/cli/
|
||||
|
||||
# Run with local changes
|
||||
python -m aitbc_cli.main --help
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
- 📖 [Documentation](../docs/cli-reference.md)
|
||||
- 🐛 [Issue Tracker](https://github.com/aitbc/aitbc/issues)
|
||||
- 💬 [Discord Community](https://discord.gg/aitbc)
|
||||
- 📧 [Email Support](mailto:support@aitbc.net)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](../LICENSE) file for details.
|
||||
|
||||
---
|
||||
|
||||
Made with ❤️ by the AITBC team
|
||||
12
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/RECORD
vendored
Executable file
12
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/RECORD
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
../../../bin/aitbc,sha256=5PvqFK96x-jimFLhLKdISw24VaVCV7Q7-aNJV4O8DSA,241
|
||||
__editable__.aitbc_cli-0.1.0.pth,sha256=4BlDxb_QZKmp0VR1CUAMpItNrr9UCvR5l3CPj7bJd7A,89
|
||||
__editable___aitbc_cli_0_1_0_finder.py,sha256=-Ed9ClOp6SvnsSTLgB6kFGTDJyv21N8n6rpLTHnlYMo,3393
|
||||
__pycache__/__editable___aitbc_cli_0_1_0_finder.cpython-313.pyc,,
|
||||
aitbc_cli-0.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
aitbc_cli-0.1.0.dist-info/METADATA,sha256=ue8rJ3soWAcrru5glUyNZHSVcq1u38yf9atrmjcZIr8,8967
|
||||
aitbc_cli-0.1.0.dist-info/RECORD,,
|
||||
aitbc_cli-0.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
aitbc_cli-0.1.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
||||
aitbc_cli-0.1.0.dist-info/direct_url.json,sha256=qmRikODUeAmiEEqi46HVK3CI0xU_hcKLpw15FwtOLO8,78
|
||||
aitbc_cli-0.1.0.dist-info/entry_points.txt,sha256=kPs3YXHg2DE_AoQwWcStNReJyJQitRAg-tkAWRBhVFs,46
|
||||
aitbc_cli-0.1.0.dist-info/top_level.txt,sha256=ckpSMvl0TqQGHAIbCmypBdhkbTNnSyzdUBvGeKX_fZo,10
|
||||
0
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/REQUESTED
vendored
Executable file
0
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/REQUESTED
vendored
Executable file
5
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/WHEEL
vendored
Executable file
5
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/WHEEL
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (82.0.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/direct_url.json
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/direct_url.json
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"dir_info": {"editable": true}, "url": "file:///home/oib/windsurf/aitbc/cli"}
|
||||
2
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/entry_points.txt
vendored
Executable file
2
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/entry_points.txt
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
[console_scripts]
|
||||
aitbc = aitbc_cli.main:main
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/top_level.txt
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/aitbc_cli-0.1.0.dist-info/top_level.txt
vendored
Executable file
@@ -0,0 +1 @@
|
||||
aitbc_cli
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/INSTALLER
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/INSTALLER
vendored
Executable file
@@ -0,0 +1 @@
|
||||
pip
|
||||
295
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/METADATA
vendored
Executable file
295
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/METADATA
vendored
Executable file
@@ -0,0 +1,295 @@
|
||||
Metadata-Version: 2.3
|
||||
Name: annotated-types
|
||||
Version: 0.7.0
|
||||
Summary: Reusable constraint types to use with typing.Annotated
|
||||
Project-URL: Homepage, https://github.com/annotated-types/annotated-types
|
||||
Project-URL: Source, https://github.com/annotated-types/annotated-types
|
||||
Project-URL: Changelog, https://github.com/annotated-types/annotated-types/releases
|
||||
Author-email: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>, Samuel Colvin <s@muelcolvin.com>, Zac Hatfield-Dodds <zac@zhd.dev>
|
||||
License-File: LICENSE
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Environment :: Console
|
||||
Classifier: Environment :: MacOS X
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Intended Audience :: Information Technology
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: POSIX :: Linux
|
||||
Classifier: Operating System :: Unix
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Typing :: Typed
|
||||
Requires-Python: >=3.8
|
||||
Requires-Dist: typing-extensions>=4.0.0; python_version < '3.9'
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
# annotated-types
|
||||
|
||||
[](https://github.com/annotated-types/annotated-types/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
|
||||
[](https://pypi.python.org/pypi/annotated-types)
|
||||
[](https://github.com/annotated-types/annotated-types)
|
||||
[](https://github.com/annotated-types/annotated-types/blob/main/LICENSE)
|
||||
|
||||
[PEP-593](https://peps.python.org/pep-0593/) added `typing.Annotated` as a way of
|
||||
adding context-specific metadata to existing types, and specifies that
|
||||
`Annotated[T, x]` _should_ be treated as `T` by any tool or library without special
|
||||
logic for `x`.
|
||||
|
||||
This package provides metadata objects which can be used to represent common
|
||||
constraints such as upper and lower bounds on scalar values and collection sizes,
|
||||
a `Predicate` marker for runtime checks, and
|
||||
descriptions of how we intend these metadata to be interpreted. In some cases,
|
||||
we also note alternative representations which do not require this package.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install annotated-types
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```python
|
||||
from typing import Annotated
|
||||
from annotated_types import Gt, Len, Predicate
|
||||
|
||||
class MyClass:
|
||||
age: Annotated[int, Gt(18)] # Valid: 19, 20, ...
|
||||
# Invalid: 17, 18, "19", 19.0, ...
|
||||
factors: list[Annotated[int, Predicate(is_prime)]] # Valid: 2, 3, 5, 7, 11, ...
|
||||
# Invalid: 4, 8, -2, 5.0, "prime", ...
|
||||
|
||||
my_list: Annotated[list[int], Len(0, 10)] # Valid: [], [10, 20, 30, 40, 50]
|
||||
# Invalid: (1, 2), ["abc"], [0] * 20
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
_While `annotated-types` avoids runtime checks for performance, users should not
|
||||
construct invalid combinations such as `MultipleOf("non-numeric")` or `Annotated[int, Len(3)]`.
|
||||
Downstream implementors may choose to raise an error, emit a warning, silently ignore
|
||||
a metadata item, etc., if the metadata objects described below are used with an
|
||||
incompatible type - or for any other reason!_
|
||||
|
||||
### Gt, Ge, Lt, Le
|
||||
|
||||
Express inclusive and/or exclusive bounds on orderable values - which may be numbers,
|
||||
dates, times, strings, sets, etc. Note that the boundary value need not be of the
|
||||
same type that was annotated, so long as they can be compared: `Annotated[int, Gt(1.5)]`
|
||||
is fine, for example, and implies that the value is an integer x such that `x > 1.5`.
|
||||
|
||||
We suggest that implementors may also interpret `functools.partial(operator.le, 1.5)`
|
||||
as being equivalent to `Gt(1.5)`, for users who wish to avoid a runtime dependency on
|
||||
the `annotated-types` package.
|
||||
|
||||
To be explicit, these types have the following meanings:
|
||||
|
||||
* `Gt(x)` - value must be "Greater Than" `x` - equivalent to exclusive minimum
|
||||
* `Ge(x)` - value must be "Greater than or Equal" to `x` - equivalent to inclusive minimum
|
||||
* `Lt(x)` - value must be "Less Than" `x` - equivalent to exclusive maximum
|
||||
* `Le(x)` - value must be "Less than or Equal" to `x` - equivalent to inclusive maximum
|
||||
|
||||
### Interval
|
||||
|
||||
`Interval(gt, ge, lt, le)` allows you to specify an upper and lower bound with a single
|
||||
metadata object. `None` attributes should be ignored, and non-`None` attributes
|
||||
treated as per the single bounds above.
|
||||
|
||||
### MultipleOf
|
||||
|
||||
`MultipleOf(multiple_of=x)` might be interpreted in two ways:
|
||||
|
||||
1. Python semantics, implying `value % multiple_of == 0`, or
|
||||
2. [JSONschema semantics](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.1),
|
||||
where `int(value / multiple_of) == value / multiple_of`.
|
||||
|
||||
We encourage users to be aware of these two common interpretations and their
|
||||
distinct behaviours, especially since very large or non-integer numbers make
|
||||
it easy to cause silent data corruption due to floating-point imprecision.
|
||||
|
||||
We encourage libraries to carefully document which interpretation they implement.
|
||||
|
||||
### MinLen, MaxLen, Len
|
||||
|
||||
`Len()` implies that `min_length <= len(value) <= max_length` - lower and upper bounds are inclusive.
|
||||
|
||||
As well as `Len()` which can optionally include upper and lower bounds, we also
|
||||
provide `MinLen(x)` and `MaxLen(y)` which are equivalent to `Len(min_length=x)`
|
||||
and `Len(max_length=y)` respectively.
|
||||
|
||||
`Len`, `MinLen`, and `MaxLen` may be used with any type which supports `len(value)`.
|
||||
|
||||
Examples of usage:
|
||||
|
||||
* `Annotated[list, MaxLen(10)]` (or `Annotated[list, Len(max_length=10))`) - list must have a length of 10 or less
|
||||
* `Annotated[str, MaxLen(10)]` - string must have a length of 10 or less
|
||||
* `Annotated[list, MinLen(3))` (or `Annotated[list, Len(min_length=3))`) - list must have a length of 3 or more
|
||||
* `Annotated[list, Len(4, 6)]` - list must have a length of 4, 5, or 6
|
||||
* `Annotated[list, Len(8, 8)]` - list must have a length of exactly 8
|
||||
|
||||
#### Changed in v0.4.0
|
||||
|
||||
* `min_inclusive` has been renamed to `min_length`, no change in meaning
|
||||
* `max_exclusive` has been renamed to `max_length`, upper bound is now **inclusive** instead of **exclusive**
|
||||
* The recommendation that slices are interpreted as `Len` has been removed due to ambiguity and different semantic
|
||||
meaning of the upper bound in slices vs. `Len`
|
||||
|
||||
See [issue #23](https://github.com/annotated-types/annotated-types/issues/23) for discussion.
|
||||
|
||||
### Timezone
|
||||
|
||||
`Timezone` can be used with a `datetime` or a `time` to express which timezones
|
||||
are allowed. `Annotated[datetime, Timezone(None)]` must be a naive datetime.
|
||||
`Timezone[...]` ([literal ellipsis](https://docs.python.org/3/library/constants.html#Ellipsis))
|
||||
expresses that any timezone-aware datetime is allowed. You may also pass a specific
|
||||
timezone string or [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects)
|
||||
object such as `Timezone(timezone.utc)` or `Timezone("Africa/Abidjan")` to express that you only
|
||||
allow a specific timezone, though we note that this is often a symptom of fragile design.
|
||||
|
||||
#### Changed in v0.x.x
|
||||
|
||||
* `Timezone` accepts [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects) objects instead of
|
||||
`timezone`, extending compatibility to [`zoneinfo`](https://docs.python.org/3/library/zoneinfo.html) and third party libraries.
|
||||
|
||||
### Unit
|
||||
|
||||
`Unit(unit: str)` expresses that the annotated numeric value is the magnitude of
|
||||
a quantity with the specified unit. For example, `Annotated[float, Unit("m/s")]`
|
||||
would be a float representing a velocity in meters per second.
|
||||
|
||||
Please note that `annotated_types` itself makes no attempt to parse or validate
|
||||
the unit string in any way. That is left entirely to downstream libraries,
|
||||
such as [`pint`](https://pint.readthedocs.io) or
|
||||
[`astropy.units`](https://docs.astropy.org/en/stable/units/).
|
||||
|
||||
An example of how a library might use this metadata:
|
||||
|
||||
```python
|
||||
from annotated_types import Unit
|
||||
from typing import Annotated, TypeVar, Callable, Any, get_origin, get_args
|
||||
|
||||
# given a type annotated with a unit:
|
||||
Meters = Annotated[float, Unit("m")]
|
||||
|
||||
|
||||
# you can cast the annotation to a specific unit type with any
|
||||
# callable that accepts a string and returns the desired type
|
||||
T = TypeVar("T")
|
||||
def cast_unit(tp: Any, unit_cls: Callable[[str], T]) -> T | None:
|
||||
if get_origin(tp) is Annotated:
|
||||
for arg in get_args(tp):
|
||||
if isinstance(arg, Unit):
|
||||
return unit_cls(arg.unit)
|
||||
return None
|
||||
|
||||
|
||||
# using `pint`
|
||||
import pint
|
||||
pint_unit = cast_unit(Meters, pint.Unit)
|
||||
|
||||
|
||||
# using `astropy.units`
|
||||
import astropy.units as u
|
||||
astropy_unit = cast_unit(Meters, u.Unit)
|
||||
```
|
||||
|
||||
### Predicate
|
||||
|
||||
`Predicate(func: Callable)` expresses that `func(value)` is truthy for valid values.
|
||||
Users should prefer the statically inspectable metadata above, but if you need
|
||||
the full power and flexibility of arbitrary runtime predicates... here it is.
|
||||
|
||||
For some common constraints, we provide generic types:
|
||||
|
||||
* `IsLower = Annotated[T, Predicate(str.islower)]`
|
||||
* `IsUpper = Annotated[T, Predicate(str.isupper)]`
|
||||
* `IsDigit = Annotated[T, Predicate(str.isdigit)]`
|
||||
* `IsFinite = Annotated[T, Predicate(math.isfinite)]`
|
||||
* `IsNotFinite = Annotated[T, Predicate(Not(math.isfinite))]`
|
||||
* `IsNan = Annotated[T, Predicate(math.isnan)]`
|
||||
* `IsNotNan = Annotated[T, Predicate(Not(math.isnan))]`
|
||||
* `IsInfinite = Annotated[T, Predicate(math.isinf)]`
|
||||
* `IsNotInfinite = Annotated[T, Predicate(Not(math.isinf))]`
|
||||
|
||||
so that you can write e.g. `x: IsFinite[float] = 2.0` instead of the longer
|
||||
(but exactly equivalent) `x: Annotated[float, Predicate(math.isfinite)] = 2.0`.
|
||||
|
||||
Some libraries might have special logic to handle known or understandable predicates,
|
||||
for example by checking for `str.isdigit` and using its presence to both call custom
|
||||
logic to enforce digit-only strings, and customise some generated external schema.
|
||||
Users are therefore encouraged to avoid indirection like `lambda s: s.lower()`, in
|
||||
favor of introspectable methods such as `str.lower` or `re.compile("pattern").search`.
|
||||
|
||||
To enable basic negation of commonly used predicates like `math.isnan` without introducing introspection that makes it impossible for implementers to introspect the predicate we provide a `Not` wrapper that simply negates the predicate in an introspectable manner. Several of the predicates listed above are created in this manner.
|
||||
|
||||
We do not specify what behaviour should be expected for predicates that raise
|
||||
an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently
|
||||
skip invalid constraints, or statically raise an error; or it might try calling it
|
||||
and then propagate or discard the resulting
|
||||
`TypeError: descriptor 'isdigit' for 'str' objects doesn't apply to a 'int' object`
|
||||
exception. We encourage libraries to document the behaviour they choose.
|
||||
|
||||
### Doc
|
||||
|
||||
`doc()` can be used to add documentation information in `Annotated`, for function and method parameters, variables, class attributes, return types, and any place where `Annotated` can be used.
|
||||
|
||||
It expects a value that can be statically analyzed, as the main use case is for static analysis, editors, documentation generators, and similar tools.
|
||||
|
||||
It returns a `DocInfo` class with a single attribute `documentation` containing the value passed to `doc()`.
|
||||
|
||||
This is the early adopter's alternative form of the [`typing-doc` proposal](https://github.com/tiangolo/fastapi/blob/typing-doc/typing_doc.md).
|
||||
|
||||
### Integrating downstream types with `GroupedMetadata`
|
||||
|
||||
Implementers may choose to provide a convenience wrapper that groups multiple pieces of metadata.
|
||||
This can help reduce verbosity and cognitive overhead for users.
|
||||
For example, an implementer like Pydantic might provide a `Field` or `Meta` type that accepts keyword arguments and transforms these into low-level metadata:
|
||||
|
||||
```python
|
||||
from dataclasses import dataclass
|
||||
from typing import Iterator
|
||||
from annotated_types import GroupedMetadata, Ge
|
||||
|
||||
@dataclass
|
||||
class Field(GroupedMetadata):
|
||||
ge: int | None = None
|
||||
description: str | None = None
|
||||
|
||||
def __iter__(self) -> Iterator[object]:
|
||||
# Iterating over a GroupedMetadata object should yield annotated-types
|
||||
# constraint metadata objects which describe it as fully as possible,
|
||||
# and may include other unknown objects too.
|
||||
if self.ge is not None:
|
||||
yield Ge(self.ge)
|
||||
if self.description is not None:
|
||||
yield Description(self.description)
|
||||
```
|
||||
|
||||
Libraries consuming annotated-types constraints should check for `GroupedMetadata` and unpack it by iterating over the object and treating the results as if they had been "unpacked" in the `Annotated` type. The same logic should be applied to the [PEP 646 `Unpack` type](https://peps.python.org/pep-0646/), so that `Annotated[T, Field(...)]`, `Annotated[T, Unpack[Field(...)]]` and `Annotated[T, *Field(...)]` are all treated consistently.
|
||||
|
||||
Libraries consuming annotated-types should also ignore any metadata they do not recongize that came from unpacking a `GroupedMetadata`, just like they ignore unrecognized metadata in `Annotated` itself.
|
||||
|
||||
Our own `annotated_types.Interval` class is a `GroupedMetadata` which unpacks itself into `Gt`, `Lt`, etc., so this is not an abstract concern. Similarly, `annotated_types.Len` is a `GroupedMetadata` which unpacks itself into `MinLen` (optionally) and `MaxLen`.
|
||||
|
||||
### Consuming metadata
|
||||
|
||||
We intend to not be prescriptive as to _how_ the metadata and constraints are used, but as an example of how one might parse constraints from types annotations see our [implementation in `test_main.py`](https://github.com/annotated-types/annotated-types/blob/f59cf6d1b5255a0fe359b93896759a180bec30ae/tests/test_main.py#L94-L103).
|
||||
|
||||
It is up to the implementer to determine how this metadata is used.
|
||||
You could use the metadata for runtime type checking, for generating schemas or to generate example data, amongst other use cases.
|
||||
|
||||
## Design & History
|
||||
|
||||
This package was designed at the PyCon 2022 sprints by the maintainers of Pydantic
|
||||
and Hypothesis, with the goal of making it as easy as possible for end-users to
|
||||
provide more informative annotations for use by runtime libraries.
|
||||
|
||||
It is deliberately minimal, and following PEP-593 allows considerable downstream
|
||||
discretion in what (if anything!) they choose to support. Nonetheless, we expect
|
||||
that staying simple and covering _only_ the most common use-cases will give users
|
||||
and maintainers the best experience we can. If you'd like more constraints for your
|
||||
types - follow our lead, by defining them and documenting them downstream!
|
||||
10
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/RECORD
vendored
Executable file
10
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/RECORD
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
annotated_types-0.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
annotated_types-0.7.0.dist-info/METADATA,sha256=7ltqxksJJ0wCYFGBNIQCWTlWQGeAH0hRFdnK3CB895E,15046
|
||||
annotated_types-0.7.0.dist-info/RECORD,,
|
||||
annotated_types-0.7.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
||||
annotated_types-0.7.0.dist-info/licenses/LICENSE,sha256=_hBJiEsaDZNCkB6I4H8ykl0ksxIdmXK2poBfuYJLCV0,1083
|
||||
annotated_types/__init__.py,sha256=RynLsRKUEGI0KimXydlD1fZEfEzWwDo0Uon3zOKhG1Q,13819
|
||||
annotated_types/__pycache__/__init__.cpython-313.pyc,,
|
||||
annotated_types/__pycache__/test_cases.cpython-313.pyc,,
|
||||
annotated_types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
annotated_types/test_cases.py,sha256=zHFX6EpcMbGJ8FzBYDbO56bPwx_DYIVSKbZM-4B3_lg,6421
|
||||
4
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/WHEEL
vendored
Executable file
4
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/WHEEL
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: hatchling 1.24.2
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
21
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE
vendored
Executable file
21
dev/env/cli_env/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 the contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
432
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/__init__.py
vendored
Executable file
432
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/__init__.py
vendored
Executable file
@@ -0,0 +1,432 @@
|
||||
import math
|
||||
import sys
|
||||
import types
|
||||
from dataclasses import dataclass
|
||||
from datetime import tzinfo
|
||||
from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional, SupportsFloat, SupportsIndex, TypeVar, Union
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
from typing_extensions import Protocol, runtime_checkable
|
||||
else:
|
||||
from typing import Protocol, runtime_checkable
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
from typing_extensions import Annotated, Literal
|
||||
else:
|
||||
from typing import Annotated, Literal
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
EllipsisType = type(Ellipsis)
|
||||
KW_ONLY = {}
|
||||
SLOTS = {}
|
||||
else:
|
||||
from types import EllipsisType
|
||||
|
||||
KW_ONLY = {"kw_only": True}
|
||||
SLOTS = {"slots": True}
|
||||
|
||||
|
||||
__all__ = (
|
||||
'BaseMetadata',
|
||||
'GroupedMetadata',
|
||||
'Gt',
|
||||
'Ge',
|
||||
'Lt',
|
||||
'Le',
|
||||
'Interval',
|
||||
'MultipleOf',
|
||||
'MinLen',
|
||||
'MaxLen',
|
||||
'Len',
|
||||
'Timezone',
|
||||
'Predicate',
|
||||
'LowerCase',
|
||||
'UpperCase',
|
||||
'IsDigits',
|
||||
'IsFinite',
|
||||
'IsNotFinite',
|
||||
'IsNan',
|
||||
'IsNotNan',
|
||||
'IsInfinite',
|
||||
'IsNotInfinite',
|
||||
'doc',
|
||||
'DocInfo',
|
||||
'__version__',
|
||||
)
|
||||
|
||||
__version__ = '0.7.0'
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
# arguments that start with __ are considered
|
||||
# positional only
|
||||
# see https://peps.python.org/pep-0484/#positional-only-arguments
|
||||
|
||||
|
||||
class SupportsGt(Protocol):
|
||||
def __gt__(self: T, __other: T) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class SupportsGe(Protocol):
|
||||
def __ge__(self: T, __other: T) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class SupportsLt(Protocol):
|
||||
def __lt__(self: T, __other: T) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class SupportsLe(Protocol):
|
||||
def __le__(self: T, __other: T) -> bool:
|
||||
...
|
||||
|
||||
|
||||
class SupportsMod(Protocol):
|
||||
def __mod__(self: T, __other: T) -> T:
|
||||
...
|
||||
|
||||
|
||||
class SupportsDiv(Protocol):
|
||||
def __div__(self: T, __other: T) -> T:
|
||||
...
|
||||
|
||||
|
||||
class BaseMetadata:
|
||||
"""Base class for all metadata.
|
||||
|
||||
This exists mainly so that implementers
|
||||
can do `isinstance(..., BaseMetadata)` while traversing field annotations.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Gt(BaseMetadata):
|
||||
"""Gt(gt=x) implies that the value must be greater than x.
|
||||
|
||||
It can be used with any type that supports the ``>`` operator,
|
||||
including numbers, dates and times, strings, sets, and so on.
|
||||
"""
|
||||
|
||||
gt: SupportsGt
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Ge(BaseMetadata):
|
||||
"""Ge(ge=x) implies that the value must be greater than or equal to x.
|
||||
|
||||
It can be used with any type that supports the ``>=`` operator,
|
||||
including numbers, dates and times, strings, sets, and so on.
|
||||
"""
|
||||
|
||||
ge: SupportsGe
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Lt(BaseMetadata):
|
||||
"""Lt(lt=x) implies that the value must be less than x.
|
||||
|
||||
It can be used with any type that supports the ``<`` operator,
|
||||
including numbers, dates and times, strings, sets, and so on.
|
||||
"""
|
||||
|
||||
lt: SupportsLt
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Le(BaseMetadata):
|
||||
"""Le(le=x) implies that the value must be less than or equal to x.
|
||||
|
||||
It can be used with any type that supports the ``<=`` operator,
|
||||
including numbers, dates and times, strings, sets, and so on.
|
||||
"""
|
||||
|
||||
le: SupportsLe
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class GroupedMetadata(Protocol):
|
||||
"""A grouping of multiple objects, like typing.Unpack.
|
||||
|
||||
`GroupedMetadata` on its own is not metadata and has no meaning.
|
||||
All of the constraints and metadata should be fully expressable
|
||||
in terms of the `BaseMetadata`'s returned by `GroupedMetadata.__iter__()`.
|
||||
|
||||
Concrete implementations should override `GroupedMetadata.__iter__()`
|
||||
to add their own metadata.
|
||||
For example:
|
||||
|
||||
>>> @dataclass
|
||||
>>> class Field(GroupedMetadata):
|
||||
>>> gt: float | None = None
|
||||
>>> description: str | None = None
|
||||
...
|
||||
>>> def __iter__(self) -> Iterable[object]:
|
||||
>>> if self.gt is not None:
|
||||
>>> yield Gt(self.gt)
|
||||
>>> if self.description is not None:
|
||||
>>> yield Description(self.gt)
|
||||
|
||||
Also see the implementation of `Interval` below for an example.
|
||||
|
||||
Parsers should recognize this and unpack it so that it can be used
|
||||
both with and without unpacking:
|
||||
|
||||
- `Annotated[int, Field(...)]` (parser must unpack Field)
|
||||
- `Annotated[int, *Field(...)]` (PEP-646)
|
||||
""" # noqa: trailing-whitespace
|
||||
|
||||
@property
|
||||
def __is_annotated_types_grouped_metadata__(self) -> Literal[True]:
|
||||
return True
|
||||
|
||||
def __iter__(self) -> Iterator[object]:
|
||||
...
|
||||
|
||||
if not TYPE_CHECKING:
|
||||
__slots__ = () # allow subclasses to use slots
|
||||
|
||||
def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None:
|
||||
# Basic ABC like functionality without the complexity of an ABC
|
||||
super().__init_subclass__(*args, **kwargs)
|
||||
if cls.__iter__ is GroupedMetadata.__iter__:
|
||||
raise TypeError("Can't subclass GroupedMetadata without implementing __iter__")
|
||||
|
||||
def __iter__(self) -> Iterator[object]: # noqa: F811
|
||||
raise NotImplementedError # more helpful than "None has no attribute..." type errors
|
||||
|
||||
|
||||
@dataclass(frozen=True, **KW_ONLY, **SLOTS)
|
||||
class Interval(GroupedMetadata):
|
||||
"""Interval can express inclusive or exclusive bounds with a single object.
|
||||
|
||||
It accepts keyword arguments ``gt``, ``ge``, ``lt``, and/or ``le``, which
|
||||
are interpreted the same way as the single-bound constraints.
|
||||
"""
|
||||
|
||||
gt: Union[SupportsGt, None] = None
|
||||
ge: Union[SupportsGe, None] = None
|
||||
lt: Union[SupportsLt, None] = None
|
||||
le: Union[SupportsLe, None] = None
|
||||
|
||||
def __iter__(self) -> Iterator[BaseMetadata]:
|
||||
"""Unpack an Interval into zero or more single-bounds."""
|
||||
if self.gt is not None:
|
||||
yield Gt(self.gt)
|
||||
if self.ge is not None:
|
||||
yield Ge(self.ge)
|
||||
if self.lt is not None:
|
||||
yield Lt(self.lt)
|
||||
if self.le is not None:
|
||||
yield Le(self.le)
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class MultipleOf(BaseMetadata):
|
||||
"""MultipleOf(multiple_of=x) might be interpreted in two ways:
|
||||
|
||||
1. Python semantics, implying ``value % multiple_of == 0``, or
|
||||
2. JSONschema semantics, where ``int(value / multiple_of) == value / multiple_of``
|
||||
|
||||
We encourage users to be aware of these two common interpretations,
|
||||
and libraries to carefully document which they implement.
|
||||
"""
|
||||
|
||||
multiple_of: Union[SupportsDiv, SupportsMod]
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class MinLen(BaseMetadata):
|
||||
"""
|
||||
MinLen() implies minimum inclusive length,
|
||||
e.g. ``len(value) >= min_length``.
|
||||
"""
|
||||
|
||||
min_length: Annotated[int, Ge(0)]
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class MaxLen(BaseMetadata):
|
||||
"""
|
||||
MaxLen() implies maximum inclusive length,
|
||||
e.g. ``len(value) <= max_length``.
|
||||
"""
|
||||
|
||||
max_length: Annotated[int, Ge(0)]
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Len(GroupedMetadata):
|
||||
"""
|
||||
Len() implies that ``min_length <= len(value) <= max_length``.
|
||||
|
||||
Upper bound may be omitted or ``None`` to indicate no upper length bound.
|
||||
"""
|
||||
|
||||
min_length: Annotated[int, Ge(0)] = 0
|
||||
max_length: Optional[Annotated[int, Ge(0)]] = None
|
||||
|
||||
def __iter__(self) -> Iterator[BaseMetadata]:
|
||||
"""Unpack a Len into zone or more single-bounds."""
|
||||
if self.min_length > 0:
|
||||
yield MinLen(self.min_length)
|
||||
if self.max_length is not None:
|
||||
yield MaxLen(self.max_length)
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Timezone(BaseMetadata):
|
||||
"""Timezone(tz=...) requires a datetime to be aware (or ``tz=None``, naive).
|
||||
|
||||
``Annotated[datetime, Timezone(None)]`` must be a naive datetime.
|
||||
``Timezone[...]`` (the ellipsis literal) expresses that the datetime must be
|
||||
tz-aware but any timezone is allowed.
|
||||
|
||||
You may also pass a specific timezone string or tzinfo object such as
|
||||
``Timezone(timezone.utc)`` or ``Timezone("Africa/Abidjan")`` to express that
|
||||
you only allow a specific timezone, though we note that this is often
|
||||
a symptom of poor design.
|
||||
"""
|
||||
|
||||
tz: Union[str, tzinfo, EllipsisType, None]
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Unit(BaseMetadata):
|
||||
"""Indicates that the value is a physical quantity with the specified unit.
|
||||
|
||||
It is intended for usage with numeric types, where the value represents the
|
||||
magnitude of the quantity. For example, ``distance: Annotated[float, Unit('m')]``
|
||||
or ``speed: Annotated[float, Unit('m/s')]``.
|
||||
|
||||
Interpretation of the unit string is left to the discretion of the consumer.
|
||||
It is suggested to follow conventions established by python libraries that work
|
||||
with physical quantities, such as
|
||||
|
||||
- ``pint`` : <https://pint.readthedocs.io/en/stable/>
|
||||
- ``astropy.units``: <https://docs.astropy.org/en/stable/units/>
|
||||
|
||||
For indicating a quantity with a certain dimensionality but without a specific unit
|
||||
it is recommended to use square brackets, e.g. `Annotated[float, Unit('[time]')]`.
|
||||
Note, however, ``annotated_types`` itself makes no use of the unit string.
|
||||
"""
|
||||
|
||||
unit: str
|
||||
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class Predicate(BaseMetadata):
|
||||
"""``Predicate(func: Callable)`` implies `func(value)` is truthy for valid values.
|
||||
|
||||
Users should prefer statically inspectable metadata, but if you need the full
|
||||
power and flexibility of arbitrary runtime predicates... here it is.
|
||||
|
||||
We provide a few predefined predicates for common string constraints:
|
||||
``IsLower = Predicate(str.islower)``, ``IsUpper = Predicate(str.isupper)``, and
|
||||
``IsDigits = Predicate(str.isdigit)``. Users are encouraged to use methods which
|
||||
can be given special handling, and avoid indirection like ``lambda s: s.lower()``.
|
||||
|
||||
Some libraries might have special logic to handle certain predicates, e.g. by
|
||||
checking for `str.isdigit` and using its presence to both call custom logic to
|
||||
enforce digit-only strings, and customise some generated external schema.
|
||||
|
||||
We do not specify what behaviour should be expected for predicates that raise
|
||||
an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently
|
||||
skip invalid constraints, or statically raise an error; or it might try calling it
|
||||
and then propagate or discard the resulting exception.
|
||||
"""
|
||||
|
||||
func: Callable[[Any], bool]
|
||||
|
||||
def __repr__(self) -> str:
|
||||
if getattr(self.func, "__name__", "<lambda>") == "<lambda>":
|
||||
return f"{self.__class__.__name__}({self.func!r})"
|
||||
if isinstance(self.func, (types.MethodType, types.BuiltinMethodType)) and (
|
||||
namespace := getattr(self.func.__self__, "__name__", None)
|
||||
):
|
||||
return f"{self.__class__.__name__}({namespace}.{self.func.__name__})"
|
||||
if isinstance(self.func, type(str.isascii)): # method descriptor
|
||||
return f"{self.__class__.__name__}({self.func.__qualname__})"
|
||||
return f"{self.__class__.__name__}({self.func.__name__})"
|
||||
|
||||
|
||||
@dataclass
|
||||
class Not:
|
||||
func: Callable[[Any], bool]
|
||||
|
||||
def __call__(self, __v: Any) -> bool:
|
||||
return not self.func(__v)
|
||||
|
||||
|
||||
_StrType = TypeVar("_StrType", bound=str)
|
||||
|
||||
LowerCase = Annotated[_StrType, Predicate(str.islower)]
|
||||
"""
|
||||
Return True if the string is a lowercase string, False otherwise.
|
||||
|
||||
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
|
||||
""" # noqa: E501
|
||||
UpperCase = Annotated[_StrType, Predicate(str.isupper)]
|
||||
"""
|
||||
Return True if the string is an uppercase string, False otherwise.
|
||||
|
||||
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
|
||||
""" # noqa: E501
|
||||
IsDigit = Annotated[_StrType, Predicate(str.isdigit)]
|
||||
IsDigits = IsDigit # type: ignore # plural for backwards compatibility, see #63
|
||||
"""
|
||||
Return True if the string is a digit string, False otherwise.
|
||||
|
||||
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
|
||||
""" # noqa: E501
|
||||
IsAscii = Annotated[_StrType, Predicate(str.isascii)]
|
||||
"""
|
||||
Return True if all characters in the string are ASCII, False otherwise.
|
||||
|
||||
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
|
||||
"""
|
||||
|
||||
_NumericType = TypeVar('_NumericType', bound=Union[SupportsFloat, SupportsIndex])
|
||||
IsFinite = Annotated[_NumericType, Predicate(math.isfinite)]
|
||||
"""Return True if x is neither an infinity nor a NaN, and False otherwise."""
|
||||
IsNotFinite = Annotated[_NumericType, Predicate(Not(math.isfinite))]
|
||||
"""Return True if x is one of infinity or NaN, and False otherwise"""
|
||||
IsNan = Annotated[_NumericType, Predicate(math.isnan)]
|
||||
"""Return True if x is a NaN (not a number), and False otherwise."""
|
||||
IsNotNan = Annotated[_NumericType, Predicate(Not(math.isnan))]
|
||||
"""Return True if x is anything but NaN (not a number), and False otherwise."""
|
||||
IsInfinite = Annotated[_NumericType, Predicate(math.isinf)]
|
||||
"""Return True if x is a positive or negative infinity, and False otherwise."""
|
||||
IsNotInfinite = Annotated[_NumericType, Predicate(Not(math.isinf))]
|
||||
"""Return True if x is neither a positive or negative infinity, and False otherwise."""
|
||||
|
||||
try:
|
||||
from typing_extensions import DocInfo, doc # type: ignore [attr-defined]
|
||||
except ImportError:
|
||||
|
||||
@dataclass(frozen=True, **SLOTS)
|
||||
class DocInfo: # type: ignore [no-redef]
|
||||
""" "
|
||||
The return value of doc(), mainly to be used by tools that want to extract the
|
||||
Annotated documentation at runtime.
|
||||
"""
|
||||
|
||||
documentation: str
|
||||
"""The documentation string passed to doc()."""
|
||||
|
||||
def doc(
|
||||
documentation: str,
|
||||
) -> DocInfo:
|
||||
"""
|
||||
Add documentation to a type annotation inside of Annotated.
|
||||
|
||||
For example:
|
||||
|
||||
>>> def hi(name: Annotated[int, doc("The name of the user")]) -> None: ...
|
||||
"""
|
||||
return DocInfo(documentation)
|
||||
0
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/py.typed
vendored
Executable file
0
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/py.typed
vendored
Executable file
151
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/test_cases.py
vendored
Executable file
151
dev/env/cli_env/lib/python3.13/site-packages/annotated_types/test_cases.py
vendored
Executable file
@@ -0,0 +1,151 @@
|
||||
import math
|
||||
import sys
|
||||
from datetime import date, datetime, timedelta, timezone
|
||||
from decimal import Decimal
|
||||
from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Set, Tuple
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
from typing_extensions import Annotated
|
||||
else:
|
||||
from typing import Annotated
|
||||
|
||||
import annotated_types as at
|
||||
|
||||
|
||||
class Case(NamedTuple):
|
||||
"""
|
||||
A test case for `annotated_types`.
|
||||
"""
|
||||
|
||||
annotation: Any
|
||||
valid_cases: Iterable[Any]
|
||||
invalid_cases: Iterable[Any]
|
||||
|
||||
|
||||
def cases() -> Iterable[Case]:
|
||||
# Gt, Ge, Lt, Le
|
||||
yield Case(Annotated[int, at.Gt(4)], (5, 6, 1000), (4, 0, -1))
|
||||
yield Case(Annotated[float, at.Gt(0.5)], (0.6, 0.7, 0.8, 0.9), (0.5, 0.0, -0.1))
|
||||
yield Case(
|
||||
Annotated[datetime, at.Gt(datetime(2000, 1, 1))],
|
||||
[datetime(2000, 1, 2), datetime(2000, 1, 3)],
|
||||
[datetime(2000, 1, 1), datetime(1999, 12, 31)],
|
||||
)
|
||||
yield Case(
|
||||
Annotated[datetime, at.Gt(date(2000, 1, 1))],
|
||||
[date(2000, 1, 2), date(2000, 1, 3)],
|
||||
[date(2000, 1, 1), date(1999, 12, 31)],
|
||||
)
|
||||
yield Case(
|
||||
Annotated[datetime, at.Gt(Decimal('1.123'))],
|
||||
[Decimal('1.1231'), Decimal('123')],
|
||||
[Decimal('1.123'), Decimal('0')],
|
||||
)
|
||||
|
||||
yield Case(Annotated[int, at.Ge(4)], (4, 5, 6, 1000, 4), (0, -1))
|
||||
yield Case(Annotated[float, at.Ge(0.5)], (0.5, 0.6, 0.7, 0.8, 0.9), (0.4, 0.0, -0.1))
|
||||
yield Case(
|
||||
Annotated[datetime, at.Ge(datetime(2000, 1, 1))],
|
||||
[datetime(2000, 1, 2), datetime(2000, 1, 3)],
|
||||
[datetime(1998, 1, 1), datetime(1999, 12, 31)],
|
||||
)
|
||||
|
||||
yield Case(Annotated[int, at.Lt(4)], (0, -1), (4, 5, 6, 1000, 4))
|
||||
yield Case(Annotated[float, at.Lt(0.5)], (0.4, 0.0, -0.1), (0.5, 0.6, 0.7, 0.8, 0.9))
|
||||
yield Case(
|
||||
Annotated[datetime, at.Lt(datetime(2000, 1, 1))],
|
||||
[datetime(1999, 12, 31), datetime(1999, 12, 31)],
|
||||
[datetime(2000, 1, 2), datetime(2000, 1, 3)],
|
||||
)
|
||||
|
||||
yield Case(Annotated[int, at.Le(4)], (4, 0, -1), (5, 6, 1000))
|
||||
yield Case(Annotated[float, at.Le(0.5)], (0.5, 0.0, -0.1), (0.6, 0.7, 0.8, 0.9))
|
||||
yield Case(
|
||||
Annotated[datetime, at.Le(datetime(2000, 1, 1))],
|
||||
[datetime(2000, 1, 1), datetime(1999, 12, 31)],
|
||||
[datetime(2000, 1, 2), datetime(2000, 1, 3)],
|
||||
)
|
||||
|
||||
# Interval
|
||||
yield Case(Annotated[int, at.Interval(gt=4)], (5, 6, 1000), (4, 0, -1))
|
||||
yield Case(Annotated[int, at.Interval(gt=4, lt=10)], (5, 6), (4, 10, 1000, 0, -1))
|
||||
yield Case(Annotated[float, at.Interval(ge=0.5, le=1)], (0.5, 0.9, 1), (0.49, 1.1))
|
||||
yield Case(
|
||||
Annotated[datetime, at.Interval(gt=datetime(2000, 1, 1), le=datetime(2000, 1, 3))],
|
||||
[datetime(2000, 1, 2), datetime(2000, 1, 3)],
|
||||
[datetime(2000, 1, 1), datetime(2000, 1, 4)],
|
||||
)
|
||||
|
||||
yield Case(Annotated[int, at.MultipleOf(multiple_of=3)], (0, 3, 9), (1, 2, 4))
|
||||
yield Case(Annotated[float, at.MultipleOf(multiple_of=0.5)], (0, 0.5, 1, 1.5), (0.4, 1.1))
|
||||
|
||||
# lengths
|
||||
|
||||
yield Case(Annotated[str, at.MinLen(3)], ('123', '1234', 'x' * 10), ('', '1', '12'))
|
||||
yield Case(Annotated[str, at.Len(3)], ('123', '1234', 'x' * 10), ('', '1', '12'))
|
||||
yield Case(Annotated[List[int], at.MinLen(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2]))
|
||||
yield Case(Annotated[List[int], at.Len(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2]))
|
||||
|
||||
yield Case(Annotated[str, at.MaxLen(4)], ('', '1234'), ('12345', 'x' * 10))
|
||||
yield Case(Annotated[str, at.Len(0, 4)], ('', '1234'), ('12345', 'x' * 10))
|
||||
yield Case(Annotated[List[str], at.MaxLen(4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10))
|
||||
yield Case(Annotated[List[str], at.Len(0, 4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10))
|
||||
|
||||
yield Case(Annotated[str, at.Len(3, 5)], ('123', '12345'), ('', '1', '12', '123456', 'x' * 10))
|
||||
yield Case(Annotated[str, at.Len(3, 3)], ('123',), ('12', '1234'))
|
||||
|
||||
yield Case(Annotated[Dict[int, int], at.Len(2, 3)], [{1: 1, 2: 2}], [{}, {1: 1}, {1: 1, 2: 2, 3: 3, 4: 4}])
|
||||
yield Case(Annotated[Set[int], at.Len(2, 3)], ({1, 2}, {1, 2, 3}), (set(), {1}, {1, 2, 3, 4}))
|
||||
yield Case(Annotated[Tuple[int, ...], at.Len(2, 3)], ((1, 2), (1, 2, 3)), ((), (1,), (1, 2, 3, 4)))
|
||||
|
||||
# Timezone
|
||||
|
||||
yield Case(
|
||||
Annotated[datetime, at.Timezone(None)], [datetime(2000, 1, 1)], [datetime(2000, 1, 1, tzinfo=timezone.utc)]
|
||||
)
|
||||
yield Case(
|
||||
Annotated[datetime, at.Timezone(...)], [datetime(2000, 1, 1, tzinfo=timezone.utc)], [datetime(2000, 1, 1)]
|
||||
)
|
||||
yield Case(
|
||||
Annotated[datetime, at.Timezone(timezone.utc)],
|
||||
[datetime(2000, 1, 1, tzinfo=timezone.utc)],
|
||||
[datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))],
|
||||
)
|
||||
yield Case(
|
||||
Annotated[datetime, at.Timezone('Europe/London')],
|
||||
[datetime(2000, 1, 1, tzinfo=timezone(timedelta(0), name='Europe/London'))],
|
||||
[datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))],
|
||||
)
|
||||
|
||||
# Quantity
|
||||
|
||||
yield Case(Annotated[float, at.Unit(unit='m')], (5, 4.2), ('5m', '4.2m'))
|
||||
|
||||
# predicate types
|
||||
|
||||
yield Case(at.LowerCase[str], ['abc', 'foobar'], ['', 'A', 'Boom'])
|
||||
yield Case(at.UpperCase[str], ['ABC', 'DEFO'], ['', 'a', 'abc', 'AbC'])
|
||||
yield Case(at.IsDigit[str], ['123'], ['', 'ab', 'a1b2'])
|
||||
yield Case(at.IsAscii[str], ['123', 'foo bar'], ['£100', '😊', 'whatever 👀'])
|
||||
|
||||
yield Case(Annotated[int, at.Predicate(lambda x: x % 2 == 0)], [0, 2, 4], [1, 3, 5])
|
||||
|
||||
yield Case(at.IsFinite[float], [1.23], [math.nan, math.inf, -math.inf])
|
||||
yield Case(at.IsNotFinite[float], [math.nan, math.inf], [1.23])
|
||||
yield Case(at.IsNan[float], [math.nan], [1.23, math.inf])
|
||||
yield Case(at.IsNotNan[float], [1.23, math.inf], [math.nan])
|
||||
yield Case(at.IsInfinite[float], [math.inf], [math.nan, 1.23])
|
||||
yield Case(at.IsNotInfinite[float], [math.nan, 1.23], [math.inf])
|
||||
|
||||
# check stacked predicates
|
||||
yield Case(at.IsInfinite[Annotated[float, at.Predicate(lambda x: x > 0)]], [math.inf], [-math.inf, 1.23, math.nan])
|
||||
|
||||
# doc
|
||||
yield Case(Annotated[int, at.doc("A number")], [1, 2], [])
|
||||
|
||||
# custom GroupedMetadata
|
||||
class MyCustomGroupedMetadata(at.GroupedMetadata):
|
||||
def __iter__(self) -> Iterator[at.Predicate]:
|
||||
yield at.Predicate(lambda x: float(x).is_integer())
|
||||
|
||||
yield Case(Annotated[float, MyCustomGroupedMetadata()], [0, 2.0], [0.01, 1.5])
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/INSTALLER
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/INSTALLER
vendored
Executable file
@@ -0,0 +1 @@
|
||||
pip
|
||||
96
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/METADATA
vendored
Executable file
96
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/METADATA
vendored
Executable file
@@ -0,0 +1,96 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: anyio
|
||||
Version: 4.12.1
|
||||
Summary: High-level concurrency and networking framework on top of asyncio or Trio
|
||||
Author-email: Alex Grönholm <alex.gronholm@nextday.fi>
|
||||
License-Expression: MIT
|
||||
Project-URL: Documentation, https://anyio.readthedocs.io/en/latest/
|
||||
Project-URL: Changelog, https://anyio.readthedocs.io/en/stable/versionhistory.html
|
||||
Project-URL: Source code, https://github.com/agronholm/anyio
|
||||
Project-URL: Issue tracker, https://github.com/agronholm/anyio/issues
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Framework :: AnyIO
|
||||
Classifier: Typing :: Typed
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Programming Language :: Python :: 3.13
|
||||
Classifier: Programming Language :: Python :: 3.14
|
||||
Requires-Python: >=3.9
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE
|
||||
Requires-Dist: exceptiongroup>=1.0.2; python_version < "3.11"
|
||||
Requires-Dist: idna>=2.8
|
||||
Requires-Dist: typing_extensions>=4.5; python_version < "3.13"
|
||||
Provides-Extra: trio
|
||||
Requires-Dist: trio>=0.32.0; python_version >= "3.10" and extra == "trio"
|
||||
Requires-Dist: trio>=0.31.0; python_version < "3.10" and extra == "trio"
|
||||
Dynamic: license-file
|
||||
|
||||
.. image:: https://github.com/agronholm/anyio/actions/workflows/test.yml/badge.svg
|
||||
:target: https://github.com/agronholm/anyio/actions/workflows/test.yml
|
||||
:alt: Build Status
|
||||
.. image:: https://coveralls.io/repos/github/agronholm/anyio/badge.svg?branch=master
|
||||
:target: https://coveralls.io/github/agronholm/anyio?branch=master
|
||||
:alt: Code Coverage
|
||||
.. image:: https://readthedocs.org/projects/anyio/badge/?version=latest
|
||||
:target: https://anyio.readthedocs.io/en/latest/?badge=latest
|
||||
:alt: Documentation
|
||||
.. image:: https://badges.gitter.im/gitterHQ/gitter.svg
|
||||
:target: https://gitter.im/python-trio/AnyIO
|
||||
:alt: Gitter chat
|
||||
|
||||
AnyIO is an asynchronous networking and concurrency library that works on top of either asyncio_ or
|
||||
Trio_. It implements Trio-like `structured concurrency`_ (SC) on top of asyncio and works in harmony
|
||||
with the native SC of Trio itself.
|
||||
|
||||
Applications and libraries written against AnyIO's API will run unmodified on either asyncio_ or
|
||||
Trio_. AnyIO can also be adopted into a library or application incrementally – bit by bit, no full
|
||||
refactoring necessary. It will blend in with the native libraries of your chosen backend.
|
||||
|
||||
To find out why you might want to use AnyIO's APIs instead of asyncio's, you can read about it
|
||||
`here <https://anyio.readthedocs.io/en/stable/why.html>`_.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
View full documentation at: https://anyio.readthedocs.io/
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
AnyIO offers the following functionality:
|
||||
|
||||
* Task groups (nurseries_ in trio terminology)
|
||||
* High-level networking (TCP, UDP and UNIX sockets)
|
||||
|
||||
* `Happy eyeballs`_ algorithm for TCP connections (more robust than that of asyncio on Python
|
||||
3.8)
|
||||
* async/await style UDP sockets (unlike asyncio where you still have to use Transports and
|
||||
Protocols)
|
||||
|
||||
* A versatile API for byte streams and object streams
|
||||
* Inter-task synchronization and communication (locks, conditions, events, semaphores, object
|
||||
streams)
|
||||
* Worker threads
|
||||
* Subprocesses
|
||||
* Subinterpreter support for code parallelization (on Python 3.13 and later)
|
||||
* Asynchronous file I/O (using worker threads)
|
||||
* Signal handling
|
||||
* Asynchronous version of the functools_ module
|
||||
|
||||
AnyIO also comes with its own pytest_ plugin which also supports asynchronous fixtures.
|
||||
It even works with the popular Hypothesis_ library.
|
||||
|
||||
.. _asyncio: https://docs.python.org/3/library/asyncio.html
|
||||
.. _Trio: https://github.com/python-trio/trio
|
||||
.. _structured concurrency: https://en.wikipedia.org/wiki/Structured_concurrency
|
||||
.. _nurseries: https://trio.readthedocs.io/en/stable/reference-core.html#nurseries-and-spawning
|
||||
.. _Happy eyeballs: https://en.wikipedia.org/wiki/Happy_Eyeballs
|
||||
.. _pytest: https://docs.pytest.org/en/latest/
|
||||
.. _functools: https://docs.python.org/3/library/functools.html
|
||||
.. _Hypothesis: https://hypothesis.works/
|
||||
92
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/RECORD
vendored
Executable file
92
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/RECORD
vendored
Executable file
@@ -0,0 +1,92 @@
|
||||
anyio-4.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
anyio-4.12.1.dist-info/METADATA,sha256=DfiDab9Tmmcfy802lOLTMEHJQShkOSbopCwqCYbLuJk,4277
|
||||
anyio-4.12.1.dist-info/RECORD,,
|
||||
anyio-4.12.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
||||
anyio-4.12.1.dist-info/entry_points.txt,sha256=_d6Yu6uiaZmNe0CydowirE9Cmg7zUL2g08tQpoS3Qvc,39
|
||||
anyio-4.12.1.dist-info/licenses/LICENSE,sha256=U2GsncWPLvX9LpsJxoKXwX8ElQkJu8gCO9uC6s8iwrA,1081
|
||||
anyio-4.12.1.dist-info/top_level.txt,sha256=QglSMiWX8_5dpoVAEIHdEYzvqFMdSYWmCj6tYw2ITkQ,6
|
||||
anyio/__init__.py,sha256=7iDVqMUprUuKNY91FuoKqayAhR-OY136YDPI6P78HHk,6170
|
||||
anyio/__pycache__/__init__.cpython-313.pyc,,
|
||||
anyio/__pycache__/from_thread.cpython-313.pyc,,
|
||||
anyio/__pycache__/functools.cpython-313.pyc,,
|
||||
anyio/__pycache__/lowlevel.cpython-313.pyc,,
|
||||
anyio/__pycache__/pytest_plugin.cpython-313.pyc,,
|
||||
anyio/__pycache__/to_interpreter.cpython-313.pyc,,
|
||||
anyio/__pycache__/to_process.cpython-313.pyc,,
|
||||
anyio/__pycache__/to_thread.cpython-313.pyc,,
|
||||
anyio/_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
anyio/_backends/__pycache__/__init__.cpython-313.pyc,,
|
||||
anyio/_backends/__pycache__/_asyncio.cpython-313.pyc,,
|
||||
anyio/_backends/__pycache__/_trio.cpython-313.pyc,,
|
||||
anyio/_backends/_asyncio.py,sha256=xG6qv60mgGnL0mK82dxjH2b8hlkMlJ-x2BqIq3qv70Y,98863
|
||||
anyio/_backends/_trio.py,sha256=30Rctb7lm8g63ZHljVPVnj5aH-uK6oQvphjwUBoAzuI,41456
|
||||
anyio/_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
anyio/_core/__pycache__/__init__.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_asyncio_selector_thread.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_contextmanagers.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_eventloop.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_exceptions.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_fileio.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_resources.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_signals.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_sockets.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_streams.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_subprocesses.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_synchronization.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_tasks.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_tempfile.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_testing.cpython-313.pyc,,
|
||||
anyio/_core/__pycache__/_typedattr.cpython-313.pyc,,
|
||||
anyio/_core/_asyncio_selector_thread.py,sha256=2PdxFM3cs02Kp6BSppbvmRT7q7asreTW5FgBxEsflBo,5626
|
||||
anyio/_core/_contextmanagers.py,sha256=YInBCabiEeS-UaP_Jdxa1CaFC71ETPW8HZTHIM8Rsc8,7215
|
||||
anyio/_core/_eventloop.py,sha256=c2EdcBX-xnKwxPcC4Pjn3_qG9I-x4IWFO2R9RqCGjM4,6448
|
||||
anyio/_core/_exceptions.py,sha256=Y3aq-Wxd7Q2HqwSg7nZPvRsHEuGazv_qeet6gqEBdPk,4407
|
||||
anyio/_core/_fileio.py,sha256=uc7t10Vb-If7GbdWM_zFf-ajUe6uek63fSt7IBLlZW0,25731
|
||||
anyio/_core/_resources.py,sha256=NbmU5O5UX3xEyACnkmYX28Fmwdl-f-ny0tHym26e0w0,435
|
||||
anyio/_core/_signals.py,sha256=mjTBB2hTKNPRlU0IhnijeQedpWOGERDiMjSlJQsFrug,1016
|
||||
anyio/_core/_sockets.py,sha256=RBXHcUqZt5gg_-OOfgHVv8uq2FSKk1uVUzTdpjBoI1o,34977
|
||||
anyio/_core/_streams.py,sha256=FczFwIgDpnkK0bODWJXMpsUJYdvAD04kaUaGzJU8DK0,1806
|
||||
anyio/_core/_subprocesses.py,sha256=EXm5igL7dj55iYkPlbYVAqtbqxJxjU-6OndSTIx9SRg,8047
|
||||
anyio/_core/_synchronization.py,sha256=MgVVqFzvt580tHC31LiOcq1G6aryut--xRG4Ff8KwxQ,20869
|
||||
anyio/_core/_tasks.py,sha256=pVB7K6AAulzUM8YgXAeqNZG44nSyZ1bYJjH8GznC00I,5435
|
||||
anyio/_core/_tempfile.py,sha256=lHb7CW4FyIlpkf5ADAf4VmLHCKwEHF9nxqNyBCFFUiA,19697
|
||||
anyio/_core/_testing.py,sha256=u7MPqGXwpTxqI7hclSdNA30z2GH1Nw258uwKvy_RfBg,2340
|
||||
anyio/_core/_typedattr.py,sha256=P4ozZikn3-DbpoYcvyghS_FOYAgbmUxeoU8-L_07pZM,2508
|
||||
anyio/abc/__init__.py,sha256=6mWhcl_pGXhrgZVHP_TCfMvIXIOp9mroEFM90fYCU_U,2869
|
||||
anyio/abc/__pycache__/__init__.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_eventloop.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_resources.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_sockets.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_streams.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_subprocesses.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_tasks.cpython-313.pyc,,
|
||||
anyio/abc/__pycache__/_testing.cpython-313.pyc,,
|
||||
anyio/abc/_eventloop.py,sha256=GlzgB3UJGgG6Kr7olpjOZ-o00PghecXuofVDQ_5611Q,10749
|
||||
anyio/abc/_resources.py,sha256=DrYvkNN1hH6Uvv5_5uKySvDsnknGVDe8FCKfko0VtN8,783
|
||||
anyio/abc/_sockets.py,sha256=ECTY0jLEF18gryANHR3vFzXzGdZ-xPwELq1QdgOb0Jo,13258
|
||||
anyio/abc/_streams.py,sha256=005GKSCXGprxnhucILboSqc2JFovECZk9m3p-qqxXVc,7640
|
||||
anyio/abc/_subprocesses.py,sha256=cumAPJTktOQtw63IqG0lDpyZqu_l1EElvQHMiwJgL08,2067
|
||||
anyio/abc/_tasks.py,sha256=KC7wrciE48AINOI-AhPutnFhe1ewfP7QnamFlDzqesQ,3721
|
||||
anyio/abc/_testing.py,sha256=tBJUzkSfOXJw23fe8qSJ03kJlShOYjjaEyFB6k6MYT8,1821
|
||||
anyio/from_thread.py,sha256=L-0w1HxJ6BSb-KuVi57k5Tkc3yzQrx3QK5tAxMPcY-0,19141
|
||||
anyio/functools.py,sha256=HWj7GBEmc0Z-mZg3uok7Z7ZJn0rEC_0Pzbt0nYUDaTQ,10973
|
||||
anyio/lowlevel.py,sha256=AyKLVK3LaWSoK39LkCKxE4_GDMLKZBNqTrLUgk63y80,5158
|
||||
anyio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
anyio/pytest_plugin.py,sha256=3jAFQn0jv_pyoWE2GBBlHaj9sqXj4e8vob0_hgrsXE8,10244
|
||||
anyio/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
anyio/streams/__pycache__/__init__.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/buffered.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/file.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/memory.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/stapled.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/text.cpython-313.pyc,,
|
||||
anyio/streams/__pycache__/tls.cpython-313.pyc,,
|
||||
anyio/streams/buffered.py,sha256=2R3PeJhe4EXrdYqz44Y6-Eg9R6DrmlsYrP36Ir43-po,6263
|
||||
anyio/streams/file.py,sha256=4WZ7XGz5WNu39FQHvqbe__TQ0HDP9OOhgO1mk9iVpVU,4470
|
||||
anyio/streams/memory.py,sha256=F0zwzvFJKAhX_LRZGoKzzqDC2oMM-f-yyTBrEYEGOaU,10740
|
||||
anyio/streams/stapled.py,sha256=T8Xqwf8K6EgURPxbt1N4i7A8BAk-gScv-GRhjLXIf_o,4390
|
||||
anyio/streams/text.py,sha256=BcVAGJw1VRvtIqnv-o0Rb0pwH7p8vwlvl21xHq522ag,5765
|
||||
anyio/streams/tls.py,sha256=Jpxy0Mfbcp1BxHCwE-YjSSFaLnIBbnnwur-excYThs4,15368
|
||||
anyio/to_interpreter.py,sha256=_mLngrMy97TMR6VbW4Y6YzDUk9ZuPcQMPlkuyRh3C9k,7100
|
||||
anyio/to_process.py,sha256=J7gAA_YOuoHqnpDAf5fm1Qu6kOmTzdFbiDNvnV755vk,9798
|
||||
anyio/to_thread.py,sha256=menEgXYmUV7Fjg_9WqCV95P9MAtQS8BzPGGcWB_QnfQ,2687
|
||||
5
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/WHEEL
vendored
Executable file
5
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/WHEEL
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: setuptools (80.9.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
2
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/entry_points.txt
vendored
Executable file
2
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/entry_points.txt
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
[pytest11]
|
||||
anyio = anyio.pytest_plugin
|
||||
20
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/licenses/LICENSE
vendored
Executable file
20
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/licenses/LICENSE
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Alex Grönholm
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
1
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/top_level.txt
vendored
Executable file
1
dev/env/cli_env/lib/python3.13/site-packages/anyio-4.12.1.dist-info/top_level.txt
vendored
Executable file
@@ -0,0 +1 @@
|
||||
anyio
|
||||
111
dev/env/cli_env/lib/python3.13/site-packages/anyio/__init__.py
vendored
Executable file
111
dev/env/cli_env/lib/python3.13/site-packages/anyio/__init__.py
vendored
Executable file
@@ -0,0 +1,111 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ._core._contextmanagers import AsyncContextManagerMixin as AsyncContextManagerMixin
|
||||
from ._core._contextmanagers import ContextManagerMixin as ContextManagerMixin
|
||||
from ._core._eventloop import current_time as current_time
|
||||
from ._core._eventloop import get_all_backends as get_all_backends
|
||||
from ._core._eventloop import get_available_backends as get_available_backends
|
||||
from ._core._eventloop import get_cancelled_exc_class as get_cancelled_exc_class
|
||||
from ._core._eventloop import run as run
|
||||
from ._core._eventloop import sleep as sleep
|
||||
from ._core._eventloop import sleep_forever as sleep_forever
|
||||
from ._core._eventloop import sleep_until as sleep_until
|
||||
from ._core._exceptions import BrokenResourceError as BrokenResourceError
|
||||
from ._core._exceptions import BrokenWorkerInterpreter as BrokenWorkerInterpreter
|
||||
from ._core._exceptions import BrokenWorkerProcess as BrokenWorkerProcess
|
||||
from ._core._exceptions import BusyResourceError as BusyResourceError
|
||||
from ._core._exceptions import ClosedResourceError as ClosedResourceError
|
||||
from ._core._exceptions import ConnectionFailed as ConnectionFailed
|
||||
from ._core._exceptions import DelimiterNotFound as DelimiterNotFound
|
||||
from ._core._exceptions import EndOfStream as EndOfStream
|
||||
from ._core._exceptions import IncompleteRead as IncompleteRead
|
||||
from ._core._exceptions import NoEventLoopError as NoEventLoopError
|
||||
from ._core._exceptions import RunFinishedError as RunFinishedError
|
||||
from ._core._exceptions import TypedAttributeLookupError as TypedAttributeLookupError
|
||||
from ._core._exceptions import WouldBlock as WouldBlock
|
||||
from ._core._fileio import AsyncFile as AsyncFile
|
||||
from ._core._fileio import Path as Path
|
||||
from ._core._fileio import open_file as open_file
|
||||
from ._core._fileio import wrap_file as wrap_file
|
||||
from ._core._resources import aclose_forcefully as aclose_forcefully
|
||||
from ._core._signals import open_signal_receiver as open_signal_receiver
|
||||
from ._core._sockets import TCPConnectable as TCPConnectable
|
||||
from ._core._sockets import UNIXConnectable as UNIXConnectable
|
||||
from ._core._sockets import as_connectable as as_connectable
|
||||
from ._core._sockets import connect_tcp as connect_tcp
|
||||
from ._core._sockets import connect_unix as connect_unix
|
||||
from ._core._sockets import create_connected_udp_socket as create_connected_udp_socket
|
||||
from ._core._sockets import (
|
||||
create_connected_unix_datagram_socket as create_connected_unix_datagram_socket,
|
||||
)
|
||||
from ._core._sockets import create_tcp_listener as create_tcp_listener
|
||||
from ._core._sockets import create_udp_socket as create_udp_socket
|
||||
from ._core._sockets import create_unix_datagram_socket as create_unix_datagram_socket
|
||||
from ._core._sockets import create_unix_listener as create_unix_listener
|
||||
from ._core._sockets import getaddrinfo as getaddrinfo
|
||||
from ._core._sockets import getnameinfo as getnameinfo
|
||||
from ._core._sockets import notify_closing as notify_closing
|
||||
from ._core._sockets import wait_readable as wait_readable
|
||||
from ._core._sockets import wait_socket_readable as wait_socket_readable
|
||||
from ._core._sockets import wait_socket_writable as wait_socket_writable
|
||||
from ._core._sockets import wait_writable as wait_writable
|
||||
from ._core._streams import create_memory_object_stream as create_memory_object_stream
|
||||
from ._core._subprocesses import open_process as open_process
|
||||
from ._core._subprocesses import run_process as run_process
|
||||
from ._core._synchronization import CapacityLimiter as CapacityLimiter
|
||||
from ._core._synchronization import (
|
||||
CapacityLimiterStatistics as CapacityLimiterStatistics,
|
||||
)
|
||||
from ._core._synchronization import Condition as Condition
|
||||
from ._core._synchronization import ConditionStatistics as ConditionStatistics
|
||||
from ._core._synchronization import Event as Event
|
||||
from ._core._synchronization import EventStatistics as EventStatistics
|
||||
from ._core._synchronization import Lock as Lock
|
||||
from ._core._synchronization import LockStatistics as LockStatistics
|
||||
from ._core._synchronization import ResourceGuard as ResourceGuard
|
||||
from ._core._synchronization import Semaphore as Semaphore
|
||||
from ._core._synchronization import SemaphoreStatistics as SemaphoreStatistics
|
||||
from ._core._tasks import TASK_STATUS_IGNORED as TASK_STATUS_IGNORED
|
||||
from ._core._tasks import CancelScope as CancelScope
|
||||
from ._core._tasks import create_task_group as create_task_group
|
||||
from ._core._tasks import current_effective_deadline as current_effective_deadline
|
||||
from ._core._tasks import fail_after as fail_after
|
||||
from ._core._tasks import move_on_after as move_on_after
|
||||
from ._core._tempfile import NamedTemporaryFile as NamedTemporaryFile
|
||||
from ._core._tempfile import SpooledTemporaryFile as SpooledTemporaryFile
|
||||
from ._core._tempfile import TemporaryDirectory as TemporaryDirectory
|
||||
from ._core._tempfile import TemporaryFile as TemporaryFile
|
||||
from ._core._tempfile import gettempdir as gettempdir
|
||||
from ._core._tempfile import gettempdirb as gettempdirb
|
||||
from ._core._tempfile import mkdtemp as mkdtemp
|
||||
from ._core._tempfile import mkstemp as mkstemp
|
||||
from ._core._testing import TaskInfo as TaskInfo
|
||||
from ._core._testing import get_current_task as get_current_task
|
||||
from ._core._testing import get_running_tasks as get_running_tasks
|
||||
from ._core._testing import wait_all_tasks_blocked as wait_all_tasks_blocked
|
||||
from ._core._typedattr import TypedAttributeProvider as TypedAttributeProvider
|
||||
from ._core._typedattr import TypedAttributeSet as TypedAttributeSet
|
||||
from ._core._typedattr import typed_attribute as typed_attribute
|
||||
|
||||
# Re-export imports so they look like they live directly in this package
|
||||
for __value in list(locals().values()):
|
||||
if getattr(__value, "__module__", "").startswith("anyio."):
|
||||
__value.__module__ = __name__
|
||||
|
||||
|
||||
del __value
|
||||
|
||||
|
||||
def __getattr__(attr: str) -> type[BrokenWorkerInterpreter]:
|
||||
"""Support deprecated aliases."""
|
||||
if attr == "BrokenWorkerIntepreter":
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"The 'BrokenWorkerIntepreter' alias is deprecated, use 'BrokenWorkerInterpreter' instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return BrokenWorkerInterpreter
|
||||
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
|
||||
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/__init__.py
vendored
Executable file
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/__init__.py
vendored
Executable file
2980
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/_asyncio.py
vendored
Executable file
2980
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/_asyncio.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1346
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/_trio.py
vendored
Executable file
1346
dev/env/cli_env/lib/python3.13/site-packages/anyio/_backends/_trio.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/__init__.py
vendored
Executable file
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/__init__.py
vendored
Executable file
167
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_asyncio_selector_thread.py
vendored
Executable file
167
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_asyncio_selector_thread.py
vendored
Executable file
@@ -0,0 +1,167 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import socket
|
||||
import threading
|
||||
from collections.abc import Callable
|
||||
from selectors import EVENT_READ, EVENT_WRITE, DefaultSelector
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
_selector_lock = threading.Lock()
|
||||
_selector: Selector | None = None
|
||||
|
||||
|
||||
class Selector:
|
||||
def __init__(self) -> None:
|
||||
self._thread = threading.Thread(target=self.run, name="AnyIO socket selector")
|
||||
self._selector = DefaultSelector()
|
||||
self._send, self._receive = socket.socketpair()
|
||||
self._send.setblocking(False)
|
||||
self._receive.setblocking(False)
|
||||
# This somewhat reduces the amount of memory wasted queueing up data
|
||||
# for wakeups. With these settings, maximum number of 1-byte sends
|
||||
# before getting BlockingIOError:
|
||||
# Linux 4.8: 6
|
||||
# macOS (darwin 15.5): 1
|
||||
# Windows 10: 525347
|
||||
# Windows you're weird. (And on Windows setting SNDBUF to 0 makes send
|
||||
# blocking, even on non-blocking sockets, so don't do that.)
|
||||
self._receive.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 1)
|
||||
self._send.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1)
|
||||
# On Windows this is a TCP socket so this might matter. On other
|
||||
# platforms this fails b/c AF_UNIX sockets aren't actually TCP.
|
||||
try:
|
||||
self._send.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self._selector.register(self._receive, EVENT_READ)
|
||||
self._closed = False
|
||||
|
||||
def start(self) -> None:
|
||||
self._thread.start()
|
||||
threading._register_atexit(self._stop) # type: ignore[attr-defined]
|
||||
|
||||
def _stop(self) -> None:
|
||||
global _selector
|
||||
self._closed = True
|
||||
self._notify_self()
|
||||
self._send.close()
|
||||
self._thread.join()
|
||||
self._selector.unregister(self._receive)
|
||||
self._receive.close()
|
||||
self._selector.close()
|
||||
_selector = None
|
||||
assert not self._selector.get_map(), (
|
||||
"selector still has registered file descriptors after shutdown"
|
||||
)
|
||||
|
||||
def _notify_self(self) -> None:
|
||||
try:
|
||||
self._send.send(b"\x00")
|
||||
except BlockingIOError:
|
||||
pass
|
||||
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[[], Any]) -> None:
|
||||
loop = asyncio.get_running_loop()
|
||||
try:
|
||||
key = self._selector.get_key(fd)
|
||||
except KeyError:
|
||||
self._selector.register(fd, EVENT_READ, {EVENT_READ: (loop, callback)})
|
||||
else:
|
||||
if EVENT_READ in key.data:
|
||||
raise ValueError(
|
||||
"this file descriptor is already registered for reading"
|
||||
)
|
||||
|
||||
key.data[EVENT_READ] = loop, callback
|
||||
self._selector.modify(fd, key.events | EVENT_READ, key.data)
|
||||
|
||||
self._notify_self()
|
||||
|
||||
def add_writer(self, fd: FileDescriptorLike, callback: Callable[[], Any]) -> None:
|
||||
loop = asyncio.get_running_loop()
|
||||
try:
|
||||
key = self._selector.get_key(fd)
|
||||
except KeyError:
|
||||
self._selector.register(fd, EVENT_WRITE, {EVENT_WRITE: (loop, callback)})
|
||||
else:
|
||||
if EVENT_WRITE in key.data:
|
||||
raise ValueError(
|
||||
"this file descriptor is already registered for writing"
|
||||
)
|
||||
|
||||
key.data[EVENT_WRITE] = loop, callback
|
||||
self._selector.modify(fd, key.events | EVENT_WRITE, key.data)
|
||||
|
||||
self._notify_self()
|
||||
|
||||
def remove_reader(self, fd: FileDescriptorLike) -> bool:
|
||||
try:
|
||||
key = self._selector.get_key(fd)
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
if new_events := key.events ^ EVENT_READ:
|
||||
del key.data[EVENT_READ]
|
||||
self._selector.modify(fd, new_events, key.data)
|
||||
else:
|
||||
self._selector.unregister(fd)
|
||||
|
||||
return True
|
||||
|
||||
def remove_writer(self, fd: FileDescriptorLike) -> bool:
|
||||
try:
|
||||
key = self._selector.get_key(fd)
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
if new_events := key.events ^ EVENT_WRITE:
|
||||
del key.data[EVENT_WRITE]
|
||||
self._selector.modify(fd, new_events, key.data)
|
||||
else:
|
||||
self._selector.unregister(fd)
|
||||
|
||||
return True
|
||||
|
||||
def run(self) -> None:
|
||||
while not self._closed:
|
||||
for key, events in self._selector.select():
|
||||
if key.fileobj is self._receive:
|
||||
try:
|
||||
while self._receive.recv(4096):
|
||||
pass
|
||||
except BlockingIOError:
|
||||
pass
|
||||
|
||||
continue
|
||||
|
||||
if events & EVENT_READ:
|
||||
loop, callback = key.data[EVENT_READ]
|
||||
self.remove_reader(key.fd)
|
||||
try:
|
||||
loop.call_soon_threadsafe(callback)
|
||||
except RuntimeError:
|
||||
pass # the loop was already closed
|
||||
|
||||
if events & EVENT_WRITE:
|
||||
loop, callback = key.data[EVENT_WRITE]
|
||||
self.remove_writer(key.fd)
|
||||
try:
|
||||
loop.call_soon_threadsafe(callback)
|
||||
except RuntimeError:
|
||||
pass # the loop was already closed
|
||||
|
||||
|
||||
def get_selector() -> Selector:
|
||||
global _selector
|
||||
|
||||
with _selector_lock:
|
||||
if _selector is None:
|
||||
_selector = Selector()
|
||||
_selector.start()
|
||||
|
||||
return _selector
|
||||
200
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_contextmanagers.py
vendored
Executable file
200
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_contextmanagers.py
vendored
Executable file
@@ -0,0 +1,200 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from contextlib import AbstractAsyncContextManager, AbstractContextManager
|
||||
from inspect import isasyncgen, iscoroutine, isgenerator
|
||||
from types import TracebackType
|
||||
from typing import Protocol, TypeVar, cast, final
|
||||
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_ExitT_co = TypeVar("_ExitT_co", covariant=True, bound="bool | None")
|
||||
|
||||
|
||||
class _SupportsCtxMgr(Protocol[_T_co, _ExitT_co]):
|
||||
def __contextmanager__(self) -> AbstractContextManager[_T_co, _ExitT_co]: ...
|
||||
|
||||
|
||||
class _SupportsAsyncCtxMgr(Protocol[_T_co, _ExitT_co]):
|
||||
def __asynccontextmanager__(
|
||||
self,
|
||||
) -> AbstractAsyncContextManager[_T_co, _ExitT_co]: ...
|
||||
|
||||
|
||||
class ContextManagerMixin:
|
||||
"""
|
||||
Mixin class providing context manager functionality via a generator-based
|
||||
implementation.
|
||||
|
||||
This class allows you to implement a context manager via :meth:`__contextmanager__`
|
||||
which should return a generator. The mechanics are meant to mirror those of
|
||||
:func:`@contextmanager <contextlib.contextmanager>`.
|
||||
|
||||
.. note:: Classes using this mix-in are not reentrant as context managers, meaning
|
||||
that once you enter it, you can't re-enter before first exiting it.
|
||||
|
||||
.. seealso:: :doc:`contextmanagers`
|
||||
"""
|
||||
|
||||
__cm: AbstractContextManager[object, bool | None] | None = None
|
||||
|
||||
@final
|
||||
def __enter__(self: _SupportsCtxMgr[_T_co, bool | None]) -> _T_co:
|
||||
# Needed for mypy to assume self still has the __cm member
|
||||
assert isinstance(self, ContextManagerMixin)
|
||||
if self.__cm is not None:
|
||||
raise RuntimeError(
|
||||
f"this {self.__class__.__qualname__} has already been entered"
|
||||
)
|
||||
|
||||
cm = self.__contextmanager__()
|
||||
if not isinstance(cm, AbstractContextManager):
|
||||
if isgenerator(cm):
|
||||
raise TypeError(
|
||||
"__contextmanager__() returned a generator object instead of "
|
||||
"a context manager. Did you forget to add the @contextmanager "
|
||||
"decorator?"
|
||||
)
|
||||
|
||||
raise TypeError(
|
||||
f"__contextmanager__() did not return a context manager object, "
|
||||
f"but {cm.__class__!r}"
|
||||
)
|
||||
|
||||
if cm is self:
|
||||
raise TypeError(
|
||||
f"{self.__class__.__qualname__}.__contextmanager__() returned "
|
||||
f"self. Did you forget to add the @contextmanager decorator and a "
|
||||
f"'yield' statement?"
|
||||
)
|
||||
|
||||
value = cm.__enter__()
|
||||
self.__cm = cm
|
||||
return value
|
||||
|
||||
@final
|
||||
def __exit__(
|
||||
self: _SupportsCtxMgr[object, _ExitT_co],
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> _ExitT_co:
|
||||
# Needed for mypy to assume self still has the __cm member
|
||||
assert isinstance(self, ContextManagerMixin)
|
||||
if self.__cm is None:
|
||||
raise RuntimeError(
|
||||
f"this {self.__class__.__qualname__} has not been entered yet"
|
||||
)
|
||||
|
||||
# Prevent circular references
|
||||
cm = self.__cm
|
||||
del self.__cm
|
||||
|
||||
return cast(_ExitT_co, cm.__exit__(exc_type, exc_val, exc_tb))
|
||||
|
||||
@abstractmethod
|
||||
def __contextmanager__(self) -> AbstractContextManager[object, bool | None]:
|
||||
"""
|
||||
Implement your context manager logic here.
|
||||
|
||||
This method **must** be decorated with
|
||||
:func:`@contextmanager <contextlib.contextmanager>`.
|
||||
|
||||
.. note:: Remember that the ``yield`` will raise any exception raised in the
|
||||
enclosed context block, so use a ``finally:`` block to clean up resources!
|
||||
|
||||
:return: a context manager object
|
||||
"""
|
||||
|
||||
|
||||
class AsyncContextManagerMixin:
|
||||
"""
|
||||
Mixin class providing async context manager functionality via a generator-based
|
||||
implementation.
|
||||
|
||||
This class allows you to implement a context manager via
|
||||
:meth:`__asynccontextmanager__`. The mechanics are meant to mirror those of
|
||||
:func:`@asynccontextmanager <contextlib.asynccontextmanager>`.
|
||||
|
||||
.. note:: Classes using this mix-in are not reentrant as context managers, meaning
|
||||
that once you enter it, you can't re-enter before first exiting it.
|
||||
|
||||
.. seealso:: :doc:`contextmanagers`
|
||||
"""
|
||||
|
||||
__cm: AbstractAsyncContextManager[object, bool | None] | None = None
|
||||
|
||||
@final
|
||||
async def __aenter__(self: _SupportsAsyncCtxMgr[_T_co, bool | None]) -> _T_co:
|
||||
# Needed for mypy to assume self still has the __cm member
|
||||
assert isinstance(self, AsyncContextManagerMixin)
|
||||
if self.__cm is not None:
|
||||
raise RuntimeError(
|
||||
f"this {self.__class__.__qualname__} has already been entered"
|
||||
)
|
||||
|
||||
cm = self.__asynccontextmanager__()
|
||||
if not isinstance(cm, AbstractAsyncContextManager):
|
||||
if isasyncgen(cm):
|
||||
raise TypeError(
|
||||
"__asynccontextmanager__() returned an async generator instead of "
|
||||
"an async context manager. Did you forget to add the "
|
||||
"@asynccontextmanager decorator?"
|
||||
)
|
||||
elif iscoroutine(cm):
|
||||
cm.close()
|
||||
raise TypeError(
|
||||
"__asynccontextmanager__() returned a coroutine object instead of "
|
||||
"an async context manager. Did you forget to add the "
|
||||
"@asynccontextmanager decorator and a 'yield' statement?"
|
||||
)
|
||||
|
||||
raise TypeError(
|
||||
f"__asynccontextmanager__() did not return an async context manager, "
|
||||
f"but {cm.__class__!r}"
|
||||
)
|
||||
|
||||
if cm is self:
|
||||
raise TypeError(
|
||||
f"{self.__class__.__qualname__}.__asynccontextmanager__() returned "
|
||||
f"self. Did you forget to add the @asynccontextmanager decorator and a "
|
||||
f"'yield' statement?"
|
||||
)
|
||||
|
||||
value = await cm.__aenter__()
|
||||
self.__cm = cm
|
||||
return value
|
||||
|
||||
@final
|
||||
async def __aexit__(
|
||||
self: _SupportsAsyncCtxMgr[object, _ExitT_co],
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> _ExitT_co:
|
||||
assert isinstance(self, AsyncContextManagerMixin)
|
||||
if self.__cm is None:
|
||||
raise RuntimeError(
|
||||
f"this {self.__class__.__qualname__} has not been entered yet"
|
||||
)
|
||||
|
||||
# Prevent circular references
|
||||
cm = self.__cm
|
||||
del self.__cm
|
||||
|
||||
return cast(_ExitT_co, await cm.__aexit__(exc_type, exc_val, exc_tb))
|
||||
|
||||
@abstractmethod
|
||||
def __asynccontextmanager__(
|
||||
self,
|
||||
) -> AbstractAsyncContextManager[object, bool | None]:
|
||||
"""
|
||||
Implement your async context manager logic here.
|
||||
|
||||
This method **must** be decorated with
|
||||
:func:`@asynccontextmanager <contextlib.asynccontextmanager>`.
|
||||
|
||||
.. note:: Remember that the ``yield`` will raise any exception raised in the
|
||||
enclosed context block, so use a ``finally:`` block to clean up resources!
|
||||
|
||||
:return: an async context manager object
|
||||
"""
|
||||
234
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_eventloop.py
vendored
Executable file
234
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_eventloop.py
vendored
Executable file
@@ -0,0 +1,234 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import sys
|
||||
import threading
|
||||
from collections.abc import Awaitable, Callable, Generator
|
||||
from contextlib import contextmanager
|
||||
from contextvars import Token
|
||||
from importlib import import_module
|
||||
from typing import TYPE_CHECKING, Any, TypeVar
|
||||
|
||||
from ._exceptions import NoEventLoopError
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypeVarTuple, Unpack
|
||||
else:
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
sniffio: Any
|
||||
try:
|
||||
import sniffio
|
||||
except ModuleNotFoundError:
|
||||
sniffio = None
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..abc import AsyncBackend
|
||||
|
||||
# This must be updated when new backends are introduced
|
||||
BACKENDS = "asyncio", "trio"
|
||||
|
||||
T_Retval = TypeVar("T_Retval")
|
||||
PosArgsT = TypeVarTuple("PosArgsT")
|
||||
|
||||
threadlocals = threading.local()
|
||||
loaded_backends: dict[str, type[AsyncBackend]] = {}
|
||||
|
||||
|
||||
def run(
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
*args: Unpack[PosArgsT],
|
||||
backend: str = "asyncio",
|
||||
backend_options: dict[str, Any] | None = None,
|
||||
) -> T_Retval:
|
||||
"""
|
||||
Run the given coroutine function in an asynchronous event loop.
|
||||
|
||||
The current thread must not be already running an event loop.
|
||||
|
||||
:param func: a coroutine function
|
||||
:param args: positional arguments to ``func``
|
||||
:param backend: name of the asynchronous event loop implementation – currently
|
||||
either ``asyncio`` or ``trio``
|
||||
:param backend_options: keyword arguments to call the backend ``run()``
|
||||
implementation with (documented :ref:`here <backend options>`)
|
||||
:return: the return value of the coroutine function
|
||||
:raises RuntimeError: if an asynchronous event loop is already running in this
|
||||
thread
|
||||
:raises LookupError: if the named backend is not found
|
||||
|
||||
"""
|
||||
if asynclib_name := current_async_library():
|
||||
raise RuntimeError(f"Already running {asynclib_name} in this thread")
|
||||
|
||||
try:
|
||||
async_backend = get_async_backend(backend)
|
||||
except ImportError as exc:
|
||||
raise LookupError(f"No such backend: {backend}") from exc
|
||||
|
||||
token = None
|
||||
if asynclib_name is None:
|
||||
# Since we're in control of the event loop, we can cache the name of the async
|
||||
# library
|
||||
token = set_current_async_library(backend)
|
||||
|
||||
try:
|
||||
backend_options = backend_options or {}
|
||||
return async_backend.run(func, args, {}, backend_options)
|
||||
finally:
|
||||
reset_current_async_library(token)
|
||||
|
||||
|
||||
async def sleep(delay: float) -> None:
|
||||
"""
|
||||
Pause the current task for the specified duration.
|
||||
|
||||
:param delay: the duration, in seconds
|
||||
|
||||
"""
|
||||
return await get_async_backend().sleep(delay)
|
||||
|
||||
|
||||
async def sleep_forever() -> None:
|
||||
"""
|
||||
Pause the current task until it's cancelled.
|
||||
|
||||
This is a shortcut for ``sleep(math.inf)``.
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
"""
|
||||
await sleep(math.inf)
|
||||
|
||||
|
||||
async def sleep_until(deadline: float) -> None:
|
||||
"""
|
||||
Pause the current task until the given time.
|
||||
|
||||
:param deadline: the absolute time to wake up at (according to the internal
|
||||
monotonic clock of the event loop)
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
"""
|
||||
now = current_time()
|
||||
await sleep(max(deadline - now, 0))
|
||||
|
||||
|
||||
def current_time() -> float:
|
||||
"""
|
||||
Return the current value of the event loop's internal clock.
|
||||
|
||||
:return: the clock value (seconds)
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return get_async_backend().current_time()
|
||||
|
||||
|
||||
def get_all_backends() -> tuple[str, ...]:
|
||||
"""Return a tuple of the names of all built-in backends."""
|
||||
return BACKENDS
|
||||
|
||||
|
||||
def get_available_backends() -> tuple[str, ...]:
|
||||
"""
|
||||
Test for the availability of built-in backends.
|
||||
|
||||
:return a tuple of the built-in backend names that were successfully imported
|
||||
|
||||
.. versionadded:: 4.12
|
||||
|
||||
"""
|
||||
available_backends: list[str] = []
|
||||
for backend_name in get_all_backends():
|
||||
try:
|
||||
get_async_backend(backend_name)
|
||||
except ImportError:
|
||||
continue
|
||||
|
||||
available_backends.append(backend_name)
|
||||
|
||||
return tuple(available_backends)
|
||||
|
||||
|
||||
def get_cancelled_exc_class() -> type[BaseException]:
|
||||
"""
|
||||
Return the current async library's cancellation exception class.
|
||||
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return get_async_backend().cancelled_exception_class()
|
||||
|
||||
|
||||
#
|
||||
# Private API
|
||||
#
|
||||
|
||||
|
||||
@contextmanager
|
||||
def claim_worker_thread(
|
||||
backend_class: type[AsyncBackend], token: object
|
||||
) -> Generator[Any, None, None]:
|
||||
from ..lowlevel import EventLoopToken
|
||||
|
||||
threadlocals.current_token = EventLoopToken(backend_class, token)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
del threadlocals.current_token
|
||||
|
||||
|
||||
def get_async_backend(asynclib_name: str | None = None) -> type[AsyncBackend]:
|
||||
if asynclib_name is None:
|
||||
asynclib_name = current_async_library()
|
||||
if not asynclib_name:
|
||||
raise NoEventLoopError(
|
||||
f"Not currently running on any asynchronous event loop. "
|
||||
f"Available async backends: {', '.join(get_all_backends())}"
|
||||
)
|
||||
|
||||
# We use our own dict instead of sys.modules to get the already imported back-end
|
||||
# class because the appropriate modules in sys.modules could potentially be only
|
||||
# partially initialized
|
||||
try:
|
||||
return loaded_backends[asynclib_name]
|
||||
except KeyError:
|
||||
module = import_module(f"anyio._backends._{asynclib_name}")
|
||||
loaded_backends[asynclib_name] = module.backend_class
|
||||
return module.backend_class
|
||||
|
||||
|
||||
def current_async_library() -> str | None:
|
||||
if sniffio is None:
|
||||
# If sniffio is not installed, we assume we're either running asyncio or nothing
|
||||
import asyncio
|
||||
|
||||
try:
|
||||
asyncio.get_running_loop()
|
||||
return "asyncio"
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
return sniffio.current_async_library()
|
||||
except sniffio.AsyncLibraryNotFoundError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def set_current_async_library(asynclib_name: str | None) -> Token | None:
|
||||
# no-op if sniffio is not installed
|
||||
if sniffio is None:
|
||||
return None
|
||||
|
||||
return sniffio.current_async_library_cvar.set(asynclib_name)
|
||||
|
||||
|
||||
def reset_current_async_library(token: Token | None) -> None:
|
||||
if token is not None:
|
||||
sniffio.current_async_library_cvar.reset(token)
|
||||
156
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_exceptions.py
vendored
Executable file
156
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_exceptions.py
vendored
Executable file
@@ -0,0 +1,156 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from collections.abc import Generator
|
||||
from textwrap import dedent
|
||||
from typing import Any
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
from exceptiongroup import BaseExceptionGroup
|
||||
|
||||
|
||||
class BrokenResourceError(Exception):
|
||||
"""
|
||||
Raised when trying to use a resource that has been rendered unusable due to external
|
||||
causes (e.g. a send stream whose peer has disconnected).
|
||||
"""
|
||||
|
||||
|
||||
class BrokenWorkerProcess(Exception):
|
||||
"""
|
||||
Raised by :meth:`~anyio.to_process.run_sync` if the worker process terminates abruptly or
|
||||
otherwise misbehaves.
|
||||
"""
|
||||
|
||||
|
||||
class BrokenWorkerInterpreter(Exception):
|
||||
"""
|
||||
Raised by :meth:`~anyio.to_interpreter.run_sync` if an unexpected exception is
|
||||
raised in the subinterpreter.
|
||||
"""
|
||||
|
||||
def __init__(self, excinfo: Any):
|
||||
# This was adapted from concurrent.futures.interpreter.ExecutionFailed
|
||||
msg = excinfo.formatted
|
||||
if not msg:
|
||||
if excinfo.type and excinfo.msg:
|
||||
msg = f"{excinfo.type.__name__}: {excinfo.msg}"
|
||||
else:
|
||||
msg = excinfo.type.__name__ or excinfo.msg
|
||||
|
||||
super().__init__(msg)
|
||||
self.excinfo = excinfo
|
||||
|
||||
def __str__(self) -> str:
|
||||
try:
|
||||
formatted = self.excinfo.errdisplay
|
||||
except Exception:
|
||||
return super().__str__()
|
||||
else:
|
||||
return dedent(
|
||||
f"""
|
||||
{super().__str__()}
|
||||
|
||||
Uncaught in the interpreter:
|
||||
|
||||
{formatted}
|
||||
""".strip()
|
||||
)
|
||||
|
||||
|
||||
class BusyResourceError(Exception):
|
||||
"""
|
||||
Raised when two tasks are trying to read from or write to the same resource
|
||||
concurrently.
|
||||
"""
|
||||
|
||||
def __init__(self, action: str):
|
||||
super().__init__(f"Another task is already {action} this resource")
|
||||
|
||||
|
||||
class ClosedResourceError(Exception):
|
||||
"""Raised when trying to use a resource that has been closed."""
|
||||
|
||||
|
||||
class ConnectionFailed(OSError):
|
||||
"""
|
||||
Raised when a connection attempt fails.
|
||||
|
||||
.. note:: This class inherits from :exc:`OSError` for backwards compatibility.
|
||||
"""
|
||||
|
||||
|
||||
def iterate_exceptions(
|
||||
exception: BaseException,
|
||||
) -> Generator[BaseException, None, None]:
|
||||
if isinstance(exception, BaseExceptionGroup):
|
||||
for exc in exception.exceptions:
|
||||
yield from iterate_exceptions(exc)
|
||||
else:
|
||||
yield exception
|
||||
|
||||
|
||||
class DelimiterNotFound(Exception):
|
||||
"""
|
||||
Raised during
|
||||
:meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
|
||||
maximum number of bytes has been read without the delimiter being found.
|
||||
"""
|
||||
|
||||
def __init__(self, max_bytes: int) -> None:
|
||||
super().__init__(
|
||||
f"The delimiter was not found among the first {max_bytes} bytes"
|
||||
)
|
||||
|
||||
|
||||
class EndOfStream(Exception):
|
||||
"""
|
||||
Raised when trying to read from a stream that has been closed from the other end.
|
||||
"""
|
||||
|
||||
|
||||
class IncompleteRead(Exception):
|
||||
"""
|
||||
Raised during
|
||||
:meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_exactly` or
|
||||
:meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
|
||||
connection is closed before the requested amount of bytes has been read.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
"The stream was closed before the read operation could be completed"
|
||||
)
|
||||
|
||||
|
||||
class TypedAttributeLookupError(LookupError):
|
||||
"""
|
||||
Raised by :meth:`~anyio.TypedAttributeProvider.extra` when the given typed attribute
|
||||
is not found and no default value has been given.
|
||||
"""
|
||||
|
||||
|
||||
class WouldBlock(Exception):
|
||||
"""Raised by ``X_nowait`` functions if ``X()`` would block."""
|
||||
|
||||
|
||||
class NoEventLoopError(RuntimeError):
|
||||
"""
|
||||
Raised by several functions that require an event loop to be running in the current
|
||||
thread when there is no running event loop.
|
||||
|
||||
This is also raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync`
|
||||
if not calling from an AnyIO worker thread, and no ``token`` was passed.
|
||||
"""
|
||||
|
||||
|
||||
class RunFinishedError(RuntimeError):
|
||||
"""
|
||||
Raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync` if the event
|
||||
loop associated with the explicitly passed token has already finished.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
"The event loop associated with the given token has already finished"
|
||||
)
|
||||
797
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_fileio.py
vendored
Executable file
797
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_fileio.py
vendored
Executable file
@@ -0,0 +1,797 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from collections.abc import (
|
||||
AsyncIterator,
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Sequence,
|
||||
)
|
||||
from dataclasses import dataclass
|
||||
from functools import partial
|
||||
from os import PathLike
|
||||
from typing import (
|
||||
IO,
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
AnyStr,
|
||||
ClassVar,
|
||||
Final,
|
||||
Generic,
|
||||
overload,
|
||||
)
|
||||
|
||||
from .. import to_thread
|
||||
from ..abc import AsyncResource
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from types import ModuleType
|
||||
|
||||
from _typeshed import OpenBinaryMode, OpenTextMode, ReadableBuffer, WriteableBuffer
|
||||
else:
|
||||
ReadableBuffer = OpenBinaryMode = OpenTextMode = WriteableBuffer = object
|
||||
|
||||
|
||||
class AsyncFile(AsyncResource, Generic[AnyStr]):
|
||||
"""
|
||||
An asynchronous file object.
|
||||
|
||||
This class wraps a standard file object and provides async friendly versions of the
|
||||
following blocking methods (where available on the original file object):
|
||||
|
||||
* read
|
||||
* read1
|
||||
* readline
|
||||
* readlines
|
||||
* readinto
|
||||
* readinto1
|
||||
* write
|
||||
* writelines
|
||||
* truncate
|
||||
* seek
|
||||
* tell
|
||||
* flush
|
||||
|
||||
All other methods are directly passed through.
|
||||
|
||||
This class supports the asynchronous context manager protocol which closes the
|
||||
underlying file at the end of the context block.
|
||||
|
||||
This class also supports asynchronous iteration::
|
||||
|
||||
async with await open_file(...) as f:
|
||||
async for line in f:
|
||||
print(line)
|
||||
"""
|
||||
|
||||
def __init__(self, fp: IO[AnyStr]) -> None:
|
||||
self._fp: Any = fp
|
||||
|
||||
def __getattr__(self, name: str) -> object:
|
||||
return getattr(self._fp, name)
|
||||
|
||||
@property
|
||||
def wrapped(self) -> IO[AnyStr]:
|
||||
"""The wrapped file object."""
|
||||
return self._fp
|
||||
|
||||
async def __aiter__(self) -> AsyncIterator[AnyStr]:
|
||||
while True:
|
||||
line = await self.readline()
|
||||
if line:
|
||||
yield line
|
||||
else:
|
||||
break
|
||||
|
||||
async def aclose(self) -> None:
|
||||
return await to_thread.run_sync(self._fp.close)
|
||||
|
||||
async def read(self, size: int = -1) -> AnyStr:
|
||||
return await to_thread.run_sync(self._fp.read, size)
|
||||
|
||||
async def read1(self: AsyncFile[bytes], size: int = -1) -> bytes:
|
||||
return await to_thread.run_sync(self._fp.read1, size)
|
||||
|
||||
async def readline(self) -> AnyStr:
|
||||
return await to_thread.run_sync(self._fp.readline)
|
||||
|
||||
async def readlines(self) -> list[AnyStr]:
|
||||
return await to_thread.run_sync(self._fp.readlines)
|
||||
|
||||
async def readinto(self: AsyncFile[bytes], b: WriteableBuffer) -> int:
|
||||
return await to_thread.run_sync(self._fp.readinto, b)
|
||||
|
||||
async def readinto1(self: AsyncFile[bytes], b: WriteableBuffer) -> int:
|
||||
return await to_thread.run_sync(self._fp.readinto1, b)
|
||||
|
||||
@overload
|
||||
async def write(self: AsyncFile[bytes], b: ReadableBuffer) -> int: ...
|
||||
|
||||
@overload
|
||||
async def write(self: AsyncFile[str], b: str) -> int: ...
|
||||
|
||||
async def write(self, b: ReadableBuffer | str) -> int:
|
||||
return await to_thread.run_sync(self._fp.write, b)
|
||||
|
||||
@overload
|
||||
async def writelines(
|
||||
self: AsyncFile[bytes], lines: Iterable[ReadableBuffer]
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
async def writelines(self: AsyncFile[str], lines: Iterable[str]) -> None: ...
|
||||
|
||||
async def writelines(self, lines: Iterable[ReadableBuffer] | Iterable[str]) -> None:
|
||||
return await to_thread.run_sync(self._fp.writelines, lines)
|
||||
|
||||
async def truncate(self, size: int | None = None) -> int:
|
||||
return await to_thread.run_sync(self._fp.truncate, size)
|
||||
|
||||
async def seek(self, offset: int, whence: int | None = os.SEEK_SET) -> int:
|
||||
return await to_thread.run_sync(self._fp.seek, offset, whence)
|
||||
|
||||
async def tell(self) -> int:
|
||||
return await to_thread.run_sync(self._fp.tell)
|
||||
|
||||
async def flush(self) -> None:
|
||||
return await to_thread.run_sync(self._fp.flush)
|
||||
|
||||
|
||||
@overload
|
||||
async def open_file(
|
||||
file: str | PathLike[str] | int,
|
||||
mode: OpenBinaryMode,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
errors: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
closefd: bool = ...,
|
||||
opener: Callable[[str, int], int] | None = ...,
|
||||
) -> AsyncFile[bytes]: ...
|
||||
|
||||
|
||||
@overload
|
||||
async def open_file(
|
||||
file: str | PathLike[str] | int,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
errors: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
closefd: bool = ...,
|
||||
opener: Callable[[str, int], int] | None = ...,
|
||||
) -> AsyncFile[str]: ...
|
||||
|
||||
|
||||
async def open_file(
|
||||
file: str | PathLike[str] | int,
|
||||
mode: str = "r",
|
||||
buffering: int = -1,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
closefd: bool = True,
|
||||
opener: Callable[[str, int], int] | None = None,
|
||||
) -> AsyncFile[Any]:
|
||||
"""
|
||||
Open a file asynchronously.
|
||||
|
||||
The arguments are exactly the same as for the builtin :func:`open`.
|
||||
|
||||
:return: an asynchronous file object
|
||||
|
||||
"""
|
||||
fp = await to_thread.run_sync(
|
||||
open, file, mode, buffering, encoding, errors, newline, closefd, opener
|
||||
)
|
||||
return AsyncFile(fp)
|
||||
|
||||
|
||||
def wrap_file(file: IO[AnyStr]) -> AsyncFile[AnyStr]:
|
||||
"""
|
||||
Wrap an existing file as an asynchronous file.
|
||||
|
||||
:param file: an existing file-like object
|
||||
:return: an asynchronous file object
|
||||
|
||||
"""
|
||||
return AsyncFile(file)
|
||||
|
||||
|
||||
@dataclass(eq=False)
|
||||
class _PathIterator(AsyncIterator["Path"]):
|
||||
iterator: Iterator[PathLike[str]]
|
||||
|
||||
async def __anext__(self) -> Path:
|
||||
nextval = await to_thread.run_sync(
|
||||
next, self.iterator, None, abandon_on_cancel=True
|
||||
)
|
||||
if nextval is None:
|
||||
raise StopAsyncIteration from None
|
||||
|
||||
return Path(nextval)
|
||||
|
||||
|
||||
class Path:
|
||||
"""
|
||||
An asynchronous version of :class:`pathlib.Path`.
|
||||
|
||||
This class cannot be substituted for :class:`pathlib.Path` or
|
||||
:class:`pathlib.PurePath`, but it is compatible with the :class:`os.PathLike`
|
||||
interface.
|
||||
|
||||
It implements the Python 3.10 version of :class:`pathlib.Path` interface, except for
|
||||
the deprecated :meth:`~pathlib.Path.link_to` method.
|
||||
|
||||
Some methods may be unavailable or have limited functionality, based on the Python
|
||||
version:
|
||||
|
||||
* :meth:`~pathlib.Path.copy` (available on Python 3.14 or later)
|
||||
* :meth:`~pathlib.Path.copy_into` (available on Python 3.14 or later)
|
||||
* :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later)
|
||||
* :meth:`~pathlib.PurePath.full_match` (available on Python 3.13 or later)
|
||||
* :attr:`~pathlib.Path.info` (available on Python 3.14 or later)
|
||||
* :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later)
|
||||
* :meth:`~pathlib.PurePath.match` (the ``case_sensitive`` parameter is only
|
||||
available on Python 3.13 or later)
|
||||
* :meth:`~pathlib.Path.move` (available on Python 3.14 or later)
|
||||
* :meth:`~pathlib.Path.move_into` (available on Python 3.14 or later)
|
||||
* :meth:`~pathlib.PurePath.relative_to` (the ``walk_up`` parameter is only available
|
||||
on Python 3.12 or later)
|
||||
* :meth:`~pathlib.Path.walk` (available on Python 3.12 or later)
|
||||
|
||||
Any methods that do disk I/O need to be awaited on. These methods are:
|
||||
|
||||
* :meth:`~pathlib.Path.absolute`
|
||||
* :meth:`~pathlib.Path.chmod`
|
||||
* :meth:`~pathlib.Path.cwd`
|
||||
* :meth:`~pathlib.Path.exists`
|
||||
* :meth:`~pathlib.Path.expanduser`
|
||||
* :meth:`~pathlib.Path.group`
|
||||
* :meth:`~pathlib.Path.hardlink_to`
|
||||
* :meth:`~pathlib.Path.home`
|
||||
* :meth:`~pathlib.Path.is_block_device`
|
||||
* :meth:`~pathlib.Path.is_char_device`
|
||||
* :meth:`~pathlib.Path.is_dir`
|
||||
* :meth:`~pathlib.Path.is_fifo`
|
||||
* :meth:`~pathlib.Path.is_file`
|
||||
* :meth:`~pathlib.Path.is_junction`
|
||||
* :meth:`~pathlib.Path.is_mount`
|
||||
* :meth:`~pathlib.Path.is_socket`
|
||||
* :meth:`~pathlib.Path.is_symlink`
|
||||
* :meth:`~pathlib.Path.lchmod`
|
||||
* :meth:`~pathlib.Path.lstat`
|
||||
* :meth:`~pathlib.Path.mkdir`
|
||||
* :meth:`~pathlib.Path.open`
|
||||
* :meth:`~pathlib.Path.owner`
|
||||
* :meth:`~pathlib.Path.read_bytes`
|
||||
* :meth:`~pathlib.Path.read_text`
|
||||
* :meth:`~pathlib.Path.readlink`
|
||||
* :meth:`~pathlib.Path.rename`
|
||||
* :meth:`~pathlib.Path.replace`
|
||||
* :meth:`~pathlib.Path.resolve`
|
||||
* :meth:`~pathlib.Path.rmdir`
|
||||
* :meth:`~pathlib.Path.samefile`
|
||||
* :meth:`~pathlib.Path.stat`
|
||||
* :meth:`~pathlib.Path.symlink_to`
|
||||
* :meth:`~pathlib.Path.touch`
|
||||
* :meth:`~pathlib.Path.unlink`
|
||||
* :meth:`~pathlib.Path.walk`
|
||||
* :meth:`~pathlib.Path.write_bytes`
|
||||
* :meth:`~pathlib.Path.write_text`
|
||||
|
||||
Additionally, the following methods return an async iterator yielding
|
||||
:class:`~.Path` objects:
|
||||
|
||||
* :meth:`~pathlib.Path.glob`
|
||||
* :meth:`~pathlib.Path.iterdir`
|
||||
* :meth:`~pathlib.Path.rglob`
|
||||
"""
|
||||
|
||||
__slots__ = "_path", "__weakref__"
|
||||
|
||||
__weakref__: Any
|
||||
|
||||
def __init__(self, *args: str | PathLike[str]) -> None:
|
||||
self._path: Final[pathlib.Path] = pathlib.Path(*args)
|
||||
|
||||
def __fspath__(self) -> str:
|
||||
return self._path.__fspath__()
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self._path.__str__()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"{self.__class__.__name__}({self.as_posix()!r})"
|
||||
|
||||
def __bytes__(self) -> bytes:
|
||||
return self._path.__bytes__()
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return self._path.__hash__()
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
target = other._path if isinstance(other, Path) else other
|
||||
return self._path.__eq__(target)
|
||||
|
||||
def __lt__(self, other: pathlib.PurePath | Path) -> bool:
|
||||
target = other._path if isinstance(other, Path) else other
|
||||
return self._path.__lt__(target)
|
||||
|
||||
def __le__(self, other: pathlib.PurePath | Path) -> bool:
|
||||
target = other._path if isinstance(other, Path) else other
|
||||
return self._path.__le__(target)
|
||||
|
||||
def __gt__(self, other: pathlib.PurePath | Path) -> bool:
|
||||
target = other._path if isinstance(other, Path) else other
|
||||
return self._path.__gt__(target)
|
||||
|
||||
def __ge__(self, other: pathlib.PurePath | Path) -> bool:
|
||||
target = other._path if isinstance(other, Path) else other
|
||||
return self._path.__ge__(target)
|
||||
|
||||
def __truediv__(self, other: str | PathLike[str]) -> Path:
|
||||
return Path(self._path / other)
|
||||
|
||||
def __rtruediv__(self, other: str | PathLike[str]) -> Path:
|
||||
return Path(other) / self
|
||||
|
||||
@property
|
||||
def parts(self) -> tuple[str, ...]:
|
||||
return self._path.parts
|
||||
|
||||
@property
|
||||
def drive(self) -> str:
|
||||
return self._path.drive
|
||||
|
||||
@property
|
||||
def root(self) -> str:
|
||||
return self._path.root
|
||||
|
||||
@property
|
||||
def anchor(self) -> str:
|
||||
return self._path.anchor
|
||||
|
||||
@property
|
||||
def parents(self) -> Sequence[Path]:
|
||||
return tuple(Path(p) for p in self._path.parents)
|
||||
|
||||
@property
|
||||
def parent(self) -> Path:
|
||||
return Path(self._path.parent)
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._path.name
|
||||
|
||||
@property
|
||||
def suffix(self) -> str:
|
||||
return self._path.suffix
|
||||
|
||||
@property
|
||||
def suffixes(self) -> list[str]:
|
||||
return self._path.suffixes
|
||||
|
||||
@property
|
||||
def stem(self) -> str:
|
||||
return self._path.stem
|
||||
|
||||
async def absolute(self) -> Path:
|
||||
path = await to_thread.run_sync(self._path.absolute)
|
||||
return Path(path)
|
||||
|
||||
def as_posix(self) -> str:
|
||||
return self._path.as_posix()
|
||||
|
||||
def as_uri(self) -> str:
|
||||
return self._path.as_uri()
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
parser: ClassVar[ModuleType] = pathlib.Path.parser
|
||||
|
||||
@classmethod
|
||||
def from_uri(cls, uri: str) -> Path:
|
||||
return Path(pathlib.Path.from_uri(uri))
|
||||
|
||||
def full_match(
|
||||
self, path_pattern: str, *, case_sensitive: bool | None = None
|
||||
) -> bool:
|
||||
return self._path.full_match(path_pattern, case_sensitive=case_sensitive)
|
||||
|
||||
def match(
|
||||
self, path_pattern: str, *, case_sensitive: bool | None = None
|
||||
) -> bool:
|
||||
return self._path.match(path_pattern, case_sensitive=case_sensitive)
|
||||
else:
|
||||
|
||||
def match(self, path_pattern: str) -> bool:
|
||||
return self._path.match(path_pattern)
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
|
||||
@property
|
||||
def info(self) -> Any: # TODO: add return type annotation when Typeshed gets it
|
||||
return self._path.info
|
||||
|
||||
async def copy(
|
||||
self,
|
||||
target: str | os.PathLike[str],
|
||||
*,
|
||||
follow_symlinks: bool = True,
|
||||
preserve_metadata: bool = False,
|
||||
) -> Path:
|
||||
func = partial(
|
||||
self._path.copy,
|
||||
follow_symlinks=follow_symlinks,
|
||||
preserve_metadata=preserve_metadata,
|
||||
)
|
||||
return Path(await to_thread.run_sync(func, pathlib.Path(target)))
|
||||
|
||||
async def copy_into(
|
||||
self,
|
||||
target_dir: str | os.PathLike[str],
|
||||
*,
|
||||
follow_symlinks: bool = True,
|
||||
preserve_metadata: bool = False,
|
||||
) -> Path:
|
||||
func = partial(
|
||||
self._path.copy_into,
|
||||
follow_symlinks=follow_symlinks,
|
||||
preserve_metadata=preserve_metadata,
|
||||
)
|
||||
return Path(await to_thread.run_sync(func, pathlib.Path(target_dir)))
|
||||
|
||||
async def move(self, target: str | os.PathLike[str]) -> Path:
|
||||
# Upstream does not handle anyio.Path properly as a PathLike
|
||||
target = pathlib.Path(target)
|
||||
return Path(await to_thread.run_sync(self._path.move, target))
|
||||
|
||||
async def move_into(
|
||||
self,
|
||||
target_dir: str | os.PathLike[str],
|
||||
) -> Path:
|
||||
return Path(await to_thread.run_sync(self._path.move_into, target_dir))
|
||||
|
||||
def is_relative_to(self, other: str | PathLike[str]) -> bool:
|
||||
try:
|
||||
self.relative_to(other)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
async def chmod(self, mode: int, *, follow_symlinks: bool = True) -> None:
|
||||
func = partial(os.chmod, follow_symlinks=follow_symlinks)
|
||||
return await to_thread.run_sync(func, self._path, mode)
|
||||
|
||||
@classmethod
|
||||
async def cwd(cls) -> Path:
|
||||
path = await to_thread.run_sync(pathlib.Path.cwd)
|
||||
return cls(path)
|
||||
|
||||
async def exists(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.exists, abandon_on_cancel=True)
|
||||
|
||||
async def expanduser(self) -> Path:
|
||||
return Path(
|
||||
await to_thread.run_sync(self._path.expanduser, abandon_on_cancel=True)
|
||||
)
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
# Python 3.11 and earlier
|
||||
def glob(self, pattern: str) -> AsyncIterator[Path]:
|
||||
gen = self._path.glob(pattern)
|
||||
return _PathIterator(gen)
|
||||
elif (3, 12) <= sys.version_info < (3, 13):
|
||||
# changed in Python 3.12:
|
||||
# - The case_sensitive parameter was added.
|
||||
def glob(
|
||||
self,
|
||||
pattern: str,
|
||||
*,
|
||||
case_sensitive: bool | None = None,
|
||||
) -> AsyncIterator[Path]:
|
||||
gen = self._path.glob(pattern, case_sensitive=case_sensitive)
|
||||
return _PathIterator(gen)
|
||||
elif sys.version_info >= (3, 13):
|
||||
# Changed in Python 3.13:
|
||||
# - The recurse_symlinks parameter was added.
|
||||
# - The pattern parameter accepts a path-like object.
|
||||
def glob( # type: ignore[misc] # mypy doesn't allow for differing signatures in a conditional block
|
||||
self,
|
||||
pattern: str | PathLike[str],
|
||||
*,
|
||||
case_sensitive: bool | None = None,
|
||||
recurse_symlinks: bool = False,
|
||||
) -> AsyncIterator[Path]:
|
||||
gen = self._path.glob(
|
||||
pattern, # type: ignore[arg-type]
|
||||
case_sensitive=case_sensitive,
|
||||
recurse_symlinks=recurse_symlinks,
|
||||
)
|
||||
return _PathIterator(gen)
|
||||
|
||||
async def group(self) -> str:
|
||||
return await to_thread.run_sync(self._path.group, abandon_on_cancel=True)
|
||||
|
||||
async def hardlink_to(
|
||||
self, target: str | bytes | PathLike[str] | PathLike[bytes]
|
||||
) -> None:
|
||||
if isinstance(target, Path):
|
||||
target = target._path
|
||||
|
||||
await to_thread.run_sync(os.link, target, self)
|
||||
|
||||
@classmethod
|
||||
async def home(cls) -> Path:
|
||||
home_path = await to_thread.run_sync(pathlib.Path.home)
|
||||
return cls(home_path)
|
||||
|
||||
def is_absolute(self) -> bool:
|
||||
return self._path.is_absolute()
|
||||
|
||||
async def is_block_device(self) -> bool:
|
||||
return await to_thread.run_sync(
|
||||
self._path.is_block_device, abandon_on_cancel=True
|
||||
)
|
||||
|
||||
async def is_char_device(self) -> bool:
|
||||
return await to_thread.run_sync(
|
||||
self._path.is_char_device, abandon_on_cancel=True
|
||||
)
|
||||
|
||||
async def is_dir(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_dir, abandon_on_cancel=True)
|
||||
|
||||
async def is_fifo(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_fifo, abandon_on_cancel=True)
|
||||
|
||||
async def is_file(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_file, abandon_on_cancel=True)
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
async def is_junction(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_junction)
|
||||
|
||||
async def is_mount(self) -> bool:
|
||||
return await to_thread.run_sync(
|
||||
os.path.ismount, self._path, abandon_on_cancel=True
|
||||
)
|
||||
|
||||
def is_reserved(self) -> bool:
|
||||
return self._path.is_reserved()
|
||||
|
||||
async def is_socket(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_socket, abandon_on_cancel=True)
|
||||
|
||||
async def is_symlink(self) -> bool:
|
||||
return await to_thread.run_sync(self._path.is_symlink, abandon_on_cancel=True)
|
||||
|
||||
async def iterdir(self) -> AsyncIterator[Path]:
|
||||
gen = (
|
||||
self._path.iterdir()
|
||||
if sys.version_info < (3, 13)
|
||||
else await to_thread.run_sync(self._path.iterdir, abandon_on_cancel=True)
|
||||
)
|
||||
async for path in _PathIterator(gen):
|
||||
yield path
|
||||
|
||||
def joinpath(self, *args: str | PathLike[str]) -> Path:
|
||||
return Path(self._path.joinpath(*args))
|
||||
|
||||
async def lchmod(self, mode: int) -> None:
|
||||
await to_thread.run_sync(self._path.lchmod, mode)
|
||||
|
||||
async def lstat(self) -> os.stat_result:
|
||||
return await to_thread.run_sync(self._path.lstat, abandon_on_cancel=True)
|
||||
|
||||
async def mkdir(
|
||||
self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False
|
||||
) -> None:
|
||||
await to_thread.run_sync(self._path.mkdir, mode, parents, exist_ok)
|
||||
|
||||
@overload
|
||||
async def open(
|
||||
self,
|
||||
mode: OpenBinaryMode,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
errors: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
) -> AsyncFile[bytes]: ...
|
||||
|
||||
@overload
|
||||
async def open(
|
||||
self,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
errors: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
) -> AsyncFile[str]: ...
|
||||
|
||||
async def open(
|
||||
self,
|
||||
mode: str = "r",
|
||||
buffering: int = -1,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
) -> AsyncFile[Any]:
|
||||
fp = await to_thread.run_sync(
|
||||
self._path.open, mode, buffering, encoding, errors, newline
|
||||
)
|
||||
return AsyncFile(fp)
|
||||
|
||||
async def owner(self) -> str:
|
||||
return await to_thread.run_sync(self._path.owner, abandon_on_cancel=True)
|
||||
|
||||
async def read_bytes(self) -> bytes:
|
||||
return await to_thread.run_sync(self._path.read_bytes)
|
||||
|
||||
async def read_text(
|
||||
self, encoding: str | None = None, errors: str | None = None
|
||||
) -> str:
|
||||
return await to_thread.run_sync(self._path.read_text, encoding, errors)
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
def relative_to(
|
||||
self, *other: str | PathLike[str], walk_up: bool = False
|
||||
) -> Path:
|
||||
# relative_to() should work with any PathLike but it doesn't
|
||||
others = [pathlib.Path(other) for other in other]
|
||||
return Path(self._path.relative_to(*others, walk_up=walk_up))
|
||||
|
||||
else:
|
||||
|
||||
def relative_to(self, *other: str | PathLike[str]) -> Path:
|
||||
return Path(self._path.relative_to(*other))
|
||||
|
||||
async def readlink(self) -> Path:
|
||||
target = await to_thread.run_sync(os.readlink, self._path)
|
||||
return Path(target)
|
||||
|
||||
async def rename(self, target: str | pathlib.PurePath | Path) -> Path:
|
||||
if isinstance(target, Path):
|
||||
target = target._path
|
||||
|
||||
await to_thread.run_sync(self._path.rename, target)
|
||||
return Path(target)
|
||||
|
||||
async def replace(self, target: str | pathlib.PurePath | Path) -> Path:
|
||||
if isinstance(target, Path):
|
||||
target = target._path
|
||||
|
||||
await to_thread.run_sync(self._path.replace, target)
|
||||
return Path(target)
|
||||
|
||||
async def resolve(self, strict: bool = False) -> Path:
|
||||
func = partial(self._path.resolve, strict=strict)
|
||||
return Path(await to_thread.run_sync(func, abandon_on_cancel=True))
|
||||
|
||||
if sys.version_info < (3, 12):
|
||||
# Pre Python 3.12
|
||||
def rglob(self, pattern: str) -> AsyncIterator[Path]:
|
||||
gen = self._path.rglob(pattern)
|
||||
return _PathIterator(gen)
|
||||
elif (3, 12) <= sys.version_info < (3, 13):
|
||||
# Changed in Python 3.12:
|
||||
# - The case_sensitive parameter was added.
|
||||
def rglob(
|
||||
self, pattern: str, *, case_sensitive: bool | None = None
|
||||
) -> AsyncIterator[Path]:
|
||||
gen = self._path.rglob(pattern, case_sensitive=case_sensitive)
|
||||
return _PathIterator(gen)
|
||||
elif sys.version_info >= (3, 13):
|
||||
# Changed in Python 3.13:
|
||||
# - The recurse_symlinks parameter was added.
|
||||
# - The pattern parameter accepts a path-like object.
|
||||
def rglob( # type: ignore[misc] # mypy doesn't allow for differing signatures in a conditional block
|
||||
self,
|
||||
pattern: str | PathLike[str],
|
||||
*,
|
||||
case_sensitive: bool | None = None,
|
||||
recurse_symlinks: bool = False,
|
||||
) -> AsyncIterator[Path]:
|
||||
gen = self._path.rglob(
|
||||
pattern, # type: ignore[arg-type]
|
||||
case_sensitive=case_sensitive,
|
||||
recurse_symlinks=recurse_symlinks,
|
||||
)
|
||||
return _PathIterator(gen)
|
||||
|
||||
async def rmdir(self) -> None:
|
||||
await to_thread.run_sync(self._path.rmdir)
|
||||
|
||||
async def samefile(self, other_path: str | PathLike[str]) -> bool:
|
||||
if isinstance(other_path, Path):
|
||||
other_path = other_path._path
|
||||
|
||||
return await to_thread.run_sync(
|
||||
self._path.samefile, other_path, abandon_on_cancel=True
|
||||
)
|
||||
|
||||
async def stat(self, *, follow_symlinks: bool = True) -> os.stat_result:
|
||||
func = partial(os.stat, follow_symlinks=follow_symlinks)
|
||||
return await to_thread.run_sync(func, self._path, abandon_on_cancel=True)
|
||||
|
||||
async def symlink_to(
|
||||
self,
|
||||
target: str | bytes | PathLike[str] | PathLike[bytes],
|
||||
target_is_directory: bool = False,
|
||||
) -> None:
|
||||
if isinstance(target, Path):
|
||||
target = target._path
|
||||
|
||||
await to_thread.run_sync(self._path.symlink_to, target, target_is_directory)
|
||||
|
||||
async def touch(self, mode: int = 0o666, exist_ok: bool = True) -> None:
|
||||
await to_thread.run_sync(self._path.touch, mode, exist_ok)
|
||||
|
||||
async def unlink(self, missing_ok: bool = False) -> None:
|
||||
try:
|
||||
await to_thread.run_sync(self._path.unlink)
|
||||
except FileNotFoundError:
|
||||
if not missing_ok:
|
||||
raise
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
async def walk(
|
||||
self,
|
||||
top_down: bool = True,
|
||||
on_error: Callable[[OSError], object] | None = None,
|
||||
follow_symlinks: bool = False,
|
||||
) -> AsyncIterator[tuple[Path, list[str], list[str]]]:
|
||||
def get_next_value() -> tuple[pathlib.Path, list[str], list[str]] | None:
|
||||
try:
|
||||
return next(gen)
|
||||
except StopIteration:
|
||||
return None
|
||||
|
||||
gen = self._path.walk(top_down, on_error, follow_symlinks)
|
||||
while True:
|
||||
value = await to_thread.run_sync(get_next_value)
|
||||
if value is None:
|
||||
return
|
||||
|
||||
root, dirs, paths = value
|
||||
yield Path(root), dirs, paths
|
||||
|
||||
def with_name(self, name: str) -> Path:
|
||||
return Path(self._path.with_name(name))
|
||||
|
||||
def with_stem(self, stem: str) -> Path:
|
||||
return Path(self._path.with_name(stem + self._path.suffix))
|
||||
|
||||
def with_suffix(self, suffix: str) -> Path:
|
||||
return Path(self._path.with_suffix(suffix))
|
||||
|
||||
def with_segments(self, *pathsegments: str | PathLike[str]) -> Path:
|
||||
return Path(*pathsegments)
|
||||
|
||||
async def write_bytes(self, data: bytes) -> int:
|
||||
return await to_thread.run_sync(self._path.write_bytes, data)
|
||||
|
||||
async def write_text(
|
||||
self,
|
||||
data: str,
|
||||
encoding: str | None = None,
|
||||
errors: str | None = None,
|
||||
newline: str | None = None,
|
||||
) -> int:
|
||||
# Path.write_text() does not support the "newline" parameter before Python 3.10
|
||||
def sync_write_text() -> int:
|
||||
with self._path.open(
|
||||
"w", encoding=encoding, errors=errors, newline=newline
|
||||
) as fp:
|
||||
return fp.write(data)
|
||||
|
||||
return await to_thread.run_sync(sync_write_text)
|
||||
|
||||
|
||||
PathLike.register(Path)
|
||||
18
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_resources.py
vendored
Executable file
18
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_resources.py
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ..abc import AsyncResource
|
||||
from ._tasks import CancelScope
|
||||
|
||||
|
||||
async def aclose_forcefully(resource: AsyncResource) -> None:
|
||||
"""
|
||||
Close an asynchronous resource in a cancelled scope.
|
||||
|
||||
Doing this closes the resource without waiting on anything.
|
||||
|
||||
:param resource: the resource to close
|
||||
|
||||
"""
|
||||
with CancelScope() as scope:
|
||||
scope.cancel()
|
||||
await resource.aclose()
|
||||
29
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_signals.py
vendored
Executable file
29
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_signals.py
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncIterator
|
||||
from contextlib import AbstractContextManager
|
||||
from signal import Signals
|
||||
|
||||
from ._eventloop import get_async_backend
|
||||
|
||||
|
||||
def open_signal_receiver(
|
||||
*signals: Signals,
|
||||
) -> AbstractContextManager[AsyncIterator[Signals]]:
|
||||
"""
|
||||
Start receiving operating system signals.
|
||||
|
||||
:param signals: signals to receive (e.g. ``signal.SIGINT``)
|
||||
:return: an asynchronous context manager for an asynchronous iterator which yields
|
||||
signal numbers
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
.. warning:: Windows does not support signals natively so it is best to avoid
|
||||
relying on this in cross-platform applications.
|
||||
|
||||
.. warning:: On asyncio, this permanently replaces any previous signal handler for
|
||||
the given signals, as set via :meth:`~asyncio.loop.add_signal_handler`.
|
||||
|
||||
"""
|
||||
return get_async_backend().open_signal_receiver(*signals)
|
||||
1003
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_sockets.py
vendored
Executable file
1003
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_sockets.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
52
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_streams.py
vendored
Executable file
52
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_streams.py
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from typing import TypeVar
|
||||
from warnings import warn
|
||||
|
||||
from ..streams.memory import (
|
||||
MemoryObjectReceiveStream,
|
||||
MemoryObjectSendStream,
|
||||
_MemoryObjectStreamState,
|
||||
)
|
||||
|
||||
T_Item = TypeVar("T_Item")
|
||||
|
||||
|
||||
class create_memory_object_stream(
|
||||
tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]],
|
||||
):
|
||||
"""
|
||||
Create a memory object stream.
|
||||
|
||||
The stream's item type can be annotated like
|
||||
:func:`create_memory_object_stream[T_Item]`.
|
||||
|
||||
:param max_buffer_size: number of items held in the buffer until ``send()`` starts
|
||||
blocking
|
||||
:param item_type: old way of marking the streams with the right generic type for
|
||||
static typing (does nothing on AnyIO 4)
|
||||
|
||||
.. deprecated:: 4.0
|
||||
Use ``create_memory_object_stream[YourItemType](...)`` instead.
|
||||
:return: a tuple of (send stream, receive stream)
|
||||
|
||||
"""
|
||||
|
||||
def __new__( # type: ignore[misc]
|
||||
cls, max_buffer_size: float = 0, item_type: object = None
|
||||
) -> tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]:
|
||||
if max_buffer_size != math.inf and not isinstance(max_buffer_size, int):
|
||||
raise ValueError("max_buffer_size must be either an integer or math.inf")
|
||||
if max_buffer_size < 0:
|
||||
raise ValueError("max_buffer_size cannot be negative")
|
||||
if item_type is not None:
|
||||
warn(
|
||||
"The item_type argument has been deprecated in AnyIO 4.0. "
|
||||
"Use create_memory_object_stream[YourItemType](...) instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
state = _MemoryObjectStreamState[T_Item](max_buffer_size)
|
||||
return (MemoryObjectSendStream(state), MemoryObjectReceiveStream(state))
|
||||
202
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_subprocesses.py
vendored
Executable file
202
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_subprocesses.py
vendored
Executable file
@@ -0,0 +1,202 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from collections.abc import AsyncIterable, Iterable, Mapping, Sequence
|
||||
from io import BytesIO
|
||||
from os import PathLike
|
||||
from subprocess import PIPE, CalledProcessError, CompletedProcess
|
||||
from typing import IO, Any, Union, cast
|
||||
|
||||
from ..abc import Process
|
||||
from ._eventloop import get_async_backend
|
||||
from ._tasks import create_task_group
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import TypeAlias
|
||||
else:
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
StrOrBytesPath: TypeAlias = Union[str, bytes, "PathLike[str]", "PathLike[bytes]"]
|
||||
|
||||
|
||||
async def run_process(
|
||||
command: StrOrBytesPath | Sequence[StrOrBytesPath],
|
||||
*,
|
||||
input: bytes | None = None,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = PIPE,
|
||||
stderr: int | IO[Any] | None = PIPE,
|
||||
check: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: Mapping[str, str] | None = None,
|
||||
startupinfo: Any = None,
|
||||
creationflags: int = 0,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Sequence[int] = (),
|
||||
user: str | int | None = None,
|
||||
group: str | int | None = None,
|
||||
extra_groups: Iterable[str | int] | None = None,
|
||||
umask: int = -1,
|
||||
) -> CompletedProcess[bytes]:
|
||||
"""
|
||||
Run an external command in a subprocess and wait until it completes.
|
||||
|
||||
.. seealso:: :func:`subprocess.run`
|
||||
|
||||
:param command: either a string to pass to the shell, or an iterable of strings
|
||||
containing the executable name or path and its arguments
|
||||
:param input: bytes passed to the standard input of the subprocess
|
||||
:param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
|
||||
a file-like object, or `None`; ``input`` overrides this
|
||||
:param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
|
||||
a file-like object, or `None`
|
||||
:param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
|
||||
:data:`subprocess.STDOUT`, a file-like object, or `None`
|
||||
:param check: if ``True``, raise :exc:`~subprocess.CalledProcessError` if the
|
||||
process terminates with a return code other than 0
|
||||
:param cwd: If not ``None``, change the working directory to this before running the
|
||||
command
|
||||
:param env: if not ``None``, this mapping replaces the inherited environment
|
||||
variables from the parent process
|
||||
:param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used
|
||||
to specify process startup parameters (Windows only)
|
||||
:param creationflags: flags that can be used to control the creation of the
|
||||
subprocess (see :class:`subprocess.Popen` for the specifics)
|
||||
:param start_new_session: if ``true`` the setsid() system call will be made in the
|
||||
child process prior to the execution of the subprocess. (POSIX only)
|
||||
:param pass_fds: sequence of file descriptors to keep open between the parent and
|
||||
child processes. (POSIX only)
|
||||
:param user: effective user to run the process as (Python >= 3.9, POSIX only)
|
||||
:param group: effective group to run the process as (Python >= 3.9, POSIX only)
|
||||
:param extra_groups: supplementary groups to set in the subprocess (Python >= 3.9,
|
||||
POSIX only)
|
||||
:param umask: if not negative, this umask is applied in the child process before
|
||||
running the given command (Python >= 3.9, POSIX only)
|
||||
:return: an object representing the completed process
|
||||
:raises ~subprocess.CalledProcessError: if ``check`` is ``True`` and the process
|
||||
exits with a nonzero return code
|
||||
|
||||
"""
|
||||
|
||||
async def drain_stream(stream: AsyncIterable[bytes], index: int) -> None:
|
||||
buffer = BytesIO()
|
||||
async for chunk in stream:
|
||||
buffer.write(chunk)
|
||||
|
||||
stream_contents[index] = buffer.getvalue()
|
||||
|
||||
if stdin is not None and input is not None:
|
||||
raise ValueError("only one of stdin and input is allowed")
|
||||
|
||||
async with await open_process(
|
||||
command,
|
||||
stdin=PIPE if input else stdin,
|
||||
stdout=stdout,
|
||||
stderr=stderr,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
startupinfo=startupinfo,
|
||||
creationflags=creationflags,
|
||||
start_new_session=start_new_session,
|
||||
pass_fds=pass_fds,
|
||||
user=user,
|
||||
group=group,
|
||||
extra_groups=extra_groups,
|
||||
umask=umask,
|
||||
) as process:
|
||||
stream_contents: list[bytes | None] = [None, None]
|
||||
async with create_task_group() as tg:
|
||||
if process.stdout:
|
||||
tg.start_soon(drain_stream, process.stdout, 0)
|
||||
|
||||
if process.stderr:
|
||||
tg.start_soon(drain_stream, process.stderr, 1)
|
||||
|
||||
if process.stdin and input:
|
||||
await process.stdin.send(input)
|
||||
await process.stdin.aclose()
|
||||
|
||||
await process.wait()
|
||||
|
||||
output, errors = stream_contents
|
||||
if check and process.returncode != 0:
|
||||
raise CalledProcessError(cast(int, process.returncode), command, output, errors)
|
||||
|
||||
return CompletedProcess(command, cast(int, process.returncode), output, errors)
|
||||
|
||||
|
||||
async def open_process(
|
||||
command: StrOrBytesPath | Sequence[StrOrBytesPath],
|
||||
*,
|
||||
stdin: int | IO[Any] | None = PIPE,
|
||||
stdout: int | IO[Any] | None = PIPE,
|
||||
stderr: int | IO[Any] | None = PIPE,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: Mapping[str, str] | None = None,
|
||||
startupinfo: Any = None,
|
||||
creationflags: int = 0,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Sequence[int] = (),
|
||||
user: str | int | None = None,
|
||||
group: str | int | None = None,
|
||||
extra_groups: Iterable[str | int] | None = None,
|
||||
umask: int = -1,
|
||||
) -> Process:
|
||||
"""
|
||||
Start an external command in a subprocess.
|
||||
|
||||
.. seealso:: :class:`subprocess.Popen`
|
||||
|
||||
:param command: either a string to pass to the shell, or an iterable of strings
|
||||
containing the executable name or path and its arguments
|
||||
:param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a
|
||||
file-like object, or ``None``
|
||||
:param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
|
||||
a file-like object, or ``None``
|
||||
:param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`,
|
||||
:data:`subprocess.STDOUT`, a file-like object, or ``None``
|
||||
:param cwd: If not ``None``, the working directory is changed before executing
|
||||
:param env: If env is not ``None``, it must be a mapping that defines the
|
||||
environment variables for the new process
|
||||
:param creationflags: flags that can be used to control the creation of the
|
||||
subprocess (see :class:`subprocess.Popen` for the specifics)
|
||||
:param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used
|
||||
to specify process startup parameters (Windows only)
|
||||
:param start_new_session: if ``true`` the setsid() system call will be made in the
|
||||
child process prior to the execution of the subprocess. (POSIX only)
|
||||
:param pass_fds: sequence of file descriptors to keep open between the parent and
|
||||
child processes. (POSIX only)
|
||||
:param user: effective user to run the process as (POSIX only)
|
||||
:param group: effective group to run the process as (POSIX only)
|
||||
:param extra_groups: supplementary groups to set in the subprocess (POSIX only)
|
||||
:param umask: if not negative, this umask is applied in the child process before
|
||||
running the given command (POSIX only)
|
||||
:return: an asynchronous process object
|
||||
|
||||
"""
|
||||
kwargs: dict[str, Any] = {}
|
||||
if user is not None:
|
||||
kwargs["user"] = user
|
||||
|
||||
if group is not None:
|
||||
kwargs["group"] = group
|
||||
|
||||
if extra_groups is not None:
|
||||
kwargs["extra_groups"] = group
|
||||
|
||||
if umask >= 0:
|
||||
kwargs["umask"] = umask
|
||||
|
||||
return await get_async_backend().open_process(
|
||||
command,
|
||||
stdin=stdin,
|
||||
stdout=stdout,
|
||||
stderr=stderr,
|
||||
cwd=cwd,
|
||||
env=env,
|
||||
startupinfo=startupinfo,
|
||||
creationflags=creationflags,
|
||||
start_new_session=start_new_session,
|
||||
pass_fds=pass_fds,
|
||||
**kwargs,
|
||||
)
|
||||
753
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_synchronization.py
vendored
Executable file
753
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_synchronization.py
vendored
Executable file
@@ -0,0 +1,753 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from collections import deque
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from types import TracebackType
|
||||
from typing import TypeVar
|
||||
|
||||
from ..lowlevel import checkpoint_if_cancelled
|
||||
from ._eventloop import get_async_backend
|
||||
from ._exceptions import BusyResourceError, NoEventLoopError
|
||||
from ._tasks import CancelScope
|
||||
from ._testing import TaskInfo, get_current_task
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EventStatistics:
|
||||
"""
|
||||
:ivar int tasks_waiting: number of tasks waiting on :meth:`~.Event.wait`
|
||||
"""
|
||||
|
||||
tasks_waiting: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CapacityLimiterStatistics:
|
||||
"""
|
||||
:ivar int borrowed_tokens: number of tokens currently borrowed by tasks
|
||||
:ivar float total_tokens: total number of available tokens
|
||||
:ivar tuple borrowers: tasks or other objects currently holding tokens borrowed from
|
||||
this limiter
|
||||
:ivar int tasks_waiting: number of tasks waiting on
|
||||
:meth:`~.CapacityLimiter.acquire` or
|
||||
:meth:`~.CapacityLimiter.acquire_on_behalf_of`
|
||||
"""
|
||||
|
||||
borrowed_tokens: int
|
||||
total_tokens: float
|
||||
borrowers: tuple[object, ...]
|
||||
tasks_waiting: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class LockStatistics:
|
||||
"""
|
||||
:ivar bool locked: flag indicating if this lock is locked or not
|
||||
:ivar ~anyio.TaskInfo owner: task currently holding the lock (or ``None`` if the
|
||||
lock is not held by any task)
|
||||
:ivar int tasks_waiting: number of tasks waiting on :meth:`~.Lock.acquire`
|
||||
"""
|
||||
|
||||
locked: bool
|
||||
owner: TaskInfo | None
|
||||
tasks_waiting: int
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ConditionStatistics:
|
||||
"""
|
||||
:ivar int tasks_waiting: number of tasks blocked on :meth:`~.Condition.wait`
|
||||
:ivar ~anyio.LockStatistics lock_statistics: statistics of the underlying
|
||||
:class:`~.Lock`
|
||||
"""
|
||||
|
||||
tasks_waiting: int
|
||||
lock_statistics: LockStatistics
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SemaphoreStatistics:
|
||||
"""
|
||||
:ivar int tasks_waiting: number of tasks waiting on :meth:`~.Semaphore.acquire`
|
||||
|
||||
"""
|
||||
|
||||
tasks_waiting: int
|
||||
|
||||
|
||||
class Event:
|
||||
def __new__(cls) -> Event:
|
||||
try:
|
||||
return get_async_backend().create_event()
|
||||
except NoEventLoopError:
|
||||
return EventAdapter()
|
||||
|
||||
def set(self) -> None:
|
||||
"""Set the flag, notifying all listeners."""
|
||||
raise NotImplementedError
|
||||
|
||||
def is_set(self) -> bool:
|
||||
"""Return ``True`` if the flag is set, ``False`` if not."""
|
||||
raise NotImplementedError
|
||||
|
||||
async def wait(self) -> None:
|
||||
"""
|
||||
Wait until the flag has been set.
|
||||
|
||||
If the flag has already been set when this method is called, it returns
|
||||
immediately.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def statistics(self) -> EventStatistics:
|
||||
"""Return statistics about the current state of this event."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class EventAdapter(Event):
|
||||
_internal_event: Event | None = None
|
||||
_is_set: bool = False
|
||||
|
||||
def __new__(cls) -> EventAdapter:
|
||||
return object.__new__(cls)
|
||||
|
||||
@property
|
||||
def _event(self) -> Event:
|
||||
if self._internal_event is None:
|
||||
self._internal_event = get_async_backend().create_event()
|
||||
if self._is_set:
|
||||
self._internal_event.set()
|
||||
|
||||
return self._internal_event
|
||||
|
||||
def set(self) -> None:
|
||||
if self._internal_event is None:
|
||||
self._is_set = True
|
||||
else:
|
||||
self._event.set()
|
||||
|
||||
def is_set(self) -> bool:
|
||||
if self._internal_event is None:
|
||||
return self._is_set
|
||||
|
||||
return self._internal_event.is_set()
|
||||
|
||||
async def wait(self) -> None:
|
||||
await self._event.wait()
|
||||
|
||||
def statistics(self) -> EventStatistics:
|
||||
if self._internal_event is None:
|
||||
return EventStatistics(tasks_waiting=0)
|
||||
|
||||
return self._internal_event.statistics()
|
||||
|
||||
|
||||
class Lock:
|
||||
def __new__(cls, *, fast_acquire: bool = False) -> Lock:
|
||||
try:
|
||||
return get_async_backend().create_lock(fast_acquire=fast_acquire)
|
||||
except NoEventLoopError:
|
||||
return LockAdapter(fast_acquire=fast_acquire)
|
||||
|
||||
async def __aenter__(self) -> None:
|
||||
await self.acquire()
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
self.release()
|
||||
|
||||
async def acquire(self) -> None:
|
||||
"""Acquire the lock."""
|
||||
raise NotImplementedError
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
"""
|
||||
Acquire the lock, without blocking.
|
||||
|
||||
:raises ~anyio.WouldBlock: if the operation would block
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def release(self) -> None:
|
||||
"""Release the lock."""
|
||||
raise NotImplementedError
|
||||
|
||||
def locked(self) -> bool:
|
||||
"""Return True if the lock is currently held."""
|
||||
raise NotImplementedError
|
||||
|
||||
def statistics(self) -> LockStatistics:
|
||||
"""
|
||||
Return statistics about the current state of this lock.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class LockAdapter(Lock):
|
||||
_internal_lock: Lock | None = None
|
||||
|
||||
def __new__(cls, *, fast_acquire: bool = False) -> LockAdapter:
|
||||
return object.__new__(cls)
|
||||
|
||||
def __init__(self, *, fast_acquire: bool = False):
|
||||
self._fast_acquire = fast_acquire
|
||||
|
||||
@property
|
||||
def _lock(self) -> Lock:
|
||||
if self._internal_lock is None:
|
||||
self._internal_lock = get_async_backend().create_lock(
|
||||
fast_acquire=self._fast_acquire
|
||||
)
|
||||
|
||||
return self._internal_lock
|
||||
|
||||
async def __aenter__(self) -> None:
|
||||
await self._lock.acquire()
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
if self._internal_lock is not None:
|
||||
self._internal_lock.release()
|
||||
|
||||
async def acquire(self) -> None:
|
||||
"""Acquire the lock."""
|
||||
await self._lock.acquire()
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
"""
|
||||
Acquire the lock, without blocking.
|
||||
|
||||
:raises ~anyio.WouldBlock: if the operation would block
|
||||
|
||||
"""
|
||||
self._lock.acquire_nowait()
|
||||
|
||||
def release(self) -> None:
|
||||
"""Release the lock."""
|
||||
self._lock.release()
|
||||
|
||||
def locked(self) -> bool:
|
||||
"""Return True if the lock is currently held."""
|
||||
return self._lock.locked()
|
||||
|
||||
def statistics(self) -> LockStatistics:
|
||||
"""
|
||||
Return statistics about the current state of this lock.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
if self._internal_lock is None:
|
||||
return LockStatistics(False, None, 0)
|
||||
|
||||
return self._internal_lock.statistics()
|
||||
|
||||
|
||||
class Condition:
|
||||
_owner_task: TaskInfo | None = None
|
||||
|
||||
def __init__(self, lock: Lock | None = None):
|
||||
self._lock = lock or Lock()
|
||||
self._waiters: deque[Event] = deque()
|
||||
|
||||
async def __aenter__(self) -> None:
|
||||
await self.acquire()
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
self.release()
|
||||
|
||||
def _check_acquired(self) -> None:
|
||||
if self._owner_task != get_current_task():
|
||||
raise RuntimeError("The current task is not holding the underlying lock")
|
||||
|
||||
async def acquire(self) -> None:
|
||||
"""Acquire the underlying lock."""
|
||||
await self._lock.acquire()
|
||||
self._owner_task = get_current_task()
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
"""
|
||||
Acquire the underlying lock, without blocking.
|
||||
|
||||
:raises ~anyio.WouldBlock: if the operation would block
|
||||
|
||||
"""
|
||||
self._lock.acquire_nowait()
|
||||
self._owner_task = get_current_task()
|
||||
|
||||
def release(self) -> None:
|
||||
"""Release the underlying lock."""
|
||||
self._lock.release()
|
||||
|
||||
def locked(self) -> bool:
|
||||
"""Return True if the lock is set."""
|
||||
return self._lock.locked()
|
||||
|
||||
def notify(self, n: int = 1) -> None:
|
||||
"""Notify exactly n listeners."""
|
||||
self._check_acquired()
|
||||
for _ in range(n):
|
||||
try:
|
||||
event = self._waiters.popleft()
|
||||
except IndexError:
|
||||
break
|
||||
|
||||
event.set()
|
||||
|
||||
def notify_all(self) -> None:
|
||||
"""Notify all the listeners."""
|
||||
self._check_acquired()
|
||||
for event in self._waiters:
|
||||
event.set()
|
||||
|
||||
self._waiters.clear()
|
||||
|
||||
async def wait(self) -> None:
|
||||
"""Wait for a notification."""
|
||||
await checkpoint_if_cancelled()
|
||||
self._check_acquired()
|
||||
event = Event()
|
||||
self._waiters.append(event)
|
||||
self.release()
|
||||
try:
|
||||
await event.wait()
|
||||
except BaseException:
|
||||
if not event.is_set():
|
||||
self._waiters.remove(event)
|
||||
|
||||
raise
|
||||
finally:
|
||||
with CancelScope(shield=True):
|
||||
await self.acquire()
|
||||
|
||||
async def wait_for(self, predicate: Callable[[], T]) -> T:
|
||||
"""
|
||||
Wait until a predicate becomes true.
|
||||
|
||||
:param predicate: a callable that returns a truthy value when the condition is
|
||||
met
|
||||
:return: the result of the predicate
|
||||
|
||||
.. versionadded:: 4.11.0
|
||||
|
||||
"""
|
||||
while not (result := predicate()):
|
||||
await self.wait()
|
||||
|
||||
return result
|
||||
|
||||
def statistics(self) -> ConditionStatistics:
|
||||
"""
|
||||
Return statistics about the current state of this condition.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
return ConditionStatistics(len(self._waiters), self._lock.statistics())
|
||||
|
||||
|
||||
class Semaphore:
|
||||
def __new__(
|
||||
cls,
|
||||
initial_value: int,
|
||||
*,
|
||||
max_value: int | None = None,
|
||||
fast_acquire: bool = False,
|
||||
) -> Semaphore:
|
||||
try:
|
||||
return get_async_backend().create_semaphore(
|
||||
initial_value, max_value=max_value, fast_acquire=fast_acquire
|
||||
)
|
||||
except NoEventLoopError:
|
||||
return SemaphoreAdapter(initial_value, max_value=max_value)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
initial_value: int,
|
||||
*,
|
||||
max_value: int | None = None,
|
||||
fast_acquire: bool = False,
|
||||
):
|
||||
if not isinstance(initial_value, int):
|
||||
raise TypeError("initial_value must be an integer")
|
||||
if initial_value < 0:
|
||||
raise ValueError("initial_value must be >= 0")
|
||||
if max_value is not None:
|
||||
if not isinstance(max_value, int):
|
||||
raise TypeError("max_value must be an integer or None")
|
||||
if max_value < initial_value:
|
||||
raise ValueError(
|
||||
"max_value must be equal to or higher than initial_value"
|
||||
)
|
||||
|
||||
self._fast_acquire = fast_acquire
|
||||
|
||||
async def __aenter__(self) -> Semaphore:
|
||||
await self.acquire()
|
||||
return self
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
self.release()
|
||||
|
||||
async def acquire(self) -> None:
|
||||
"""Decrement the semaphore value, blocking if necessary."""
|
||||
raise NotImplementedError
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
"""
|
||||
Acquire the underlying lock, without blocking.
|
||||
|
||||
:raises ~anyio.WouldBlock: if the operation would block
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def release(self) -> None:
|
||||
"""Increment the semaphore value."""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def value(self) -> int:
|
||||
"""The current value of the semaphore."""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def max_value(self) -> int | None:
|
||||
"""The maximum value of the semaphore."""
|
||||
raise NotImplementedError
|
||||
|
||||
def statistics(self) -> SemaphoreStatistics:
|
||||
"""
|
||||
Return statistics about the current state of this semaphore.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class SemaphoreAdapter(Semaphore):
|
||||
_internal_semaphore: Semaphore | None = None
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
initial_value: int,
|
||||
*,
|
||||
max_value: int | None = None,
|
||||
fast_acquire: bool = False,
|
||||
) -> SemaphoreAdapter:
|
||||
return object.__new__(cls)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
initial_value: int,
|
||||
*,
|
||||
max_value: int | None = None,
|
||||
fast_acquire: bool = False,
|
||||
) -> None:
|
||||
super().__init__(initial_value, max_value=max_value, fast_acquire=fast_acquire)
|
||||
self._initial_value = initial_value
|
||||
self._max_value = max_value
|
||||
|
||||
@property
|
||||
def _semaphore(self) -> Semaphore:
|
||||
if self._internal_semaphore is None:
|
||||
self._internal_semaphore = get_async_backend().create_semaphore(
|
||||
self._initial_value, max_value=self._max_value
|
||||
)
|
||||
|
||||
return self._internal_semaphore
|
||||
|
||||
async def acquire(self) -> None:
|
||||
await self._semaphore.acquire()
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
self._semaphore.acquire_nowait()
|
||||
|
||||
def release(self) -> None:
|
||||
self._semaphore.release()
|
||||
|
||||
@property
|
||||
def value(self) -> int:
|
||||
if self._internal_semaphore is None:
|
||||
return self._initial_value
|
||||
|
||||
return self._semaphore.value
|
||||
|
||||
@property
|
||||
def max_value(self) -> int | None:
|
||||
return self._max_value
|
||||
|
||||
def statistics(self) -> SemaphoreStatistics:
|
||||
if self._internal_semaphore is None:
|
||||
return SemaphoreStatistics(tasks_waiting=0)
|
||||
|
||||
return self._semaphore.statistics()
|
||||
|
||||
|
||||
class CapacityLimiter:
|
||||
def __new__(cls, total_tokens: float) -> CapacityLimiter:
|
||||
try:
|
||||
return get_async_backend().create_capacity_limiter(total_tokens)
|
||||
except NoEventLoopError:
|
||||
return CapacityLimiterAdapter(total_tokens)
|
||||
|
||||
async def __aenter__(self) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def total_tokens(self) -> float:
|
||||
"""
|
||||
The total number of tokens available for borrowing.
|
||||
|
||||
This is a read-write property. If the total number of tokens is increased, the
|
||||
proportionate number of tasks waiting on this limiter will be granted their
|
||||
tokens.
|
||||
|
||||
.. versionchanged:: 3.0
|
||||
The property is now writable.
|
||||
.. versionchanged:: 4.12
|
||||
The value can now be set to 0.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@total_tokens.setter
|
||||
def total_tokens(self, value: float) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def borrowed_tokens(self) -> int:
|
||||
"""The number of tokens that have currently been borrowed."""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def available_tokens(self) -> float:
|
||||
"""The number of tokens currently available to be borrowed"""
|
||||
raise NotImplementedError
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
"""
|
||||
Acquire a token for the current task without waiting for one to become
|
||||
available.
|
||||
|
||||
:raises ~anyio.WouldBlock: if there are no tokens available for borrowing
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def acquire_on_behalf_of_nowait(self, borrower: object) -> None:
|
||||
"""
|
||||
Acquire a token without waiting for one to become available.
|
||||
|
||||
:param borrower: the entity borrowing a token
|
||||
:raises ~anyio.WouldBlock: if there are no tokens available for borrowing
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def acquire(self) -> None:
|
||||
"""
|
||||
Acquire a token for the current task, waiting if necessary for one to become
|
||||
available.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def acquire_on_behalf_of(self, borrower: object) -> None:
|
||||
"""
|
||||
Acquire a token, waiting if necessary for one to become available.
|
||||
|
||||
:param borrower: the entity borrowing a token
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def release(self) -> None:
|
||||
"""
|
||||
Release the token held by the current task.
|
||||
|
||||
:raises RuntimeError: if the current task has not borrowed a token from this
|
||||
limiter.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def release_on_behalf_of(self, borrower: object) -> None:
|
||||
"""
|
||||
Release the token held by the given borrower.
|
||||
|
||||
:raises RuntimeError: if the borrower has not borrowed a token from this
|
||||
limiter.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def statistics(self) -> CapacityLimiterStatistics:
|
||||
"""
|
||||
Return statistics about the current state of this limiter.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class CapacityLimiterAdapter(CapacityLimiter):
|
||||
_internal_limiter: CapacityLimiter | None = None
|
||||
|
||||
def __new__(cls, total_tokens: float) -> CapacityLimiterAdapter:
|
||||
return object.__new__(cls)
|
||||
|
||||
def __init__(self, total_tokens: float) -> None:
|
||||
self.total_tokens = total_tokens
|
||||
|
||||
@property
|
||||
def _limiter(self) -> CapacityLimiter:
|
||||
if self._internal_limiter is None:
|
||||
self._internal_limiter = get_async_backend().create_capacity_limiter(
|
||||
self._total_tokens
|
||||
)
|
||||
|
||||
return self._internal_limiter
|
||||
|
||||
async def __aenter__(self) -> None:
|
||||
await self._limiter.__aenter__()
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
return await self._limiter.__aexit__(exc_type, exc_val, exc_tb)
|
||||
|
||||
@property
|
||||
def total_tokens(self) -> float:
|
||||
if self._internal_limiter is None:
|
||||
return self._total_tokens
|
||||
|
||||
return self._internal_limiter.total_tokens
|
||||
|
||||
@total_tokens.setter
|
||||
def total_tokens(self, value: float) -> None:
|
||||
if not isinstance(value, int) and value is not math.inf:
|
||||
raise TypeError("total_tokens must be an int or math.inf")
|
||||
elif value < 1:
|
||||
raise ValueError("total_tokens must be >= 1")
|
||||
|
||||
if self._internal_limiter is None:
|
||||
self._total_tokens = value
|
||||
return
|
||||
|
||||
self._limiter.total_tokens = value
|
||||
|
||||
@property
|
||||
def borrowed_tokens(self) -> int:
|
||||
if self._internal_limiter is None:
|
||||
return 0
|
||||
|
||||
return self._internal_limiter.borrowed_tokens
|
||||
|
||||
@property
|
||||
def available_tokens(self) -> float:
|
||||
if self._internal_limiter is None:
|
||||
return self._total_tokens
|
||||
|
||||
return self._internal_limiter.available_tokens
|
||||
|
||||
def acquire_nowait(self) -> None:
|
||||
self._limiter.acquire_nowait()
|
||||
|
||||
def acquire_on_behalf_of_nowait(self, borrower: object) -> None:
|
||||
self._limiter.acquire_on_behalf_of_nowait(borrower)
|
||||
|
||||
async def acquire(self) -> None:
|
||||
await self._limiter.acquire()
|
||||
|
||||
async def acquire_on_behalf_of(self, borrower: object) -> None:
|
||||
await self._limiter.acquire_on_behalf_of(borrower)
|
||||
|
||||
def release(self) -> None:
|
||||
self._limiter.release()
|
||||
|
||||
def release_on_behalf_of(self, borrower: object) -> None:
|
||||
self._limiter.release_on_behalf_of(borrower)
|
||||
|
||||
def statistics(self) -> CapacityLimiterStatistics:
|
||||
if self._internal_limiter is None:
|
||||
return CapacityLimiterStatistics(
|
||||
borrowed_tokens=0,
|
||||
total_tokens=self.total_tokens,
|
||||
borrowers=(),
|
||||
tasks_waiting=0,
|
||||
)
|
||||
|
||||
return self._internal_limiter.statistics()
|
||||
|
||||
|
||||
class ResourceGuard:
|
||||
"""
|
||||
A context manager for ensuring that a resource is only used by a single task at a
|
||||
time.
|
||||
|
||||
Entering this context manager while the previous has not exited it yet will trigger
|
||||
:exc:`BusyResourceError`.
|
||||
|
||||
:param action: the action to guard against (visible in the :exc:`BusyResourceError`
|
||||
when triggered, e.g. "Another task is already {action} this resource")
|
||||
|
||||
.. versionadded:: 4.1
|
||||
"""
|
||||
|
||||
__slots__ = "action", "_guarded"
|
||||
|
||||
def __init__(self, action: str = "using"):
|
||||
self.action: str = action
|
||||
self._guarded = False
|
||||
|
||||
def __enter__(self) -> None:
|
||||
if self._guarded:
|
||||
raise BusyResourceError(self.action)
|
||||
|
||||
self._guarded = True
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
self._guarded = False
|
||||
173
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_tasks.py
vendored
Executable file
173
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_tasks.py
vendored
Executable file
@@ -0,0 +1,173 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
from collections.abc import Generator
|
||||
from contextlib import contextmanager
|
||||
from types import TracebackType
|
||||
|
||||
from ..abc._tasks import TaskGroup, TaskStatus
|
||||
from ._eventloop import get_async_backend
|
||||
|
||||
|
||||
class _IgnoredTaskStatus(TaskStatus[object]):
|
||||
def started(self, value: object = None) -> None:
|
||||
pass
|
||||
|
||||
|
||||
TASK_STATUS_IGNORED = _IgnoredTaskStatus()
|
||||
|
||||
|
||||
class CancelScope:
|
||||
"""
|
||||
Wraps a unit of work that can be made separately cancellable.
|
||||
|
||||
:param deadline: The time (clock value) when this scope is cancelled automatically
|
||||
:param shield: ``True`` to shield the cancel scope from external cancellation
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
"""
|
||||
|
||||
def __new__(
|
||||
cls, *, deadline: float = math.inf, shield: bool = False
|
||||
) -> CancelScope:
|
||||
return get_async_backend().create_cancel_scope(shield=shield, deadline=deadline)
|
||||
|
||||
def cancel(self, reason: str | None = None) -> None:
|
||||
"""
|
||||
Cancel this scope immediately.
|
||||
|
||||
:param reason: a message describing the reason for the cancellation
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def deadline(self) -> float:
|
||||
"""
|
||||
The time (clock value) when this scope is cancelled automatically.
|
||||
|
||||
Will be ``float('inf')`` if no timeout has been set.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@deadline.setter
|
||||
def deadline(self, value: float) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def cancel_called(self) -> bool:
|
||||
"""``True`` if :meth:`cancel` has been called."""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def cancelled_caught(self) -> bool:
|
||||
"""
|
||||
``True`` if this scope suppressed a cancellation exception it itself raised.
|
||||
|
||||
This is typically used to check if any work was interrupted, or to see if the
|
||||
scope was cancelled due to its deadline being reached. The value will, however,
|
||||
only be ``True`` if the cancellation was triggered by the scope itself (and not
|
||||
an outer scope).
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def shield(self) -> bool:
|
||||
"""
|
||||
``True`` if this scope is shielded from external cancellation.
|
||||
|
||||
While a scope is shielded, it will not receive cancellations from outside.
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@shield.setter
|
||||
def shield(self, value: bool) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
def __enter__(self) -> CancelScope:
|
||||
raise NotImplementedError
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> bool:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@contextmanager
|
||||
def fail_after(
|
||||
delay: float | None, shield: bool = False
|
||||
) -> Generator[CancelScope, None, None]:
|
||||
"""
|
||||
Create a context manager which raises a :class:`TimeoutError` if does not finish in
|
||||
time.
|
||||
|
||||
:param delay: maximum allowed time (in seconds) before raising the exception, or
|
||||
``None`` to disable the timeout
|
||||
:param shield: ``True`` to shield the cancel scope from external cancellation
|
||||
:return: a context manager that yields a cancel scope
|
||||
:rtype: :class:`~typing.ContextManager`\\[:class:`~anyio.CancelScope`\\]
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
current_time = get_async_backend().current_time
|
||||
deadline = (current_time() + delay) if delay is not None else math.inf
|
||||
with get_async_backend().create_cancel_scope(
|
||||
deadline=deadline, shield=shield
|
||||
) as cancel_scope:
|
||||
yield cancel_scope
|
||||
|
||||
if cancel_scope.cancelled_caught and current_time() >= cancel_scope.deadline:
|
||||
raise TimeoutError
|
||||
|
||||
|
||||
def move_on_after(delay: float | None, shield: bool = False) -> CancelScope:
|
||||
"""
|
||||
Create a cancel scope with a deadline that expires after the given delay.
|
||||
|
||||
:param delay: maximum allowed time (in seconds) before exiting the context block, or
|
||||
``None`` to disable the timeout
|
||||
:param shield: ``True`` to shield the cancel scope from external cancellation
|
||||
:return: a cancel scope
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
deadline = (
|
||||
(get_async_backend().current_time() + delay) if delay is not None else math.inf
|
||||
)
|
||||
return get_async_backend().create_cancel_scope(deadline=deadline, shield=shield)
|
||||
|
||||
|
||||
def current_effective_deadline() -> float:
|
||||
"""
|
||||
Return the nearest deadline among all the cancel scopes effective for the current
|
||||
task.
|
||||
|
||||
:return: a clock value from the event loop's internal clock (or ``float('inf')`` if
|
||||
there is no deadline in effect, or ``float('-inf')`` if the current scope has
|
||||
been cancelled)
|
||||
:rtype: float
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return get_async_backend().current_effective_deadline()
|
||||
|
||||
|
||||
def create_task_group() -> TaskGroup:
|
||||
"""
|
||||
Create a task group.
|
||||
|
||||
:return: a task group
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return get_async_backend().create_task_group()
|
||||
616
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_tempfile.py
vendored
Executable file
616
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_tempfile.py
vendored
Executable file
@@ -0,0 +1,616 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
from collections.abc import Iterable
|
||||
from io import BytesIO, TextIOWrapper
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
AnyStr,
|
||||
Generic,
|
||||
overload,
|
||||
)
|
||||
|
||||
from .. import to_thread
|
||||
from .._core._fileio import AsyncFile
|
||||
from ..lowlevel import checkpoint_if_cancelled
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _typeshed import OpenBinaryMode, OpenTextMode, ReadableBuffer, WriteableBuffer
|
||||
|
||||
|
||||
class TemporaryFile(Generic[AnyStr]):
|
||||
"""
|
||||
An asynchronous temporary file that is automatically created and cleaned up.
|
||||
|
||||
This class provides an asynchronous context manager interface to a temporary file.
|
||||
The file is created using Python's standard `tempfile.TemporaryFile` function in a
|
||||
background thread, and is wrapped as an asynchronous file using `AsyncFile`.
|
||||
|
||||
:param mode: The mode in which the file is opened. Defaults to "w+b".
|
||||
:param buffering: The buffering policy (-1 means the default buffering).
|
||||
:param encoding: The encoding used to decode or encode the file. Only applicable in
|
||||
text mode.
|
||||
:param newline: Controls how universal newlines mode works (only applicable in text
|
||||
mode).
|
||||
:param suffix: The suffix for the temporary file name.
|
||||
:param prefix: The prefix for the temporary file name.
|
||||
:param dir: The directory in which the temporary file is created.
|
||||
:param errors: The error handling scheme used for encoding/decoding errors.
|
||||
"""
|
||||
|
||||
_async_file: AsyncFile[AnyStr]
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self: TemporaryFile[bytes],
|
||||
mode: OpenBinaryMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
): ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: TemporaryFile[str],
|
||||
mode: OpenTextMode,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
): ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
mode: OpenTextMode | OpenBinaryMode = "w+b",
|
||||
buffering: int = -1,
|
||||
encoding: str | None = None,
|
||||
newline: str | None = None,
|
||||
suffix: str | None = None,
|
||||
prefix: str | None = None,
|
||||
dir: str | None = None,
|
||||
*,
|
||||
errors: str | None = None,
|
||||
) -> None:
|
||||
self.mode = mode
|
||||
self.buffering = buffering
|
||||
self.encoding = encoding
|
||||
self.newline = newline
|
||||
self.suffix: str | None = suffix
|
||||
self.prefix: str | None = prefix
|
||||
self.dir: str | None = dir
|
||||
self.errors = errors
|
||||
|
||||
async def __aenter__(self) -> AsyncFile[AnyStr]:
|
||||
fp = await to_thread.run_sync(
|
||||
lambda: tempfile.TemporaryFile(
|
||||
self.mode,
|
||||
self.buffering,
|
||||
self.encoding,
|
||||
self.newline,
|
||||
self.suffix,
|
||||
self.prefix,
|
||||
self.dir,
|
||||
errors=self.errors,
|
||||
)
|
||||
)
|
||||
self._async_file = AsyncFile(fp)
|
||||
return self._async_file
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: TracebackType | None,
|
||||
) -> None:
|
||||
await self._async_file.aclose()
|
||||
|
||||
|
||||
class NamedTemporaryFile(Generic[AnyStr]):
|
||||
"""
|
||||
An asynchronous named temporary file that is automatically created and cleaned up.
|
||||
|
||||
This class provides an asynchronous context manager for a temporary file with a
|
||||
visible name in the file system. It uses Python's standard
|
||||
:func:`~tempfile.NamedTemporaryFile` function and wraps the file object with
|
||||
:class:`AsyncFile` for asynchronous operations.
|
||||
|
||||
:param mode: The mode in which the file is opened. Defaults to "w+b".
|
||||
:param buffering: The buffering policy (-1 means the default buffering).
|
||||
:param encoding: The encoding used to decode or encode the file. Only applicable in
|
||||
text mode.
|
||||
:param newline: Controls how universal newlines mode works (only applicable in text
|
||||
mode).
|
||||
:param suffix: The suffix for the temporary file name.
|
||||
:param prefix: The prefix for the temporary file name.
|
||||
:param dir: The directory in which the temporary file is created.
|
||||
:param delete: Whether to delete the file when it is closed.
|
||||
:param errors: The error handling scheme used for encoding/decoding errors.
|
||||
:param delete_on_close: (Python 3.12+) Whether to delete the file on close.
|
||||
"""
|
||||
|
||||
_async_file: AsyncFile[AnyStr]
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self: NamedTemporaryFile[bytes],
|
||||
mode: OpenBinaryMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
delete: bool = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
delete_on_close: bool = ...,
|
||||
): ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: NamedTemporaryFile[str],
|
||||
mode: OpenTextMode,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
delete: bool = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
delete_on_close: bool = ...,
|
||||
): ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
mode: OpenBinaryMode | OpenTextMode = "w+b",
|
||||
buffering: int = -1,
|
||||
encoding: str | None = None,
|
||||
newline: str | None = None,
|
||||
suffix: str | None = None,
|
||||
prefix: str | None = None,
|
||||
dir: str | None = None,
|
||||
delete: bool = True,
|
||||
*,
|
||||
errors: str | None = None,
|
||||
delete_on_close: bool = True,
|
||||
) -> None:
|
||||
self._params: dict[str, Any] = {
|
||||
"mode": mode,
|
||||
"buffering": buffering,
|
||||
"encoding": encoding,
|
||||
"newline": newline,
|
||||
"suffix": suffix,
|
||||
"prefix": prefix,
|
||||
"dir": dir,
|
||||
"delete": delete,
|
||||
"errors": errors,
|
||||
}
|
||||
if sys.version_info >= (3, 12):
|
||||
self._params["delete_on_close"] = delete_on_close
|
||||
|
||||
async def __aenter__(self) -> AsyncFile[AnyStr]:
|
||||
fp = await to_thread.run_sync(
|
||||
lambda: tempfile.NamedTemporaryFile(**self._params)
|
||||
)
|
||||
self._async_file = AsyncFile(fp)
|
||||
return self._async_file
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: TracebackType | None,
|
||||
) -> None:
|
||||
await self._async_file.aclose()
|
||||
|
||||
|
||||
class SpooledTemporaryFile(AsyncFile[AnyStr]):
|
||||
"""
|
||||
An asynchronous spooled temporary file that starts in memory and is spooled to disk.
|
||||
|
||||
This class provides an asynchronous interface to a spooled temporary file, much like
|
||||
Python's standard :class:`~tempfile.SpooledTemporaryFile`. It supports asynchronous
|
||||
write operations and provides a method to force a rollover to disk.
|
||||
|
||||
:param max_size: Maximum size in bytes before the file is rolled over to disk.
|
||||
:param mode: The mode in which the file is opened. Defaults to "w+b".
|
||||
:param buffering: The buffering policy (-1 means the default buffering).
|
||||
:param encoding: The encoding used to decode or encode the file (text mode only).
|
||||
:param newline: Controls how universal newlines mode works (text mode only).
|
||||
:param suffix: The suffix for the temporary file name.
|
||||
:param prefix: The prefix for the temporary file name.
|
||||
:param dir: The directory in which the temporary file is created.
|
||||
:param errors: The error handling scheme used for encoding/decoding errors.
|
||||
"""
|
||||
|
||||
_rolled: bool = False
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
self: SpooledTemporaryFile[bytes],
|
||||
max_size: int = ...,
|
||||
mode: OpenBinaryMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
): ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: SpooledTemporaryFile[str],
|
||||
max_size: int = ...,
|
||||
mode: OpenTextMode = ...,
|
||||
buffering: int = ...,
|
||||
encoding: str | None = ...,
|
||||
newline: str | None = ...,
|
||||
suffix: str | None = ...,
|
||||
prefix: str | None = ...,
|
||||
dir: str | None = ...,
|
||||
*,
|
||||
errors: str | None = ...,
|
||||
): ...
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
max_size: int = 0,
|
||||
mode: OpenBinaryMode | OpenTextMode = "w+b",
|
||||
buffering: int = -1,
|
||||
encoding: str | None = None,
|
||||
newline: str | None = None,
|
||||
suffix: str | None = None,
|
||||
prefix: str | None = None,
|
||||
dir: str | None = None,
|
||||
*,
|
||||
errors: str | None = None,
|
||||
) -> None:
|
||||
self._tempfile_params: dict[str, Any] = {
|
||||
"mode": mode,
|
||||
"buffering": buffering,
|
||||
"encoding": encoding,
|
||||
"newline": newline,
|
||||
"suffix": suffix,
|
||||
"prefix": prefix,
|
||||
"dir": dir,
|
||||
"errors": errors,
|
||||
}
|
||||
self._max_size = max_size
|
||||
if "b" in mode:
|
||||
super().__init__(BytesIO()) # type: ignore[arg-type]
|
||||
else:
|
||||
super().__init__(
|
||||
TextIOWrapper( # type: ignore[arg-type]
|
||||
BytesIO(),
|
||||
encoding=encoding,
|
||||
errors=errors,
|
||||
newline=newline,
|
||||
write_through=True,
|
||||
)
|
||||
)
|
||||
|
||||
async def aclose(self) -> None:
|
||||
if not self._rolled:
|
||||
self._fp.close()
|
||||
return
|
||||
|
||||
await super().aclose()
|
||||
|
||||
async def _check(self) -> None:
|
||||
if self._rolled or self._fp.tell() <= self._max_size:
|
||||
return
|
||||
|
||||
await self.rollover()
|
||||
|
||||
async def rollover(self) -> None:
|
||||
if self._rolled:
|
||||
return
|
||||
|
||||
self._rolled = True
|
||||
buffer = self._fp
|
||||
buffer.seek(0)
|
||||
self._fp = await to_thread.run_sync(
|
||||
lambda: tempfile.TemporaryFile(**self._tempfile_params)
|
||||
)
|
||||
await self.write(buffer.read())
|
||||
buffer.close()
|
||||
|
||||
@property
|
||||
def closed(self) -> bool:
|
||||
return self._fp.closed
|
||||
|
||||
async def read(self, size: int = -1) -> AnyStr:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.read(size)
|
||||
|
||||
return await super().read(size) # type: ignore[return-value]
|
||||
|
||||
async def read1(self: SpooledTemporaryFile[bytes], size: int = -1) -> bytes:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.read1(size)
|
||||
|
||||
return await super().read1(size)
|
||||
|
||||
async def readline(self) -> AnyStr:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.readline()
|
||||
|
||||
return await super().readline() # type: ignore[return-value]
|
||||
|
||||
async def readlines(self) -> list[AnyStr]:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.readlines()
|
||||
|
||||
return await super().readlines() # type: ignore[return-value]
|
||||
|
||||
async def readinto(self: SpooledTemporaryFile[bytes], b: WriteableBuffer) -> int:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
self._fp.readinto(b)
|
||||
|
||||
return await super().readinto(b)
|
||||
|
||||
async def readinto1(self: SpooledTemporaryFile[bytes], b: WriteableBuffer) -> int:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
self._fp.readinto(b)
|
||||
|
||||
return await super().readinto1(b)
|
||||
|
||||
async def seek(self, offset: int, whence: int | None = os.SEEK_SET) -> int:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.seek(offset, whence)
|
||||
|
||||
return await super().seek(offset, whence)
|
||||
|
||||
async def tell(self) -> int:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.tell()
|
||||
|
||||
return await super().tell()
|
||||
|
||||
async def truncate(self, size: int | None = None) -> int:
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
return self._fp.truncate(size)
|
||||
|
||||
return await super().truncate(size)
|
||||
|
||||
@overload
|
||||
async def write(self: SpooledTemporaryFile[bytes], b: ReadableBuffer) -> int: ...
|
||||
@overload
|
||||
async def write(self: SpooledTemporaryFile[str], b: str) -> int: ...
|
||||
|
||||
async def write(self, b: ReadableBuffer | str) -> int:
|
||||
"""
|
||||
Asynchronously write data to the spooled temporary file.
|
||||
|
||||
If the file has not yet been rolled over, the data is written synchronously,
|
||||
and a rollover is triggered if the size exceeds the maximum size.
|
||||
|
||||
:param s: The data to write.
|
||||
:return: The number of bytes written.
|
||||
:raises RuntimeError: If the underlying file is not initialized.
|
||||
|
||||
"""
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
result = self._fp.write(b)
|
||||
await self._check()
|
||||
return result
|
||||
|
||||
return await super().write(b) # type: ignore[misc]
|
||||
|
||||
@overload
|
||||
async def writelines(
|
||||
self: SpooledTemporaryFile[bytes], lines: Iterable[ReadableBuffer]
|
||||
) -> None: ...
|
||||
@overload
|
||||
async def writelines(
|
||||
self: SpooledTemporaryFile[str], lines: Iterable[str]
|
||||
) -> None: ...
|
||||
|
||||
async def writelines(self, lines: Iterable[str] | Iterable[ReadableBuffer]) -> None:
|
||||
"""
|
||||
Asynchronously write a list of lines to the spooled temporary file.
|
||||
|
||||
If the file has not yet been rolled over, the lines are written synchronously,
|
||||
and a rollover is triggered if the size exceeds the maximum size.
|
||||
|
||||
:param lines: An iterable of lines to write.
|
||||
:raises RuntimeError: If the underlying file is not initialized.
|
||||
|
||||
"""
|
||||
if not self._rolled:
|
||||
await checkpoint_if_cancelled()
|
||||
result = self._fp.writelines(lines)
|
||||
await self._check()
|
||||
return result
|
||||
|
||||
return await super().writelines(lines) # type: ignore[misc]
|
||||
|
||||
|
||||
class TemporaryDirectory(Generic[AnyStr]):
|
||||
"""
|
||||
An asynchronous temporary directory that is created and cleaned up automatically.
|
||||
|
||||
This class provides an asynchronous context manager for creating a temporary
|
||||
directory. It wraps Python's standard :class:`~tempfile.TemporaryDirectory` to
|
||||
perform directory creation and cleanup operations in a background thread.
|
||||
|
||||
:param suffix: Suffix to be added to the temporary directory name.
|
||||
:param prefix: Prefix to be added to the temporary directory name.
|
||||
:param dir: The parent directory where the temporary directory is created.
|
||||
:param ignore_cleanup_errors: Whether to ignore errors during cleanup
|
||||
(Python 3.10+).
|
||||
:param delete: Whether to delete the directory upon closing (Python 3.12+).
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
suffix: AnyStr | None = None,
|
||||
prefix: AnyStr | None = None,
|
||||
dir: AnyStr | None = None,
|
||||
*,
|
||||
ignore_cleanup_errors: bool = False,
|
||||
delete: bool = True,
|
||||
) -> None:
|
||||
self.suffix: AnyStr | None = suffix
|
||||
self.prefix: AnyStr | None = prefix
|
||||
self.dir: AnyStr | None = dir
|
||||
self.ignore_cleanup_errors = ignore_cleanup_errors
|
||||
self.delete = delete
|
||||
|
||||
self._tempdir: tempfile.TemporaryDirectory | None = None
|
||||
|
||||
async def __aenter__(self) -> str:
|
||||
params: dict[str, Any] = {
|
||||
"suffix": self.suffix,
|
||||
"prefix": self.prefix,
|
||||
"dir": self.dir,
|
||||
}
|
||||
if sys.version_info >= (3, 10):
|
||||
params["ignore_cleanup_errors"] = self.ignore_cleanup_errors
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
params["delete"] = self.delete
|
||||
|
||||
self._tempdir = await to_thread.run_sync(
|
||||
lambda: tempfile.TemporaryDirectory(**params)
|
||||
)
|
||||
return await to_thread.run_sync(self._tempdir.__enter__)
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_value: BaseException | None,
|
||||
traceback: TracebackType | None,
|
||||
) -> None:
|
||||
if self._tempdir is not None:
|
||||
await to_thread.run_sync(
|
||||
self._tempdir.__exit__, exc_type, exc_value, traceback
|
||||
)
|
||||
|
||||
async def cleanup(self) -> None:
|
||||
if self._tempdir is not None:
|
||||
await to_thread.run_sync(self._tempdir.cleanup)
|
||||
|
||||
|
||||
@overload
|
||||
async def mkstemp(
|
||||
suffix: str | None = None,
|
||||
prefix: str | None = None,
|
||||
dir: str | None = None,
|
||||
text: bool = False,
|
||||
) -> tuple[int, str]: ...
|
||||
|
||||
|
||||
@overload
|
||||
async def mkstemp(
|
||||
suffix: bytes | None = None,
|
||||
prefix: bytes | None = None,
|
||||
dir: bytes | None = None,
|
||||
text: bool = False,
|
||||
) -> tuple[int, bytes]: ...
|
||||
|
||||
|
||||
async def mkstemp(
|
||||
suffix: AnyStr | None = None,
|
||||
prefix: AnyStr | None = None,
|
||||
dir: AnyStr | None = None,
|
||||
text: bool = False,
|
||||
) -> tuple[int, str | bytes]:
|
||||
"""
|
||||
Asynchronously create a temporary file and return an OS-level handle and the file
|
||||
name.
|
||||
|
||||
This function wraps `tempfile.mkstemp` and executes it in a background thread.
|
||||
|
||||
:param suffix: Suffix to be added to the file name.
|
||||
:param prefix: Prefix to be added to the file name.
|
||||
:param dir: Directory in which the temporary file is created.
|
||||
:param text: Whether the file is opened in text mode.
|
||||
:return: A tuple containing the file descriptor and the file name.
|
||||
|
||||
"""
|
||||
return await to_thread.run_sync(tempfile.mkstemp, suffix, prefix, dir, text)
|
||||
|
||||
|
||||
@overload
|
||||
async def mkdtemp(
|
||||
suffix: str | None = None,
|
||||
prefix: str | None = None,
|
||||
dir: str | None = None,
|
||||
) -> str: ...
|
||||
|
||||
|
||||
@overload
|
||||
async def mkdtemp(
|
||||
suffix: bytes | None = None,
|
||||
prefix: bytes | None = None,
|
||||
dir: bytes | None = None,
|
||||
) -> bytes: ...
|
||||
|
||||
|
||||
async def mkdtemp(
|
||||
suffix: AnyStr | None = None,
|
||||
prefix: AnyStr | None = None,
|
||||
dir: AnyStr | None = None,
|
||||
) -> str | bytes:
|
||||
"""
|
||||
Asynchronously create a temporary directory and return its path.
|
||||
|
||||
This function wraps `tempfile.mkdtemp` and executes it in a background thread.
|
||||
|
||||
:param suffix: Suffix to be added to the directory name.
|
||||
:param prefix: Prefix to be added to the directory name.
|
||||
:param dir: Parent directory where the temporary directory is created.
|
||||
:return: The path of the created temporary directory.
|
||||
|
||||
"""
|
||||
return await to_thread.run_sync(tempfile.mkdtemp, suffix, prefix, dir)
|
||||
|
||||
|
||||
async def gettempdir() -> str:
|
||||
"""
|
||||
Asynchronously return the name of the directory used for temporary files.
|
||||
|
||||
This function wraps `tempfile.gettempdir` and executes it in a background thread.
|
||||
|
||||
:return: The path of the temporary directory as a string.
|
||||
|
||||
"""
|
||||
return await to_thread.run_sync(tempfile.gettempdir)
|
||||
|
||||
|
||||
async def gettempdirb() -> bytes:
|
||||
"""
|
||||
Asynchronously return the name of the directory used for temporary files in bytes.
|
||||
|
||||
This function wraps `tempfile.gettempdirb` and executes it in a background thread.
|
||||
|
||||
:return: The path of the temporary directory as bytes.
|
||||
|
||||
"""
|
||||
return await to_thread.run_sync(tempfile.gettempdirb)
|
||||
82
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_testing.py
vendored
Executable file
82
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_testing.py
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Generator
|
||||
from typing import Any, cast
|
||||
|
||||
from ._eventloop import get_async_backend
|
||||
|
||||
|
||||
class TaskInfo:
|
||||
"""
|
||||
Represents an asynchronous task.
|
||||
|
||||
:ivar int id: the unique identifier of the task
|
||||
:ivar parent_id: the identifier of the parent task, if any
|
||||
:vartype parent_id: Optional[int]
|
||||
:ivar str name: the description of the task (if any)
|
||||
:ivar ~collections.abc.Coroutine coro: the coroutine object of the task
|
||||
"""
|
||||
|
||||
__slots__ = "_name", "id", "parent_id", "name", "coro"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
id: int,
|
||||
parent_id: int | None,
|
||||
name: str | None,
|
||||
coro: Generator[Any, Any, Any] | Awaitable[Any],
|
||||
):
|
||||
func = get_current_task
|
||||
self._name = f"{func.__module__}.{func.__qualname__}"
|
||||
self.id: int = id
|
||||
self.parent_id: int | None = parent_id
|
||||
self.name: str | None = name
|
||||
self.coro: Generator[Any, Any, Any] | Awaitable[Any] = coro
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if isinstance(other, TaskInfo):
|
||||
return self.id == other.id
|
||||
|
||||
return NotImplemented
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.id)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"{self.__class__.__name__}(id={self.id!r}, name={self.name!r})"
|
||||
|
||||
def has_pending_cancellation(self) -> bool:
|
||||
"""
|
||||
Return ``True`` if the task has a cancellation pending, ``False`` otherwise.
|
||||
|
||||
"""
|
||||
return False
|
||||
|
||||
|
||||
def get_current_task() -> TaskInfo:
|
||||
"""
|
||||
Return the current task.
|
||||
|
||||
:return: a representation of the current task
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return get_async_backend().get_current_task()
|
||||
|
||||
|
||||
def get_running_tasks() -> list[TaskInfo]:
|
||||
"""
|
||||
Return a list of running tasks in the current event loop.
|
||||
|
||||
:return: a list of task info objects
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
"""
|
||||
return cast("list[TaskInfo]", get_async_backend().get_running_tasks())
|
||||
|
||||
|
||||
async def wait_all_tasks_blocked() -> None:
|
||||
"""Wait until all other tasks are waiting for something."""
|
||||
await get_async_backend().wait_all_tasks_blocked()
|
||||
81
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_typedattr.py
vendored
Executable file
81
dev/env/cli_env/lib/python3.13/site-packages/anyio/_core/_typedattr.py
vendored
Executable file
@@ -0,0 +1,81 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any, TypeVar, final, overload
|
||||
|
||||
from ._exceptions import TypedAttributeLookupError
|
||||
|
||||
T_Attr = TypeVar("T_Attr")
|
||||
T_Default = TypeVar("T_Default")
|
||||
undefined = object()
|
||||
|
||||
|
||||
def typed_attribute() -> Any:
|
||||
"""Return a unique object, used to mark typed attributes."""
|
||||
return object()
|
||||
|
||||
|
||||
class TypedAttributeSet:
|
||||
"""
|
||||
Superclass for typed attribute collections.
|
||||
|
||||
Checks that every public attribute of every subclass has a type annotation.
|
||||
"""
|
||||
|
||||
def __init_subclass__(cls) -> None:
|
||||
annotations: dict[str, Any] = getattr(cls, "__annotations__", {})
|
||||
for attrname in dir(cls):
|
||||
if not attrname.startswith("_") and attrname not in annotations:
|
||||
raise TypeError(
|
||||
f"Attribute {attrname!r} is missing its type annotation"
|
||||
)
|
||||
|
||||
super().__init_subclass__()
|
||||
|
||||
|
||||
class TypedAttributeProvider:
|
||||
"""Base class for classes that wish to provide typed extra attributes."""
|
||||
|
||||
@property
|
||||
def extra_attributes(self) -> Mapping[T_Attr, Callable[[], T_Attr]]:
|
||||
"""
|
||||
A mapping of the extra attributes to callables that return the corresponding
|
||||
values.
|
||||
|
||||
If the provider wraps another provider, the attributes from that wrapper should
|
||||
also be included in the returned mapping (but the wrapper may override the
|
||||
callables from the wrapped instance).
|
||||
|
||||
"""
|
||||
return {}
|
||||
|
||||
@overload
|
||||
def extra(self, attribute: T_Attr) -> T_Attr: ...
|
||||
|
||||
@overload
|
||||
def extra(self, attribute: T_Attr, default: T_Default) -> T_Attr | T_Default: ...
|
||||
|
||||
@final
|
||||
def extra(self, attribute: Any, default: object = undefined) -> object:
|
||||
"""
|
||||
extra(attribute, default=undefined)
|
||||
|
||||
Return the value of the given typed extra attribute.
|
||||
|
||||
:param attribute: the attribute (member of a :class:`~TypedAttributeSet`) to
|
||||
look for
|
||||
:param default: the value that should be returned if no value is found for the
|
||||
attribute
|
||||
:raises ~anyio.TypedAttributeLookupError: if the search failed and no default
|
||||
value was given
|
||||
|
||||
"""
|
||||
try:
|
||||
getter = self.extra_attributes[attribute]
|
||||
except KeyError:
|
||||
if default is undefined:
|
||||
raise TypedAttributeLookupError("Attribute not found") from None
|
||||
else:
|
||||
return default
|
||||
|
||||
return getter()
|
||||
58
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/__init__.py
vendored
Executable file
58
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/__init__.py
vendored
Executable file
@@ -0,0 +1,58 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ._eventloop import AsyncBackend as AsyncBackend
|
||||
from ._resources import AsyncResource as AsyncResource
|
||||
from ._sockets import ConnectedUDPSocket as ConnectedUDPSocket
|
||||
from ._sockets import ConnectedUNIXDatagramSocket as ConnectedUNIXDatagramSocket
|
||||
from ._sockets import IPAddressType as IPAddressType
|
||||
from ._sockets import IPSockAddrType as IPSockAddrType
|
||||
from ._sockets import SocketAttribute as SocketAttribute
|
||||
from ._sockets import SocketListener as SocketListener
|
||||
from ._sockets import SocketStream as SocketStream
|
||||
from ._sockets import UDPPacketType as UDPPacketType
|
||||
from ._sockets import UDPSocket as UDPSocket
|
||||
from ._sockets import UNIXDatagramPacketType as UNIXDatagramPacketType
|
||||
from ._sockets import UNIXDatagramSocket as UNIXDatagramSocket
|
||||
from ._sockets import UNIXSocketStream as UNIXSocketStream
|
||||
from ._streams import AnyByteReceiveStream as AnyByteReceiveStream
|
||||
from ._streams import AnyByteSendStream as AnyByteSendStream
|
||||
from ._streams import AnyByteStream as AnyByteStream
|
||||
from ._streams import AnyByteStreamConnectable as AnyByteStreamConnectable
|
||||
from ._streams import AnyUnreliableByteReceiveStream as AnyUnreliableByteReceiveStream
|
||||
from ._streams import AnyUnreliableByteSendStream as AnyUnreliableByteSendStream
|
||||
from ._streams import AnyUnreliableByteStream as AnyUnreliableByteStream
|
||||
from ._streams import ByteReceiveStream as ByteReceiveStream
|
||||
from ._streams import ByteSendStream as ByteSendStream
|
||||
from ._streams import ByteStream as ByteStream
|
||||
from ._streams import ByteStreamConnectable as ByteStreamConnectable
|
||||
from ._streams import Listener as Listener
|
||||
from ._streams import ObjectReceiveStream as ObjectReceiveStream
|
||||
from ._streams import ObjectSendStream as ObjectSendStream
|
||||
from ._streams import ObjectStream as ObjectStream
|
||||
from ._streams import ObjectStreamConnectable as ObjectStreamConnectable
|
||||
from ._streams import UnreliableObjectReceiveStream as UnreliableObjectReceiveStream
|
||||
from ._streams import UnreliableObjectSendStream as UnreliableObjectSendStream
|
||||
from ._streams import UnreliableObjectStream as UnreliableObjectStream
|
||||
from ._subprocesses import Process as Process
|
||||
from ._tasks import TaskGroup as TaskGroup
|
||||
from ._tasks import TaskStatus as TaskStatus
|
||||
from ._testing import TestRunner as TestRunner
|
||||
|
||||
# Re-exported here, for backwards compatibility
|
||||
# isort: off
|
||||
from .._core._synchronization import (
|
||||
CapacityLimiter as CapacityLimiter,
|
||||
Condition as Condition,
|
||||
Event as Event,
|
||||
Lock as Lock,
|
||||
Semaphore as Semaphore,
|
||||
)
|
||||
from .._core._tasks import CancelScope as CancelScope
|
||||
from ..from_thread import BlockingPortal as BlockingPortal
|
||||
|
||||
# Re-export imports so they look like they live directly in this package
|
||||
for __value in list(locals().values()):
|
||||
if getattr(__value, "__module__", "").startswith("anyio.abc."):
|
||||
__value.__module__ = __name__
|
||||
|
||||
del __value
|
||||
414
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_eventloop.py
vendored
Executable file
414
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_eventloop.py
vendored
Executable file
@@ -0,0 +1,414 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import AsyncIterator, Awaitable, Callable, Sequence
|
||||
from contextlib import AbstractContextManager
|
||||
from os import PathLike
|
||||
from signal import Signals
|
||||
from socket import AddressFamily, SocketKind, socket
|
||||
from typing import (
|
||||
IO,
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypeVarTuple, Unpack
|
||||
else:
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import TypeAlias
|
||||
else:
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _typeshed import FileDescriptorLike
|
||||
|
||||
from .._core._synchronization import CapacityLimiter, Event, Lock, Semaphore
|
||||
from .._core._tasks import CancelScope
|
||||
from .._core._testing import TaskInfo
|
||||
from ._sockets import (
|
||||
ConnectedUDPSocket,
|
||||
ConnectedUNIXDatagramSocket,
|
||||
IPSockAddrType,
|
||||
SocketListener,
|
||||
SocketStream,
|
||||
UDPSocket,
|
||||
UNIXDatagramSocket,
|
||||
UNIXSocketStream,
|
||||
)
|
||||
from ._subprocesses import Process
|
||||
from ._tasks import TaskGroup
|
||||
from ._testing import TestRunner
|
||||
|
||||
T_Retval = TypeVar("T_Retval")
|
||||
PosArgsT = TypeVarTuple("PosArgsT")
|
||||
StrOrBytesPath: TypeAlias = Union[str, bytes, "PathLike[str]", "PathLike[bytes]"]
|
||||
|
||||
|
||||
class AsyncBackend(metaclass=ABCMeta):
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def run(
|
||||
cls,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
kwargs: dict[str, Any],
|
||||
options: dict[str, Any],
|
||||
) -> T_Retval:
|
||||
"""
|
||||
Run the given coroutine function in an asynchronous event loop.
|
||||
|
||||
The current thread must not be already running an event loop.
|
||||
|
||||
:param func: a coroutine function
|
||||
:param args: positional arguments to ``func``
|
||||
:param kwargs: positional arguments to ``func``
|
||||
:param options: keyword arguments to call the backend ``run()`` implementation
|
||||
with
|
||||
:return: the return value of the coroutine function
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def current_token(cls) -> object:
|
||||
"""
|
||||
Return an object that allows other threads to run code inside the event loop.
|
||||
|
||||
:return: a token object, specific to the event loop running in the current
|
||||
thread
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def current_time(cls) -> float:
|
||||
"""
|
||||
Return the current value of the event loop's internal clock.
|
||||
|
||||
:return: the clock value (seconds)
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def cancelled_exception_class(cls) -> type[BaseException]:
|
||||
"""Return the exception class that is raised in a task if it's cancelled."""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def checkpoint(cls) -> None:
|
||||
"""
|
||||
Check if the task has been cancelled, and allow rescheduling of other tasks.
|
||||
|
||||
This is effectively the same as running :meth:`checkpoint_if_cancelled` and then
|
||||
:meth:`cancel_shielded_checkpoint`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def checkpoint_if_cancelled(cls) -> None:
|
||||
"""
|
||||
Check if the current task group has been cancelled.
|
||||
|
||||
This will check if the task has been cancelled, but will not allow other tasks
|
||||
to be scheduled if not.
|
||||
|
||||
"""
|
||||
if cls.current_effective_deadline() == -math.inf:
|
||||
await cls.checkpoint()
|
||||
|
||||
@classmethod
|
||||
async def cancel_shielded_checkpoint(cls) -> None:
|
||||
"""
|
||||
Allow the rescheduling of other tasks.
|
||||
|
||||
This will give other tasks the opportunity to run, but without checking if the
|
||||
current task group has been cancelled, unlike with :meth:`checkpoint`.
|
||||
|
||||
"""
|
||||
with cls.create_cancel_scope(shield=True):
|
||||
await cls.sleep(0)
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def sleep(cls, delay: float) -> None:
|
||||
"""
|
||||
Pause the current task for the specified duration.
|
||||
|
||||
:param delay: the duration, in seconds
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_cancel_scope(
|
||||
cls, *, deadline: float = math.inf, shield: bool = False
|
||||
) -> CancelScope:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def current_effective_deadline(cls) -> float:
|
||||
"""
|
||||
Return the nearest deadline among all the cancel scopes effective for the
|
||||
current task.
|
||||
|
||||
:return:
|
||||
- a clock value from the event loop's internal clock
|
||||
- ``inf`` if there is no deadline in effect
|
||||
- ``-inf`` if the current scope has been cancelled
|
||||
:rtype: float
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_task_group(cls) -> TaskGroup:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_event(cls) -> Event:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_lock(cls, *, fast_acquire: bool) -> Lock:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_semaphore(
|
||||
cls,
|
||||
initial_value: int,
|
||||
*,
|
||||
max_value: int | None = None,
|
||||
fast_acquire: bool = False,
|
||||
) -> Semaphore:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_capacity_limiter(cls, total_tokens: float) -> CapacityLimiter:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def run_sync_in_worker_thread(
|
||||
cls,
|
||||
func: Callable[[Unpack[PosArgsT]], T_Retval],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
abandon_on_cancel: bool = False,
|
||||
limiter: CapacityLimiter | None = None,
|
||||
) -> T_Retval:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def check_cancelled(cls) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def run_async_from_thread(
|
||||
cls,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
token: object,
|
||||
) -> T_Retval:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def run_sync_from_thread(
|
||||
cls,
|
||||
func: Callable[[Unpack[PosArgsT]], T_Retval],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
token: object,
|
||||
) -> T_Retval:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def open_process(
|
||||
cls,
|
||||
command: StrOrBytesPath | Sequence[StrOrBytesPath],
|
||||
*,
|
||||
stdin: int | IO[Any] | None,
|
||||
stdout: int | IO[Any] | None,
|
||||
stderr: int | IO[Any] | None,
|
||||
**kwargs: Any,
|
||||
) -> Process:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def setup_process_pool_exit_at_shutdown(cls, workers: set[Process]) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def connect_tcp(
|
||||
cls, host: str, port: int, local_address: IPSockAddrType | None = None
|
||||
) -> SocketStream:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def connect_unix(cls, path: str | bytes) -> UNIXSocketStream:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_tcp_listener(cls, sock: socket) -> SocketListener:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_unix_listener(cls, sock: socket) -> SocketListener:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def create_udp_socket(
|
||||
cls,
|
||||
family: AddressFamily,
|
||||
local_address: IPSockAddrType | None,
|
||||
remote_address: IPSockAddrType | None,
|
||||
reuse_port: bool,
|
||||
) -> UDPSocket | ConnectedUDPSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@overload
|
||||
async def create_unix_datagram_socket(
|
||||
cls, raw_socket: socket, remote_path: None
|
||||
) -> UNIXDatagramSocket: ...
|
||||
|
||||
@classmethod
|
||||
@overload
|
||||
async def create_unix_datagram_socket(
|
||||
cls, raw_socket: socket, remote_path: str | bytes
|
||||
) -> ConnectedUNIXDatagramSocket: ...
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def create_unix_datagram_socket(
|
||||
cls, raw_socket: socket, remote_path: str | bytes | None
|
||||
) -> UNIXDatagramSocket | ConnectedUNIXDatagramSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def getaddrinfo(
|
||||
cls,
|
||||
host: bytes | str | None,
|
||||
port: str | int | None,
|
||||
*,
|
||||
family: int | AddressFamily = 0,
|
||||
type: int | SocketKind = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
) -> Sequence[
|
||||
tuple[
|
||||
AddressFamily,
|
||||
SocketKind,
|
||||
int,
|
||||
str,
|
||||
tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes],
|
||||
]
|
||||
]:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def getnameinfo(
|
||||
cls, sockaddr: IPSockAddrType, flags: int = 0
|
||||
) -> tuple[str, str]:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wait_readable(cls, obj: FileDescriptorLike) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wait_writable(cls, obj: FileDescriptorLike) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def notify_closing(cls, obj: FileDescriptorLike) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_listener_socket(cls, sock: socket) -> SocketListener:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_stream_socket(cls, sock: socket) -> SocketStream:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_unix_stream_socket(cls, sock: socket) -> UNIXSocketStream:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_udp_socket(cls, sock: socket) -> UDPSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_connected_udp_socket(cls, sock: socket) -> ConnectedUDPSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_unix_datagram_socket(cls, sock: socket) -> UNIXDatagramSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wrap_connected_unix_datagram_socket(
|
||||
cls, sock: socket
|
||||
) -> ConnectedUNIXDatagramSocket:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def current_default_thread_limiter(cls) -> CapacityLimiter:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def open_signal_receiver(
|
||||
cls, *signals: Signals
|
||||
) -> AbstractContextManager[AsyncIterator[Signals]]:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def get_current_task(cls) -> TaskInfo:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def get_running_tasks(cls) -> Sequence[TaskInfo]:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
async def wait_all_tasks_blocked(cls) -> None:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def create_test_runner(cls, options: dict[str, Any]) -> TestRunner:
|
||||
pass
|
||||
33
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_resources.py
vendored
Executable file
33
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_resources.py
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from types import TracebackType
|
||||
from typing import TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class AsyncResource(metaclass=ABCMeta):
|
||||
"""
|
||||
Abstract base class for all closeable asynchronous resources.
|
||||
|
||||
Works as an asynchronous context manager which returns the instance itself on enter,
|
||||
and calls :meth:`aclose` on exit.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
async def __aenter__(self: T) -> T:
|
||||
return self
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
await self.aclose()
|
||||
|
||||
@abstractmethod
|
||||
async def aclose(self) -> None:
|
||||
"""Close the resource."""
|
||||
405
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_sockets.py
vendored
Executable file
405
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_sockets.py
vendored
Executable file
@@ -0,0 +1,405 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import errno
|
||||
import socket
|
||||
import sys
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Collection, Mapping
|
||||
from contextlib import AsyncExitStack
|
||||
from io import IOBase
|
||||
from ipaddress import IPv4Address, IPv6Address
|
||||
from socket import AddressFamily
|
||||
from typing import Any, TypeVar, Union
|
||||
|
||||
from .._core._eventloop import get_async_backend
|
||||
from .._core._typedattr import (
|
||||
TypedAttributeProvider,
|
||||
TypedAttributeSet,
|
||||
typed_attribute,
|
||||
)
|
||||
from ._streams import ByteStream, Listener, UnreliableObjectStream
|
||||
from ._tasks import TaskGroup
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import TypeAlias
|
||||
else:
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
IPAddressType: TypeAlias = Union[str, IPv4Address, IPv6Address]
|
||||
IPSockAddrType: TypeAlias = tuple[str, int]
|
||||
SockAddrType: TypeAlias = Union[IPSockAddrType, str]
|
||||
UDPPacketType: TypeAlias = tuple[bytes, IPSockAddrType]
|
||||
UNIXDatagramPacketType: TypeAlias = tuple[bytes, str]
|
||||
T_Retval = TypeVar("T_Retval")
|
||||
|
||||
|
||||
def _validate_socket(
|
||||
sock_or_fd: socket.socket | int,
|
||||
sock_type: socket.SocketKind,
|
||||
addr_family: socket.AddressFamily = socket.AF_UNSPEC,
|
||||
*,
|
||||
require_connected: bool = False,
|
||||
require_bound: bool = False,
|
||||
) -> socket.socket:
|
||||
if isinstance(sock_or_fd, int):
|
||||
try:
|
||||
sock = socket.socket(fileno=sock_or_fd)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.ENOTSOCK:
|
||||
raise ValueError(
|
||||
"the file descriptor does not refer to a socket"
|
||||
) from exc
|
||||
elif require_connected:
|
||||
raise ValueError("the socket must be connected") from exc
|
||||
elif require_bound:
|
||||
raise ValueError("the socket must be bound to a local address") from exc
|
||||
else:
|
||||
raise
|
||||
elif isinstance(sock_or_fd, socket.socket):
|
||||
sock = sock_or_fd
|
||||
else:
|
||||
raise TypeError(
|
||||
f"expected an int or socket, got {type(sock_or_fd).__qualname__} instead"
|
||||
)
|
||||
|
||||
try:
|
||||
if require_connected:
|
||||
try:
|
||||
sock.getpeername()
|
||||
except OSError as exc:
|
||||
raise ValueError("the socket must be connected") from exc
|
||||
|
||||
if require_bound:
|
||||
try:
|
||||
if sock.family in (socket.AF_INET, socket.AF_INET6):
|
||||
bound_addr = sock.getsockname()[1]
|
||||
else:
|
||||
bound_addr = sock.getsockname()
|
||||
except OSError:
|
||||
bound_addr = None
|
||||
|
||||
if not bound_addr:
|
||||
raise ValueError("the socket must be bound to a local address")
|
||||
|
||||
if addr_family != socket.AF_UNSPEC and sock.family != addr_family:
|
||||
raise ValueError(
|
||||
f"address family mismatch: expected {addr_family.name}, got "
|
||||
f"{sock.family.name}"
|
||||
)
|
||||
|
||||
if sock.type != sock_type:
|
||||
raise ValueError(
|
||||
f"socket type mismatch: expected {sock_type.name}, got {sock.type.name}"
|
||||
)
|
||||
except BaseException:
|
||||
# Avoid ResourceWarning from the locally constructed socket object
|
||||
if isinstance(sock_or_fd, int):
|
||||
sock.detach()
|
||||
|
||||
raise
|
||||
|
||||
sock.setblocking(False)
|
||||
return sock
|
||||
|
||||
|
||||
class SocketAttribute(TypedAttributeSet):
|
||||
"""
|
||||
.. attribute:: family
|
||||
:type: socket.AddressFamily
|
||||
|
||||
the address family of the underlying socket
|
||||
|
||||
.. attribute:: local_address
|
||||
:type: tuple[str, int] | str
|
||||
|
||||
the local address the underlying socket is connected to
|
||||
|
||||
.. attribute:: local_port
|
||||
:type: int
|
||||
|
||||
for IP based sockets, the local port the underlying socket is bound to
|
||||
|
||||
.. attribute:: raw_socket
|
||||
:type: socket.socket
|
||||
|
||||
the underlying stdlib socket object
|
||||
|
||||
.. attribute:: remote_address
|
||||
:type: tuple[str, int] | str
|
||||
|
||||
the remote address the underlying socket is connected to
|
||||
|
||||
.. attribute:: remote_port
|
||||
:type: int
|
||||
|
||||
for IP based sockets, the remote port the underlying socket is connected to
|
||||
"""
|
||||
|
||||
family: AddressFamily = typed_attribute()
|
||||
local_address: SockAddrType = typed_attribute()
|
||||
local_port: int = typed_attribute()
|
||||
raw_socket: socket.socket = typed_attribute()
|
||||
remote_address: SockAddrType = typed_attribute()
|
||||
remote_port: int = typed_attribute()
|
||||
|
||||
|
||||
class _SocketProvider(TypedAttributeProvider):
|
||||
@property
|
||||
def extra_attributes(self) -> Mapping[Any, Callable[[], Any]]:
|
||||
from .._core._sockets import convert_ipv6_sockaddr as convert
|
||||
|
||||
attributes: dict[Any, Callable[[], Any]] = {
|
||||
SocketAttribute.family: lambda: self._raw_socket.family,
|
||||
SocketAttribute.local_address: lambda: convert(
|
||||
self._raw_socket.getsockname()
|
||||
),
|
||||
SocketAttribute.raw_socket: lambda: self._raw_socket,
|
||||
}
|
||||
try:
|
||||
peername: tuple[str, int] | None = convert(self._raw_socket.getpeername())
|
||||
except OSError:
|
||||
peername = None
|
||||
|
||||
# Provide the remote address for connected sockets
|
||||
if peername is not None:
|
||||
attributes[SocketAttribute.remote_address] = lambda: peername
|
||||
|
||||
# Provide local and remote ports for IP based sockets
|
||||
if self._raw_socket.family in (AddressFamily.AF_INET, AddressFamily.AF_INET6):
|
||||
attributes[SocketAttribute.local_port] = (
|
||||
lambda: self._raw_socket.getsockname()[1]
|
||||
)
|
||||
if peername is not None:
|
||||
remote_port = peername[1]
|
||||
attributes[SocketAttribute.remote_port] = lambda: remote_port
|
||||
|
||||
return attributes
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def _raw_socket(self) -> socket.socket:
|
||||
pass
|
||||
|
||||
|
||||
class SocketStream(ByteStream, _SocketProvider):
|
||||
"""
|
||||
Transports bytes over a socket.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(cls, sock_or_fd: socket.socket | int) -> SocketStream:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a socket stream.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
The existing socket must already be connected.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a socket stream
|
||||
|
||||
"""
|
||||
sock = _validate_socket(sock_or_fd, socket.SOCK_STREAM, require_connected=True)
|
||||
return await get_async_backend().wrap_stream_socket(sock)
|
||||
|
||||
|
||||
class UNIXSocketStream(SocketStream):
|
||||
@classmethod
|
||||
async def from_socket(cls, sock_or_fd: socket.socket | int) -> UNIXSocketStream:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a UNIX socket stream.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
The existing socket must already be connected.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a UNIX socket stream
|
||||
|
||||
"""
|
||||
sock = _validate_socket(
|
||||
sock_or_fd, socket.SOCK_STREAM, socket.AF_UNIX, require_connected=True
|
||||
)
|
||||
return await get_async_backend().wrap_unix_stream_socket(sock)
|
||||
|
||||
@abstractmethod
|
||||
async def send_fds(self, message: bytes, fds: Collection[int | IOBase]) -> None:
|
||||
"""
|
||||
Send file descriptors along with a message to the peer.
|
||||
|
||||
:param message: a non-empty bytestring
|
||||
:param fds: a collection of files (either numeric file descriptors or open file
|
||||
or socket objects)
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def receive_fds(self, msglen: int, maxfds: int) -> tuple[bytes, list[int]]:
|
||||
"""
|
||||
Receive file descriptors along with a message from the peer.
|
||||
|
||||
:param msglen: length of the message to expect from the peer
|
||||
:param maxfds: maximum number of file descriptors to expect from the peer
|
||||
:return: a tuple of (message, file descriptors)
|
||||
"""
|
||||
|
||||
|
||||
class SocketListener(Listener[SocketStream], _SocketProvider):
|
||||
"""
|
||||
Listens to incoming socket connections.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(
|
||||
cls,
|
||||
sock_or_fd: socket.socket | int,
|
||||
) -> SocketListener:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a socket listener.
|
||||
|
||||
The newly created listener takes ownership of the socket being passed in.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a socket listener
|
||||
|
||||
"""
|
||||
sock = _validate_socket(sock_or_fd, socket.SOCK_STREAM, require_bound=True)
|
||||
return await get_async_backend().wrap_listener_socket(sock)
|
||||
|
||||
@abstractmethod
|
||||
async def accept(self) -> SocketStream:
|
||||
"""Accept an incoming connection."""
|
||||
|
||||
async def serve(
|
||||
self,
|
||||
handler: Callable[[SocketStream], Any],
|
||||
task_group: TaskGroup | None = None,
|
||||
) -> None:
|
||||
from .. import create_task_group
|
||||
|
||||
async with AsyncExitStack() as stack:
|
||||
if task_group is None:
|
||||
task_group = await stack.enter_async_context(create_task_group())
|
||||
|
||||
while True:
|
||||
stream = await self.accept()
|
||||
task_group.start_soon(handler, stream)
|
||||
|
||||
|
||||
class UDPSocket(UnreliableObjectStream[UDPPacketType], _SocketProvider):
|
||||
"""
|
||||
Represents an unconnected UDP socket.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(cls, sock_or_fd: socket.socket | int) -> UDPSocket:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a UDP socket.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
The existing socket must be bound to a local address.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a UDP socket
|
||||
|
||||
"""
|
||||
sock = _validate_socket(sock_or_fd, socket.SOCK_DGRAM, require_bound=True)
|
||||
return await get_async_backend().wrap_udp_socket(sock)
|
||||
|
||||
async def sendto(self, data: bytes, host: str, port: int) -> None:
|
||||
"""
|
||||
Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, (host, port))).
|
||||
|
||||
"""
|
||||
return await self.send((data, (host, port)))
|
||||
|
||||
|
||||
class ConnectedUDPSocket(UnreliableObjectStream[bytes], _SocketProvider):
|
||||
"""
|
||||
Represents an connected UDP socket.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(cls, sock_or_fd: socket.socket | int) -> ConnectedUDPSocket:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a connected UDP socket.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
The existing socket must already be connected.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a connected UDP socket
|
||||
|
||||
"""
|
||||
sock = _validate_socket(
|
||||
sock_or_fd,
|
||||
socket.SOCK_DGRAM,
|
||||
require_connected=True,
|
||||
)
|
||||
return await get_async_backend().wrap_connected_udp_socket(sock)
|
||||
|
||||
|
||||
class UNIXDatagramSocket(
|
||||
UnreliableObjectStream[UNIXDatagramPacketType], _SocketProvider
|
||||
):
|
||||
"""
|
||||
Represents an unconnected Unix datagram socket.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(
|
||||
cls,
|
||||
sock_or_fd: socket.socket | int,
|
||||
) -> UNIXDatagramSocket:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a UNIX datagram
|
||||
socket.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a UNIX datagram socket
|
||||
|
||||
"""
|
||||
sock = _validate_socket(sock_or_fd, socket.SOCK_DGRAM, socket.AF_UNIX)
|
||||
return await get_async_backend().wrap_unix_datagram_socket(sock)
|
||||
|
||||
async def sendto(self, data: bytes, path: str) -> None:
|
||||
"""Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, path))."""
|
||||
return await self.send((data, path))
|
||||
|
||||
|
||||
class ConnectedUNIXDatagramSocket(UnreliableObjectStream[bytes], _SocketProvider):
|
||||
"""
|
||||
Represents a connected Unix datagram socket.
|
||||
|
||||
Supports all relevant extra attributes from :class:`~SocketAttribute`.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
async def from_socket(
|
||||
cls,
|
||||
sock_or_fd: socket.socket | int,
|
||||
) -> ConnectedUNIXDatagramSocket:
|
||||
"""
|
||||
Wrap an existing socket object or file descriptor as a connected UNIX datagram
|
||||
socket.
|
||||
|
||||
The newly created socket wrapper takes ownership of the socket being passed in.
|
||||
The existing socket must already be connected.
|
||||
|
||||
:param sock_or_fd: a socket object or file descriptor
|
||||
:return: a connected UNIX datagram socket
|
||||
|
||||
"""
|
||||
sock = _validate_socket(
|
||||
sock_or_fd, socket.SOCK_DGRAM, socket.AF_UNIX, require_connected=True
|
||||
)
|
||||
return await get_async_backend().wrap_connected_unix_datagram_socket(sock)
|
||||
239
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_streams.py
vendored
Executable file
239
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_streams.py
vendored
Executable file
@@ -0,0 +1,239 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Generic, TypeVar, Union
|
||||
|
||||
from .._core._exceptions import EndOfStream
|
||||
from .._core._typedattr import TypedAttributeProvider
|
||||
from ._resources import AsyncResource
|
||||
from ._tasks import TaskGroup
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from typing import TypeAlias
|
||||
else:
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
T_Item = TypeVar("T_Item")
|
||||
T_co = TypeVar("T_co", covariant=True)
|
||||
T_contra = TypeVar("T_contra", contravariant=True)
|
||||
|
||||
|
||||
class UnreliableObjectReceiveStream(
|
||||
Generic[T_co], AsyncResource, TypedAttributeProvider
|
||||
):
|
||||
"""
|
||||
An interface for receiving objects.
|
||||
|
||||
This interface makes no guarantees that the received messages arrive in the order in
|
||||
which they were sent, or that no messages are missed.
|
||||
|
||||
Asynchronously iterating over objects of this type will yield objects matching the
|
||||
given type parameter.
|
||||
"""
|
||||
|
||||
def __aiter__(self) -> UnreliableObjectReceiveStream[T_co]:
|
||||
return self
|
||||
|
||||
async def __anext__(self) -> T_co:
|
||||
try:
|
||||
return await self.receive()
|
||||
except EndOfStream:
|
||||
raise StopAsyncIteration from None
|
||||
|
||||
@abstractmethod
|
||||
async def receive(self) -> T_co:
|
||||
"""
|
||||
Receive the next item.
|
||||
|
||||
:raises ~anyio.ClosedResourceError: if the receive stream has been explicitly
|
||||
closed
|
||||
:raises ~anyio.EndOfStream: if this stream has been closed from the other end
|
||||
:raises ~anyio.BrokenResourceError: if this stream has been rendered unusable
|
||||
due to external causes
|
||||
"""
|
||||
|
||||
|
||||
class UnreliableObjectSendStream(
|
||||
Generic[T_contra], AsyncResource, TypedAttributeProvider
|
||||
):
|
||||
"""
|
||||
An interface for sending objects.
|
||||
|
||||
This interface makes no guarantees that the messages sent will reach the
|
||||
recipient(s) in the same order in which they were sent, or at all.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def send(self, item: T_contra) -> None:
|
||||
"""
|
||||
Send an item to the peer(s).
|
||||
|
||||
:param item: the item to send
|
||||
:raises ~anyio.ClosedResourceError: if the send stream has been explicitly
|
||||
closed
|
||||
:raises ~anyio.BrokenResourceError: if this stream has been rendered unusable
|
||||
due to external causes
|
||||
"""
|
||||
|
||||
|
||||
class UnreliableObjectStream(
|
||||
UnreliableObjectReceiveStream[T_Item], UnreliableObjectSendStream[T_Item]
|
||||
):
|
||||
"""
|
||||
A bidirectional message stream which does not guarantee the order or reliability of
|
||||
message delivery.
|
||||
"""
|
||||
|
||||
|
||||
class ObjectReceiveStream(UnreliableObjectReceiveStream[T_co]):
|
||||
"""
|
||||
A receive message stream which guarantees that messages are received in the same
|
||||
order in which they were sent, and that no messages are missed.
|
||||
"""
|
||||
|
||||
|
||||
class ObjectSendStream(UnreliableObjectSendStream[T_contra]):
|
||||
"""
|
||||
A send message stream which guarantees that messages are delivered in the same order
|
||||
in which they were sent, without missing any messages in the middle.
|
||||
"""
|
||||
|
||||
|
||||
class ObjectStream(
|
||||
ObjectReceiveStream[T_Item],
|
||||
ObjectSendStream[T_Item],
|
||||
UnreliableObjectStream[T_Item],
|
||||
):
|
||||
"""
|
||||
A bidirectional message stream which guarantees the order and reliability of message
|
||||
delivery.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def send_eof(self) -> None:
|
||||
"""
|
||||
Send an end-of-file indication to the peer.
|
||||
|
||||
You should not try to send any further data to this stream after calling this
|
||||
method. This method is idempotent (does nothing on successive calls).
|
||||
"""
|
||||
|
||||
|
||||
class ByteReceiveStream(AsyncResource, TypedAttributeProvider):
|
||||
"""
|
||||
An interface for receiving bytes from a single peer.
|
||||
|
||||
Iterating this byte stream will yield a byte string of arbitrary length, but no more
|
||||
than 65536 bytes.
|
||||
"""
|
||||
|
||||
def __aiter__(self) -> ByteReceiveStream:
|
||||
return self
|
||||
|
||||
async def __anext__(self) -> bytes:
|
||||
try:
|
||||
return await self.receive()
|
||||
except EndOfStream:
|
||||
raise StopAsyncIteration from None
|
||||
|
||||
@abstractmethod
|
||||
async def receive(self, max_bytes: int = 65536) -> bytes:
|
||||
"""
|
||||
Receive at most ``max_bytes`` bytes from the peer.
|
||||
|
||||
.. note:: Implementers of this interface should not return an empty
|
||||
:class:`bytes` object, and users should ignore them.
|
||||
|
||||
:param max_bytes: maximum number of bytes to receive
|
||||
:return: the received bytes
|
||||
:raises ~anyio.EndOfStream: if this stream has been closed from the other end
|
||||
"""
|
||||
|
||||
|
||||
class ByteSendStream(AsyncResource, TypedAttributeProvider):
|
||||
"""An interface for sending bytes to a single peer."""
|
||||
|
||||
@abstractmethod
|
||||
async def send(self, item: bytes) -> None:
|
||||
"""
|
||||
Send the given bytes to the peer.
|
||||
|
||||
:param item: the bytes to send
|
||||
"""
|
||||
|
||||
|
||||
class ByteStream(ByteReceiveStream, ByteSendStream):
|
||||
"""A bidirectional byte stream."""
|
||||
|
||||
@abstractmethod
|
||||
async def send_eof(self) -> None:
|
||||
"""
|
||||
Send an end-of-file indication to the peer.
|
||||
|
||||
You should not try to send any further data to this stream after calling this
|
||||
method. This method is idempotent (does nothing on successive calls).
|
||||
"""
|
||||
|
||||
|
||||
#: Type alias for all unreliable bytes-oriented receive streams.
|
||||
AnyUnreliableByteReceiveStream: TypeAlias = Union[
|
||||
UnreliableObjectReceiveStream[bytes], ByteReceiveStream
|
||||
]
|
||||
#: Type alias for all unreliable bytes-oriented send streams.
|
||||
AnyUnreliableByteSendStream: TypeAlias = Union[
|
||||
UnreliableObjectSendStream[bytes], ByteSendStream
|
||||
]
|
||||
#: Type alias for all unreliable bytes-oriented streams.
|
||||
AnyUnreliableByteStream: TypeAlias = Union[UnreliableObjectStream[bytes], ByteStream]
|
||||
#: Type alias for all bytes-oriented receive streams.
|
||||
AnyByteReceiveStream: TypeAlias = Union[ObjectReceiveStream[bytes], ByteReceiveStream]
|
||||
#: Type alias for all bytes-oriented send streams.
|
||||
AnyByteSendStream: TypeAlias = Union[ObjectSendStream[bytes], ByteSendStream]
|
||||
#: Type alias for all bytes-oriented streams.
|
||||
AnyByteStream: TypeAlias = Union[ObjectStream[bytes], ByteStream]
|
||||
|
||||
|
||||
class Listener(Generic[T_co], AsyncResource, TypedAttributeProvider):
|
||||
"""An interface for objects that let you accept incoming connections."""
|
||||
|
||||
@abstractmethod
|
||||
async def serve(
|
||||
self, handler: Callable[[T_co], Any], task_group: TaskGroup | None = None
|
||||
) -> None:
|
||||
"""
|
||||
Accept incoming connections as they come in and start tasks to handle them.
|
||||
|
||||
:param handler: a callable that will be used to handle each accepted connection
|
||||
:param task_group: the task group that will be used to start tasks for handling
|
||||
each accepted connection (if omitted, an ad-hoc task group will be created)
|
||||
"""
|
||||
|
||||
|
||||
class ObjectStreamConnectable(Generic[T_co], metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
async def connect(self) -> ObjectStream[T_co]:
|
||||
"""
|
||||
Connect to the remote endpoint.
|
||||
|
||||
:return: an object stream connected to the remote end
|
||||
:raises ConnectionFailed: if the connection fails
|
||||
"""
|
||||
|
||||
|
||||
class ByteStreamConnectable(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
async def connect(self) -> ByteStream:
|
||||
"""
|
||||
Connect to the remote endpoint.
|
||||
|
||||
:return: a bytestream connected to the remote end
|
||||
:raises ConnectionFailed: if the connection fails
|
||||
"""
|
||||
|
||||
|
||||
#: Type alias for all connectables returning bytestreams or bytes-oriented object streams
|
||||
AnyByteStreamConnectable: TypeAlias = Union[
|
||||
ObjectStreamConnectable[bytes], ByteStreamConnectable
|
||||
]
|
||||
79
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_subprocesses.py
vendored
Executable file
79
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_subprocesses.py
vendored
Executable file
@@ -0,0 +1,79 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import abstractmethod
|
||||
from signal import Signals
|
||||
|
||||
from ._resources import AsyncResource
|
||||
from ._streams import ByteReceiveStream, ByteSendStream
|
||||
|
||||
|
||||
class Process(AsyncResource):
|
||||
"""An asynchronous version of :class:`subprocess.Popen`."""
|
||||
|
||||
@abstractmethod
|
||||
async def wait(self) -> int:
|
||||
"""
|
||||
Wait until the process exits.
|
||||
|
||||
:return: the exit code of the process
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def terminate(self) -> None:
|
||||
"""
|
||||
Terminates the process, gracefully if possible.
|
||||
|
||||
On Windows, this calls ``TerminateProcess()``.
|
||||
On POSIX systems, this sends ``SIGTERM`` to the process.
|
||||
|
||||
.. seealso:: :meth:`subprocess.Popen.terminate`
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def kill(self) -> None:
|
||||
"""
|
||||
Kills the process.
|
||||
|
||||
On Windows, this calls ``TerminateProcess()``.
|
||||
On POSIX systems, this sends ``SIGKILL`` to the process.
|
||||
|
||||
.. seealso:: :meth:`subprocess.Popen.kill`
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def send_signal(self, signal: Signals) -> None:
|
||||
"""
|
||||
Send a signal to the subprocess.
|
||||
|
||||
.. seealso:: :meth:`subprocess.Popen.send_signal`
|
||||
|
||||
:param signal: the signal number (e.g. :data:`signal.SIGHUP`)
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def pid(self) -> int:
|
||||
"""The process ID of the process."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def returncode(self) -> int | None:
|
||||
"""
|
||||
The return code of the process. If the process has not yet terminated, this will
|
||||
be ``None``.
|
||||
"""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def stdin(self) -> ByteSendStream | None:
|
||||
"""The stream for the standard input of the process."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def stdout(self) -> ByteReceiveStream | None:
|
||||
"""The stream for the standard output of the process."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def stderr(self) -> ByteReceiveStream | None:
|
||||
"""The stream for the standard error output of the process."""
|
||||
117
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_tasks.py
vendored
Executable file
117
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_tasks.py
vendored
Executable file
@@ -0,0 +1,117 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Awaitable, Callable
|
||||
from types import TracebackType
|
||||
from typing import TYPE_CHECKING, Any, Protocol, overload
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
from typing import TypeVar
|
||||
else:
|
||||
from typing_extensions import TypeVar
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypeVarTuple, Unpack
|
||||
else:
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .._core._tasks import CancelScope
|
||||
|
||||
T_Retval = TypeVar("T_Retval")
|
||||
T_contra = TypeVar("T_contra", contravariant=True, default=None)
|
||||
PosArgsT = TypeVarTuple("PosArgsT")
|
||||
|
||||
|
||||
class TaskStatus(Protocol[T_contra]):
|
||||
@overload
|
||||
def started(self: TaskStatus[None]) -> None: ...
|
||||
|
||||
@overload
|
||||
def started(self, value: T_contra) -> None: ...
|
||||
|
||||
def started(self, value: T_contra | None = None) -> None:
|
||||
"""
|
||||
Signal that the task has started.
|
||||
|
||||
:param value: object passed back to the starter of the task
|
||||
"""
|
||||
|
||||
|
||||
class TaskGroup(metaclass=ABCMeta):
|
||||
"""
|
||||
Groups several asynchronous tasks together.
|
||||
|
||||
:ivar cancel_scope: the cancel scope inherited by all child tasks
|
||||
:vartype cancel_scope: CancelScope
|
||||
|
||||
.. note:: On asyncio, support for eager task factories is considered to be
|
||||
**experimental**. In particular, they don't follow the usual semantics of new
|
||||
tasks being scheduled on the next iteration of the event loop, and may thus
|
||||
cause unexpected behavior in code that wasn't written with such semantics in
|
||||
mind.
|
||||
"""
|
||||
|
||||
cancel_scope: CancelScope
|
||||
|
||||
@abstractmethod
|
||||
def start_soon(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[Any]],
|
||||
*args: Unpack[PosArgsT],
|
||||
name: object = None,
|
||||
) -> None:
|
||||
"""
|
||||
Start a new task in this task group.
|
||||
|
||||
:param func: a coroutine function
|
||||
:param args: positional arguments to call the function with
|
||||
:param name: name of the task, for the purposes of introspection and debugging
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def start(
|
||||
self,
|
||||
func: Callable[..., Awaitable[Any]],
|
||||
*args: object,
|
||||
name: object = None,
|
||||
) -> Any:
|
||||
"""
|
||||
Start a new task and wait until it signals for readiness.
|
||||
|
||||
The target callable must accept a keyword argument ``task_status`` (of type
|
||||
:class:`TaskStatus`). Awaiting on this method will return whatever was passed to
|
||||
``task_status.started()`` (``None`` by default).
|
||||
|
||||
.. note:: The :class:`TaskStatus` class is generic, and the type argument should
|
||||
indicate the type of the value that will be passed to
|
||||
``task_status.started()``.
|
||||
|
||||
:param func: a coroutine function that accepts the ``task_status`` keyword
|
||||
argument
|
||||
:param args: positional arguments to call the function with
|
||||
:param name: an optional name for the task, for introspection and debugging
|
||||
:return: the value passed to ``task_status.started()``
|
||||
:raises RuntimeError: if the task finishes without calling
|
||||
``task_status.started()``
|
||||
|
||||
.. seealso:: :ref:`start_initialize`
|
||||
|
||||
.. versionadded:: 3.0
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
async def __aenter__(self) -> TaskGroup:
|
||||
"""Enter the task group context and allow starting new tasks."""
|
||||
|
||||
@abstractmethod
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> bool:
|
||||
"""Exit the task group context waiting for all tasks to finish."""
|
||||
65
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_testing.py
vendored
Executable file
65
dev/env/cli_env/lib/python3.13/site-packages/anyio/abc/_testing.py
vendored
Executable file
@@ -0,0 +1,65 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import types
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import AsyncGenerator, Callable, Coroutine, Iterable
|
||||
from typing import Any, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
class TestRunner(metaclass=ABCMeta):
|
||||
"""
|
||||
Encapsulates a running event loop. Every call made through this object will use the
|
||||
same event loop.
|
||||
"""
|
||||
|
||||
def __enter__(self) -> TestRunner:
|
||||
return self
|
||||
|
||||
@abstractmethod
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: types.TracebackType | None,
|
||||
) -> bool | None: ...
|
||||
|
||||
@abstractmethod
|
||||
def run_asyncgen_fixture(
|
||||
self,
|
||||
fixture_func: Callable[..., AsyncGenerator[_T, Any]],
|
||||
kwargs: dict[str, Any],
|
||||
) -> Iterable[_T]:
|
||||
"""
|
||||
Run an async generator fixture.
|
||||
|
||||
:param fixture_func: the fixture function
|
||||
:param kwargs: keyword arguments to call the fixture function with
|
||||
:return: an iterator yielding the value yielded from the async generator
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def run_fixture(
|
||||
self,
|
||||
fixture_func: Callable[..., Coroutine[Any, Any, _T]],
|
||||
kwargs: dict[str, Any],
|
||||
) -> _T:
|
||||
"""
|
||||
Run an async fixture.
|
||||
|
||||
:param fixture_func: the fixture function
|
||||
:param kwargs: keyword arguments to call the fixture function with
|
||||
:return: the return value of the fixture function
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def run_test(
|
||||
self, test_func: Callable[..., Coroutine[Any, Any, Any]], kwargs: dict[str, Any]
|
||||
) -> None:
|
||||
"""
|
||||
Run an async test function.
|
||||
|
||||
:param test_func: the test function
|
||||
:param kwargs: keyword arguments to call the test function with
|
||||
"""
|
||||
578
dev/env/cli_env/lib/python3.13/site-packages/anyio/from_thread.py
vendored
Executable file
578
dev/env/cli_env/lib/python3.13/site-packages/anyio/from_thread.py
vendored
Executable file
@@ -0,0 +1,578 @@
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = (
|
||||
"BlockingPortal",
|
||||
"BlockingPortalProvider",
|
||||
"check_cancelled",
|
||||
"run",
|
||||
"run_sync",
|
||||
"start_blocking_portal",
|
||||
)
|
||||
|
||||
import sys
|
||||
from collections.abc import Awaitable, Callable, Generator
|
||||
from concurrent.futures import Future
|
||||
from contextlib import (
|
||||
AbstractAsyncContextManager,
|
||||
AbstractContextManager,
|
||||
contextmanager,
|
||||
)
|
||||
from dataclasses import dataclass, field
|
||||
from functools import partial
|
||||
from inspect import isawaitable
|
||||
from threading import Lock, Thread, current_thread, get_ident
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
Any,
|
||||
Generic,
|
||||
TypeVar,
|
||||
cast,
|
||||
overload,
|
||||
)
|
||||
|
||||
from ._core._eventloop import (
|
||||
get_cancelled_exc_class,
|
||||
threadlocals,
|
||||
)
|
||||
from ._core._eventloop import run as run_eventloop
|
||||
from ._core._exceptions import NoEventLoopError
|
||||
from ._core._synchronization import Event
|
||||
from ._core._tasks import CancelScope, create_task_group
|
||||
from .abc._tasks import TaskStatus
|
||||
from .lowlevel import EventLoopToken, current_token
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import TypeVarTuple, Unpack
|
||||
else:
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
T_Retval = TypeVar("T_Retval")
|
||||
T_co = TypeVar("T_co", covariant=True)
|
||||
PosArgsT = TypeVarTuple("PosArgsT")
|
||||
|
||||
|
||||
def _token_or_error(token: EventLoopToken | None) -> EventLoopToken:
|
||||
if token is not None:
|
||||
return token
|
||||
|
||||
try:
|
||||
return threadlocals.current_token
|
||||
except AttributeError:
|
||||
raise NoEventLoopError(
|
||||
"Not running inside an AnyIO worker thread, and no event loop token was "
|
||||
"provided"
|
||||
) from None
|
||||
|
||||
|
||||
def run(
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
*args: Unpack[PosArgsT],
|
||||
token: EventLoopToken | None = None,
|
||||
) -> T_Retval:
|
||||
"""
|
||||
Call a coroutine function from a worker thread.
|
||||
|
||||
:param func: a coroutine function
|
||||
:param args: positional arguments for the callable
|
||||
:param token: an event loop token to use to get back to the event loop thread
|
||||
(required if calling this function from outside an AnyIO worker thread)
|
||||
:return: the return value of the coroutine function
|
||||
:raises MissingTokenError: if no token was provided and called from outside an
|
||||
AnyIO worker thread
|
||||
:raises RunFinishedError: if the event loop tied to ``token`` is no longer running
|
||||
|
||||
.. versionchanged:: 4.11.0
|
||||
Added the ``token`` parameter.
|
||||
|
||||
"""
|
||||
explicit_token = token is not None
|
||||
token = _token_or_error(token)
|
||||
return token.backend_class.run_async_from_thread(
|
||||
func, args, token=token.native_token if explicit_token else None
|
||||
)
|
||||
|
||||
|
||||
def run_sync(
|
||||
func: Callable[[Unpack[PosArgsT]], T_Retval],
|
||||
*args: Unpack[PosArgsT],
|
||||
token: EventLoopToken | None = None,
|
||||
) -> T_Retval:
|
||||
"""
|
||||
Call a function in the event loop thread from a worker thread.
|
||||
|
||||
:param func: a callable
|
||||
:param args: positional arguments for the callable
|
||||
:param token: an event loop token to use to get back to the event loop thread
|
||||
(required if calling this function from outside an AnyIO worker thread)
|
||||
:return: the return value of the callable
|
||||
:raises MissingTokenError: if no token was provided and called from outside an
|
||||
AnyIO worker thread
|
||||
:raises RunFinishedError: if the event loop tied to ``token`` is no longer running
|
||||
|
||||
.. versionchanged:: 4.11.0
|
||||
Added the ``token`` parameter.
|
||||
|
||||
"""
|
||||
explicit_token = token is not None
|
||||
token = _token_or_error(token)
|
||||
return token.backend_class.run_sync_from_thread(
|
||||
func, args, token=token.native_token if explicit_token else None
|
||||
)
|
||||
|
||||
|
||||
class _BlockingAsyncContextManager(Generic[T_co], AbstractContextManager):
|
||||
_enter_future: Future[T_co]
|
||||
_exit_future: Future[bool | None]
|
||||
_exit_event: Event
|
||||
_exit_exc_info: tuple[
|
||||
type[BaseException] | None, BaseException | None, TracebackType | None
|
||||
] = (None, None, None)
|
||||
|
||||
def __init__(
|
||||
self, async_cm: AbstractAsyncContextManager[T_co], portal: BlockingPortal
|
||||
):
|
||||
self._async_cm = async_cm
|
||||
self._portal = portal
|
||||
|
||||
async def run_async_cm(self) -> bool | None:
|
||||
try:
|
||||
self._exit_event = Event()
|
||||
value = await self._async_cm.__aenter__()
|
||||
except BaseException as exc:
|
||||
self._enter_future.set_exception(exc)
|
||||
raise
|
||||
else:
|
||||
self._enter_future.set_result(value)
|
||||
|
||||
try:
|
||||
# Wait for the sync context manager to exit.
|
||||
# This next statement can raise `get_cancelled_exc_class()` if
|
||||
# something went wrong in a task group in this async context
|
||||
# manager.
|
||||
await self._exit_event.wait()
|
||||
finally:
|
||||
# In case of cancellation, it could be that we end up here before
|
||||
# `_BlockingAsyncContextManager.__exit__` is called, and an
|
||||
# `_exit_exc_info` has been set.
|
||||
result = await self._async_cm.__aexit__(*self._exit_exc_info)
|
||||
|
||||
return result
|
||||
|
||||
def __enter__(self) -> T_co:
|
||||
self._enter_future = Future()
|
||||
self._exit_future = self._portal.start_task_soon(self.run_async_cm)
|
||||
return self._enter_future.result()
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
__exc_type: type[BaseException] | None,
|
||||
__exc_value: BaseException | None,
|
||||
__traceback: TracebackType | None,
|
||||
) -> bool | None:
|
||||
self._exit_exc_info = __exc_type, __exc_value, __traceback
|
||||
self._portal.call(self._exit_event.set)
|
||||
return self._exit_future.result()
|
||||
|
||||
|
||||
class _BlockingPortalTaskStatus(TaskStatus):
|
||||
def __init__(self, future: Future):
|
||||
self._future = future
|
||||
|
||||
def started(self, value: object = None) -> None:
|
||||
self._future.set_result(value)
|
||||
|
||||
|
||||
class BlockingPortal:
|
||||
"""
|
||||
An object that lets external threads run code in an asynchronous event loop.
|
||||
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._token = current_token()
|
||||
self._event_loop_thread_id: int | None = get_ident()
|
||||
self._stop_event = Event()
|
||||
self._task_group = create_task_group()
|
||||
|
||||
async def __aenter__(self) -> BlockingPortal:
|
||||
await self._task_group.__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> bool:
|
||||
await self.stop()
|
||||
return await self._task_group.__aexit__(exc_type, exc_val, exc_tb)
|
||||
|
||||
def _check_running(self) -> None:
|
||||
if self._event_loop_thread_id is None:
|
||||
raise RuntimeError("This portal is not running")
|
||||
if self._event_loop_thread_id == get_ident():
|
||||
raise RuntimeError(
|
||||
"This method cannot be called from the event loop thread"
|
||||
)
|
||||
|
||||
async def sleep_until_stopped(self) -> None:
|
||||
"""Sleep until :meth:`stop` is called."""
|
||||
await self._stop_event.wait()
|
||||
|
||||
async def stop(self, cancel_remaining: bool = False) -> None:
|
||||
"""
|
||||
Signal the portal to shut down.
|
||||
|
||||
This marks the portal as no longer accepting new calls and exits from
|
||||
:meth:`sleep_until_stopped`.
|
||||
|
||||
:param cancel_remaining: ``True`` to cancel all the remaining tasks, ``False``
|
||||
to let them finish before returning
|
||||
|
||||
"""
|
||||
self._event_loop_thread_id = None
|
||||
self._stop_event.set()
|
||||
if cancel_remaining:
|
||||
self._task_group.cancel_scope.cancel("the blocking portal is shutting down")
|
||||
|
||||
async def _call_func(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
kwargs: dict[str, Any],
|
||||
future: Future[T_Retval],
|
||||
) -> None:
|
||||
def callback(f: Future[T_Retval]) -> None:
|
||||
if f.cancelled():
|
||||
if self._event_loop_thread_id == get_ident():
|
||||
scope.cancel("the future was cancelled")
|
||||
elif self._event_loop_thread_id is not None:
|
||||
self.call(scope.cancel, "the future was cancelled")
|
||||
|
||||
try:
|
||||
retval_or_awaitable = func(*args, **kwargs)
|
||||
if isawaitable(retval_or_awaitable):
|
||||
with CancelScope() as scope:
|
||||
future.add_done_callback(callback)
|
||||
retval = await retval_or_awaitable
|
||||
else:
|
||||
retval = retval_or_awaitable
|
||||
except get_cancelled_exc_class():
|
||||
future.cancel()
|
||||
future.set_running_or_notify_cancel()
|
||||
except BaseException as exc:
|
||||
if not future.cancelled():
|
||||
future.set_exception(exc)
|
||||
|
||||
# Let base exceptions fall through
|
||||
if not isinstance(exc, Exception):
|
||||
raise
|
||||
else:
|
||||
if not future.cancelled():
|
||||
future.set_result(retval)
|
||||
finally:
|
||||
scope = None # type: ignore[assignment]
|
||||
|
||||
def _spawn_task_from_thread(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval],
|
||||
args: tuple[Unpack[PosArgsT]],
|
||||
kwargs: dict[str, Any],
|
||||
name: object,
|
||||
future: Future[T_Retval],
|
||||
) -> None:
|
||||
"""
|
||||
Spawn a new task using the given callable.
|
||||
|
||||
:param func: a callable
|
||||
:param args: positional arguments to be passed to the callable
|
||||
:param kwargs: keyword arguments to be passed to the callable
|
||||
:param name: name of the task (will be coerced to a string if not ``None``)
|
||||
:param future: a future that will resolve to the return value of the callable,
|
||||
or the exception raised during its execution
|
||||
|
||||
"""
|
||||
run_sync(
|
||||
partial(self._task_group.start_soon, name=name),
|
||||
self._call_func,
|
||||
func,
|
||||
args,
|
||||
kwargs,
|
||||
future,
|
||||
token=self._token,
|
||||
)
|
||||
|
||||
@overload
|
||||
def call(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
*args: Unpack[PosArgsT],
|
||||
) -> T_Retval: ...
|
||||
|
||||
@overload
|
||||
def call(
|
||||
self, func: Callable[[Unpack[PosArgsT]], T_Retval], *args: Unpack[PosArgsT]
|
||||
) -> T_Retval: ...
|
||||
|
||||
def call(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval],
|
||||
*args: Unpack[PosArgsT],
|
||||
) -> T_Retval:
|
||||
"""
|
||||
Call the given function in the event loop thread.
|
||||
|
||||
If the callable returns a coroutine object, it is awaited on.
|
||||
|
||||
:param func: any callable
|
||||
:raises RuntimeError: if the portal is not running or if this method is called
|
||||
from within the event loop thread
|
||||
|
||||
"""
|
||||
return cast(T_Retval, self.start_task_soon(func, *args).result())
|
||||
|
||||
@overload
|
||||
def start_task_soon(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]],
|
||||
*args: Unpack[PosArgsT],
|
||||
name: object = None,
|
||||
) -> Future[T_Retval]: ...
|
||||
|
||||
@overload
|
||||
def start_task_soon(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], T_Retval],
|
||||
*args: Unpack[PosArgsT],
|
||||
name: object = None,
|
||||
) -> Future[T_Retval]: ...
|
||||
|
||||
def start_task_soon(
|
||||
self,
|
||||
func: Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval],
|
||||
*args: Unpack[PosArgsT],
|
||||
name: object = None,
|
||||
) -> Future[T_Retval]:
|
||||
"""
|
||||
Start a task in the portal's task group.
|
||||
|
||||
The task will be run inside a cancel scope which can be cancelled by cancelling
|
||||
the returned future.
|
||||
|
||||
:param func: the target function
|
||||
:param args: positional arguments passed to ``func``
|
||||
:param name: name of the task (will be coerced to a string if not ``None``)
|
||||
:return: a future that resolves with the return value of the callable if the
|
||||
task completes successfully, or with the exception raised in the task
|
||||
:raises RuntimeError: if the portal is not running or if this method is called
|
||||
from within the event loop thread
|
||||
:rtype: concurrent.futures.Future[T_Retval]
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
self._check_running()
|
||||
f: Future[T_Retval] = Future()
|
||||
self._spawn_task_from_thread(func, args, {}, name, f)
|
||||
return f
|
||||
|
||||
def start_task(
|
||||
self,
|
||||
func: Callable[..., Awaitable[T_Retval]],
|
||||
*args: object,
|
||||
name: object = None,
|
||||
) -> tuple[Future[T_Retval], Any]:
|
||||
"""
|
||||
Start a task in the portal's task group and wait until it signals for readiness.
|
||||
|
||||
This method works the same way as :meth:`.abc.TaskGroup.start`.
|
||||
|
||||
:param func: the target function
|
||||
:param args: positional arguments passed to ``func``
|
||||
:param name: name of the task (will be coerced to a string if not ``None``)
|
||||
:return: a tuple of (future, task_status_value) where the ``task_status_value``
|
||||
is the value passed to ``task_status.started()`` from within the target
|
||||
function
|
||||
:rtype: tuple[concurrent.futures.Future[T_Retval], Any]
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
|
||||
def task_done(future: Future[T_Retval]) -> None:
|
||||
if not task_status_future.done():
|
||||
if future.cancelled():
|
||||
task_status_future.cancel()
|
||||
elif future.exception():
|
||||
task_status_future.set_exception(future.exception())
|
||||
else:
|
||||
exc = RuntimeError(
|
||||
"Task exited without calling task_status.started()"
|
||||
)
|
||||
task_status_future.set_exception(exc)
|
||||
|
||||
self._check_running()
|
||||
task_status_future: Future = Future()
|
||||
task_status = _BlockingPortalTaskStatus(task_status_future)
|
||||
f: Future = Future()
|
||||
f.add_done_callback(task_done)
|
||||
self._spawn_task_from_thread(func, args, {"task_status": task_status}, name, f)
|
||||
return f, task_status_future.result()
|
||||
|
||||
def wrap_async_context_manager(
|
||||
self, cm: AbstractAsyncContextManager[T_co]
|
||||
) -> AbstractContextManager[T_co]:
|
||||
"""
|
||||
Wrap an async context manager as a synchronous context manager via this portal.
|
||||
|
||||
Spawns a task that will call both ``__aenter__()`` and ``__aexit__()``, stopping
|
||||
in the middle until the synchronous context manager exits.
|
||||
|
||||
:param cm: an asynchronous context manager
|
||||
:return: a synchronous context manager
|
||||
|
||||
.. versionadded:: 2.1
|
||||
|
||||
"""
|
||||
return _BlockingAsyncContextManager(cm, self)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BlockingPortalProvider:
|
||||
"""
|
||||
A manager for a blocking portal. Used as a context manager. The first thread to
|
||||
enter this context manager causes a blocking portal to be started with the specific
|
||||
parameters, and the last thread to exit causes the portal to be shut down. Thus,
|
||||
there will be exactly one blocking portal running in this context as long as at
|
||||
least one thread has entered this context manager.
|
||||
|
||||
The parameters are the same as for :func:`~anyio.run`.
|
||||
|
||||
:param backend: name of the backend
|
||||
:param backend_options: backend options
|
||||
|
||||
.. versionadded:: 4.4
|
||||
"""
|
||||
|
||||
backend: str = "asyncio"
|
||||
backend_options: dict[str, Any] | None = None
|
||||
_lock: Lock = field(init=False, default_factory=Lock)
|
||||
_leases: int = field(init=False, default=0)
|
||||
_portal: BlockingPortal = field(init=False)
|
||||
_portal_cm: AbstractContextManager[BlockingPortal] | None = field(
|
||||
init=False, default=None
|
||||
)
|
||||
|
||||
def __enter__(self) -> BlockingPortal:
|
||||
with self._lock:
|
||||
if self._portal_cm is None:
|
||||
self._portal_cm = start_blocking_portal(
|
||||
self.backend, self.backend_options
|
||||
)
|
||||
self._portal = self._portal_cm.__enter__()
|
||||
|
||||
self._leases += 1
|
||||
return self._portal
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
portal_cm: AbstractContextManager[BlockingPortal] | None = None
|
||||
with self._lock:
|
||||
assert self._portal_cm
|
||||
assert self._leases > 0
|
||||
self._leases -= 1
|
||||
if not self._leases:
|
||||
portal_cm = self._portal_cm
|
||||
self._portal_cm = None
|
||||
del self._portal
|
||||
|
||||
if portal_cm:
|
||||
portal_cm.__exit__(None, None, None)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def start_blocking_portal(
|
||||
backend: str = "asyncio",
|
||||
backend_options: dict[str, Any] | None = None,
|
||||
*,
|
||||
name: str | None = None,
|
||||
) -> Generator[BlockingPortal, Any, None]:
|
||||
"""
|
||||
Start a new event loop in a new thread and run a blocking portal in its main task.
|
||||
|
||||
The parameters are the same as for :func:`~anyio.run`.
|
||||
|
||||
:param backend: name of the backend
|
||||
:param backend_options: backend options
|
||||
:param name: name of the thread
|
||||
:return: a context manager that yields a blocking portal
|
||||
|
||||
.. versionchanged:: 3.0
|
||||
Usage as a context manager is now required.
|
||||
|
||||
"""
|
||||
|
||||
async def run_portal() -> None:
|
||||
async with BlockingPortal() as portal_:
|
||||
if name is None:
|
||||
current_thread().name = f"{backend}-portal-{id(portal_):x}"
|
||||
|
||||
future.set_result(portal_)
|
||||
await portal_.sleep_until_stopped()
|
||||
|
||||
def run_blocking_portal() -> None:
|
||||
if future.set_running_or_notify_cancel():
|
||||
try:
|
||||
run_eventloop(
|
||||
run_portal, backend=backend, backend_options=backend_options
|
||||
)
|
||||
except BaseException as exc:
|
||||
if not future.done():
|
||||
future.set_exception(exc)
|
||||
|
||||
future: Future[BlockingPortal] = Future()
|
||||
thread = Thread(target=run_blocking_portal, daemon=True, name=name)
|
||||
thread.start()
|
||||
try:
|
||||
cancel_remaining_tasks = False
|
||||
portal = future.result()
|
||||
try:
|
||||
yield portal
|
||||
except BaseException:
|
||||
cancel_remaining_tasks = True
|
||||
raise
|
||||
finally:
|
||||
try:
|
||||
portal.call(portal.stop, cancel_remaining_tasks)
|
||||
except RuntimeError:
|
||||
pass
|
||||
finally:
|
||||
thread.join()
|
||||
|
||||
|
||||
def check_cancelled() -> None:
|
||||
"""
|
||||
Check if the cancel scope of the host task's running the current worker thread has
|
||||
been cancelled.
|
||||
|
||||
If the host task's current cancel scope has indeed been cancelled, the
|
||||
backend-specific cancellation exception will be raised.
|
||||
|
||||
:raises RuntimeError: if the current thread was not spawned by
|
||||
:func:`.to_thread.run_sync`
|
||||
|
||||
"""
|
||||
try:
|
||||
token: EventLoopToken = threadlocals.current_token
|
||||
except AttributeError:
|
||||
raise NoEventLoopError(
|
||||
"This function can only be called inside an AnyIO worker thread"
|
||||
) from None
|
||||
|
||||
token.backend_class.check_cancelled()
|
||||
375
dev/env/cli_env/lib/python3.13/site-packages/anyio/functools.py
vendored
Executable file
375
dev/env/cli_env/lib/python3.13/site-packages/anyio/functools.py
vendored
Executable file
@@ -0,0 +1,375 @@
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = (
|
||||
"AsyncCacheInfo",
|
||||
"AsyncCacheParameters",
|
||||
"AsyncLRUCacheWrapper",
|
||||
"cache",
|
||||
"lru_cache",
|
||||
"reduce",
|
||||
)
|
||||
|
||||
import functools
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from collections.abc import (
|
||||
AsyncIterable,
|
||||
Awaitable,
|
||||
Callable,
|
||||
Coroutine,
|
||||
Hashable,
|
||||
Iterable,
|
||||
)
|
||||
from functools import update_wrapper
|
||||
from inspect import iscoroutinefunction
|
||||
from typing import (
|
||||
Any,
|
||||
Generic,
|
||||
NamedTuple,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
cast,
|
||||
final,
|
||||
overload,
|
||||
)
|
||||
from weakref import WeakKeyDictionary
|
||||
|
||||
from ._core._synchronization import Lock
|
||||
from .lowlevel import RunVar, checkpoint
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import ParamSpec
|
||||
else:
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
T = TypeVar("T")
|
||||
S = TypeVar("S")
|
||||
P = ParamSpec("P")
|
||||
lru_cache_items: RunVar[
|
||||
WeakKeyDictionary[
|
||||
AsyncLRUCacheWrapper[Any, Any],
|
||||
OrderedDict[Hashable, tuple[_InitialMissingType, Lock] | tuple[Any, None]],
|
||||
]
|
||||
] = RunVar("lru_cache_items")
|
||||
|
||||
|
||||
class _InitialMissingType:
|
||||
pass
|
||||
|
||||
|
||||
initial_missing: _InitialMissingType = _InitialMissingType()
|
||||
|
||||
|
||||
class AsyncCacheInfo(NamedTuple):
|
||||
hits: int
|
||||
misses: int
|
||||
maxsize: int | None
|
||||
currsize: int
|
||||
|
||||
|
||||
class AsyncCacheParameters(TypedDict):
|
||||
maxsize: int | None
|
||||
typed: bool
|
||||
always_checkpoint: bool
|
||||
|
||||
|
||||
class _LRUMethodWrapper(Generic[T]):
|
||||
def __init__(self, wrapper: AsyncLRUCacheWrapper[..., T], instance: object):
|
||||
self.__wrapper = wrapper
|
||||
self.__instance = instance
|
||||
|
||||
def cache_info(self) -> AsyncCacheInfo:
|
||||
return self.__wrapper.cache_info()
|
||||
|
||||
def cache_parameters(self) -> AsyncCacheParameters:
|
||||
return self.__wrapper.cache_parameters()
|
||||
|
||||
def cache_clear(self) -> None:
|
||||
self.__wrapper.cache_clear()
|
||||
|
||||
async def __call__(self, *args: Any, **kwargs: Any) -> T:
|
||||
if self.__instance is None:
|
||||
return await self.__wrapper(*args, **kwargs)
|
||||
|
||||
return await self.__wrapper(self.__instance, *args, **kwargs)
|
||||
|
||||
|
||||
@final
|
||||
class AsyncLRUCacheWrapper(Generic[P, T]):
|
||||
def __init__(
|
||||
self,
|
||||
func: Callable[P, Awaitable[T]],
|
||||
maxsize: int | None,
|
||||
typed: bool,
|
||||
always_checkpoint: bool,
|
||||
):
|
||||
self.__wrapped__ = func
|
||||
self._hits: int = 0
|
||||
self._misses: int = 0
|
||||
self._maxsize = max(maxsize, 0) if maxsize is not None else None
|
||||
self._currsize: int = 0
|
||||
self._typed = typed
|
||||
self._always_checkpoint = always_checkpoint
|
||||
update_wrapper(self, func)
|
||||
|
||||
def cache_info(self) -> AsyncCacheInfo:
|
||||
return AsyncCacheInfo(self._hits, self._misses, self._maxsize, self._currsize)
|
||||
|
||||
def cache_parameters(self) -> AsyncCacheParameters:
|
||||
return {
|
||||
"maxsize": self._maxsize,
|
||||
"typed": self._typed,
|
||||
"always_checkpoint": self._always_checkpoint,
|
||||
}
|
||||
|
||||
def cache_clear(self) -> None:
|
||||
if cache := lru_cache_items.get(None):
|
||||
cache.pop(self, None)
|
||||
self._hits = self._misses = self._currsize = 0
|
||||
|
||||
async def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T:
|
||||
# Easy case first: if maxsize == 0, no caching is done
|
||||
if self._maxsize == 0:
|
||||
value = await self.__wrapped__(*args, **kwargs)
|
||||
self._misses += 1
|
||||
return value
|
||||
|
||||
# The key is constructed as a flat tuple to avoid memory overhead
|
||||
key: tuple[Any, ...] = args
|
||||
if kwargs:
|
||||
# initial_missing is used as a separator
|
||||
key += (initial_missing,) + sum(kwargs.items(), ())
|
||||
|
||||
if self._typed:
|
||||
key += tuple(type(arg) for arg in args)
|
||||
if kwargs:
|
||||
key += (initial_missing,) + tuple(type(val) for val in kwargs.values())
|
||||
|
||||
try:
|
||||
cache = lru_cache_items.get()
|
||||
except LookupError:
|
||||
cache = WeakKeyDictionary()
|
||||
lru_cache_items.set(cache)
|
||||
|
||||
try:
|
||||
cache_entry = cache[self]
|
||||
except KeyError:
|
||||
cache_entry = cache[self] = OrderedDict()
|
||||
|
||||
cached_value: T | _InitialMissingType
|
||||
try:
|
||||
cached_value, lock = cache_entry[key]
|
||||
except KeyError:
|
||||
# We're the first task to call this function
|
||||
cached_value, lock = (
|
||||
initial_missing,
|
||||
Lock(fast_acquire=not self._always_checkpoint),
|
||||
)
|
||||
cache_entry[key] = cached_value, lock
|
||||
|
||||
if lock is None:
|
||||
# The value was already cached
|
||||
self._hits += 1
|
||||
cache_entry.move_to_end(key)
|
||||
if self._always_checkpoint:
|
||||
await checkpoint()
|
||||
|
||||
return cast(T, cached_value)
|
||||
|
||||
async with lock:
|
||||
# Check if another task filled the cache while we acquired the lock
|
||||
if (cached_value := cache_entry[key][0]) is initial_missing:
|
||||
self._misses += 1
|
||||
if self._maxsize is not None and self._currsize >= self._maxsize:
|
||||
cache_entry.popitem(last=False)
|
||||
else:
|
||||
self._currsize += 1
|
||||
|
||||
value = await self.__wrapped__(*args, **kwargs)
|
||||
cache_entry[key] = value, None
|
||||
else:
|
||||
# Another task filled the cache while we were waiting for the lock
|
||||
self._hits += 1
|
||||
cache_entry.move_to_end(key)
|
||||
value = cast(T, cached_value)
|
||||
|
||||
return value
|
||||
|
||||
def __get__(
|
||||
self, instance: object, owner: type | None = None
|
||||
) -> _LRUMethodWrapper[T]:
|
||||
wrapper = _LRUMethodWrapper(self, instance)
|
||||
update_wrapper(wrapper, self.__wrapped__)
|
||||
return wrapper
|
||||
|
||||
|
||||
class _LRUCacheWrapper(Generic[T]):
|
||||
def __init__(self, maxsize: int | None, typed: bool, always_checkpoint: bool):
|
||||
self._maxsize = maxsize
|
||||
self._typed = typed
|
||||
self._always_checkpoint = always_checkpoint
|
||||
|
||||
@overload
|
||||
def __call__( # type: ignore[overload-overlap]
|
||||
self, func: Callable[P, Coroutine[Any, Any, T]], /
|
||||
) -> AsyncLRUCacheWrapper[P, T]: ...
|
||||
|
||||
@overload
|
||||
def __call__(
|
||||
self, func: Callable[..., T], /
|
||||
) -> functools._lru_cache_wrapper[T]: ...
|
||||
|
||||
def __call__(
|
||||
self, f: Callable[P, Coroutine[Any, Any, T]] | Callable[..., T], /
|
||||
) -> AsyncLRUCacheWrapper[P, T] | functools._lru_cache_wrapper[T]:
|
||||
if iscoroutinefunction(f):
|
||||
return AsyncLRUCacheWrapper(
|
||||
f, self._maxsize, self._typed, self._always_checkpoint
|
||||
)
|
||||
|
||||
return functools.lru_cache(maxsize=self._maxsize, typed=self._typed)(f) # type: ignore[arg-type]
|
||||
|
||||
|
||||
@overload
|
||||
def cache( # type: ignore[overload-overlap]
|
||||
func: Callable[P, Coroutine[Any, Any, T]], /
|
||||
) -> AsyncLRUCacheWrapper[P, T]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def cache(func: Callable[..., T], /) -> functools._lru_cache_wrapper[T]: ...
|
||||
|
||||
|
||||
def cache(
|
||||
func: Callable[..., T] | Callable[P, Coroutine[Any, Any, T]], /
|
||||
) -> AsyncLRUCacheWrapper[P, T] | functools._lru_cache_wrapper[T]:
|
||||
"""
|
||||
A convenient shortcut for :func:`lru_cache` with ``maxsize=None``.
|
||||
|
||||
This is the asynchronous equivalent to :func:`functools.cache`.
|
||||
|
||||
"""
|
||||
return lru_cache(maxsize=None)(func)
|
||||
|
||||
|
||||
@overload
|
||||
def lru_cache(
|
||||
*, maxsize: int | None = ..., typed: bool = ..., always_checkpoint: bool = ...
|
||||
) -> _LRUCacheWrapper[Any]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def lru_cache( # type: ignore[overload-overlap]
|
||||
func: Callable[P, Coroutine[Any, Any, T]], /
|
||||
) -> AsyncLRUCacheWrapper[P, T]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def lru_cache(func: Callable[..., T], /) -> functools._lru_cache_wrapper[T]: ...
|
||||
|
||||
|
||||
def lru_cache(
|
||||
func: Callable[P, Coroutine[Any, Any, T]] | Callable[..., T] | None = None,
|
||||
/,
|
||||
*,
|
||||
maxsize: int | None = 128,
|
||||
typed: bool = False,
|
||||
always_checkpoint: bool = False,
|
||||
) -> (
|
||||
AsyncLRUCacheWrapper[P, T] | functools._lru_cache_wrapper[T] | _LRUCacheWrapper[Any]
|
||||
):
|
||||
"""
|
||||
An asynchronous version of :func:`functools.lru_cache`.
|
||||
|
||||
If a synchronous function is passed, the standard library
|
||||
:func:`functools.lru_cache` is applied instead.
|
||||
|
||||
:param always_checkpoint: if ``True``, every call to the cached function will be
|
||||
guaranteed to yield control to the event loop at least once
|
||||
|
||||
.. note:: Caches and locks are managed on a per-event loop basis.
|
||||
|
||||
"""
|
||||
if func is None:
|
||||
return _LRUCacheWrapper[Any](maxsize, typed, always_checkpoint)
|
||||
|
||||
if not callable(func):
|
||||
raise TypeError("the first argument must be callable")
|
||||
|
||||
return _LRUCacheWrapper[T](maxsize, typed, always_checkpoint)(func)
|
||||
|
||||
|
||||
@overload
|
||||
async def reduce(
|
||||
function: Callable[[T, S], Awaitable[T]],
|
||||
iterable: Iterable[S] | AsyncIterable[S],
|
||||
/,
|
||||
initial: T,
|
||||
) -> T: ...
|
||||
|
||||
|
||||
@overload
|
||||
async def reduce(
|
||||
function: Callable[[T, T], Awaitable[T]],
|
||||
iterable: Iterable[T] | AsyncIterable[T],
|
||||
/,
|
||||
) -> T: ...
|
||||
|
||||
|
||||
async def reduce( # type: ignore[misc]
|
||||
function: Callable[[T, T], Awaitable[T]] | Callable[[T, S], Awaitable[T]],
|
||||
iterable: Iterable[T] | Iterable[S] | AsyncIterable[T] | AsyncIterable[S],
|
||||
/,
|
||||
initial: T | _InitialMissingType = initial_missing,
|
||||
) -> T:
|
||||
"""
|
||||
Asynchronous version of :func:`functools.reduce`.
|
||||
|
||||
:param function: a coroutine function that takes two arguments: the accumulated
|
||||
value and the next element from the iterable
|
||||
:param iterable: an iterable or async iterable
|
||||
:param initial: the initial value (if missing, the first element of the iterable is
|
||||
used as the initial value)
|
||||
|
||||
"""
|
||||
element: Any
|
||||
function_called = False
|
||||
if isinstance(iterable, AsyncIterable):
|
||||
async_it = iterable.__aiter__()
|
||||
if initial is initial_missing:
|
||||
try:
|
||||
value = cast(T, await async_it.__anext__())
|
||||
except StopAsyncIteration:
|
||||
raise TypeError(
|
||||
"reduce() of empty sequence with no initial value"
|
||||
) from None
|
||||
else:
|
||||
value = cast(T, initial)
|
||||
|
||||
async for element in async_it:
|
||||
value = await function(value, element)
|
||||
function_called = True
|
||||
elif isinstance(iterable, Iterable):
|
||||
it = iter(iterable)
|
||||
if initial is initial_missing:
|
||||
try:
|
||||
value = cast(T, next(it))
|
||||
except StopIteration:
|
||||
raise TypeError(
|
||||
"reduce() of empty sequence with no initial value"
|
||||
) from None
|
||||
else:
|
||||
value = cast(T, initial)
|
||||
|
||||
for element in it:
|
||||
value = await function(value, element)
|
||||
function_called = True
|
||||
else:
|
||||
raise TypeError("reduce() argument 2 must be an iterable or async iterable")
|
||||
|
||||
# Make sure there is at least one checkpoint, even if an empty iterable and an
|
||||
# initial value were given
|
||||
if not function_called:
|
||||
await checkpoint()
|
||||
|
||||
return value
|
||||
196
dev/env/cli_env/lib/python3.13/site-packages/anyio/lowlevel.py
vendored
Executable file
196
dev/env/cli_env/lib/python3.13/site-packages/anyio/lowlevel.py
vendored
Executable file
@@ -0,0 +1,196 @@
|
||||
from __future__ import annotations
|
||||
|
||||
__all__ = (
|
||||
"EventLoopToken",
|
||||
"RunvarToken",
|
||||
"RunVar",
|
||||
"checkpoint",
|
||||
"checkpoint_if_cancelled",
|
||||
"cancel_shielded_checkpoint",
|
||||
"current_token",
|
||||
)
|
||||
|
||||
import enum
|
||||
from dataclasses import dataclass
|
||||
from types import TracebackType
|
||||
from typing import Any, Generic, Literal, TypeVar, final, overload
|
||||
from weakref import WeakKeyDictionary
|
||||
|
||||
from ._core._eventloop import get_async_backend
|
||||
from .abc import AsyncBackend
|
||||
|
||||
T = TypeVar("T")
|
||||
D = TypeVar("D")
|
||||
|
||||
|
||||
async def checkpoint() -> None:
|
||||
"""
|
||||
Check for cancellation and allow the scheduler to switch to another task.
|
||||
|
||||
Equivalent to (but more efficient than)::
|
||||
|
||||
await checkpoint_if_cancelled()
|
||||
await cancel_shielded_checkpoint()
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
await get_async_backend().checkpoint()
|
||||
|
||||
|
||||
async def checkpoint_if_cancelled() -> None:
|
||||
"""
|
||||
Enter a checkpoint if the enclosing cancel scope has been cancelled.
|
||||
|
||||
This does not allow the scheduler to switch to a different task.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
await get_async_backend().checkpoint_if_cancelled()
|
||||
|
||||
|
||||
async def cancel_shielded_checkpoint() -> None:
|
||||
"""
|
||||
Allow the scheduler to switch to another task but without checking for cancellation.
|
||||
|
||||
Equivalent to (but potentially more efficient than)::
|
||||
|
||||
with CancelScope(shield=True):
|
||||
await checkpoint()
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
"""
|
||||
await get_async_backend().cancel_shielded_checkpoint()
|
||||
|
||||
|
||||
@final
|
||||
@dataclass(frozen=True, repr=False)
|
||||
class EventLoopToken:
|
||||
"""
|
||||
An opaque object that holds a reference to an event loop.
|
||||
|
||||
.. versionadded:: 4.11.0
|
||||
"""
|
||||
|
||||
backend_class: type[AsyncBackend]
|
||||
native_token: object
|
||||
|
||||
|
||||
def current_token() -> EventLoopToken:
|
||||
"""
|
||||
Return a token object that can be used to call code in the current event loop from
|
||||
another thread.
|
||||
|
||||
:raises NoEventLoopError: if no supported asynchronous event loop is running in the
|
||||
current thread
|
||||
|
||||
.. versionadded:: 4.11.0
|
||||
|
||||
"""
|
||||
backend_class = get_async_backend()
|
||||
raw_token = backend_class.current_token()
|
||||
return EventLoopToken(backend_class, raw_token)
|
||||
|
||||
|
||||
_run_vars: WeakKeyDictionary[object, dict[RunVar[Any], Any]] = WeakKeyDictionary()
|
||||
|
||||
|
||||
class _NoValueSet(enum.Enum):
|
||||
NO_VALUE_SET = enum.auto()
|
||||
|
||||
|
||||
class RunvarToken(Generic[T]):
|
||||
__slots__ = "_var", "_value", "_redeemed"
|
||||
|
||||
def __init__(self, var: RunVar[T], value: T | Literal[_NoValueSet.NO_VALUE_SET]):
|
||||
self._var = var
|
||||
self._value: T | Literal[_NoValueSet.NO_VALUE_SET] = value
|
||||
self._redeemed = False
|
||||
|
||||
def __enter__(self) -> RunvarToken[T]:
|
||||
return self
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: type[BaseException] | None,
|
||||
exc_val: BaseException | None,
|
||||
exc_tb: TracebackType | None,
|
||||
) -> None:
|
||||
self._var.reset(self)
|
||||
|
||||
|
||||
class RunVar(Generic[T]):
|
||||
"""
|
||||
Like a :class:`~contextvars.ContextVar`, except scoped to the running event loop.
|
||||
|
||||
Can be used as a context manager, Just like :class:`~contextvars.ContextVar`, that
|
||||
will reset the variable to its previous value when the context block is exited.
|
||||
"""
|
||||
|
||||
__slots__ = "_name", "_default"
|
||||
|
||||
NO_VALUE_SET: Literal[_NoValueSet.NO_VALUE_SET] = _NoValueSet.NO_VALUE_SET
|
||||
|
||||
def __init__(
|
||||
self, name: str, default: T | Literal[_NoValueSet.NO_VALUE_SET] = NO_VALUE_SET
|
||||
):
|
||||
self._name = name
|
||||
self._default = default
|
||||
|
||||
@property
|
||||
def _current_vars(self) -> dict[RunVar[T], T]:
|
||||
native_token = current_token().native_token
|
||||
try:
|
||||
return _run_vars[native_token]
|
||||
except KeyError:
|
||||
run_vars = _run_vars[native_token] = {}
|
||||
return run_vars
|
||||
|
||||
@overload
|
||||
def get(self, default: D) -> T | D: ...
|
||||
|
||||
@overload
|
||||
def get(self) -> T: ...
|
||||
|
||||
def get(
|
||||
self, default: D | Literal[_NoValueSet.NO_VALUE_SET] = NO_VALUE_SET
|
||||
) -> T | D:
|
||||
try:
|
||||
return self._current_vars[self]
|
||||
except KeyError:
|
||||
if default is not RunVar.NO_VALUE_SET:
|
||||
return default
|
||||
elif self._default is not RunVar.NO_VALUE_SET:
|
||||
return self._default
|
||||
|
||||
raise LookupError(
|
||||
f'Run variable "{self._name}" has no value and no default set'
|
||||
)
|
||||
|
||||
def set(self, value: T) -> RunvarToken[T]:
|
||||
current_vars = self._current_vars
|
||||
token = RunvarToken(self, current_vars.get(self, RunVar.NO_VALUE_SET))
|
||||
current_vars[self] = value
|
||||
return token
|
||||
|
||||
def reset(self, token: RunvarToken[T]) -> None:
|
||||
if token._var is not self:
|
||||
raise ValueError("This token does not belong to this RunVar")
|
||||
|
||||
if token._redeemed:
|
||||
raise ValueError("This token has already been used")
|
||||
|
||||
if token._value is _NoValueSet.NO_VALUE_SET:
|
||||
try:
|
||||
del self._current_vars[self]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
self._current_vars[self] = token._value
|
||||
|
||||
token._redeemed = True
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<RunVar name={self._name!r}>"
|
||||
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/py.typed
vendored
Executable file
0
dev/env/cli_env/lib/python3.13/site-packages/anyio/py.typed
vendored
Executable file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user