arki3212 commited on
Commit
c40402f
·
verified ·
1 Parent(s): 10a832f

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +10 -0
  2. .gitignore +25 -0
  3. Dockerfile +19 -0
  4. README.md +7 -5
  5. app.py +6 -0
  6. data/.scraped_channels +3 -0
  7. main.py +215 -0
  8. requirements.txt +15 -0
  9. run_telegram_only.py +117 -0
  10. session_venv/.gitignore +2 -0
  11. session_venv/bin/Activate.ps1 +248 -0
  12. session_venv/bin/activate +76 -0
  13. session_venv/bin/activate.csh +27 -0
  14. session_venv/bin/activate.fish +69 -0
  15. session_venv/bin/dotenv +6 -0
  16. session_venv/bin/pip +6 -0
  17. session_venv/bin/pip3 +6 -0
  18. session_venv/bin/pip3.13 +6 -0
  19. session_venv/bin/pyrsa-decrypt +6 -0
  20. session_venv/bin/pyrsa-encrypt +6 -0
  21. session_venv/bin/pyrsa-keygen +6 -0
  22. session_venv/bin/pyrsa-priv2pub +6 -0
  23. session_venv/bin/pyrsa-sign +6 -0
  24. session_venv/bin/pyrsa-verify +6 -0
  25. session_venv/bin/python +3 -0
  26. session_venv/bin/python3 +3 -0
  27. session_venv/bin/python3.13 +3 -0
  28. session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/INSTALLER +1 -0
  29. session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/METADATA +295 -0
  30. session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/RECORD +10 -0
  31. session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/WHEEL +4 -0
  32. session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE +21 -0
  33. session_venv/lib/python3.13/site-packages/annotated_types/__init__.py +432 -0
  34. session_venv/lib/python3.13/site-packages/annotated_types/py.typed +0 -0
  35. session_venv/lib/python3.13/site-packages/annotated_types/test_cases.py +151 -0
  36. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/INSTALLER +1 -0
  37. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/METADATA +672 -0
  38. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/RECORD +221 -0
  39. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/REQUESTED +0 -0
  40. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/WHEEL +5 -0
  41. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/licenses/LICENSE +687 -0
  42. session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/top_level.txt +1 -0
  43. session_venv/lib/python3.13/site-packages/confluent_kafka.libs/librdkafka-a760591f.so.1 +3 -0
  44. session_venv/lib/python3.13/site-packages/confluent_kafka/__init__.py +171 -0
  45. session_venv/lib/python3.13/site-packages/confluent_kafka/_model/__init__.py +195 -0
  46. session_venv/lib/python3.13/site-packages/confluent_kafka/_types.py +38 -0
  47. session_venv/lib/python3.13/site-packages/confluent_kafka/_util/__init__.py +16 -0
  48. session_venv/lib/python3.13/site-packages/confluent_kafka/_util/conversion_util.py +39 -0
  49. session_venv/lib/python3.13/site-packages/confluent_kafka/_util/validation_util.py +58 -0
  50. session_venv/lib/python3.13/site-packages/confluent_kafka/admin/__init__.py +1382 -0
.gitattributes CHANGED
@@ -33,3 +33,13 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ session_venv/bin/python filter=lfs diff=lfs merge=lfs -text
37
+ session_venv/bin/python3 filter=lfs diff=lfs merge=lfs -text
38
+ session_venv/bin/python3.13 filter=lfs diff=lfs merge=lfs -text
39
+ session_venv/lib/python3.13/site-packages/confluent_kafka/cimpl.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
40
+ session_venv/lib/python3.13/site-packages/confluent_kafka.libs/librdkafka-a760591f.so.1 filter=lfs diff=lfs merge=lfs -text
41
+ session_venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64-arm.exe filter=lfs diff=lfs merge=lfs -text
42
+ session_venv/lib/python3.13/site-packages/pip/_vendor/distlib/t64.exe filter=lfs diff=lfs merge=lfs -text
43
+ session_venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64-arm.exe filter=lfs diff=lfs merge=lfs -text
44
+ session_venv/lib/python3.13/site-packages/pip/_vendor/distlib/w64.exe filter=lfs diff=lfs merge=lfs -text
45
+ session_venv/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Python
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+ venv/
7
+ .env
8
+
9
+ # Project Specific
10
+ data/
11
+ .scraped_history
12
+ telegram_session.session
13
+ telegram_session.session-journal
14
+
15
+ # Logs & Tests
16
+ *.log
17
+ check_db.py
18
+ test_mongo_upload.py
19
+ audit_sources.py
20
+ build_history.py
21
+ test_telegram.py
22
+
23
+ # OS
24
+ .DS_Store
25
+ Thumbs.db
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
6
+
7
+ COPY requirements.txt .
8
+ RUN pip install --no-cache-dir -r requirements.txt
9
+
10
+ COPY . .
11
+
12
+ # Ensure cert files are readable
13
+ RUN chmod -R 644 /app/certs/* 2>/dev/null || true
14
+
15
+ ENV PYTHONPATH=/app
16
+
17
+ EXPOSE 7860
18
+
19
+ CMD ["python", "main.py"]
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Multilingual Scraper
3
- emoji: 🦀
4
- colorFrom: purple
5
- colorTo: pink
6
  sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
  ---
2
+ title: Multilingual News Scraper
3
+ emoji: 🕸️
4
+ colorFrom: blue
5
+ colorTo: purple
6
  sdk: docker
7
  pinned: false
8
  ---
9
 
10
+ # Multilingual News Scraper
11
+
12
+ FastAPI application that periodically scrapes multilingual news sites and telegram channels, filters them, and publishes raw articles to Kafka.
app.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import sys
2
+ import os
3
+ # Add current directory to path
4
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
5
+
6
+ from main import app
data/.scraped_channels ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tikvahethiopia
2
+ tikvahethmagazine
3
+ shegamediaet
main.py ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ import httpx
3
+ import os
4
+ import logging
5
+ from collections import defaultdict
6
+ from src.config import SOURCES
7
+ from src.telegram_config import TELEGRAM_CONFIG, TELEGRAM_CHANNELS, TELEGRAM_SETTINGS
8
+ from src.scraper import NewsScraper
9
+ from src.extractor import ArticleExtractor
10
+ from src.filters import RelevanceFilter
11
+ from src.storage import ArticleStorage
12
+ from src.telegram_scraper import TelegramScraper
13
+ from src.news_discovery import NewsDiscovery
14
+ from src.bulk_extractor import BulkExtractor
15
+ from urllib.parse import urlparse
16
+
17
+ # Configure logging
18
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
19
+ logger = logging.getLogger(__name__)
20
+
21
+ # Global concurrency cap across all sources
22
+ GLOBAL_SEM = asyncio.Semaphore(20)
23
+ # Per-domain semaphore: max 2 concurrent requests to any single domain
24
+ _domain_sems: dict = defaultdict(lambda: asyncio.Semaphore(2))
25
+
26
+ def _get_domain_sem(url: str) -> asyncio.Semaphore:
27
+ domain = urlparse(url).netloc
28
+ return _domain_sems[domain]
29
+
30
+ async def process_news_source(source, scraper, extractor, r_filter, storage, client):
31
+ async with GLOBAL_SEM:
32
+ try:
33
+ print(f"🔍 Scraping {source['name']}...", flush=True)
34
+ links = await scraper.scrape_source(source, client)
35
+ if not links:
36
+ print(f" ↳ {source['name']}: no links found", flush=True)
37
+ return
38
+ collected = []
39
+ for link in links:
40
+ if storage.exists(link): continue
41
+ async with _get_domain_sem(link):
42
+ article = await extractor.process_url(scraper, link, source["name"], client)
43
+ if not article: continue
44
+ if r_filter.is_relevant(article): collected.append(article)
45
+ if collected:
46
+ print(f" ↳ {source['name']}: {len(collected)} articles saved", flush=True)
47
+ storage.save_collection(collected, source["name"])
48
+ except Exception as e:
49
+ print(f"❌ [News:{source['name']}] Failed: {e}", flush=True)
50
+
51
+ async def process_telegram(tg_scraper, storage):
52
+ print("🚀 Starting Telegram Scrape...")
53
+ if not TELEGRAM_SETTINGS.get("enabled") or not TELEGRAM_CONFIG.get("enabled"): return
54
+ await tg_scraper.initialize()
55
+ for channel in TELEGRAM_CHANNELS:
56
+ try:
57
+ messages = await tg_scraper.scrape_channel(channel, days_back=TELEGRAM_SETTINGS["days_back"], keywords=TELEGRAM_SETTINGS["keywords"])
58
+ new_msgs = [m for m in messages if not storage.exists(m["url"])]
59
+ if new_msgs: storage.save_collection(new_msgs, f"tg_{channel.replace('@', '')}")
60
+ except Exception as e: print(f"❌ [TG:{channel}] Failed: {e}")
61
+ await tg_scraper.close()
62
+
63
+ async def process_bulk_discovery(scraper, storage, client):
64
+ """
65
+ Intelligent bulk discovery from multiple free sources.
66
+ Gracefully handles all errors - never crashes the main pipeline.
67
+ """
68
+ print("\n🔍 Starting Intelligent Bulk Discovery...", flush=True)
69
+
70
+ try:
71
+ discovery = NewsDiscovery()
72
+ bulk_extractor = BulkExtractor()
73
+
74
+ # Discover URLs from all sources (RSS + NewsAPI + Guardian)
75
+ print(" → Discovering URLs from multiple sources...", flush=True)
76
+ discovered_urls = await discovery.discover_all_urls()
77
+
78
+ if not discovered_urls:
79
+ print(" ↳ No URLs discovered (all sources may have failed)", flush=True)
80
+ return
81
+
82
+ print(f" ↳ Total URLs discovered: {len(discovered_urls)}", flush=True)
83
+
84
+ # Filter out already scraped URLs
85
+ new_urls = [url for url in discovered_urls if not storage.exists(url)]
86
+ print(f" ↳ New URLs (after dedup): {len(new_urls)}", flush=True)
87
+
88
+ if not new_urls:
89
+ print(" ↳ All discovered URLs already scraped", flush=True)
90
+ return
91
+
92
+ # Process URLs with bulk extractor (no date filtering, no relevance filter)
93
+ print(f" → Processing {len(new_urls)} new URLs...", flush=True)
94
+ collected = []
95
+ failed = 0
96
+
97
+ for i, url in enumerate(new_urls, 1):
98
+ try:
99
+ # Extract source name from URL domain
100
+ source_name = discovery.extract_source_from_url(url)
101
+
102
+ # Use domain-based rate limiting
103
+ async with _get_domain_sem(url):
104
+ article = await bulk_extractor.process_url(scraper, url, source_name, client)
105
+
106
+ if article:
107
+ collected.append(article)
108
+ if i % 50 == 0: # Progress update every 50 articles
109
+ print(f" ↳ Progress: {i}/{len(new_urls)} processed, {len(collected)} extracted", flush=True)
110
+ else:
111
+ failed += 1
112
+
113
+ except Exception as e:
114
+ logger.debug(f"Failed to process {url}: {e}")
115
+ failed += 1
116
+ continue
117
+
118
+ # Save collected articles
119
+ if collected:
120
+ print(f" ↳ Successfully extracted: {len(collected)} articles", flush=True)
121
+ print(f" ↳ Failed/skipped: {failed} URLs", flush=True)
122
+ storage.save_collection(collected, "bulk_discovery")
123
+ print(f"✅ Bulk Discovery Complete: {len(collected)} articles saved", flush=True)
124
+ else:
125
+ print(f" ↳ No articles extracted (all {failed} URLs failed)", flush=True)
126
+
127
+ except Exception as e:
128
+ print(f"❌ Bulk Discovery failed: {e}", flush=True)
129
+ logger.error(f"Bulk discovery error: {e}", exc_info=True)
130
+
131
+ async def main():
132
+ print("🌟 RAGsystem Production Pipeline Launching", flush=True)
133
+ print("🔌 Initializing Kafka producer...", flush=True)
134
+
135
+ try:
136
+ storage = ArticleStorage()
137
+ print("✅ Kafka producer ready", flush=True)
138
+ except Exception as e:
139
+ print(f"❌ Kafka producer failed: {e}", flush=True)
140
+ raise
141
+
142
+ print("🔧 Initializing other components...", flush=True)
143
+ r_filter = RelevanceFilter()
144
+ scraper = NewsScraper()
145
+ extractor = ArticleExtractor()
146
+ active_sources = storage.get_synchronized_sources(SOURCES)
147
+ print(f"✅ Components ready. Found {len(active_sources)} sources", flush=True)
148
+
149
+ async with httpx.AsyncClient(
150
+ timeout=30.0,
151
+ follow_redirects=True,
152
+ headers=scraper.headers,
153
+ ) as client:
154
+ print(f"🚀 Starting News Discovery for {len(active_sources)} sources...", flush=True)
155
+ news_tasks = [process_news_source(s, scraper, extractor, r_filter, storage, client) for s in active_sources]
156
+ await asyncio.gather(*news_tasks)
157
+
158
+ # NEW: Intelligent Bulk Discovery (runs after regular scrapers)
159
+ await process_bulk_discovery(scraper, storage, client)
160
+
161
+ if TELEGRAM_CONFIG["api_id"]:
162
+ tg_scraper = TelegramScraper(TELEGRAM_CONFIG["api_id"], TELEGRAM_CONFIG["api_hash"], TELEGRAM_CONFIG["phone"])
163
+ await process_telegram(tg_scraper, storage)
164
+ print("\n🏁 All Pipelines Complete. Data ready for RAG.", flush=True)
165
+
166
+ from fastapi import FastAPI, BackgroundTasks
167
+ import uvicorn
168
+
169
+ app = FastAPI()
170
+
171
+ # Global state to prevent concurrent manual runs
172
+ is_running = False
173
+
174
+ async def loop_main():
175
+ while True:
176
+ try:
177
+ await main()
178
+ except Exception as e:
179
+ print(f"❌ Main loop failed: {e}", flush=True)
180
+ logger.error(f"Main loop error: {e}", exc_info=True)
181
+ print("⏳ Waiting 1 hour before next run...", flush=True)
182
+ await asyncio.sleep(3600) # 1 hour
183
+
184
+ @app.on_event("startup")
185
+ async def startup_event():
186
+ print("🚀 Starting continuous 1-hour scraper loop in background...", flush=True)
187
+ asyncio.create_task(loop_main())
188
+
189
+ @app.get("/")
190
+ def health_check():
191
+ return {"status": "healthy", "service": "Multilingual Scraper"}
192
+
193
+ @app.get("/trigger")
194
+ async def trigger_scraper(background_tasks: BackgroundTasks):
195
+ """Manually trigger the scraper outside of the 1-hour schedule."""
196
+ global is_running
197
+ if is_running:
198
+ return {"status": "error", "message": "Scraper is already running"}
199
+
200
+ async def run_once():
201
+ global is_running
202
+ is_running = True
203
+ try:
204
+ print("⚡ Manual trigger activated!", flush=True)
205
+ await main()
206
+ except Exception as e:
207
+ print(f"❌ Manual run failed: {e}", flush=True)
208
+ finally:
209
+ is_running = False
210
+
211
+ background_tasks.add_task(run_once)
212
+ return {"status": "success", "message": "Scraper triggered successfully in the background!"}
213
+
214
+ if __name__ == "__main__":
215
+ uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=False)
requirements.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ httpx
2
+ feedparser
3
+ beautifulsoup4
4
+ trafilatura
5
+ langdetect
6
+ python-dateutil
7
+ tqdm
8
+ lxml_html_clean
9
+ tweepy>=4.14.0
10
+ python-dotenv>=1.0.0
11
+ pymongo
12
+ telethon
13
+ fastapi
14
+ uvicorn
15
+ confluent-kafka
run_telegram_only.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Standalone Telegram scraper - runs only Telegram channels without other news sources.
3
+ """
4
+ import asyncio
5
+ import logging
6
+ from src.telegram_config import (
7
+ TELEGRAM_CONFIG,
8
+ AMHARIC_TELEGRAM_CHANNELS, AMHARIC_TELEGRAM_SETTINGS,
9
+ ETHIOPIAN_ENGLISH_TELEGRAM_CHANNELS, ETHIOPIAN_ENGLISH_TELEGRAM_SETTINGS,
10
+ )
11
+ from src.storage import ArticleStorage
12
+ from src.telegram_scraper import TelegramScraper
13
+
14
+ # Configure logging
15
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
16
+ logger = logging.getLogger(__name__)
17
+
18
+ async def process_telegram_only():
19
+ """Process only Telegram channels - today + yesterday (last 2 days)"""
20
+ print("🚀 Starting Telegram-Only Scraper (Today + Yesterday)...", flush=True)
21
+
22
+ # Check if Telegram is configured
23
+ if not TELEGRAM_CONFIG.get("enabled") or not TELEGRAM_CONFIG["api_id"]:
24
+ print("❌ Telegram API credentials not configured in .env", flush=True)
25
+ print(" Required: TELEGRAM_API_ID, TELEGRAM_API_HASH, TELEGRAM_PHONE", flush=True)
26
+ return
27
+
28
+ print("🔌 Initializing Kafka producer...", flush=True)
29
+ try:
30
+ storage = ArticleStorage()
31
+ print("✅ Kafka producer ready", flush=True)
32
+ except Exception as e:
33
+ print(f"❌ Kafka producer failed: {e}", flush=True)
34
+ raise
35
+
36
+ print("📱 Initializing Telegram client...", flush=True)
37
+ tg_scraper = TelegramScraper(
38
+ TELEGRAM_CONFIG["api_id"],
39
+ TELEGRAM_CONFIG["api_hash"],
40
+ TELEGRAM_CONFIG["phone"]
41
+ )
42
+
43
+ try:
44
+ await tg_scraper.initialize()
45
+ print("✅ Telegram client connected", flush=True)
46
+ except Exception as e:
47
+ print(f"❌ Telegram initialization failed: {e}", flush=True)
48
+ raise
49
+
50
+ total_saved = 0
51
+ DAYS_BACK = 2 # Today + Yesterday
52
+
53
+ # Process Ethiopian Amharic channels — no keyword filter, force language tag to "am"
54
+ if AMHARIC_TELEGRAM_SETTINGS.get("enabled"):
55
+ print(f"\n📰 Processing {len(AMHARIC_TELEGRAM_CHANNELS)} Amharic channels (last {DAYS_BACK} days)...", flush=True)
56
+ for channel in AMHARIC_TELEGRAM_CHANNELS:
57
+ try:
58
+ print(f" 🔍 {channel}: scraping last {DAYS_BACK} days", flush=True)
59
+
60
+ messages = await tg_scraper.scrape_channel(
61
+ channel,
62
+ days_back=DAYS_BACK,
63
+ keywords=None # No keyword filter for Amharic
64
+ )
65
+
66
+ # Force Amharic language tag and add local_title
67
+ for m in messages:
68
+ m["language"] = "am"
69
+ text = m.get("text", "") or ""
70
+ m.setdefault("metadata", {})["local_title"] = text[:80] if text else "Untitled"
71
+
72
+ # Filter out already scraped
73
+ new_msgs = [m for m in messages if not storage.exists(m["url"])]
74
+
75
+ if new_msgs:
76
+ storage.save_collection(new_msgs, f"tg_{channel.replace('@', '')}")
77
+ total_saved += len(new_msgs)
78
+ print(f" ✅ {channel}: {len(new_msgs)} new messages saved", flush=True)
79
+ else:
80
+ print(f" ↳ {channel}: no new messages (all already scraped)", flush=True)
81
+
82
+ except Exception as e:
83
+ print(f" ❌ {channel}: Failed - {e}", flush=True)
84
+ logger.error(f"Amharic channel {channel} error: {e}", exc_info=True)
85
+
86
+ # Process Ethiopian English channels — keyword-filtered
87
+ if ETHIOPIAN_ENGLISH_TELEGRAM_SETTINGS.get("enabled"):
88
+ print(f"\n📰 Processing {len(ETHIOPIAN_ENGLISH_TELEGRAM_CHANNELS)} Ethiopian English channels (last {DAYS_BACK} days)...", flush=True)
89
+ for channel in ETHIOPIAN_ENGLISH_TELEGRAM_CHANNELS:
90
+ try:
91
+ print(f" 🔍 {channel}: scraping last {DAYS_BACK} days", flush=True)
92
+
93
+ messages = await tg_scraper.scrape_channel(
94
+ channel,
95
+ days_back=DAYS_BACK,
96
+ keywords=ETHIOPIAN_ENGLISH_TELEGRAM_SETTINGS["keywords"]
97
+ )
98
+
99
+ new_msgs = [m for m in messages if not storage.exists(m["url"])]
100
+
101
+ if new_msgs:
102
+ storage.save_collection(new_msgs, f"tg_{channel.replace('@', '')}")
103
+ total_saved += len(new_msgs)
104
+ print(f" ✅ {channel}: {len(new_msgs)} new messages saved", flush=True)
105
+ else:
106
+ print(f" ↳ {channel}: no new messages", flush=True)
107
+
108
+ except Exception as e:
109
+ print(f" ❌ {channel}: Failed - {e}", flush=True)
110
+ logger.error(f"English channel {channel} error: {e}", exc_info=True)
111
+
112
+ await tg_scraper.close()
113
+ print(f"\n🏁 Telegram Scraping Complete: {total_saved} total messages saved", flush=True)
114
+
115
+ if __name__ == "__main__":
116
+ print("🚀 Starting Telegram-only scraper...", flush=True)
117
+ asyncio.run(process_telegram_only())
session_venv/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Created by venv; see https://docs.python.org/3/library/venv.html
2
+ *
session_venv/bin/Activate.ps1 ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <#
2
+ .Synopsis
3
+ Activate a Python virtual environment for the current PowerShell session.
4
+
5
+ .Description
6
+ Pushes the python executable for a virtual environment to the front of the
7
+ $Env:PATH environment variable and sets the prompt to signify that you are
8
+ in a Python virtual environment. Makes use of the command line switches as
9
+ well as the `pyvenv.cfg` file values present in the virtual environment.
10
+
11
+ .Parameter VenvDir
12
+ Path to the directory that contains the virtual environment to activate. The
13
+ default value for this is the parent of the directory that the Activate.ps1
14
+ script is located within.
15
+
16
+ .Parameter Prompt
17
+ The prompt prefix to display when this virtual environment is activated. By
18
+ default, this prompt is the name of the virtual environment folder (VenvDir)
19
+ surrounded by parentheses and followed by a single space (ie. '(.venv) ').
20
+
21
+ .Example
22
+ Activate.ps1
23
+ Activates the Python virtual environment that contains the Activate.ps1 script.
24
+
25
+ .Example
26
+ Activate.ps1 -Verbose
27
+ Activates the Python virtual environment that contains the Activate.ps1 script,
28
+ and shows extra information about the activation as it executes.
29
+
30
+ .Example
31
+ Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
32
+ Activates the Python virtual environment located in the specified location.
33
+
34
+ .Example
35
+ Activate.ps1 -Prompt "MyPython"
36
+ Activates the Python virtual environment that contains the Activate.ps1 script,
37
+ and prefixes the current prompt with the specified string (surrounded in
38
+ parentheses) while the virtual environment is active.
39
+
40
+ .Notes
41
+ On Windows, it may be required to enable this Activate.ps1 script by setting the
42
+ execution policy for the user. You can do this by issuing the following PowerShell
43
+ command:
44
+
45
+ PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
46
+
47
+ For more information on Execution Policies:
48
+ https://go.microsoft.com/fwlink/?LinkID=135170
49
+
50
+ #>
51
+ Param(
52
+ [Parameter(Mandatory = $false)]
53
+ [String]
54
+ $VenvDir,
55
+ [Parameter(Mandatory = $false)]
56
+ [String]
57
+ $Prompt
58
+ )
59
+
60
+ <# Function declarations --------------------------------------------------- #>
61
+
62
+ <#
63
+ .Synopsis
64
+ Remove all shell session elements added by the Activate script, including the
65
+ addition of the virtual environment's Python executable from the beginning of
66
+ the PATH variable.
67
+
68
+ .Parameter NonDestructive
69
+ If present, do not remove this function from the global namespace for the
70
+ session.
71
+
72
+ #>
73
+ function global:deactivate ([switch]$NonDestructive) {
74
+ # Revert to original values
75
+
76
+ # The prior prompt:
77
+ if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
78
+ Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
79
+ Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
80
+ }
81
+
82
+ # The prior PYTHONHOME:
83
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
84
+ Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
85
+ Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
86
+ }
87
+
88
+ # The prior PATH:
89
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
90
+ Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
91
+ Remove-Item -Path Env:_OLD_VIRTUAL_PATH
92
+ }
93
+
94
+ # Just remove the VIRTUAL_ENV altogether:
95
+ if (Test-Path -Path Env:VIRTUAL_ENV) {
96
+ Remove-Item -Path env:VIRTUAL_ENV
97
+ }
98
+
99
+ # Just remove VIRTUAL_ENV_PROMPT altogether.
100
+ if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
101
+ Remove-Item -Path env:VIRTUAL_ENV_PROMPT
102
+ }
103
+
104
+ # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
105
+ if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
106
+ Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
107
+ }
108
+
109
+ # Leave deactivate function in the global namespace if requested:
110
+ if (-not $NonDestructive) {
111
+ Remove-Item -Path function:deactivate
112
+ }
113
+ }
114
+
115
+ <#
116
+ .Description
117
+ Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
118
+ given folder, and returns them in a map.
119
+
120
+ For each line in the pyvenv.cfg file, if that line can be parsed into exactly
121
+ two strings separated by `=` (with any amount of whitespace surrounding the =)
122
+ then it is considered a `key = value` line. The left hand string is the key,
123
+ the right hand is the value.
124
+
125
+ If the value starts with a `'` or a `"` then the first and last character is
126
+ stripped from the value before being captured.
127
+
128
+ .Parameter ConfigDir
129
+ Path to the directory that contains the `pyvenv.cfg` file.
130
+ #>
131
+ function Get-PyVenvConfig(
132
+ [String]
133
+ $ConfigDir
134
+ ) {
135
+ Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
136
+
137
+ # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
138
+ $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
139
+
140
+ # An empty map will be returned if no config file is found.
141
+ $pyvenvConfig = @{ }
142
+
143
+ if ($pyvenvConfigPath) {
144
+
145
+ Write-Verbose "File exists, parse `key = value` lines"
146
+ $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
147
+
148
+ $pyvenvConfigContent | ForEach-Object {
149
+ $keyval = $PSItem -split "\s*=\s*", 2
150
+ if ($keyval[0] -and $keyval[1]) {
151
+ $val = $keyval[1]
152
+
153
+ # Remove extraneous quotations around a string value.
154
+ if ("'""".Contains($val.Substring(0, 1))) {
155
+ $val = $val.Substring(1, $val.Length - 2)
156
+ }
157
+
158
+ $pyvenvConfig[$keyval[0]] = $val
159
+ Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
160
+ }
161
+ }
162
+ }
163
+ return $pyvenvConfig
164
+ }
165
+
166
+
167
+ <# Begin Activate script --------------------------------------------------- #>
168
+
169
+ # Determine the containing directory of this script
170
+ $VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
171
+ $VenvExecDir = Get-Item -Path $VenvExecPath
172
+
173
+ Write-Verbose "Activation script is located in path: '$VenvExecPath'"
174
+ Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
175
+ Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
176
+
177
+ # Set values required in priority: CmdLine, ConfigFile, Default
178
+ # First, get the location of the virtual environment, it might not be
179
+ # VenvExecDir if specified on the command line.
180
+ if ($VenvDir) {
181
+ Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
182
+ }
183
+ else {
184
+ Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
185
+ $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
186
+ Write-Verbose "VenvDir=$VenvDir"
187
+ }
188
+
189
+ # Next, read the `pyvenv.cfg` file to determine any required value such
190
+ # as `prompt`.
191
+ $pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
192
+
193
+ # Next, set the prompt from the command line, or the config file, or
194
+ # just use the name of the virtual environment folder.
195
+ if ($Prompt) {
196
+ Write-Verbose "Prompt specified as argument, using '$Prompt'"
197
+ }
198
+ else {
199
+ Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
200
+ if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
201
+ Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
202
+ $Prompt = $pyvenvCfg['prompt'];
203
+ }
204
+ else {
205
+ Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
206
+ Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
207
+ $Prompt = Split-Path -Path $venvDir -Leaf
208
+ }
209
+ }
210
+
211
+ Write-Verbose "Prompt = '$Prompt'"
212
+ Write-Verbose "VenvDir='$VenvDir'"
213
+
214
+ # Deactivate any currently active virtual environment, but leave the
215
+ # deactivate function in place.
216
+ deactivate -nondestructive
217
+
218
+ # Now set the environment variable VIRTUAL_ENV, used by many tools to determine
219
+ # that there is an activated venv.
220
+ $env:VIRTUAL_ENV = $VenvDir
221
+
222
+ $env:VIRTUAL_ENV_PROMPT = $Prompt
223
+
224
+ if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
225
+
226
+ Write-Verbose "Setting prompt to '$Prompt'"
227
+
228
+ # Set the prompt to include the env name
229
+ # Make sure _OLD_VIRTUAL_PROMPT is global
230
+ function global:_OLD_VIRTUAL_PROMPT { "" }
231
+ Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
232
+ New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
233
+
234
+ function global:prompt {
235
+ Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
236
+ _OLD_VIRTUAL_PROMPT
237
+ }
238
+ }
239
+
240
+ # Clear PYTHONHOME
241
+ if (Test-Path -Path Env:PYTHONHOME) {
242
+ Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
243
+ Remove-Item -Path Env:PYTHONHOME
244
+ }
245
+
246
+ # Add the venv to the PATH
247
+ Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
248
+ $Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
session_venv/bin/activate ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate" *from bash*
2
+ # You cannot run it directly
3
+
4
+ deactivate () {
5
+ # reset old environment variables
6
+ if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
7
+ PATH="${_OLD_VIRTUAL_PATH:-}"
8
+ export PATH
9
+ unset _OLD_VIRTUAL_PATH
10
+ fi
11
+ if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
12
+ PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
13
+ export PYTHONHOME
14
+ unset _OLD_VIRTUAL_PYTHONHOME
15
+ fi
16
+
17
+ # Call hash to forget past locations. Without forgetting
18
+ # past locations the $PATH changes we made may not be respected.
19
+ # See "man bash" for more details. hash is usually a builtin of your shell
20
+ hash -r 2> /dev/null
21
+
22
+ if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
23
+ PS1="${_OLD_VIRTUAL_PS1:-}"
24
+ export PS1
25
+ unset _OLD_VIRTUAL_PS1
26
+ fi
27
+
28
+ unset VIRTUAL_ENV
29
+ unset VIRTUAL_ENV_PROMPT
30
+ if [ ! "${1:-}" = "nondestructive" ] ; then
31
+ # Self destruct!
32
+ unset -f deactivate
33
+ fi
34
+ }
35
+
36
+ # unset irrelevant variables
37
+ deactivate nondestructive
38
+
39
+ # on Windows, a path can contain colons and backslashes and has to be converted:
40
+ case "$(uname)" in
41
+ CYGWIN*|MSYS*|MINGW*)
42
+ # transform D:\path\to\venv to /d/path/to/venv on MSYS and MINGW
43
+ # and to /cygdrive/d/path/to/venv on Cygwin
44
+ VIRTUAL_ENV=$(cygpath /home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv)
45
+ export VIRTUAL_ENV
46
+ ;;
47
+ *)
48
+ # use the path as-is
49
+ export VIRTUAL_ENV=/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv
50
+ ;;
51
+ esac
52
+
53
+ _OLD_VIRTUAL_PATH="$PATH"
54
+ PATH="$VIRTUAL_ENV/"bin":$PATH"
55
+ export PATH
56
+
57
+ VIRTUAL_ENV_PROMPT=session_venv
58
+ export VIRTUAL_ENV_PROMPT
59
+
60
+ # unset PYTHONHOME if set
61
+ # this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
62
+ # could use `if (set -u; : $PYTHONHOME) ;` in bash
63
+ if [ -n "${PYTHONHOME:-}" ] ; then
64
+ _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
65
+ unset PYTHONHOME
66
+ fi
67
+
68
+ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
69
+ _OLD_VIRTUAL_PS1="${PS1:-}"
70
+ PS1="("session_venv") ${PS1:-}"
71
+ export PS1
72
+ fi
73
+
74
+ # Call hash to forget past commands. Without forgetting
75
+ # past commands the $PATH changes we made may not be respected
76
+ hash -r 2> /dev/null
session_venv/bin/activate.csh ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate.csh" *from csh*.
2
+ # You cannot run it directly.
3
+
4
+ # Created by Davide Di Blasi <davidedb@gmail.com>.
5
+ # Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
6
+
7
+ 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'
8
+
9
+ # Unset irrelevant variables.
10
+ deactivate nondestructive
11
+
12
+ setenv VIRTUAL_ENV /home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv
13
+
14
+ set _OLD_VIRTUAL_PATH="$PATH"
15
+ setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
16
+ setenv VIRTUAL_ENV_PROMPT session_venv
17
+
18
+
19
+ set _OLD_VIRTUAL_PROMPT="$prompt"
20
+
21
+ if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
22
+ set prompt = "("session_venv") $prompt:q"
23
+ endif
24
+
25
+ alias pydoc python -m pydoc
26
+
27
+ rehash
session_venv/bin/activate.fish ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source <venv>/bin/activate.fish" *from fish*
2
+ # (https://fishshell.com/). You cannot run it directly.
3
+
4
+ function deactivate -d "Exit virtual environment and return to normal shell environment"
5
+ # reset old environment variables
6
+ if test -n "$_OLD_VIRTUAL_PATH"
7
+ set -gx PATH $_OLD_VIRTUAL_PATH
8
+ set -e _OLD_VIRTUAL_PATH
9
+ end
10
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
11
+ set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
12
+ set -e _OLD_VIRTUAL_PYTHONHOME
13
+ end
14
+
15
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
16
+ set -e _OLD_FISH_PROMPT_OVERRIDE
17
+ # prevents error when using nested fish instances (Issue #93858)
18
+ if functions -q _old_fish_prompt
19
+ functions -e fish_prompt
20
+ functions -c _old_fish_prompt fish_prompt
21
+ functions -e _old_fish_prompt
22
+ end
23
+ end
24
+
25
+ set -e VIRTUAL_ENV
26
+ set -e VIRTUAL_ENV_PROMPT
27
+ if test "$argv[1]" != "nondestructive"
28
+ # Self-destruct!
29
+ functions -e deactivate
30
+ end
31
+ end
32
+
33
+ # Unset irrelevant variables.
34
+ deactivate nondestructive
35
+
36
+ set -gx VIRTUAL_ENV /home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv
37
+
38
+ set -gx _OLD_VIRTUAL_PATH $PATH
39
+ set -gx PATH "$VIRTUAL_ENV/"bin $PATH
40
+ set -gx VIRTUAL_ENV_PROMPT session_venv
41
+
42
+ # Unset PYTHONHOME if set.
43
+ if set -q PYTHONHOME
44
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
45
+ set -e PYTHONHOME
46
+ end
47
+
48
+ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
49
+ # fish uses a function instead of an env var to generate the prompt.
50
+
51
+ # Save the current fish_prompt function as the function _old_fish_prompt.
52
+ functions -c fish_prompt _old_fish_prompt
53
+
54
+ # With the original prompt function renamed, we can override with our own.
55
+ function fish_prompt
56
+ # Save the return status of the last command.
57
+ set -l old_status $status
58
+
59
+ # Output the venv prompt; color taken from the blue of the Python logo.
60
+ printf "%s(%s)%s " (set_color 4B8BBE) session_venv (set_color normal)
61
+
62
+ # Restore the return status of the previous command.
63
+ echo "exit $old_status" | .
64
+ # Output the original/"old" prompt.
65
+ _old_fish_prompt
66
+ end
67
+
68
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
69
+ end
session_venv/bin/dotenv ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from dotenv.__main__ import cli
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(cli())
session_venv/bin/pip ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from pip._internal.cli.main import main
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(main())
session_venv/bin/pip3 ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from pip._internal.cli.main import main
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(main())
session_venv/bin/pip3.13 ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from pip._internal.cli.main import main
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(main())
session_venv/bin/pyrsa-decrypt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.cli import decrypt
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(decrypt())
session_venv/bin/pyrsa-encrypt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.cli import encrypt
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(encrypt())
session_venv/bin/pyrsa-keygen ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.cli import keygen
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(keygen())
session_venv/bin/pyrsa-priv2pub ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.util import private_to_public
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(private_to_public())
session_venv/bin/pyrsa-sign ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.cli import sign
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(sign())
session_venv/bin/pyrsa-verify ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/home/nahom/Documents/Rag/Rag-System-V2/services/ingestion/scraper-multilingual/session_venv/bin/python3
2
+ import sys
3
+ from rsa.cli import verify
4
+ if __name__ == '__main__':
5
+ sys.argv[0] = sys.argv[0].removesuffix('.exe')
6
+ sys.exit(verify())
session_venv/bin/python ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e59d0124ff06c248546876e01fcfb1ea3cda63534949f94a9372bfcfe3bfc3f5
3
+ size 6828688
session_venv/bin/python3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e59d0124ff06c248546876e01fcfb1ea3cda63534949f94a9372bfcfe3bfc3f5
3
+ size 6828688
session_venv/bin/python3.13 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e59d0124ff06c248546876e01fcfb1ea3cda63534949f94a9372bfcfe3bfc3f5
3
+ size 6828688
session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/METADATA ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.3
2
+ Name: annotated-types
3
+ Version: 0.7.0
4
+ Summary: Reusable constraint types to use with typing.Annotated
5
+ Project-URL: Homepage, https://github.com/annotated-types/annotated-types
6
+ Project-URL: Source, https://github.com/annotated-types/annotated-types
7
+ Project-URL: Changelog, https://github.com/annotated-types/annotated-types/releases
8
+ Author-email: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>, Samuel Colvin <s@muelcolvin.com>, Zac Hatfield-Dodds <zac@zhd.dev>
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Environment :: MacOS X
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Unix
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.8
27
+ Requires-Dist: typing-extensions>=4.0.0; python_version < '3.9'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # annotated-types
31
+
32
+ [![CI](https://github.com/annotated-types/annotated-types/workflows/CI/badge.svg?event=push)](https://github.com/annotated-types/annotated-types/actions?query=event%3Apush+branch%3Amain+workflow%3ACI)
33
+ [![pypi](https://img.shields.io/pypi/v/annotated-types.svg)](https://pypi.python.org/pypi/annotated-types)
34
+ [![versions](https://img.shields.io/pypi/pyversions/annotated-types.svg)](https://github.com/annotated-types/annotated-types)
35
+ [![license](https://img.shields.io/github/license/annotated-types/annotated-types.svg)](https://github.com/annotated-types/annotated-types/blob/main/LICENSE)
36
+
37
+ [PEP-593](https://peps.python.org/pep-0593/) added `typing.Annotated` as a way of
38
+ adding context-specific metadata to existing types, and specifies that
39
+ `Annotated[T, x]` _should_ be treated as `T` by any tool or library without special
40
+ logic for `x`.
41
+
42
+ This package provides metadata objects which can be used to represent common
43
+ constraints such as upper and lower bounds on scalar values and collection sizes,
44
+ a `Predicate` marker for runtime checks, and
45
+ descriptions of how we intend these metadata to be interpreted. In some cases,
46
+ we also note alternative representations which do not require this package.
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ pip install annotated-types
52
+ ```
53
+
54
+ ## Examples
55
+
56
+ ```python
57
+ from typing import Annotated
58
+ from annotated_types import Gt, Len, Predicate
59
+
60
+ class MyClass:
61
+ age: Annotated[int, Gt(18)] # Valid: 19, 20, ...
62
+ # Invalid: 17, 18, "19", 19.0, ...
63
+ factors: list[Annotated[int, Predicate(is_prime)]] # Valid: 2, 3, 5, 7, 11, ...
64
+ # Invalid: 4, 8, -2, 5.0, "prime", ...
65
+
66
+ my_list: Annotated[list[int], Len(0, 10)] # Valid: [], [10, 20, 30, 40, 50]
67
+ # Invalid: (1, 2), ["abc"], [0] * 20
68
+ ```
69
+
70
+ ## Documentation
71
+
72
+ _While `annotated-types` avoids runtime checks for performance, users should not
73
+ construct invalid combinations such as `MultipleOf("non-numeric")` or `Annotated[int, Len(3)]`.
74
+ Downstream implementors may choose to raise an error, emit a warning, silently ignore
75
+ a metadata item, etc., if the metadata objects described below are used with an
76
+ incompatible type - or for any other reason!_
77
+
78
+ ### Gt, Ge, Lt, Le
79
+
80
+ Express inclusive and/or exclusive bounds on orderable values - which may be numbers,
81
+ dates, times, strings, sets, etc. Note that the boundary value need not be of the
82
+ same type that was annotated, so long as they can be compared: `Annotated[int, Gt(1.5)]`
83
+ is fine, for example, and implies that the value is an integer x such that `x > 1.5`.
84
+
85
+ We suggest that implementors may also interpret `functools.partial(operator.le, 1.5)`
86
+ as being equivalent to `Gt(1.5)`, for users who wish to avoid a runtime dependency on
87
+ the `annotated-types` package.
88
+
89
+ To be explicit, these types have the following meanings:
90
+
91
+ * `Gt(x)` - value must be "Greater Than" `x` - equivalent to exclusive minimum
92
+ * `Ge(x)` - value must be "Greater than or Equal" to `x` - equivalent to inclusive minimum
93
+ * `Lt(x)` - value must be "Less Than" `x` - equivalent to exclusive maximum
94
+ * `Le(x)` - value must be "Less than or Equal" to `x` - equivalent to inclusive maximum
95
+
96
+ ### Interval
97
+
98
+ `Interval(gt, ge, lt, le)` allows you to specify an upper and lower bound with a single
99
+ metadata object. `None` attributes should be ignored, and non-`None` attributes
100
+ treated as per the single bounds above.
101
+
102
+ ### MultipleOf
103
+
104
+ `MultipleOf(multiple_of=x)` might be interpreted in two ways:
105
+
106
+ 1. Python semantics, implying `value % multiple_of == 0`, or
107
+ 2. [JSONschema semantics](https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.2.1),
108
+ where `int(value / multiple_of) == value / multiple_of`.
109
+
110
+ We encourage users to be aware of these two common interpretations and their
111
+ distinct behaviours, especially since very large or non-integer numbers make
112
+ it easy to cause silent data corruption due to floating-point imprecision.
113
+
114
+ We encourage libraries to carefully document which interpretation they implement.
115
+
116
+ ### MinLen, MaxLen, Len
117
+
118
+ `Len()` implies that `min_length <= len(value) <= max_length` - lower and upper bounds are inclusive.
119
+
120
+ As well as `Len()` which can optionally include upper and lower bounds, we also
121
+ provide `MinLen(x)` and `MaxLen(y)` which are equivalent to `Len(min_length=x)`
122
+ and `Len(max_length=y)` respectively.
123
+
124
+ `Len`, `MinLen`, and `MaxLen` may be used with any type which supports `len(value)`.
125
+
126
+ Examples of usage:
127
+
128
+ * `Annotated[list, MaxLen(10)]` (or `Annotated[list, Len(max_length=10))`) - list must have a length of 10 or less
129
+ * `Annotated[str, MaxLen(10)]` - string must have a length of 10 or less
130
+ * `Annotated[list, MinLen(3))` (or `Annotated[list, Len(min_length=3))`) - list must have a length of 3 or more
131
+ * `Annotated[list, Len(4, 6)]` - list must have a length of 4, 5, or 6
132
+ * `Annotated[list, Len(8, 8)]` - list must have a length of exactly 8
133
+
134
+ #### Changed in v0.4.0
135
+
136
+ * `min_inclusive` has been renamed to `min_length`, no change in meaning
137
+ * `max_exclusive` has been renamed to `max_length`, upper bound is now **inclusive** instead of **exclusive**
138
+ * The recommendation that slices are interpreted as `Len` has been removed due to ambiguity and different semantic
139
+ meaning of the upper bound in slices vs. `Len`
140
+
141
+ See [issue #23](https://github.com/annotated-types/annotated-types/issues/23) for discussion.
142
+
143
+ ### Timezone
144
+
145
+ `Timezone` can be used with a `datetime` or a `time` to express which timezones
146
+ are allowed. `Annotated[datetime, Timezone(None)]` must be a naive datetime.
147
+ `Timezone[...]` ([literal ellipsis](https://docs.python.org/3/library/constants.html#Ellipsis))
148
+ expresses that any timezone-aware datetime is allowed. You may also pass a specific
149
+ timezone string or [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects)
150
+ object such as `Timezone(timezone.utc)` or `Timezone("Africa/Abidjan")` to express that you only
151
+ allow a specific timezone, though we note that this is often a symptom of fragile design.
152
+
153
+ #### Changed in v0.x.x
154
+
155
+ * `Timezone` accepts [`tzinfo`](https://docs.python.org/3/library/datetime.html#tzinfo-objects) objects instead of
156
+ `timezone`, extending compatibility to [`zoneinfo`](https://docs.python.org/3/library/zoneinfo.html) and third party libraries.
157
+
158
+ ### Unit
159
+
160
+ `Unit(unit: str)` expresses that the annotated numeric value is the magnitude of
161
+ a quantity with the specified unit. For example, `Annotated[float, Unit("m/s")]`
162
+ would be a float representing a velocity in meters per second.
163
+
164
+ Please note that `annotated_types` itself makes no attempt to parse or validate
165
+ the unit string in any way. That is left entirely to downstream libraries,
166
+ such as [`pint`](https://pint.readthedocs.io) or
167
+ [`astropy.units`](https://docs.astropy.org/en/stable/units/).
168
+
169
+ An example of how a library might use this metadata:
170
+
171
+ ```python
172
+ from annotated_types import Unit
173
+ from typing import Annotated, TypeVar, Callable, Any, get_origin, get_args
174
+
175
+ # given a type annotated with a unit:
176
+ Meters = Annotated[float, Unit("m")]
177
+
178
+
179
+ # you can cast the annotation to a specific unit type with any
180
+ # callable that accepts a string and returns the desired type
181
+ T = TypeVar("T")
182
+ def cast_unit(tp: Any, unit_cls: Callable[[str], T]) -> T | None:
183
+ if get_origin(tp) is Annotated:
184
+ for arg in get_args(tp):
185
+ if isinstance(arg, Unit):
186
+ return unit_cls(arg.unit)
187
+ return None
188
+
189
+
190
+ # using `pint`
191
+ import pint
192
+ pint_unit = cast_unit(Meters, pint.Unit)
193
+
194
+
195
+ # using `astropy.units`
196
+ import astropy.units as u
197
+ astropy_unit = cast_unit(Meters, u.Unit)
198
+ ```
199
+
200
+ ### Predicate
201
+
202
+ `Predicate(func: Callable)` expresses that `func(value)` is truthy for valid values.
203
+ Users should prefer the statically inspectable metadata above, but if you need
204
+ the full power and flexibility of arbitrary runtime predicates... here it is.
205
+
206
+ For some common constraints, we provide generic types:
207
+
208
+ * `IsLower = Annotated[T, Predicate(str.islower)]`
209
+ * `IsUpper = Annotated[T, Predicate(str.isupper)]`
210
+ * `IsDigit = Annotated[T, Predicate(str.isdigit)]`
211
+ * `IsFinite = Annotated[T, Predicate(math.isfinite)]`
212
+ * `IsNotFinite = Annotated[T, Predicate(Not(math.isfinite))]`
213
+ * `IsNan = Annotated[T, Predicate(math.isnan)]`
214
+ * `IsNotNan = Annotated[T, Predicate(Not(math.isnan))]`
215
+ * `IsInfinite = Annotated[T, Predicate(math.isinf)]`
216
+ * `IsNotInfinite = Annotated[T, Predicate(Not(math.isinf))]`
217
+
218
+ so that you can write e.g. `x: IsFinite[float] = 2.0` instead of the longer
219
+ (but exactly equivalent) `x: Annotated[float, Predicate(math.isfinite)] = 2.0`.
220
+
221
+ Some libraries might have special logic to handle known or understandable predicates,
222
+ for example by checking for `str.isdigit` and using its presence to both call custom
223
+ logic to enforce digit-only strings, and customise some generated external schema.
224
+ Users are therefore encouraged to avoid indirection like `lambda s: s.lower()`, in
225
+ favor of introspectable methods such as `str.lower` or `re.compile("pattern").search`.
226
+
227
+ 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.
228
+
229
+ We do not specify what behaviour should be expected for predicates that raise
230
+ an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently
231
+ skip invalid constraints, or statically raise an error; or it might try calling it
232
+ and then propagate or discard the resulting
233
+ `TypeError: descriptor 'isdigit' for 'str' objects doesn't apply to a 'int' object`
234
+ exception. We encourage libraries to document the behaviour they choose.
235
+
236
+ ### Doc
237
+
238
+ `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.
239
+
240
+ It expects a value that can be statically analyzed, as the main use case is for static analysis, editors, documentation generators, and similar tools.
241
+
242
+ It returns a `DocInfo` class with a single attribute `documentation` containing the value passed to `doc()`.
243
+
244
+ This is the early adopter's alternative form of the [`typing-doc` proposal](https://github.com/tiangolo/fastapi/blob/typing-doc/typing_doc.md).
245
+
246
+ ### Integrating downstream types with `GroupedMetadata`
247
+
248
+ Implementers may choose to provide a convenience wrapper that groups multiple pieces of metadata.
249
+ This can help reduce verbosity and cognitive overhead for users.
250
+ For example, an implementer like Pydantic might provide a `Field` or `Meta` type that accepts keyword arguments and transforms these into low-level metadata:
251
+
252
+ ```python
253
+ from dataclasses import dataclass
254
+ from typing import Iterator
255
+ from annotated_types import GroupedMetadata, Ge
256
+
257
+ @dataclass
258
+ class Field(GroupedMetadata):
259
+ ge: int | None = None
260
+ description: str | None = None
261
+
262
+ def __iter__(self) -> Iterator[object]:
263
+ # Iterating over a GroupedMetadata object should yield annotated-types
264
+ # constraint metadata objects which describe it as fully as possible,
265
+ # and may include other unknown objects too.
266
+ if self.ge is not None:
267
+ yield Ge(self.ge)
268
+ if self.description is not None:
269
+ yield Description(self.description)
270
+ ```
271
+
272
+ 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.
273
+
274
+ 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.
275
+
276
+ 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`.
277
+
278
+ ### Consuming metadata
279
+
280
+ 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).
281
+
282
+ It is up to the implementer to determine how this metadata is used.
283
+ You could use the metadata for runtime type checking, for generating schemas or to generate example data, amongst other use cases.
284
+
285
+ ## Design & History
286
+
287
+ This package was designed at the PyCon 2022 sprints by the maintainers of Pydantic
288
+ and Hypothesis, with the goal of making it as easy as possible for end-users to
289
+ provide more informative annotations for use by runtime libraries.
290
+
291
+ It is deliberately minimal, and following PEP-593 allows considerable downstream
292
+ discretion in what (if anything!) they choose to support. Nonetheless, we expect
293
+ that staying simple and covering _only_ the most common use-cases will give users
294
+ and maintainers the best experience we can. If you'd like more constraints for your
295
+ types - follow our lead, by defining them and documenting them downstream!
session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/RECORD ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ annotated_types-0.7.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ annotated_types-0.7.0.dist-info/METADATA,sha256=7ltqxksJJ0wCYFGBNIQCWTlWQGeAH0hRFdnK3CB895E,15046
3
+ annotated_types-0.7.0.dist-info/RECORD,,
4
+ annotated_types-0.7.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
5
+ annotated_types-0.7.0.dist-info/licenses/LICENSE,sha256=_hBJiEsaDZNCkB6I4H8ykl0ksxIdmXK2poBfuYJLCV0,1083
6
+ annotated_types/__init__.py,sha256=RynLsRKUEGI0KimXydlD1fZEfEzWwDo0Uon3zOKhG1Q,13819
7
+ annotated_types/__pycache__/__init__.cpython-313.pyc,,
8
+ annotated_types/__pycache__/test_cases.cpython-313.pyc,,
9
+ annotated_types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ annotated_types/test_cases.py,sha256=zHFX6EpcMbGJ8FzBYDbO56bPwx_DYIVSKbZM-4B3_lg,6421
session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.24.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
session_venv/lib/python3.13/site-packages/annotated_types-0.7.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 the contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
session_venv/lib/python3.13/site-packages/annotated_types/__init__.py ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import sys
3
+ import types
4
+ from dataclasses import dataclass
5
+ from datetime import tzinfo
6
+ from typing import TYPE_CHECKING, Any, Callable, Iterator, Optional, SupportsFloat, SupportsIndex, TypeVar, Union
7
+
8
+ if sys.version_info < (3, 8):
9
+ from typing_extensions import Protocol, runtime_checkable
10
+ else:
11
+ from typing import Protocol, runtime_checkable
12
+
13
+ if sys.version_info < (3, 9):
14
+ from typing_extensions import Annotated, Literal
15
+ else:
16
+ from typing import Annotated, Literal
17
+
18
+ if sys.version_info < (3, 10):
19
+ EllipsisType = type(Ellipsis)
20
+ KW_ONLY = {}
21
+ SLOTS = {}
22
+ else:
23
+ from types import EllipsisType
24
+
25
+ KW_ONLY = {"kw_only": True}
26
+ SLOTS = {"slots": True}
27
+
28
+
29
+ __all__ = (
30
+ 'BaseMetadata',
31
+ 'GroupedMetadata',
32
+ 'Gt',
33
+ 'Ge',
34
+ 'Lt',
35
+ 'Le',
36
+ 'Interval',
37
+ 'MultipleOf',
38
+ 'MinLen',
39
+ 'MaxLen',
40
+ 'Len',
41
+ 'Timezone',
42
+ 'Predicate',
43
+ 'LowerCase',
44
+ 'UpperCase',
45
+ 'IsDigits',
46
+ 'IsFinite',
47
+ 'IsNotFinite',
48
+ 'IsNan',
49
+ 'IsNotNan',
50
+ 'IsInfinite',
51
+ 'IsNotInfinite',
52
+ 'doc',
53
+ 'DocInfo',
54
+ '__version__',
55
+ )
56
+
57
+ __version__ = '0.7.0'
58
+
59
+
60
+ T = TypeVar('T')
61
+
62
+
63
+ # arguments that start with __ are considered
64
+ # positional only
65
+ # see https://peps.python.org/pep-0484/#positional-only-arguments
66
+
67
+
68
+ class SupportsGt(Protocol):
69
+ def __gt__(self: T, __other: T) -> bool:
70
+ ...
71
+
72
+
73
+ class SupportsGe(Protocol):
74
+ def __ge__(self: T, __other: T) -> bool:
75
+ ...
76
+
77
+
78
+ class SupportsLt(Protocol):
79
+ def __lt__(self: T, __other: T) -> bool:
80
+ ...
81
+
82
+
83
+ class SupportsLe(Protocol):
84
+ def __le__(self: T, __other: T) -> bool:
85
+ ...
86
+
87
+
88
+ class SupportsMod(Protocol):
89
+ def __mod__(self: T, __other: T) -> T:
90
+ ...
91
+
92
+
93
+ class SupportsDiv(Protocol):
94
+ def __div__(self: T, __other: T) -> T:
95
+ ...
96
+
97
+
98
+ class BaseMetadata:
99
+ """Base class for all metadata.
100
+
101
+ This exists mainly so that implementers
102
+ can do `isinstance(..., BaseMetadata)` while traversing field annotations.
103
+ """
104
+
105
+ __slots__ = ()
106
+
107
+
108
+ @dataclass(frozen=True, **SLOTS)
109
+ class Gt(BaseMetadata):
110
+ """Gt(gt=x) implies that the value must be greater than x.
111
+
112
+ It can be used with any type that supports the ``>`` operator,
113
+ including numbers, dates and times, strings, sets, and so on.
114
+ """
115
+
116
+ gt: SupportsGt
117
+
118
+
119
+ @dataclass(frozen=True, **SLOTS)
120
+ class Ge(BaseMetadata):
121
+ """Ge(ge=x) implies that the value must be greater than or equal to x.
122
+
123
+ It can be used with any type that supports the ``>=`` operator,
124
+ including numbers, dates and times, strings, sets, and so on.
125
+ """
126
+
127
+ ge: SupportsGe
128
+
129
+
130
+ @dataclass(frozen=True, **SLOTS)
131
+ class Lt(BaseMetadata):
132
+ """Lt(lt=x) implies that the value must be less than x.
133
+
134
+ It can be used with any type that supports the ``<`` operator,
135
+ including numbers, dates and times, strings, sets, and so on.
136
+ """
137
+
138
+ lt: SupportsLt
139
+
140
+
141
+ @dataclass(frozen=True, **SLOTS)
142
+ class Le(BaseMetadata):
143
+ """Le(le=x) implies that the value must be less than or equal to x.
144
+
145
+ It can be used with any type that supports the ``<=`` operator,
146
+ including numbers, dates and times, strings, sets, and so on.
147
+ """
148
+
149
+ le: SupportsLe
150
+
151
+
152
+ @runtime_checkable
153
+ class GroupedMetadata(Protocol):
154
+ """A grouping of multiple objects, like typing.Unpack.
155
+
156
+ `GroupedMetadata` on its own is not metadata and has no meaning.
157
+ All of the constraints and metadata should be fully expressable
158
+ in terms of the `BaseMetadata`'s returned by `GroupedMetadata.__iter__()`.
159
+
160
+ Concrete implementations should override `GroupedMetadata.__iter__()`
161
+ to add their own metadata.
162
+ For example:
163
+
164
+ >>> @dataclass
165
+ >>> class Field(GroupedMetadata):
166
+ >>> gt: float | None = None
167
+ >>> description: str | None = None
168
+ ...
169
+ >>> def __iter__(self) -> Iterable[object]:
170
+ >>> if self.gt is not None:
171
+ >>> yield Gt(self.gt)
172
+ >>> if self.description is not None:
173
+ >>> yield Description(self.gt)
174
+
175
+ Also see the implementation of `Interval` below for an example.
176
+
177
+ Parsers should recognize this and unpack it so that it can be used
178
+ both with and without unpacking:
179
+
180
+ - `Annotated[int, Field(...)]` (parser must unpack Field)
181
+ - `Annotated[int, *Field(...)]` (PEP-646)
182
+ """ # noqa: trailing-whitespace
183
+
184
+ @property
185
+ def __is_annotated_types_grouped_metadata__(self) -> Literal[True]:
186
+ return True
187
+
188
+ def __iter__(self) -> Iterator[object]:
189
+ ...
190
+
191
+ if not TYPE_CHECKING:
192
+ __slots__ = () # allow subclasses to use slots
193
+
194
+ def __init_subclass__(cls, *args: Any, **kwargs: Any) -> None:
195
+ # Basic ABC like functionality without the complexity of an ABC
196
+ super().__init_subclass__(*args, **kwargs)
197
+ if cls.__iter__ is GroupedMetadata.__iter__:
198
+ raise TypeError("Can't subclass GroupedMetadata without implementing __iter__")
199
+
200
+ def __iter__(self) -> Iterator[object]: # noqa: F811
201
+ raise NotImplementedError # more helpful than "None has no attribute..." type errors
202
+
203
+
204
+ @dataclass(frozen=True, **KW_ONLY, **SLOTS)
205
+ class Interval(GroupedMetadata):
206
+ """Interval can express inclusive or exclusive bounds with a single object.
207
+
208
+ It accepts keyword arguments ``gt``, ``ge``, ``lt``, and/or ``le``, which
209
+ are interpreted the same way as the single-bound constraints.
210
+ """
211
+
212
+ gt: Union[SupportsGt, None] = None
213
+ ge: Union[SupportsGe, None] = None
214
+ lt: Union[SupportsLt, None] = None
215
+ le: Union[SupportsLe, None] = None
216
+
217
+ def __iter__(self) -> Iterator[BaseMetadata]:
218
+ """Unpack an Interval into zero or more single-bounds."""
219
+ if self.gt is not None:
220
+ yield Gt(self.gt)
221
+ if self.ge is not None:
222
+ yield Ge(self.ge)
223
+ if self.lt is not None:
224
+ yield Lt(self.lt)
225
+ if self.le is not None:
226
+ yield Le(self.le)
227
+
228
+
229
+ @dataclass(frozen=True, **SLOTS)
230
+ class MultipleOf(BaseMetadata):
231
+ """MultipleOf(multiple_of=x) might be interpreted in two ways:
232
+
233
+ 1. Python semantics, implying ``value % multiple_of == 0``, or
234
+ 2. JSONschema semantics, where ``int(value / multiple_of) == value / multiple_of``
235
+
236
+ We encourage users to be aware of these two common interpretations,
237
+ and libraries to carefully document which they implement.
238
+ """
239
+
240
+ multiple_of: Union[SupportsDiv, SupportsMod]
241
+
242
+
243
+ @dataclass(frozen=True, **SLOTS)
244
+ class MinLen(BaseMetadata):
245
+ """
246
+ MinLen() implies minimum inclusive length,
247
+ e.g. ``len(value) >= min_length``.
248
+ """
249
+
250
+ min_length: Annotated[int, Ge(0)]
251
+
252
+
253
+ @dataclass(frozen=True, **SLOTS)
254
+ class MaxLen(BaseMetadata):
255
+ """
256
+ MaxLen() implies maximum inclusive length,
257
+ e.g. ``len(value) <= max_length``.
258
+ """
259
+
260
+ max_length: Annotated[int, Ge(0)]
261
+
262
+
263
+ @dataclass(frozen=True, **SLOTS)
264
+ class Len(GroupedMetadata):
265
+ """
266
+ Len() implies that ``min_length <= len(value) <= max_length``.
267
+
268
+ Upper bound may be omitted or ``None`` to indicate no upper length bound.
269
+ """
270
+
271
+ min_length: Annotated[int, Ge(0)] = 0
272
+ max_length: Optional[Annotated[int, Ge(0)]] = None
273
+
274
+ def __iter__(self) -> Iterator[BaseMetadata]:
275
+ """Unpack a Len into zone or more single-bounds."""
276
+ if self.min_length > 0:
277
+ yield MinLen(self.min_length)
278
+ if self.max_length is not None:
279
+ yield MaxLen(self.max_length)
280
+
281
+
282
+ @dataclass(frozen=True, **SLOTS)
283
+ class Timezone(BaseMetadata):
284
+ """Timezone(tz=...) requires a datetime to be aware (or ``tz=None``, naive).
285
+
286
+ ``Annotated[datetime, Timezone(None)]`` must be a naive datetime.
287
+ ``Timezone[...]`` (the ellipsis literal) expresses that the datetime must be
288
+ tz-aware but any timezone is allowed.
289
+
290
+ You may also pass a specific timezone string or tzinfo object such as
291
+ ``Timezone(timezone.utc)`` or ``Timezone("Africa/Abidjan")`` to express that
292
+ you only allow a specific timezone, though we note that this is often
293
+ a symptom of poor design.
294
+ """
295
+
296
+ tz: Union[str, tzinfo, EllipsisType, None]
297
+
298
+
299
+ @dataclass(frozen=True, **SLOTS)
300
+ class Unit(BaseMetadata):
301
+ """Indicates that the value is a physical quantity with the specified unit.
302
+
303
+ It is intended for usage with numeric types, where the value represents the
304
+ magnitude of the quantity. For example, ``distance: Annotated[float, Unit('m')]``
305
+ or ``speed: Annotated[float, Unit('m/s')]``.
306
+
307
+ Interpretation of the unit string is left to the discretion of the consumer.
308
+ It is suggested to follow conventions established by python libraries that work
309
+ with physical quantities, such as
310
+
311
+ - ``pint`` : <https://pint.readthedocs.io/en/stable/>
312
+ - ``astropy.units``: <https://docs.astropy.org/en/stable/units/>
313
+
314
+ For indicating a quantity with a certain dimensionality but without a specific unit
315
+ it is recommended to use square brackets, e.g. `Annotated[float, Unit('[time]')]`.
316
+ Note, however, ``annotated_types`` itself makes no use of the unit string.
317
+ """
318
+
319
+ unit: str
320
+
321
+
322
+ @dataclass(frozen=True, **SLOTS)
323
+ class Predicate(BaseMetadata):
324
+ """``Predicate(func: Callable)`` implies `func(value)` is truthy for valid values.
325
+
326
+ Users should prefer statically inspectable metadata, but if you need the full
327
+ power and flexibility of arbitrary runtime predicates... here it is.
328
+
329
+ We provide a few predefined predicates for common string constraints:
330
+ ``IsLower = Predicate(str.islower)``, ``IsUpper = Predicate(str.isupper)``, and
331
+ ``IsDigits = Predicate(str.isdigit)``. Users are encouraged to use methods which
332
+ can be given special handling, and avoid indirection like ``lambda s: s.lower()``.
333
+
334
+ Some libraries might have special logic to handle certain predicates, e.g. by
335
+ checking for `str.isdigit` and using its presence to both call custom logic to
336
+ enforce digit-only strings, and customise some generated external schema.
337
+
338
+ We do not specify what behaviour should be expected for predicates that raise
339
+ an exception. For example `Annotated[int, Predicate(str.isdigit)]` might silently
340
+ skip invalid constraints, or statically raise an error; or it might try calling it
341
+ and then propagate or discard the resulting exception.
342
+ """
343
+
344
+ func: Callable[[Any], bool]
345
+
346
+ def __repr__(self) -> str:
347
+ if getattr(self.func, "__name__", "<lambda>") == "<lambda>":
348
+ return f"{self.__class__.__name__}({self.func!r})"
349
+ if isinstance(self.func, (types.MethodType, types.BuiltinMethodType)) and (
350
+ namespace := getattr(self.func.__self__, "__name__", None)
351
+ ):
352
+ return f"{self.__class__.__name__}({namespace}.{self.func.__name__})"
353
+ if isinstance(self.func, type(str.isascii)): # method descriptor
354
+ return f"{self.__class__.__name__}({self.func.__qualname__})"
355
+ return f"{self.__class__.__name__}({self.func.__name__})"
356
+
357
+
358
+ @dataclass
359
+ class Not:
360
+ func: Callable[[Any], bool]
361
+
362
+ def __call__(self, __v: Any) -> bool:
363
+ return not self.func(__v)
364
+
365
+
366
+ _StrType = TypeVar("_StrType", bound=str)
367
+
368
+ LowerCase = Annotated[_StrType, Predicate(str.islower)]
369
+ """
370
+ Return True if the string is a lowercase string, False otherwise.
371
+
372
+ A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
373
+ """ # noqa: E501
374
+ UpperCase = Annotated[_StrType, Predicate(str.isupper)]
375
+ """
376
+ Return True if the string is an uppercase string, False otherwise.
377
+
378
+ A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
379
+ """ # noqa: E501
380
+ IsDigit = Annotated[_StrType, Predicate(str.isdigit)]
381
+ IsDigits = IsDigit # type: ignore # plural for backwards compatibility, see #63
382
+ """
383
+ Return True if the string is a digit string, False otherwise.
384
+
385
+ A string is a digit string if all characters in the string are digits and there is at least one character in the string.
386
+ """ # noqa: E501
387
+ IsAscii = Annotated[_StrType, Predicate(str.isascii)]
388
+ """
389
+ Return True if all characters in the string are ASCII, False otherwise.
390
+
391
+ ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
392
+ """
393
+
394
+ _NumericType = TypeVar('_NumericType', bound=Union[SupportsFloat, SupportsIndex])
395
+ IsFinite = Annotated[_NumericType, Predicate(math.isfinite)]
396
+ """Return True if x is neither an infinity nor a NaN, and False otherwise."""
397
+ IsNotFinite = Annotated[_NumericType, Predicate(Not(math.isfinite))]
398
+ """Return True if x is one of infinity or NaN, and False otherwise"""
399
+ IsNan = Annotated[_NumericType, Predicate(math.isnan)]
400
+ """Return True if x is a NaN (not a number), and False otherwise."""
401
+ IsNotNan = Annotated[_NumericType, Predicate(Not(math.isnan))]
402
+ """Return True if x is anything but NaN (not a number), and False otherwise."""
403
+ IsInfinite = Annotated[_NumericType, Predicate(math.isinf)]
404
+ """Return True if x is a positive or negative infinity, and False otherwise."""
405
+ IsNotInfinite = Annotated[_NumericType, Predicate(Not(math.isinf))]
406
+ """Return True if x is neither a positive or negative infinity, and False otherwise."""
407
+
408
+ try:
409
+ from typing_extensions import DocInfo, doc # type: ignore [attr-defined]
410
+ except ImportError:
411
+
412
+ @dataclass(frozen=True, **SLOTS)
413
+ class DocInfo: # type: ignore [no-redef]
414
+ """ "
415
+ The return value of doc(), mainly to be used by tools that want to extract the
416
+ Annotated documentation at runtime.
417
+ """
418
+
419
+ documentation: str
420
+ """The documentation string passed to doc()."""
421
+
422
+ def doc(
423
+ documentation: str,
424
+ ) -> DocInfo:
425
+ """
426
+ Add documentation to a type annotation inside of Annotated.
427
+
428
+ For example:
429
+
430
+ >>> def hi(name: Annotated[int, doc("The name of the user")]) -> None: ...
431
+ """
432
+ return DocInfo(documentation)
session_venv/lib/python3.13/site-packages/annotated_types/py.typed ADDED
File without changes
session_venv/lib/python3.13/site-packages/annotated_types/test_cases.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ import sys
3
+ from datetime import date, datetime, timedelta, timezone
4
+ from decimal import Decimal
5
+ from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Set, Tuple
6
+
7
+ if sys.version_info < (3, 9):
8
+ from typing_extensions import Annotated
9
+ else:
10
+ from typing import Annotated
11
+
12
+ import annotated_types as at
13
+
14
+
15
+ class Case(NamedTuple):
16
+ """
17
+ A test case for `annotated_types`.
18
+ """
19
+
20
+ annotation: Any
21
+ valid_cases: Iterable[Any]
22
+ invalid_cases: Iterable[Any]
23
+
24
+
25
+ def cases() -> Iterable[Case]:
26
+ # Gt, Ge, Lt, Le
27
+ yield Case(Annotated[int, at.Gt(4)], (5, 6, 1000), (4, 0, -1))
28
+ yield Case(Annotated[float, at.Gt(0.5)], (0.6, 0.7, 0.8, 0.9), (0.5, 0.0, -0.1))
29
+ yield Case(
30
+ Annotated[datetime, at.Gt(datetime(2000, 1, 1))],
31
+ [datetime(2000, 1, 2), datetime(2000, 1, 3)],
32
+ [datetime(2000, 1, 1), datetime(1999, 12, 31)],
33
+ )
34
+ yield Case(
35
+ Annotated[datetime, at.Gt(date(2000, 1, 1))],
36
+ [date(2000, 1, 2), date(2000, 1, 3)],
37
+ [date(2000, 1, 1), date(1999, 12, 31)],
38
+ )
39
+ yield Case(
40
+ Annotated[datetime, at.Gt(Decimal('1.123'))],
41
+ [Decimal('1.1231'), Decimal('123')],
42
+ [Decimal('1.123'), Decimal('0')],
43
+ )
44
+
45
+ yield Case(Annotated[int, at.Ge(4)], (4, 5, 6, 1000, 4), (0, -1))
46
+ yield Case(Annotated[float, at.Ge(0.5)], (0.5, 0.6, 0.7, 0.8, 0.9), (0.4, 0.0, -0.1))
47
+ yield Case(
48
+ Annotated[datetime, at.Ge(datetime(2000, 1, 1))],
49
+ [datetime(2000, 1, 2), datetime(2000, 1, 3)],
50
+ [datetime(1998, 1, 1), datetime(1999, 12, 31)],
51
+ )
52
+
53
+ yield Case(Annotated[int, at.Lt(4)], (0, -1), (4, 5, 6, 1000, 4))
54
+ yield Case(Annotated[float, at.Lt(0.5)], (0.4, 0.0, -0.1), (0.5, 0.6, 0.7, 0.8, 0.9))
55
+ yield Case(
56
+ Annotated[datetime, at.Lt(datetime(2000, 1, 1))],
57
+ [datetime(1999, 12, 31), datetime(1999, 12, 31)],
58
+ [datetime(2000, 1, 2), datetime(2000, 1, 3)],
59
+ )
60
+
61
+ yield Case(Annotated[int, at.Le(4)], (4, 0, -1), (5, 6, 1000))
62
+ yield Case(Annotated[float, at.Le(0.5)], (0.5, 0.0, -0.1), (0.6, 0.7, 0.8, 0.9))
63
+ yield Case(
64
+ Annotated[datetime, at.Le(datetime(2000, 1, 1))],
65
+ [datetime(2000, 1, 1), datetime(1999, 12, 31)],
66
+ [datetime(2000, 1, 2), datetime(2000, 1, 3)],
67
+ )
68
+
69
+ # Interval
70
+ yield Case(Annotated[int, at.Interval(gt=4)], (5, 6, 1000), (4, 0, -1))
71
+ yield Case(Annotated[int, at.Interval(gt=4, lt=10)], (5, 6), (4, 10, 1000, 0, -1))
72
+ yield Case(Annotated[float, at.Interval(ge=0.5, le=1)], (0.5, 0.9, 1), (0.49, 1.1))
73
+ yield Case(
74
+ Annotated[datetime, at.Interval(gt=datetime(2000, 1, 1), le=datetime(2000, 1, 3))],
75
+ [datetime(2000, 1, 2), datetime(2000, 1, 3)],
76
+ [datetime(2000, 1, 1), datetime(2000, 1, 4)],
77
+ )
78
+
79
+ yield Case(Annotated[int, at.MultipleOf(multiple_of=3)], (0, 3, 9), (1, 2, 4))
80
+ yield Case(Annotated[float, at.MultipleOf(multiple_of=0.5)], (0, 0.5, 1, 1.5), (0.4, 1.1))
81
+
82
+ # lengths
83
+
84
+ yield Case(Annotated[str, at.MinLen(3)], ('123', '1234', 'x' * 10), ('', '1', '12'))
85
+ yield Case(Annotated[str, at.Len(3)], ('123', '1234', 'x' * 10), ('', '1', '12'))
86
+ yield Case(Annotated[List[int], at.MinLen(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2]))
87
+ yield Case(Annotated[List[int], at.Len(3)], ([1, 2, 3], [1, 2, 3, 4], [1] * 10), ([], [1], [1, 2]))
88
+
89
+ yield Case(Annotated[str, at.MaxLen(4)], ('', '1234'), ('12345', 'x' * 10))
90
+ yield Case(Annotated[str, at.Len(0, 4)], ('', '1234'), ('12345', 'x' * 10))
91
+ yield Case(Annotated[List[str], at.MaxLen(4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10))
92
+ yield Case(Annotated[List[str], at.Len(0, 4)], ([], ['a', 'bcdef'], ['a', 'b', 'c']), (['a'] * 5, ['b'] * 10))
93
+
94
+ yield Case(Annotated[str, at.Len(3, 5)], ('123', '12345'), ('', '1', '12', '123456', 'x' * 10))
95
+ yield Case(Annotated[str, at.Len(3, 3)], ('123',), ('12', '1234'))
96
+
97
+ yield Case(Annotated[Dict[int, int], at.Len(2, 3)], [{1: 1, 2: 2}], [{}, {1: 1}, {1: 1, 2: 2, 3: 3, 4: 4}])
98
+ yield Case(Annotated[Set[int], at.Len(2, 3)], ({1, 2}, {1, 2, 3}), (set(), {1}, {1, 2, 3, 4}))
99
+ yield Case(Annotated[Tuple[int, ...], at.Len(2, 3)], ((1, 2), (1, 2, 3)), ((), (1,), (1, 2, 3, 4)))
100
+
101
+ # Timezone
102
+
103
+ yield Case(
104
+ Annotated[datetime, at.Timezone(None)], [datetime(2000, 1, 1)], [datetime(2000, 1, 1, tzinfo=timezone.utc)]
105
+ )
106
+ yield Case(
107
+ Annotated[datetime, at.Timezone(...)], [datetime(2000, 1, 1, tzinfo=timezone.utc)], [datetime(2000, 1, 1)]
108
+ )
109
+ yield Case(
110
+ Annotated[datetime, at.Timezone(timezone.utc)],
111
+ [datetime(2000, 1, 1, tzinfo=timezone.utc)],
112
+ [datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))],
113
+ )
114
+ yield Case(
115
+ Annotated[datetime, at.Timezone('Europe/London')],
116
+ [datetime(2000, 1, 1, tzinfo=timezone(timedelta(0), name='Europe/London'))],
117
+ [datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=timezone(timedelta(hours=6)))],
118
+ )
119
+
120
+ # Quantity
121
+
122
+ yield Case(Annotated[float, at.Unit(unit='m')], (5, 4.2), ('5m', '4.2m'))
123
+
124
+ # predicate types
125
+
126
+ yield Case(at.LowerCase[str], ['abc', 'foobar'], ['', 'A', 'Boom'])
127
+ yield Case(at.UpperCase[str], ['ABC', 'DEFO'], ['', 'a', 'abc', 'AbC'])
128
+ yield Case(at.IsDigit[str], ['123'], ['', 'ab', 'a1b2'])
129
+ yield Case(at.IsAscii[str], ['123', 'foo bar'], ['£100', '😊', 'whatever 👀'])
130
+
131
+ yield Case(Annotated[int, at.Predicate(lambda x: x % 2 == 0)], [0, 2, 4], [1, 3, 5])
132
+
133
+ yield Case(at.IsFinite[float], [1.23], [math.nan, math.inf, -math.inf])
134
+ yield Case(at.IsNotFinite[float], [math.nan, math.inf], [1.23])
135
+ yield Case(at.IsNan[float], [math.nan], [1.23, math.inf])
136
+ yield Case(at.IsNotNan[float], [1.23, math.inf], [math.nan])
137
+ yield Case(at.IsInfinite[float], [math.inf], [math.nan, 1.23])
138
+ yield Case(at.IsNotInfinite[float], [math.nan, 1.23], [math.inf])
139
+
140
+ # check stacked predicates
141
+ yield Case(at.IsInfinite[Annotated[float, at.Predicate(lambda x: x > 0)]], [math.inf], [-math.inf, 1.23, math.nan])
142
+
143
+ # doc
144
+ yield Case(Annotated[int, at.doc("A number")], [1, 2], [])
145
+
146
+ # custom GroupedMetadata
147
+ class MyCustomGroupedMetadata(at.GroupedMetadata):
148
+ def __iter__(self) -> Iterator[at.Predicate]:
149
+ yield at.Predicate(lambda x: float(x).is_integer())
150
+
151
+ yield Case(Annotated[float, MyCustomGroupedMetadata()], [0, 2.0], [0.01, 1.5])
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/METADATA ADDED
@@ -0,0 +1,672 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: confluent-kafka
3
+ Version: 2.14.0
4
+ Summary: Confluent's Python client for Apache Kafka
5
+ Author-email: "Confluent Inc." <support@confluent.io>
6
+ Project-URL: Homepage, https://github.com/confluentinc/confluent-kafka-python
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: typing-extensions; python_version < "3.11"
17
+ Provides-Extra: schemaregistry
18
+ Requires-Dist: attrs>=21.2.0; extra == "schemaregistry"
19
+ Requires-Dist: cachetools>=5.5.0; extra == "schemaregistry"
20
+ Requires-Dist: certifi; extra == "schemaregistry"
21
+ Requires-Dist: httpx>=0.26; extra == "schemaregistry"
22
+ Requires-Dist: authlib>=1.0.0; extra == "schemaregistry"
23
+ Provides-Extra: schema-registry
24
+ Requires-Dist: attrs>=21.2.0; extra == "schema-registry"
25
+ Requires-Dist: cachetools>=5.5.0; extra == "schema-registry"
26
+ Requires-Dist: certifi; extra == "schema-registry"
27
+ Requires-Dist: httpx>=0.26; extra == "schema-registry"
28
+ Requires-Dist: authlib>=1.0.0; extra == "schema-registry"
29
+ Provides-Extra: rules
30
+ Requires-Dist: azure-identity; extra == "rules"
31
+ Requires-Dist: azure-keyvault-keys; extra == "rules"
32
+ Requires-Dist: boto3>=1.35; extra == "rules"
33
+ Requires-Dist: cel-python>=0.4.0; extra == "rules"
34
+ Requires-Dist: google-re2<1.1.20251105; extra == "rules"
35
+ Requires-Dist: google-auth; extra == "rules"
36
+ Requires-Dist: google-api-core; extra == "rules"
37
+ Requires-Dist: google-cloud-kms; extra == "rules"
38
+ Requires-Dist: hkdf==0.0.3; extra == "rules"
39
+ Requires-Dist: hvac; extra == "rules"
40
+ Requires-Dist: jsonata-python; extra == "rules"
41
+ Requires-Dist: pyyaml>=6.0.0; extra == "rules"
42
+ Requires-Dist: tink; extra == "rules"
43
+ Requires-Dist: attrs>=21.2.0; extra == "rules"
44
+ Requires-Dist: cachetools>=5.5.0; extra == "rules"
45
+ Requires-Dist: certifi; extra == "rules"
46
+ Requires-Dist: httpx>=0.26; extra == "rules"
47
+ Requires-Dist: authlib>=1.0.0; extra == "rules"
48
+ Provides-Extra: avro
49
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "avro"
50
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "avro"
51
+ Requires-Dist: requests; extra == "avro"
52
+ Requires-Dist: avro<2,>=1.11.1; extra == "avro"
53
+ Requires-Dist: attrs>=21.2.0; extra == "avro"
54
+ Requires-Dist: cachetools>=5.5.0; extra == "avro"
55
+ Requires-Dist: certifi; extra == "avro"
56
+ Requires-Dist: httpx>=0.26; extra == "avro"
57
+ Requires-Dist: authlib>=1.0.0; extra == "avro"
58
+ Provides-Extra: json
59
+ Requires-Dist: pyrsistent; extra == "json"
60
+ Requires-Dist: jsonschema>=4.18.0; extra == "json"
61
+ Requires-Dist: orjson>=3.10; extra == "json"
62
+ Requires-Dist: attrs>=21.2.0; extra == "json"
63
+ Requires-Dist: cachetools>=5.5.0; extra == "json"
64
+ Requires-Dist: certifi; extra == "json"
65
+ Requires-Dist: httpx>=0.26; extra == "json"
66
+ Requires-Dist: authlib>=1.0.0; extra == "json"
67
+ Provides-Extra: protobuf
68
+ Requires-Dist: googleapis-common-protos; extra == "protobuf"
69
+ Requires-Dist: protobuf; extra == "protobuf"
70
+ Requires-Dist: attrs>=21.2.0; extra == "protobuf"
71
+ Requires-Dist: cachetools>=5.5.0; extra == "protobuf"
72
+ Requires-Dist: certifi; extra == "protobuf"
73
+ Requires-Dist: httpx>=0.26; extra == "protobuf"
74
+ Requires-Dist: authlib>=1.0.0; extra == "protobuf"
75
+ Provides-Extra: dev
76
+ Requires-Dist: sphinx; extra == "dev"
77
+ Requires-Dist: sphinx-rtd-theme; extra == "dev"
78
+ Requires-Dist: tomli; python_version < "3.11" and extra == "dev"
79
+ Requires-Dist: pandoc; extra == "dev"
80
+ Requires-Dist: confluent-kafka; extra == "dev"
81
+ Requires-Dist: fastapi; extra == "dev"
82
+ Requires-Dist: pydantic; extra == "dev"
83
+ Requires-Dist: uvicorn; extra == "dev"
84
+ Requires-Dist: six; extra == "dev"
85
+ Requires-Dist: attrs; extra == "dev"
86
+ Requires-Dist: cachetools; extra == "dev"
87
+ Requires-Dist: httpx>=0.26; extra == "dev"
88
+ Requires-Dist: authlib>=1.0.0; extra == "dev"
89
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "dev"
90
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "dev"
91
+ Requires-Dist: requests; extra == "dev"
92
+ Requires-Dist: avro<2,>=1.11.1; extra == "dev"
93
+ Requires-Dist: pyrsistent; extra == "dev"
94
+ Requires-Dist: jsonschema>=4.18.0; extra == "dev"
95
+ Requires-Dist: orjson>=3.10; extra == "dev"
96
+ Requires-Dist: googleapis-common-protos; extra == "dev"
97
+ Requires-Dist: protobuf; extra == "dev"
98
+ Requires-Dist: azure-identity; extra == "dev"
99
+ Requires-Dist: azure-keyvault-keys; extra == "dev"
100
+ Requires-Dist: boto3; extra == "dev"
101
+ Requires-Dist: cel-python>=0.4.0; extra == "dev"
102
+ Requires-Dist: google-auth; extra == "dev"
103
+ Requires-Dist: google-api-core; extra == "dev"
104
+ Requires-Dist: google-cloud-kms; extra == "dev"
105
+ Requires-Dist: hkdf==0.0.3; extra == "dev"
106
+ Requires-Dist: hvac; extra == "dev"
107
+ Requires-Dist: jsonata-python; extra == "dev"
108
+ Requires-Dist: pyyaml>=6.0.0; extra == "dev"
109
+ Requires-Dist: tink; extra == "dev"
110
+ Requires-Dist: urllib3<3; extra == "dev"
111
+ Requires-Dist: flake8; extra == "dev"
112
+ Requires-Dist: mypy; extra == "dev"
113
+ Requires-Dist: attrs; extra == "dev"
114
+ Requires-Dist: types-cachetools; extra == "dev"
115
+ Requires-Dist: types-requests; extra == "dev"
116
+ Requires-Dist: orjson; extra == "dev"
117
+ Requires-Dist: pytest; extra == "dev"
118
+ Requires-Dist: pytest-timeout; extra == "dev"
119
+ Requires-Dist: requests-mock; extra == "dev"
120
+ Requires-Dist: respx; extra == "dev"
121
+ Requires-Dist: pytest_cov; extra == "dev"
122
+ Requires-Dist: pluggy<1.6.0; extra == "dev"
123
+ Requires-Dist: pytest-asyncio; extra == "dev"
124
+ Requires-Dist: async-timeout; extra == "dev"
125
+ Requires-Dist: black>=24.0.0; extra == "dev"
126
+ Requires-Dist: isort>=5.13.0; extra == "dev"
127
+ Requires-Dist: attrs>=21.2.0; extra == "dev"
128
+ Requires-Dist: cachetools>=5.5.0; extra == "dev"
129
+ Requires-Dist: certifi; extra == "dev"
130
+ Requires-Dist: httpx>=0.26; extra == "dev"
131
+ Requires-Dist: authlib>=1.0.0; extra == "dev"
132
+ Requires-Dist: azure-identity; extra == "dev"
133
+ Requires-Dist: azure-keyvault-keys; extra == "dev"
134
+ Requires-Dist: boto3>=1.35; extra == "dev"
135
+ Requires-Dist: cel-python>=0.4.0; extra == "dev"
136
+ Requires-Dist: google-re2<1.1.20251105; extra == "dev"
137
+ Requires-Dist: google-auth; extra == "dev"
138
+ Requires-Dist: google-api-core; extra == "dev"
139
+ Requires-Dist: google-cloud-kms; extra == "dev"
140
+ Requires-Dist: hkdf==0.0.3; extra == "dev"
141
+ Requires-Dist: hvac; extra == "dev"
142
+ Requires-Dist: jsonata-python; extra == "dev"
143
+ Requires-Dist: pyyaml>=6.0.0; extra == "dev"
144
+ Requires-Dist: tink; extra == "dev"
145
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "dev"
146
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "dev"
147
+ Requires-Dist: requests; extra == "dev"
148
+ Requires-Dist: avro<2,>=1.11.1; extra == "dev"
149
+ Requires-Dist: pyrsistent; extra == "dev"
150
+ Requires-Dist: jsonschema>=4.18.0; extra == "dev"
151
+ Requires-Dist: orjson>=3.10; extra == "dev"
152
+ Requires-Dist: googleapis-common-protos; extra == "dev"
153
+ Requires-Dist: protobuf; extra == "dev"
154
+ Provides-Extra: docs
155
+ Requires-Dist: sphinx; extra == "docs"
156
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
157
+ Requires-Dist: tomli; python_version < "3.11" and extra == "docs"
158
+ Requires-Dist: pandoc; extra == "docs"
159
+ Requires-Dist: attrs>=21.2.0; extra == "docs"
160
+ Requires-Dist: cachetools>=5.5.0; extra == "docs"
161
+ Requires-Dist: certifi; extra == "docs"
162
+ Requires-Dist: httpx>=0.26; extra == "docs"
163
+ Requires-Dist: authlib>=1.0.0; extra == "docs"
164
+ Requires-Dist: azure-identity; extra == "docs"
165
+ Requires-Dist: azure-keyvault-keys; extra == "docs"
166
+ Requires-Dist: boto3>=1.35; extra == "docs"
167
+ Requires-Dist: cel-python>=0.4.0; extra == "docs"
168
+ Requires-Dist: google-re2<1.1.20251105; extra == "docs"
169
+ Requires-Dist: google-auth; extra == "docs"
170
+ Requires-Dist: google-api-core; extra == "docs"
171
+ Requires-Dist: google-cloud-kms; extra == "docs"
172
+ Requires-Dist: hkdf==0.0.3; extra == "docs"
173
+ Requires-Dist: hvac; extra == "docs"
174
+ Requires-Dist: jsonata-python; extra == "docs"
175
+ Requires-Dist: pyyaml>=6.0.0; extra == "docs"
176
+ Requires-Dist: tink; extra == "docs"
177
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "docs"
178
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "docs"
179
+ Requires-Dist: requests; extra == "docs"
180
+ Requires-Dist: avro<2,>=1.11.1; extra == "docs"
181
+ Requires-Dist: pyrsistent; extra == "docs"
182
+ Requires-Dist: jsonschema>=4.18.0; extra == "docs"
183
+ Requires-Dist: orjson>=3.10; extra == "docs"
184
+ Requires-Dist: googleapis-common-protos; extra == "docs"
185
+ Requires-Dist: protobuf; extra == "docs"
186
+ Provides-Extra: tests
187
+ Requires-Dist: urllib3<3; extra == "tests"
188
+ Requires-Dist: flake8; extra == "tests"
189
+ Requires-Dist: mypy; extra == "tests"
190
+ Requires-Dist: attrs; extra == "tests"
191
+ Requires-Dist: types-cachetools; extra == "tests"
192
+ Requires-Dist: types-requests; extra == "tests"
193
+ Requires-Dist: orjson; extra == "tests"
194
+ Requires-Dist: pytest; extra == "tests"
195
+ Requires-Dist: pytest-timeout; extra == "tests"
196
+ Requires-Dist: requests-mock; extra == "tests"
197
+ Requires-Dist: respx; extra == "tests"
198
+ Requires-Dist: pytest_cov; extra == "tests"
199
+ Requires-Dist: pluggy<1.6.0; extra == "tests"
200
+ Requires-Dist: pytest-asyncio; extra == "tests"
201
+ Requires-Dist: async-timeout; extra == "tests"
202
+ Requires-Dist: black>=24.0.0; extra == "tests"
203
+ Requires-Dist: isort>=5.13.0; extra == "tests"
204
+ Requires-Dist: attrs>=21.2.0; extra == "tests"
205
+ Requires-Dist: cachetools>=5.5.0; extra == "tests"
206
+ Requires-Dist: certifi; extra == "tests"
207
+ Requires-Dist: httpx>=0.26; extra == "tests"
208
+ Requires-Dist: authlib>=1.0.0; extra == "tests"
209
+ Requires-Dist: azure-identity; extra == "tests"
210
+ Requires-Dist: azure-keyvault-keys; extra == "tests"
211
+ Requires-Dist: boto3>=1.35; extra == "tests"
212
+ Requires-Dist: cel-python>=0.4.0; extra == "tests"
213
+ Requires-Dist: google-re2<1.1.20251105; extra == "tests"
214
+ Requires-Dist: google-auth; extra == "tests"
215
+ Requires-Dist: google-api-core; extra == "tests"
216
+ Requires-Dist: google-cloud-kms; extra == "tests"
217
+ Requires-Dist: hkdf==0.0.3; extra == "tests"
218
+ Requires-Dist: hvac; extra == "tests"
219
+ Requires-Dist: jsonata-python; extra == "tests"
220
+ Requires-Dist: pyyaml>=6.0.0; extra == "tests"
221
+ Requires-Dist: tink; extra == "tests"
222
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "tests"
223
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "tests"
224
+ Requires-Dist: requests; extra == "tests"
225
+ Requires-Dist: avro<2,>=1.11.1; extra == "tests"
226
+ Requires-Dist: pyrsistent; extra == "tests"
227
+ Requires-Dist: jsonschema>=4.18.0; extra == "tests"
228
+ Requires-Dist: orjson>=3.10; extra == "tests"
229
+ Requires-Dist: googleapis-common-protos; extra == "tests"
230
+ Requires-Dist: protobuf; extra == "tests"
231
+ Provides-Extra: examples
232
+ Requires-Dist: confluent-kafka; extra == "examples"
233
+ Requires-Dist: fastapi; extra == "examples"
234
+ Requires-Dist: pydantic; extra == "examples"
235
+ Requires-Dist: uvicorn; extra == "examples"
236
+ Requires-Dist: six; extra == "examples"
237
+ Requires-Dist: attrs; extra == "examples"
238
+ Requires-Dist: cachetools; extra == "examples"
239
+ Requires-Dist: httpx>=0.26; extra == "examples"
240
+ Requires-Dist: authlib>=1.0.0; extra == "examples"
241
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "examples"
242
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "examples"
243
+ Requires-Dist: requests; extra == "examples"
244
+ Requires-Dist: avro<2,>=1.11.1; extra == "examples"
245
+ Requires-Dist: pyrsistent; extra == "examples"
246
+ Requires-Dist: jsonschema>=4.18.0; extra == "examples"
247
+ Requires-Dist: orjson>=3.10; extra == "examples"
248
+ Requires-Dist: googleapis-common-protos; extra == "examples"
249
+ Requires-Dist: protobuf; extra == "examples"
250
+ Requires-Dist: azure-identity; extra == "examples"
251
+ Requires-Dist: azure-keyvault-keys; extra == "examples"
252
+ Requires-Dist: boto3; extra == "examples"
253
+ Requires-Dist: cel-python>=0.4.0; extra == "examples"
254
+ Requires-Dist: google-auth; extra == "examples"
255
+ Requires-Dist: google-api-core; extra == "examples"
256
+ Requires-Dist: google-cloud-kms; extra == "examples"
257
+ Requires-Dist: hkdf==0.0.3; extra == "examples"
258
+ Requires-Dist: hvac; extra == "examples"
259
+ Requires-Dist: jsonata-python; extra == "examples"
260
+ Requires-Dist: pyyaml>=6.0.0; extra == "examples"
261
+ Requires-Dist: tink; extra == "examples"
262
+ Provides-Extra: soaktest
263
+ Requires-Dist: psutil; extra == "soaktest"
264
+ Requires-Dist: opentelemetry-distro; extra == "soaktest"
265
+ Requires-Dist: opentelemetry-exporter-otlp; extra == "soaktest"
266
+ Provides-Extra: all
267
+ Requires-Dist: psutil; extra == "all"
268
+ Requires-Dist: opentelemetry-distro; extra == "all"
269
+ Requires-Dist: opentelemetry-exporter-otlp; extra == "all"
270
+ Requires-Dist: sphinx; extra == "all"
271
+ Requires-Dist: sphinx-rtd-theme; extra == "all"
272
+ Requires-Dist: tomli; python_version < "3.11" and extra == "all"
273
+ Requires-Dist: pandoc; extra == "all"
274
+ Requires-Dist: confluent-kafka; extra == "all"
275
+ Requires-Dist: fastapi; extra == "all"
276
+ Requires-Dist: pydantic; extra == "all"
277
+ Requires-Dist: uvicorn; extra == "all"
278
+ Requires-Dist: six; extra == "all"
279
+ Requires-Dist: attrs; extra == "all"
280
+ Requires-Dist: cachetools; extra == "all"
281
+ Requires-Dist: httpx>=0.26; extra == "all"
282
+ Requires-Dist: authlib>=1.0.0; extra == "all"
283
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "all"
284
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "all"
285
+ Requires-Dist: requests; extra == "all"
286
+ Requires-Dist: avro<2,>=1.11.1; extra == "all"
287
+ Requires-Dist: pyrsistent; extra == "all"
288
+ Requires-Dist: jsonschema>=4.18.0; extra == "all"
289
+ Requires-Dist: orjson>=3.10; extra == "all"
290
+ Requires-Dist: googleapis-common-protos; extra == "all"
291
+ Requires-Dist: protobuf; extra == "all"
292
+ Requires-Dist: azure-identity; extra == "all"
293
+ Requires-Dist: azure-keyvault-keys; extra == "all"
294
+ Requires-Dist: boto3; extra == "all"
295
+ Requires-Dist: cel-python>=0.4.0; extra == "all"
296
+ Requires-Dist: google-auth; extra == "all"
297
+ Requires-Dist: google-api-core; extra == "all"
298
+ Requires-Dist: google-cloud-kms; extra == "all"
299
+ Requires-Dist: hkdf==0.0.3; extra == "all"
300
+ Requires-Dist: hvac; extra == "all"
301
+ Requires-Dist: jsonata-python; extra == "all"
302
+ Requires-Dist: pyyaml>=6.0.0; extra == "all"
303
+ Requires-Dist: tink; extra == "all"
304
+ Requires-Dist: urllib3<3; extra == "all"
305
+ Requires-Dist: flake8; extra == "all"
306
+ Requires-Dist: mypy; extra == "all"
307
+ Requires-Dist: attrs; extra == "all"
308
+ Requires-Dist: types-cachetools; extra == "all"
309
+ Requires-Dist: types-requests; extra == "all"
310
+ Requires-Dist: orjson; extra == "all"
311
+ Requires-Dist: pytest; extra == "all"
312
+ Requires-Dist: pytest-timeout; extra == "all"
313
+ Requires-Dist: requests-mock; extra == "all"
314
+ Requires-Dist: respx; extra == "all"
315
+ Requires-Dist: pytest_cov; extra == "all"
316
+ Requires-Dist: pluggy<1.6.0; extra == "all"
317
+ Requires-Dist: pytest-asyncio; extra == "all"
318
+ Requires-Dist: async-timeout; extra == "all"
319
+ Requires-Dist: black>=24.0.0; extra == "all"
320
+ Requires-Dist: isort>=5.13.0; extra == "all"
321
+ Requires-Dist: attrs>=21.2.0; extra == "all"
322
+ Requires-Dist: cachetools>=5.5.0; extra == "all"
323
+ Requires-Dist: certifi; extra == "all"
324
+ Requires-Dist: httpx>=0.26; extra == "all"
325
+ Requires-Dist: authlib>=1.0.0; extra == "all"
326
+ Requires-Dist: azure-identity; extra == "all"
327
+ Requires-Dist: azure-keyvault-keys; extra == "all"
328
+ Requires-Dist: boto3>=1.35; extra == "all"
329
+ Requires-Dist: cel-python>=0.4.0; extra == "all"
330
+ Requires-Dist: google-re2<1.1.20251105; extra == "all"
331
+ Requires-Dist: google-auth; extra == "all"
332
+ Requires-Dist: google-api-core; extra == "all"
333
+ Requires-Dist: google-cloud-kms; extra == "all"
334
+ Requires-Dist: hkdf==0.0.3; extra == "all"
335
+ Requires-Dist: hvac; extra == "all"
336
+ Requires-Dist: jsonata-python; extra == "all"
337
+ Requires-Dist: pyyaml>=6.0.0; extra == "all"
338
+ Requires-Dist: tink; extra == "all"
339
+ Requires-Dist: fastavro<1.8.0,>=1.5.4; python_version == "3.7" and extra == "all"
340
+ Requires-Dist: fastavro<2,>=1.5.4; python_version > "3.7" and extra == "all"
341
+ Requires-Dist: requests; extra == "all"
342
+ Requires-Dist: avro<2,>=1.11.1; extra == "all"
343
+ Requires-Dist: pyrsistent; extra == "all"
344
+ Requires-Dist: jsonschema>=4.18.0; extra == "all"
345
+ Requires-Dist: orjson>=3.10; extra == "all"
346
+ Requires-Dist: googleapis-common-protos; extra == "all"
347
+ Requires-Dist: protobuf; extra == "all"
348
+ Dynamic: license-file
349
+
350
+ # Confluent's Python Client for Apache Kafka®
351
+
352
+ [![Try Confluent Cloud - The Data Streaming Platform](https://images.ctfassets.net/8vofjvai1hpv/10bgcSfn5MzmvS4nNqr94J/af43dd2336e3f9e0c0ca4feef4398f6f/confluent-banner-v2.svg)](https://confluent.cloud/signup?utm_source=github&utm_medium=banner&utm_campaign=tm.plg.cflt-oss-repos&utm_term=confluent-kafka-python)
353
+
354
+ **confluent-kafka-python** provides a high-level `Producer`, `Consumer` and `AdminClient` compatible with all [Apache Kafka](http://kafka.apache.org/) brokers >= v0.8, [Confluent Cloud](https://www.confluent.io/confluent-cloud/) and [Confluent Platform](https://www.confluent.io/product/compare/).
355
+
356
+ **Recommended for Production:** While this client works with any Kafka deployment, it's optimized for and fully supported with [Confluent Cloud](https://www.confluent.io/confluent-cloud/) (fully managed) and [Confluent Platform](https://www.confluent.io/product/compare/) (self-managed), which provide enterprise-grade security, monitoring, and support.
357
+
358
+ ## Why Choose Confluent's Python Client?
359
+
360
+ Unlike the basic Apache Kafka Python client, `confluent-kafka-python` provides:
361
+
362
+ - **Production-Ready Performance**: Built on `librdkafka` (C library) for maximum throughput and minimal latency, significantly outperforming pure Python implementations.
363
+ - **Enterprise Features**: Schema Registry integration, transactions, exactly-once semantics, and advanced serialization support out of the box.
364
+ - **AsyncIO Support**: Native async/await support for modern Python applications - not available in the Apache Kafka client.
365
+ - **Comprehensive Serialization**: Built-in Avro, Protobuf, and JSON Schema support with automatic schema evolution handling.
366
+ - **Professional Support**: Backed by Confluent's engineering team with enterprise SLAs and 24/7 support options.
367
+ - **Active Development**: Continuously updated with the latest Kafka features and performance optimizations.
368
+ - **Battle-Tested**: Used by thousands of organizations in production, from startups to Fortune 500 companies.
369
+
370
+ **Performance Note:** The Apache Kafka Python client (`kafka-python`) is a pure Python implementation that, while functional, has significant performance limitations for high-throughput production use cases. `confluent-kafka-python` leverages the same high-performance C library (`librdkafka`) used by Confluent's other clients, providing enterprise-grade performance and reliability.
371
+
372
+ ## Key Features
373
+
374
+ - **High Performance & Reliability**: Built on [`librdkafka`](https://github.com/confluentinc/librdkafka), the battle-tested C client for Apache Kafka, ensuring maximum throughput, low latency, and stability. The client is supported by Confluent and is trusted in mission-critical production environments.
375
+ - **Comprehensive Kafka Support**: Full support for the Kafka protocol, transactions, and administration APIs.
376
+ - **AsyncIO Producer**: A fully asynchronous producer (`AIOProducer`) for seamless integration with modern Python applications using `asyncio`.
377
+ - **Seamless Schema Registry Integration**: Synchronous and asynchronous clients for Confluent Schema Registry to handle schema management and serialization (Avro, Protobuf, JSON Schema).
378
+ - **Improved Error Handling**: Detailed, context-aware error messages and exceptions to speed up debugging and troubleshooting.
379
+ - **[Confluent Cloud] Automatic Zone Detection**: Producers automatically connect to brokers in the same availability zone, reducing latency and data transfer costs without requiring manual configuration.
380
+ - **[Confluent Cloud] Simplified Configuration Profiles**: Pre-defined configuration profiles optimized for common use cases like high throughput or low latency, simplifying client setup.
381
+ - **Enterprise Support**: Backed by Confluent's expert support team with SLAs and 24/7 assistance for production deployments.
382
+
383
+ ## Usage
384
+
385
+ For a step-by-step guide on using the client, see [Getting Started with Apache Kafka and Python](https://developer.confluent.io/get-started/python/).
386
+
387
+ ### Choosing Your Kafka Deployment
388
+
389
+ - **[Confluent Cloud](https://www.confluent.io/confluent-cloud/)** - Fully managed service with automatic scaling, security, and monitoring. Best for teams wanting to focus on applications rather than infrastructure.
390
+ - **[Confluent Platform](https://www.confluent.io/product/compare/)** - Self-managed deployment with enterprise features, support, and tooling. Ideal for on-premises or hybrid cloud requirements.
391
+ - **Apache Kafka** - Open source deployment. Requires manual setup, monitoring, and maintenance.
392
+
393
+ Additional examples can be found in the [examples](examples) directory or the [confluentinc/examples](https://github.com/confluentinc/examples/tree/master/clients/cloud/python) GitHub repo, which include demonstrations of:
394
+
395
+ - Exactly once data processing using the transactional API.
396
+ - Integration with asyncio.
397
+ - (De)serializing Protobuf, JSON, and Avro data with Confluent Schema Registry integration.
398
+ - [Confluent Cloud](https://www.confluent.io/confluent-cloud/) configuration.
399
+
400
+ Also see the [Python client docs](https://docs.confluent.io/kafka-clients/python/current/overview.html) and the [API reference](https://docs.confluent.io/kafka-clients/python/current/).
401
+
402
+ Finally, the [tests](tests) are useful as a reference for example usage.
403
+ ### AsyncIO Producer
404
+
405
+ Use the AsyncIO `Producer` inside async applications to avoid blocking the event loop.
406
+
407
+ ```python
408
+ import asyncio
409
+ from confluent_kafka.aio import AIOProducer
410
+
411
+ async def main():
412
+ p = AIOProducer({"bootstrap.servers": "mybroker"})
413
+ try:
414
+ # produce() returns a Future; first await the coroutine to get the Future,
415
+ # then await the Future to get the delivered Message.
416
+ delivery_future = await p.produce("mytopic", value=b"hello")
417
+ delivered_msg = await delivery_future
418
+ # Optionally flush any remaining buffered messages before shutdown
419
+ await p.flush()
420
+ finally:
421
+ await p.close()
422
+
423
+ asyncio.run(main())
424
+ ```
425
+
426
+ Notes:
427
+
428
+ - Batched async produce buffers messages; delivery callbacks, stats, errors, and logger run on the event loop.
429
+ - Per-message headers are not supported in the batched async path. If headers are required, use the synchronous `Producer.produce(...)` (you can offload to a thread in async apps).
430
+
431
+ For a more detailed example that includes both an async producer and consumer, see
432
+ [`examples/asyncio_example.py`](examples/asyncio_example.py).
433
+
434
+ **Architecture:** For implementation details and component architecture, see the [AIOProducer Architecture Overview](aio_producer_simple_diagram.md).
435
+
436
+ #### When to use AsyncIO vs synchronous Producer
437
+
438
+ - **Use AsyncIO `Producer`** when your code runs under an event loop (FastAPI/Starlette, aiohttp, Sanic, asyncio workers) and must not block.
439
+ - **Use synchronous `Producer`** for scripts, batch jobs, and highest-throughput pipelines where you control threads/processes and can call `poll()`/`flush()` directly.
440
+ - **In async servers**, prefer AsyncIO `Producer`; if you need headers, call sync `produce()` via `run_in_executor` for that path.
441
+
442
+ #### AsyncIO with Schema Registry
443
+
444
+ The AsyncIO producer and consumer integrate seamlessly with async Schema Registry serializers. See the [Schema Registry Integration](#schema-registry-integration) section below for full details.
445
+
446
+ ### Basic Producer example
447
+
448
+ ```python
449
+ from confluent_kafka import Producer
450
+
451
+ p = Producer({'bootstrap.servers': 'mybroker1,mybroker2'})
452
+
453
+ def delivery_report(err, msg):
454
+ """ Called once for each message produced to indicate delivery result.
455
+ Triggered by poll() or flush()."""
456
+ if err is not None:
457
+ print('Message delivery failed: {}'.format(err))
458
+ else:
459
+ print('Message delivered to {} [{}]'.format(msg.topic(), msg.partition()))
460
+
461
+ for data in some_data_source:
462
+ # Trigger any available delivery report callbacks from previous produce() calls
463
+ p.poll(0)
464
+
465
+ # Asynchronously produce a message. The delivery report callback will
466
+ # be triggered from the call to poll() above, or flush() below, when the
467
+ # message has been successfully delivered or failed permanently.
468
+ p.produce('mytopic', data.encode('utf-8'), callback=delivery_report)
469
+
470
+ # Wait for any outstanding messages to be delivered and delivery report
471
+ # callbacks to be triggered.
472
+ p.flush()
473
+ ```
474
+
475
+ For a discussion on the poll based producer API, refer to the
476
+ [Integrating Apache Kafka With Python Asyncio Web Applications](https://www.confluent.io/blog/kafka-python-asyncio-integration/)
477
+ blog post.
478
+ ### Schema Registry Integration
479
+
480
+ This client provides full integration with Schema Registry for schema management and message serialization, and is compatible with both [Confluent Platform](https://docs.confluent.io/platform/current/schema-registry/index.html) and [Confluent Cloud](https://docs.confluent.io/cloud/current/sr/index.html). Both synchronous and asynchronous clients are available.
481
+
482
+ #### Learn more
483
+
484
+ - [Getting Started with Apache Kafka and Python](https://developer.confluent.io/get-started/python/) – step-by-step course with videos and labs.
485
+ - [Schema Registry Basics](https://developer.confluent.io/learn-kafka/stream-processing/sr-schema-registry/) – short tutorial explaining subjects, compatibility, and serialization patterns.
486
+
487
+ #### Synchronous Client & Serializers
488
+
489
+ Use the synchronous `SchemaRegistryClient` with the standard `Producer` and `Consumer`.
490
+
491
+ ```python
492
+ from confluent_kafka import Producer
493
+ from confluent_kafka.schema_registry import SchemaRegistryClient
494
+ from confluent_kafka.schema_registry.avro import AvroSerializer
495
+ from confluent_kafka.serialization import StringSerializer, SerializationContext, MessageField
496
+
497
+ # Configure Schema Registry Client
498
+ schema_registry_conf = {'url': 'http://localhost:8081'} # Confluent Platform
499
+ # For Confluent Cloud, add: 'basic.auth.user.info': '<sr-api-key>:<sr-api-secret>'
500
+ # See: https://docs.confluent.io/cloud/current/sr/index.html
501
+ schema_registry_client = SchemaRegistryClient(schema_registry_conf)
502
+
503
+ # 2. Configure AvroSerializer
504
+ avro_serializer = AvroSerializer(schema_registry_client,
505
+ user_schema_str,
506
+ lambda user, ctx: user.to_dict())
507
+
508
+ # 3. Configure Producer
509
+ producer_conf = {
510
+ 'bootstrap.servers': 'localhost:9092',
511
+ }
512
+ producer = Producer(producer_conf)
513
+
514
+ # 4. Produce messages
515
+ serialized_value = avro_serializer(some_user_object)
516
+ producer.produce('my-topic', key='user1', value=serialized_value)
517
+ producer.flush()
518
+ ```
519
+
520
+ #### Asynchronous Client & Serializers (AsyncIO)
521
+
522
+ Use the `AsyncSchemaRegistryClient` and `Async` serializers with `AIOProducer` and `AIOConsumer`. The configuration is the same as the synchronous client.
523
+
524
+ ```python
525
+ from confluent_kafka.aio import AIOProducer
526
+ from confluent_kafka.schema_registry import AsyncSchemaRegistryClient
527
+ from confluent_kafka.schema_registry._async.avro import AsyncAvroSerializer
528
+
529
+ # Setup async Schema Registry client and serializer
530
+ # (See configuration options in the synchronous example above)
531
+ schema_registry_conf = {'url': 'http://localhost:8081'}
532
+ schema_client = AsyncSchemaRegistryClient(schema_registry_conf)
533
+ serializer = await AsyncAvroSerializer(schema_client, schema_str=avro_schema)
534
+
535
+ # Use with AsyncIO producer
536
+ producer = AIOProducer({"bootstrap.servers": "localhost:9092"})
537
+ serialized_value = await serializer(data, SerializationContext("topic", MessageField.VALUE))
538
+ delivery_future = await producer.produce("topic", value=serialized_value)
539
+ ```
540
+
541
+ Available async serializers: `AsyncAvroSerializer`, `AsyncJSONSerializer`, `AsyncProtobufSerializer` (and corresponding deserializers).
542
+
543
+ See also:
544
+
545
+ - Example: [`examples/asyncio_avro_producer.py`](examples/asyncio_avro_producer.py)
546
+
547
+ #### Import paths
548
+
549
+ ```python
550
+ from confluent_kafka.schema_registry._async.avro import AsyncAvroSerializer, AsyncAvroDeserializer
551
+ from confluent_kafka.schema_registry._async.json_schema import AsyncJSONSerializer, AsyncJSONDeserializer
552
+ from confluent_kafka.schema_registry._async.protobuf import AsyncProtobufSerializer, AsyncProtobufDeserializer
553
+ ```
554
+
555
+ **Client-Side Field Level Encryption (CSFLE):** To use Data Contracts rules (including CSFLE), install the `rules` extra (see Install section), and refer to the encryption examples in [`examples/README.md`](examples/README.md). For CSFLE-specific guidance, see the [Confluent Cloud CSFLE documentation](https://docs.confluent.io/cloud/current/security/encrypt/csfle/overview.html).
556
+
557
+ **Note:** The async Schema Registry interface mirrors the synchronous client exactly - same configuration options, same calling patterns, no unexpected gotchas or limitations. Simply add `await` to method calls and use the `Async` prefixed classes.
558
+
559
+ #### Troubleshooting
560
+
561
+ - **401/403 Unauthorized when using Confluent Cloud:** Verify your `basic.auth.user.info` (SR API key/secret) is correct and that the Schema Registry URL is for your specific cluster. Ensure you are using an SR API key, not a Kafka API key.
562
+ - **Schema not found:** Check that your `subject.name.strategy` configuration matches how your schemas are registered in Schema Registry, and that the topic and message field (key/value) pairing is correct.
563
+ ### Basic Consumer example
564
+
565
+ ```python
566
+ from confluent_kafka import Consumer
567
+
568
+ c = Consumer({
569
+ 'bootstrap.servers': 'mybroker',
570
+ 'group.id': 'mygroup',
571
+ 'auto.offset.reset': 'earliest'
572
+ })
573
+
574
+ c.subscribe(['mytopic'])
575
+
576
+ while True:
577
+ msg = c.poll(1.0)
578
+
579
+ if msg is None:
580
+ continue
581
+ if msg.error():
582
+ print("Consumer error: {}".format(msg.error()))
583
+ continue
584
+
585
+ print('Received message: {}'.format(msg.value().decode('utf-8')))
586
+
587
+ c.close()
588
+ ```
589
+ ### Basic AdminClient example
590
+
591
+ Create topics:
592
+
593
+ ```python
594
+ from confluent_kafka.admin import AdminClient, NewTopic
595
+
596
+ a = AdminClient({'bootstrap.servers': 'mybroker'})
597
+
598
+ new_topics = [NewTopic(topic, num_partitions=3, replication_factor=1) for topic in ["topic1", "topic2"]]
599
+ # Note: In a multi-cluster production scenario, it is more typical to use a replication_factor of 3 for durability.
600
+
601
+ # Call create_topics to asynchronously create topics. A dict
602
+ # of <topic,future> is returned.
603
+ fs = a.create_topics(new_topics)
604
+
605
+ # Wait for each operation to finish.
606
+ for topic, f in fs.items():
607
+ try:
608
+ f.result() # The result itself is None
609
+ print("Topic {} created".format(topic))
610
+ except Exception as e:
611
+ print("Failed to create topic {}: {}".format(topic, e))
612
+ ```
613
+ ## Thread safety
614
+
615
+ The `Producer`, `Consumer`, and `AdminClient` are all thread safe.
616
+ ## Install
617
+
618
+ ```bash
619
+ # Basic installation
620
+ pip install confluent-kafka
621
+
622
+ # With Schema Registry support
623
+ pip install "confluent-kafka[avro,schemaregistry]" # Avro
624
+ pip install "confluent-kafka[json,schemaregistry]" # JSON Schema
625
+ pip install "confluent-kafka[protobuf,schemaregistry]" # Protobuf
626
+
627
+ # With Data Contract rules (includes CSFLE support)
628
+ pip install "confluent-kafka[avro,schemaregistry,rules]"
629
+ ```
630
+
631
+ **Note:** Pre-built Linux wheels do not include SASL Kerberos/GSSAPI support. For Kerberos, see the source installation instructions in [INSTALL.md](INSTALL.md).
632
+ To use Schema Registry with the Avro serializer/deserializer:
633
+
634
+ ```bash
635
+ pip install "confluent-kafka[avro,schemaregistry]"
636
+ ```
637
+
638
+ To use Schema Registry with the JSON serializer/deserializer:
639
+
640
+ ```bash
641
+ pip install "confluent-kafka[json,schemaregistry]"
642
+ ```
643
+
644
+ To use Schema Registry with the Protobuf serializer/deserializer:
645
+
646
+ ```bash
647
+ pip install "confluent-kafka[protobuf,schemaregistry]"
648
+ ```
649
+
650
+ When using Data Contract rules (including CSFLE) add the `rules`extra, e.g.:
651
+
652
+ ```bash
653
+ pip install "confluent-kafka[avro,schemaregistry,rules]"
654
+ ```
655
+
656
+ **Install from source**
657
+
658
+ For source install, see the *Install from source* section in [INSTALL.md](INSTALL.md).
659
+
660
+ ## Broker compatibility
661
+
662
+ The Python client (as well as the underlying C library librdkafka) supports
663
+ all broker versions >= 0.8.
664
+ But due to the nature of the Kafka protocol in broker versions 0.8 and 0.9 it
665
+ is not safe for a client to assume what protocol version is actually supported
666
+ by the broker, thus you will need to hint the Python client what protocol
667
+ version it may use. This is done through two configuration settings:
668
+
669
+ - `broker.version.fallback=YOUR_BROKER_VERSION` (default 0.9.0.1)
670
+ - `api.version.request=true|false` (default true)
671
+
672
+ When using a Kafka 0.10 broker or later you don't need to do anything
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/RECORD ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ confluent_kafka-2.14.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ confluent_kafka-2.14.0.dist-info/METADATA,sha256=H9ZRYnadnNI_np9pQfNN2SVDr9YTcZIF79JY_gMU6bc,32515
3
+ confluent_kafka-2.14.0.dist-info/RECORD,,
4
+ confluent_kafka-2.14.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ confluent_kafka-2.14.0.dist-info/WHEEL,sha256=Rh30Baa4WDYEuAIz4jzHfiyOUzrqmb0t4kcd0JIwZmc,113
6
+ confluent_kafka-2.14.0.dist-info/licenses/LICENSE,sha256=ODxWuWScELrxWzxjD3adTI_PftH_QwSV6MFVE1IdCJk,34725
7
+ confluent_kafka-2.14.0.dist-info/top_level.txt,sha256=hlCYXhurQM0_gFE2OVipV3cQ8k_37ovY6UYYkAyBzLA,16
8
+ confluent_kafka.libs/librdkafka-a760591f.so.1,sha256=NElq7LFzX0kro0Ut8VxVhd-n8NoqXp3aBtvnbazh7Ks,9221633
9
+ confluent_kafka/__init__.py,sha256=LCi3pakU9xIjTaaTOLAz72yBatwkyA4uEiYNtX2g5gg,4762
10
+ confluent_kafka/__pycache__/__init__.cpython-313.pyc,,
11
+ confluent_kafka/__pycache__/_types.cpython-313.pyc,,
12
+ confluent_kafka/__pycache__/deserializing_consumer.cpython-313.pyc,,
13
+ confluent_kafka/__pycache__/error.cpython-313.pyc,,
14
+ confluent_kafka/__pycache__/serializing_producer.cpython-313.pyc,,
15
+ confluent_kafka/_model/__init__.py,sha256=E4KHVOyJGijw0SGdencsGq2oOPN152nCMpZ_AfKxMqI,5480
16
+ confluent_kafka/_model/__pycache__/__init__.cpython-313.pyc,,
17
+ confluent_kafka/_types.py,sha256=L8SnUMf5XhRzALgsSpL26bcRkTMMQuSJOY6PIxUAtDg,1624
18
+ confluent_kafka/_util/__init__.py,sha256=o3BckLsv8N6sBFY2hMwy6kKsgg8eQucc3OzsJ7VWpyA,691
19
+ confluent_kafka/_util/__pycache__/__init__.cpython-313.pyc,,
20
+ confluent_kafka/_util/__pycache__/conversion_util.cpython-313.pyc,,
21
+ confluent_kafka/_util/__pycache__/validation_util.cpython-313.pyc,,
22
+ confluent_kafka/_util/conversion_util.py,sha256=BhXb3NQoePNdAnP6oWL-9jUrtOJqR8S6cg2EFpugA3I,1481
23
+ confluent_kafka/_util/validation_util.py,sha256=NTu_XngK78PTU3QSxH363z38q10WgF8RMzPN1-Y6tsc,2098
24
+ confluent_kafka/admin/__init__.py,sha256=FWjeUvIrEf-jgmJssQCxZBpMbM5Cq_JN8osYI7hxDso,63860
25
+ confluent_kafka/admin/__pycache__/__init__.cpython-313.pyc,,
26
+ confluent_kafka/admin/__pycache__/_acl.cpython-313.pyc,,
27
+ confluent_kafka/admin/__pycache__/_cluster.cpython-313.pyc,,
28
+ confluent_kafka/admin/__pycache__/_config.cpython-313.pyc,,
29
+ confluent_kafka/admin/__pycache__/_group.cpython-313.pyc,,
30
+ confluent_kafka/admin/__pycache__/_listoffsets.cpython-313.pyc,,
31
+ confluent_kafka/admin/__pycache__/_metadata.cpython-313.pyc,,
32
+ confluent_kafka/admin/__pycache__/_records.cpython-313.pyc,,
33
+ confluent_kafka/admin/__pycache__/_resource.cpython-313.pyc,,
34
+ confluent_kafka/admin/__pycache__/_scram.cpython-313.pyc,,
35
+ confluent_kafka/admin/__pycache__/_topic.cpython-313.pyc,,
36
+ confluent_kafka/admin/_acl.py,sha256=He1jmRUBlCCrSsak4R8rUbOkzRH_Th3Y8StQioYDQxw,8955
37
+ confluent_kafka/admin/_cluster.py,sha256=OyzcWM3MYyeaoFBqHd_kcPI-YMK-r1oJ_HH4dOtLJT4,1819
38
+ confluent_kafka/admin/_config.py,sha256=M_IrR-fCmJ2GFKWAob74bUtlV_JnFf88RBuPgPs4pOM,9191
39
+ confluent_kafka/admin/_group.py,sha256=MJIOnHTZs20gM8Zbe-pxtjfa1SNImCR7rLb4grfw6TE,5924
40
+ confluent_kafka/admin/_listoffsets.py,sha256=UzHIgROCqMyW0aOUSPzNpZDP4zSSy7KnRND4KceCXfg,4593
41
+ confluent_kafka/admin/_metadata.py,sha256=m7uLeZKz6I0K9-t2uc-_uCcZGLLWk3SH-uts4LqLCPA,6255
42
+ confluent_kafka/admin/_records.py,sha256=serRlNcdkFLe-KwRgmmxtUk_7r8vNxbXb4TIg_Fqa5k,921
43
+ confluent_kafka/admin/_resource.py,sha256=L6ihgRWSPRBC2s_AjLl9t6reG1XItlhmTWycvWzH2aA,2106
44
+ confluent_kafka/admin/_scram.py,sha256=wt6u9080H49HXybm6cpZb3Shvafw5r0SIGkgEBDUgiU,3588
45
+ confluent_kafka/admin/_topic.py,sha256=uj-1QdGwuu5gxje6MddMU3dXjSx0XqF-fVkG-9FA6IE,1927
46
+ confluent_kafka/aio/_AIOConsumer.py,sha256=6XcCRJ5vzD7WdzkDQDgYoOC-9LSsf1QM4Xg0rDQ88Fk,7525
47
+ confluent_kafka/aio/__init__.py,sha256=pAbshIwpYAr9pNy9GlgtoPN6822C0EaQ6LNgBuVmTuU,689
48
+ confluent_kafka/aio/__pycache__/_AIOConsumer.cpython-313.pyc,,
49
+ confluent_kafka/aio/__pycache__/__init__.cpython-313.pyc,,
50
+ confluent_kafka/aio/__pycache__/_common.cpython-313.pyc,,
51
+ confluent_kafka/aio/_common.py,sha256=kY8911IDvyRuMdZgo3BIBf8iovVnh4tt6m1tQ6sZ-zs,2889
52
+ confluent_kafka/aio/producer/_AIOProducer.py,sha256=ADdI2583H6lraIPJpB6JQjGGGEdti7xVBQSv5SddbvY,14308
53
+ confluent_kafka/aio/producer/__init__.py,sha256=lHKs3H-UTys1ikDXbDHJFBkEPGypkN9vFEZLeQ1rK1o,755
54
+ confluent_kafka/aio/producer/__pycache__/_AIOProducer.cpython-313.pyc,,
55
+ confluent_kafka/aio/producer/__pycache__/__init__.cpython-313.pyc,,
56
+ confluent_kafka/aio/producer/__pycache__/_buffer_timeout_manager.cpython-313.pyc,,
57
+ confluent_kafka/aio/producer/__pycache__/_kafka_batch_executor.cpython-313.pyc,,
58
+ confluent_kafka/aio/producer/__pycache__/_message_batch.cpython-313.pyc,,
59
+ confluent_kafka/aio/producer/__pycache__/_producer_batch_processor.cpython-313.pyc,,
60
+ confluent_kafka/aio/producer/_buffer_timeout_manager.py,sha256=HHAvYjQ9qvvXoXtkIuLE1oXMX0DqRlk43jOlYH4rW74,5820
61
+ confluent_kafka/aio/producer/_kafka_batch_executor.py,sha256=XDsW7tIhoOPIvN3wXkYt-o5kdrt9B3jMa30W7JG6Wh4,6355
62
+ confluent_kafka/aio/producer/_message_batch.py,sha256=lVqpgfNkASgc6uHH8DXZFGR1EhRclMsaxxq7nreD_rw,2654
63
+ confluent_kafka/aio/producer/_producer_batch_processor.py,sha256=daubeHmUmwuq4-E4zEb0BSUqmqrdN6u7aqavsq5ZtQ4,13238
64
+ confluent_kafka/avro/__init__.py,sha256=nbNEB_Xf3A0SAjJz8675C9lXOaHttWxpOAquOKR6oj4,8320
65
+ confluent_kafka/avro/__pycache__/__init__.cpython-313.pyc,,
66
+ confluent_kafka/avro/__pycache__/cached_schema_registry_client.cpython-313.pyc,,
67
+ confluent_kafka/avro/__pycache__/error.cpython-313.pyc,,
68
+ confluent_kafka/avro/__pycache__/load.cpython-313.pyc,,
69
+ confluent_kafka/avro/cached_schema_registry_client.py,sha256=zW0z9H0HXese3WvojO7qZlTSdvYSaC801ZDVaeEJFDM,20879
70
+ confluent_kafka/avro/error.py,sha256=JCWseNrVMtHaBkbTRGQVuWtXjFUgxC07a28quw6-PTs,1004
71
+ confluent_kafka/avro/load.py,sha256=Fa3HnX8nXX8zGVK7IYL1aV8KWLm2JiENO49ctWBBQgg,1737
72
+ confluent_kafka/avro/serializer/__init__.py,sha256=jLedS5zJ6yZzIhIadMcXHr58lEBqIGfqfMf6ActErEw,1034
73
+ confluent_kafka/avro/serializer/__pycache__/__init__.cpython-313.pyc,,
74
+ confluent_kafka/avro/serializer/__pycache__/message_serializer.cpython-313.pyc,,
75
+ confluent_kafka/avro/serializer/message_serializer.py,sha256=27TeDjQPwCk4BqMc8_dP8ulJo18IAPlarMDGCSOo2Z4,8793
76
+ confluent_kafka/cimpl.cpython-313-x86_64-linux-gnu.so,sha256=28_Bw0bGzWEri1g_IiTdemrqxBU7WRCwg0TsC27dxXE,362169
77
+ confluent_kafka/cimpl.pyi,sha256=BEhv9Gn696fIpbrCJsJGBdqfR2iFjP___kBYnLCPcsg,25986
78
+ confluent_kafka/deserializing_consumer.py,sha256=CwlREZvE8PgtlgzYAUyTBmGIPA-JFxYwaScOaFnoQyE,6005
79
+ confluent_kafka/error.py,sha256=PWlHU_m5F6Y-hjfnrl3kpU3hDXGyu-N_Yi-dhOg-J6s,5016
80
+ confluent_kafka/kafkatest/__init__.py,sha256=RRTSs7HuLjS9yN38Y_vw8KdQv6v5FZdj5MqX0bUbM-M,83
81
+ confluent_kafka/kafkatest/__pycache__/__init__.cpython-313.pyc,,
82
+ confluent_kafka/kafkatest/__pycache__/verifiable_client.cpython-313.pyc,,
83
+ confluent_kafka/kafkatest/__pycache__/verifiable_consumer.cpython-313.pyc,,
84
+ confluent_kafka/kafkatest/__pycache__/verifiable_producer.cpython-313.pyc,,
85
+ confluent_kafka/kafkatest/verifiable_client.py,sha256=-pWJVItVHhv0AInsobeJc0WviKxhyvAqpH8CnAHMKRU,3569
86
+ confluent_kafka/kafkatest/verifiable_consumer.py,sha256=vkWh721XRjlyt7JSn0kqdWKWGEe90TySx1AX28leHMc,12415
87
+ confluent_kafka/kafkatest/verifiable_producer.py,sha256=HqSUWx0HVQWPGV39_m_eS1AbKgUVj8g2uAKGIaV8Rgo,5700
88
+ confluent_kafka/py.typed,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
89
+ confluent_kafka/schema_registry/__init__.py,sha256=2ABDUDJ1Ecu8Lr6Dzpj924e5AXXO5acIINtp4GFSWzw,7955
90
+ confluent_kafka/schema_registry/__pycache__/__init__.cpython-313.pyc,,
91
+ confluent_kafka/schema_registry/__pycache__/avro.cpython-313.pyc,,
92
+ confluent_kafka/schema_registry/__pycache__/error.cpython-313.pyc,,
93
+ confluent_kafka/schema_registry/__pycache__/json_schema.cpython-313.pyc,,
94
+ confluent_kafka/schema_registry/__pycache__/protobuf.cpython-313.pyc,,
95
+ confluent_kafka/schema_registry/__pycache__/rule_registry.cpython-313.pyc,,
96
+ confluent_kafka/schema_registry/__pycache__/schema_registry_client.cpython-313.pyc,,
97
+ confluent_kafka/schema_registry/__pycache__/serde.cpython-313.pyc,,
98
+ confluent_kafka/schema_registry/__pycache__/wildcard_matcher.cpython-313.pyc,,
99
+ confluent_kafka/schema_registry/_async/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
+ confluent_kafka/schema_registry/_async/__pycache__/__init__.cpython-313.pyc,,
101
+ confluent_kafka/schema_registry/_async/__pycache__/avro.cpython-313.pyc,,
102
+ confluent_kafka/schema_registry/_async/__pycache__/json_schema.cpython-313.pyc,,
103
+ confluent_kafka/schema_registry/_async/__pycache__/mock_schema_registry_client.cpython-313.pyc,,
104
+ confluent_kafka/schema_registry/_async/__pycache__/protobuf.cpython-313.pyc,,
105
+ confluent_kafka/schema_registry/_async/__pycache__/schema_registry_client.cpython-313.pyc,,
106
+ confluent_kafka/schema_registry/_async/__pycache__/serde.cpython-313.pyc,,
107
+ confluent_kafka/schema_registry/_async/avro.py,sha256=3PONg7VoGHtr00cnbL1sLV6cr9QieF6flUi6kaBvHik,41259
108
+ confluent_kafka/schema_registry/_async/json_schema.py,sha256=JRqOABdw14CAcRNsd2_ZgZcnOxqiRPGbnaISUyJZdpY,42595
109
+ confluent_kafka/schema_registry/_async/mock_schema_registry_client.py,sha256=EGn_prpqCjqE2qd2WUZwtKLqU01myh8hPUb2I4-2vNc,18159
110
+ confluent_kafka/schema_registry/_async/protobuf.py,sha256=O2P8hmpuTSFeilbwqa8AZXtV8yGsXYPcmjpGTpDQUaE,41628
111
+ confluent_kafka/schema_registry/_async/schema_registry_client.py,sha256=EdM3PZpadY1YU86Q-U2XX8Yo-Xma2u1Rcov2BeVWb1I,68335
112
+ confluent_kafka/schema_registry/_async/serde.py,sha256=cea-9EtGOKpkWuGwg8Q-Z-5fQvEKmc0JC-SwTRiHS30,26951
113
+ confluent_kafka/schema_registry/_sync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
114
+ confluent_kafka/schema_registry/_sync/__pycache__/__init__.cpython-313.pyc,,
115
+ confluent_kafka/schema_registry/_sync/__pycache__/avro.cpython-313.pyc,,
116
+ confluent_kafka/schema_registry/_sync/__pycache__/json_schema.cpython-313.pyc,,
117
+ confluent_kafka/schema_registry/_sync/__pycache__/mock_schema_registry_client.cpython-313.pyc,,
118
+ confluent_kafka/schema_registry/_sync/__pycache__/protobuf.cpython-313.pyc,,
119
+ confluent_kafka/schema_registry/_sync/__pycache__/schema_registry_client.cpython-313.pyc,,
120
+ confluent_kafka/schema_registry/_sync/__pycache__/serde.cpython-313.pyc,,
121
+ confluent_kafka/schema_registry/_sync/avro.py,sha256=EWgF4LKu0jY9K_zEzGsFFUWEWNvgFl_C0tTpcEJ0Lxw,40841
122
+ confluent_kafka/schema_registry/_sync/json_schema.py,sha256=yxZbNbpQAI0Wd9YbVx_TTI3leDEGWCXXAiPC1OmxzR4,42137
123
+ confluent_kafka/schema_registry/_sync/mock_schema_registry_client.py,sha256=KpziRRrEdKWeeQBxMK50ZFn_3_2V-HNrO39xX4qgujg,18036
124
+ confluent_kafka/schema_registry/_sync/protobuf.py,sha256=pL2MHEf78a7QkzMrRtD2IH_615CVla9inGudpk14mOo,41123
125
+ confluent_kafka/schema_registry/_sync/schema_registry_client.py,sha256=VFtPOQn_WTXpWvdHS7DHU-4iZlq3mM3yegjY0qJ-6uc,67289
126
+ confluent_kafka/schema_registry/_sync/serde.py,sha256=p2Ehg4i75Xno12XAHbBLt5x_HJU_tB_dpmS2z0SLSnE,26717
127
+ confluent_kafka/schema_registry/avro.py,sha256=Ifj9wDdi2Esfyd41YHVg2SkooUoKMZV07K7aBz72okg,727
128
+ confluent_kafka/schema_registry/common/__init__.py,sha256=PPXaET93GDju3yaRyEt6Za5cVobooHvSU6NoBmFBINk,1004
129
+ confluent_kafka/schema_registry/common/__pycache__/__init__.cpython-313.pyc,,
130
+ confluent_kafka/schema_registry/common/__pycache__/_oauthbearer.cpython-313.pyc,,
131
+ confluent_kafka/schema_registry/common/__pycache__/avro.cpython-313.pyc,,
132
+ confluent_kafka/schema_registry/common/__pycache__/json_schema.cpython-313.pyc,,
133
+ confluent_kafka/schema_registry/common/__pycache__/protobuf.cpython-313.pyc,,
134
+ confluent_kafka/schema_registry/common/__pycache__/schema_registry_client.cpython-313.pyc,,
135
+ confluent_kafka/schema_registry/common/__pycache__/serde.cpython-313.pyc,,
136
+ confluent_kafka/schema_registry/common/_oauthbearer.py,sha256=LU1ZHo8CnWxGnZruG2KAEosgxD6gKpRUlDIp7PCJHc8,8465
137
+ confluent_kafka/schema_registry/common/avro.py,sha256=V5ujUJii6KvjNddQ19cBictcOepKxRFWtfARjHpeJqM,9792
138
+ confluent_kafka/schema_registry/common/json_schema.py,sha256=n1OuE6S25rlpbmbBnew6lNTNK6-Dh6lK5L7jNspKtO8,8778
139
+ confluent_kafka/schema_registry/common/protobuf.py,sha256=5c63Buq1xfevs741UvBcE_SE0ZKnsmVmwBKul0jLx1Q,12497
140
+ confluent_kafka/schema_registry/common/schema_registry_client.py,sha256=KBUr2UljVfoRCUxPxcHS5tMsZWbD_KRy_A9nieZrxCM,40026
141
+ confluent_kafka/schema_registry/common/serde.py,sha256=NEPrBRaSkRwY6Fn677xB5URVedb_QHco3ON-JJYZIwQ,15734
142
+ confluent_kafka/schema_registry/confluent/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
143
+ confluent_kafka/schema_registry/confluent/__pycache__/__init__.cpython-313.pyc,,
144
+ confluent_kafka/schema_registry/confluent/__pycache__/meta_pb2.cpython-313.pyc,,
145
+ confluent_kafka/schema_registry/confluent/meta_pb2.py,sha256=buqn-KscS7mIPyxEQYZJry0KPokhUywmNNFWMHpnwkE,2510
146
+ confluent_kafka/schema_registry/confluent/types/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
147
+ confluent_kafka/schema_registry/confluent/types/__pycache__/__init__.cpython-313.pyc,,
148
+ confluent_kafka/schema_registry/confluent/types/__pycache__/decimal_pb2.cpython-313.pyc,,
149
+ confluent_kafka/schema_registry/confluent/types/decimal_pb2.py,sha256=-3UQ-Q6ZQ0FOSj1ze07gmyR6PXyLRvgnvekUXW1JmMQ,1172
150
+ confluent_kafka/schema_registry/error.py,sha256=znDkuQhcDUh9cqi_rFdPH15G7a5LFUfrIuUHf7WdiUg,2171
151
+ confluent_kafka/schema_registry/json_schema.py,sha256=4T6-qV7h__TU49NbUNGcF25dYl1Iqhs2Bp8pZU_WjKg,748
152
+ confluent_kafka/schema_registry/protobuf.py,sha256=E405X4Pb2k6n3dbFgkunCzDzvHeXkEpKHWHY6F0AGZA,744
153
+ confluent_kafka/schema_registry/rule_registry.py,sha256=V9R9uetSyMDOWcvXwPLo7HXts2bEbOImLZ_yVA1iSAM,2820
154
+ confluent_kafka/schema_registry/rules/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
155
+ confluent_kafka/schema_registry/rules/__pycache__/__init__.cpython-313.pyc,,
156
+ confluent_kafka/schema_registry/rules/cel/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
157
+ confluent_kafka/schema_registry/rules/cel/__pycache__/__init__.cpython-313.pyc,,
158
+ confluent_kafka/schema_registry/rules/cel/__pycache__/cel_executor.cpython-313.pyc,,
159
+ confluent_kafka/schema_registry/rules/cel/__pycache__/cel_field_executor.cpython-313.pyc,,
160
+ confluent_kafka/schema_registry/rules/cel/__pycache__/cel_field_presence.cpython-313.pyc,,
161
+ confluent_kafka/schema_registry/rules/cel/__pycache__/constraints.cpython-313.pyc,,
162
+ confluent_kafka/schema_registry/rules/cel/__pycache__/extra_func.cpython-313.pyc,,
163
+ confluent_kafka/schema_registry/rules/cel/__pycache__/string_format.cpython-313.pyc,,
164
+ confluent_kafka/schema_registry/rules/cel/cel_executor.py,sha256=7H_xmVIzxL67CNZC1txVmwEwJe42aPdy6gACTEh3R7E,6123
165
+ confluent_kafka/schema_registry/rules/cel/cel_field_executor.py,sha256=lRcUEXdg7FZvpyE5ZsRTyMUKesUD8vK9GWoat9hXuIA,1942
166
+ confluent_kafka/schema_registry/rules/cel/cel_field_presence.py,sha256=QB7FbW56zDCl6VgWJ8s858QjDfInTGRcXw4A2FGH-X4,1574
167
+ confluent_kafka/schema_registry/rules/cel/constraints.py,sha256=BFE345Wdwzwg5ZRm67ppwcEKFJYwgGrWWNUb7t8E7ZM,8364
168
+ confluent_kafka/schema_registry/rules/cel/extra_func.py,sha256=N9zkNTnkm9Luw6RxRfvrkVyQcRgShjFOgEB5B_HHWq8,5932
169
+ confluent_kafka/schema_registry/rules/cel/string_format.py,sha256=hpLjgUySxPbBr-uAg544waVgvJkTSh9yFGTpgQBoxEk,7784
170
+ confluent_kafka/schema_registry/rules/encryption/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
171
+ confluent_kafka/schema_registry/rules/encryption/__pycache__/__init__.cpython-313.pyc,,
172
+ confluent_kafka/schema_registry/rules/encryption/__pycache__/encrypt_executor.cpython-313.pyc,,
173
+ confluent_kafka/schema_registry/rules/encryption/__pycache__/kms_driver_registry.cpython-313.pyc,,
174
+ confluent_kafka/schema_registry/rules/encryption/awskms/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
175
+ confluent_kafka/schema_registry/rules/encryption/awskms/__pycache__/__init__.cpython-313.pyc,,
176
+ confluent_kafka/schema_registry/rules/encryption/awskms/__pycache__/aws_driver.cpython-313.pyc,,
177
+ confluent_kafka/schema_registry/rules/encryption/awskms/aws_driver.py,sha256=QW8fp4kK0bu2gex9ooEDBE6zM4-wXYEjEPxXzujPbCM,4060
178
+ confluent_kafka/schema_registry/rules/encryption/azurekms/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
179
+ confluent_kafka/schema_registry/rules/encryption/azurekms/__pycache__/__init__.cpython-313.pyc,,
180
+ confluent_kafka/schema_registry/rules/encryption/azurekms/__pycache__/azure_aead.cpython-313.pyc,,
181
+ confluent_kafka/schema_registry/rules/encryption/azurekms/__pycache__/azure_client.cpython-313.pyc,,
182
+ confluent_kafka/schema_registry/rules/encryption/azurekms/__pycache__/azure_driver.cpython-313.pyc,,
183
+ confluent_kafka/schema_registry/rules/encryption/azurekms/azure_aead.py,sha256=sFGA0XjGhllmJoMPmmQUtXbSRjwiwIzPs3L-g6sXq_w,1588
184
+ confluent_kafka/schema_registry/rules/encryption/azurekms/azure_client.py,sha256=tj1J-oofnF8a2ATuFyOglDLJhuc0JPSOE5bF_m2xdSk,2764
185
+ confluent_kafka/schema_registry/rules/encryption/azurekms/azure_driver.py,sha256=iUmvG9Z6JckhA9UvbHbkPiRybbrmJUE2Rr1R5l4zoQM,1938
186
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
187
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/__pycache__/__init__.cpython-313.pyc,,
188
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/__pycache__/dek_registry_client.cpython-313.pyc,,
189
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/__pycache__/mock_dek_registry_client.cpython-313.pyc,,
190
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/dek_registry_client.py,sha256=NXytF3g_Yoro6SK5YWf6v_a1dK2VyAixVxjFTUJDKvk,19830
191
+ confluent_kafka/schema_registry/rules/encryption/dek_registry/mock_dek_registry_client.py,sha256=vX8x8c_o1QrKjYtRtxknTmxXUuD7ql-taMY_749l1CU,3897
192
+ confluent_kafka/schema_registry/rules/encryption/encrypt_executor.py,sha256=RODGiunL0xKyYQd2L68nOULpas9kprpTUX9JF0kSSnI,22981
193
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
194
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/__pycache__/__init__.cpython-313.pyc,,
195
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/__pycache__/gcp_client.cpython-313.pyc,,
196
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/__pycache__/gcp_driver.cpython-313.pyc,,
197
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/gcp_client.py,sha256=J3bOFUiHKALMZKsRb79bifvHH5Y2CkKzQtWVUUhFwLM,2986
198
+ confluent_kafka/schema_registry/rules/encryption/gcpkms/gcp_driver.py,sha256=AkSYUveQdRa595c5J9fwkGqXqWK9hFgPXTP6jk2ErpU,3171
199
+ confluent_kafka/schema_registry/rules/encryption/hcvault/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
200
+ confluent_kafka/schema_registry/rules/encryption/hcvault/__pycache__/__init__.cpython-313.pyc,,
201
+ confluent_kafka/schema_registry/rules/encryption/hcvault/__pycache__/hcvault_client.cpython-313.pyc,,
202
+ confluent_kafka/schema_registry/rules/encryption/hcvault/__pycache__/hcvault_driver.cpython-313.pyc,,
203
+ confluent_kafka/schema_registry/rules/encryption/hcvault/hcvault_client.py,sha256=sY-hleU71xwXUciiSLrUyB5d4iSji7YEBI0Nf82FOLU,3135
204
+ confluent_kafka/schema_registry/rules/encryption/hcvault/hcvault_driver.py,sha256=dImKoKpy_3A68YlNfeyDlYZCW7-hID53CtuJ8f3k1V0,2026
205
+ confluent_kafka/schema_registry/rules/encryption/kms_driver_registry.py,sha256=u6ajQ3c-tdnbHj9g12OIeXGVzgdHAvoN8AKny-OZPGI,1679
206
+ confluent_kafka/schema_registry/rules/encryption/localkms/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
207
+ confluent_kafka/schema_registry/rules/encryption/localkms/__pycache__/__init__.cpython-313.pyc,,
208
+ confluent_kafka/schema_registry/rules/encryption/localkms/__pycache__/local_client.cpython-313.pyc,,
209
+ confluent_kafka/schema_registry/rules/encryption/localkms/__pycache__/local_driver.cpython-313.pyc,,
210
+ confluent_kafka/schema_registry/rules/encryption/localkms/local_client.py,sha256=XFCR1HOBjFfFQApagN7fhZCvQYbzCIhmAHuDYn74p78,1888
211
+ confluent_kafka/schema_registry/rules/encryption/localkms/local_driver.py,sha256=FhNFZEf8lw8AeOjdCG-vy4JYaTtuk68kuoBM84D5hFQ,1478
212
+ confluent_kafka/schema_registry/rules/jsonata/__init__.py,sha256=ccnDsKUqzHNXuataT6pGXlsyOajlvL7q-rb31eZp98w,574
213
+ confluent_kafka/schema_registry/rules/jsonata/__pycache__/__init__.cpython-313.pyc,,
214
+ confluent_kafka/schema_registry/rules/jsonata/__pycache__/jsonata_executor.cpython-313.pyc,,
215
+ confluent_kafka/schema_registry/rules/jsonata/jsonata_executor.py,sha256=VmMyQF8qaNBvkoBnNXxGUP4Zg7fG2sgHDygAnsGEgcc,1830
216
+ confluent_kafka/schema_registry/schema_registry_client.py,sha256=k9a74xEor8_heh_pPgd4-yVGj6S66QB_zr6sQ9afMok,829
217
+ confluent_kafka/schema_registry/serde.py,sha256=qFbqegUxoxWmLlOVksPKDtqzXtns11qsQumI00Y7m7E,732
218
+ confluent_kafka/schema_registry/wildcard_matcher.py,sha256=9g-hyA--MKcE9_GqEIiliC-5RE44Bie7avOfDpNlqSg,2878
219
+ confluent_kafka/serialization/__init__.py,sha256=gdt1e5VYexR5x0ZZK1QMkhkE4gHtmY4KoLO_LSDQ9Yc,12111
220
+ confluent_kafka/serialization/__pycache__/__init__.cpython-313.pyc,,
221
+ confluent_kafka/serializing_producer.py,sha256=53C8b0Xa3mGaIY1ZGmyYd7f0dyz-wn74Ak64DOrFBuE,7104
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/REQUESTED ADDED
File without changes
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-manylinux_2_28_x86_64
5
+
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,687 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ##############################################################################
2
+ # The source distribution of confluent-kafka-python is covered by the #
3
+ # Apache 2.0 license. #
4
+ ##############################################################################
5
+
6
+ Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ APPENDIX: How to apply the Apache License to your work.
184
+
185
+ To apply the Apache License to your work, attach the following
186
+ boilerplate notice, with the fields enclosed by brackets "{}"
187
+ replaced with your own identifying information. (Don't include
188
+ the brackets!) The text should be enclosed in the appropriate
189
+ comment syntax for the file format. We also recommend that a
190
+ file or class name and description of purpose be included on the
191
+ same "printed page" as the copyright notice for easier
192
+ identification within third-party archives.
193
+
194
+ Copyright {yyyy} {name of copyright owner}
195
+
196
+ Licensed under the Apache License, Version 2.0 (the "License");
197
+ you may not use this file except in compliance with the License.
198
+ You may obtain a copy of the License at
199
+
200
+ http://www.apache.org/licenses/LICENSE-2.0
201
+
202
+ Unless required by applicable law or agreed to in writing, software
203
+ distributed under the License is distributed on an "AS IS" BASIS,
204
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
205
+ See the License for the specific language governing permissions and
206
+ limitations under the License.
207
+
208
+
209
+
210
+
211
+ ##############################################################################
212
+ # The binary wheel distribution of confluent-kafka-python contains #
213
+ # additional software with the following licenses: #
214
+ ##############################################################################
215
+
216
+
217
+ ##############################################################################
218
+ # OpenSSL #
219
+ ##############################################################################
220
+
221
+ OpenSSL License
222
+ ---------------
223
+
224
+ /* ====================================================================
225
+ * Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved.
226
+ *
227
+ * Redistribution and use in source and binary forms, with or without
228
+ * modification, are permitted provided that the following conditions
229
+ * are met:
230
+ *
231
+ * 1. Redistributions of source code must retain the above copyright
232
+ * notice, this list of conditions and the following disclaimer.
233
+ *
234
+ * 2. Redistributions in binary form must reproduce the above copyright
235
+ * notice, this list of conditions and the following disclaimer in
236
+ * the documentation and/or other materials provided with the
237
+ * distribution.
238
+ *
239
+ * 3. All advertising materials mentioning features or use of this
240
+ * software must display the following acknowledgment:
241
+ * "This product includes software developed by the OpenSSL Project
242
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
243
+ *
244
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
245
+ * endorse or promote products derived from this software without
246
+ * prior written permission. For written permission, please contact
247
+ * openssl-core@openssl.org.
248
+ *
249
+ * 5. Products derived from this software may not be called "OpenSSL"
250
+ * nor may "OpenSSL" appear in their names without prior written
251
+ * permission of the OpenSSL Project.
252
+ *
253
+ * 6. Redistributions of any form whatsoever must retain the following
254
+ * acknowledgment:
255
+ * "This product includes software developed by the OpenSSL Project
256
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
257
+ *
258
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
259
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
260
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
261
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
262
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
263
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
264
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
265
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
266
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
267
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
268
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
269
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
270
+ * ====================================================================
271
+ *
272
+ * This product includes cryptographic software written by Eric Young
273
+ * (eay@cryptsoft.com). This product includes software written by Tim
274
+ * Hudson (tjh@cryptsoft.com).
275
+ *
276
+ */
277
+
278
+ Original SSLeay License
279
+ -----------------------
280
+
281
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
282
+ * All rights reserved.
283
+ *
284
+ * This package is an SSL implementation written
285
+ * by Eric Young (eay@cryptsoft.com).
286
+ * The implementation was written so as to conform with Netscapes SSL.
287
+ *
288
+ * This library is free for commercial and non-commercial use as long as
289
+ * the following conditions are aheared to. The following conditions
290
+ * apply to all code found in this distribution, be it the RC4, RSA,
291
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
292
+ * included with this distribution is covered by the same copyright terms
293
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
294
+ *
295
+ * Copyright remains Eric Young's, and as such any Copyright notices in
296
+ * the code are not to be removed.
297
+ * If this package is used in a product, Eric Young should be given attribution
298
+ * as the author of the parts of the library used.
299
+ * This can be in the form of a textual message at program startup or
300
+ * in documentation (online or textual) provided with the package.
301
+ *
302
+ * Redistribution and use in source and binary forms, with or without
303
+ * modification, are permitted provided that the following conditions
304
+ * are met:
305
+ * 1. Redistributions of source code must retain the copyright
306
+ * notice, this list of conditions and the following disclaimer.
307
+ * 2. Redistributions in binary form must reproduce the above copyright
308
+ * notice, this list of conditions and the following disclaimer in the
309
+ * documentation and/or other materials provided with the distribution.
310
+ * 3. All advertising materials mentioning features or use of this software
311
+ * must display the following acknowledgement:
312
+ * "This product includes cryptographic software written by
313
+ * Eric Young (eay@cryptsoft.com)"
314
+ * The word 'cryptographic' can be left out if the rouines from the library
315
+ * being used are not cryptographic related :-).
316
+ * 4. If you include any Windows specific code (or a derivative thereof) from
317
+ * the apps directory (application code) you must include an acknowledgement:
318
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
319
+ *
320
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
321
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
322
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
323
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
324
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
325
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
326
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
327
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
328
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
329
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
330
+ * SUCH DAMAGE.
331
+ *
332
+ * The licence and distribution terms for any publically available version or
333
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
334
+ * copied and put under another distribution licence
335
+ * [including the GNU Public Licence.]
336
+ */
337
+
338
+
339
+ ##############################################################################
340
+ # zlib #
341
+ ##############################################################################
342
+
343
+ Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
344
+
345
+ This software is provided 'as-is', without any express or implied
346
+ warranty. In no event will the authors be held liable for any damages
347
+ arising from the use of this software.
348
+
349
+ Permission is granted to anyone to use this software for any purpose,
350
+ including commercial applications, and to alter it and redistribute it
351
+ freely, subject to the following restrictions:
352
+
353
+ 1. The origin of this software must not be misrepresented; you must not
354
+ claim that you wrote the original software. If you use this software
355
+ in a product, an acknowledgment in the product documentation would be
356
+ appreciated but is not required.
357
+ 2. Altered source versions must be plainly marked as such, and must not be
358
+ misrepresented as being the original software.
359
+ 3. This notice may not be removed or altered from any source distribution.
360
+
361
+ Jean-loup Gailly Mark Adler
362
+ jloup@gzip.org madler@alumni.caltech.edu
363
+
364
+
365
+
366
+
367
+ ##############################################################################
368
+ # librdkafka licenses #
369
+ ##############################################################################
370
+
371
+ LICENSE
372
+ --------------------------------------------------------------
373
+ librdkafka - Apache Kafka C driver library
374
+
375
+ Copyright (c) 2012, Magnus Edenhill
376
+ All rights reserved.
377
+
378
+ Redistribution and use in source and binary forms, with or without
379
+ modification, are permitted provided that the following conditions are met:
380
+
381
+ 1. Redistributions of source code must retain the above copyright notice,
382
+ this list of conditions and the following disclaimer.
383
+ 2. Redistributions in binary form must reproduce the above copyright notice,
384
+ this list of conditions and the following disclaimer in the documentation
385
+ and/or other materials provided with the distribution.
386
+
387
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
388
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
389
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
390
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
391
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
392
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
393
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
394
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
395
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
396
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
397
+ POSSIBILITY OF SUCH DAMAGE.
398
+
399
+
400
+ LICENSE.crc32c
401
+ --------------------------------------------------------------
402
+ # For src/crc32c.c copied (with modifications) from
403
+ # http://stackoverflow.com/a/17646775/1821055
404
+
405
+ /* crc32c.c -- compute CRC-32C using the Intel crc32 instruction
406
+ * Copyright (C) 2013 Mark Adler
407
+ * Version 1.1 1 Aug 2013 Mark Adler
408
+ */
409
+
410
+ /*
411
+ This software is provided 'as-is', without any express or implied
412
+ warranty. In no event will the author be held liable for any damages
413
+ arising from the use of this software.
414
+
415
+ Permission is granted to anyone to use this software for any purpose,
416
+ including commercial applications, and to alter it and redistribute it
417
+ freely, subject to the following restrictions:
418
+
419
+ 1. The origin of this software must not be misrepresented; you must not
420
+ claim that you wrote the original software. If you use this software
421
+ in a product, an acknowledgment in the product documentation would be
422
+ appreciated but is not required.
423
+ 2. Altered source versions must be plainly marked as such, and must not be
424
+ misrepresented as being the original software.
425
+ 3. This notice may not be removed or altered from any source distribution.
426
+
427
+ Mark Adler
428
+ madler@alumni.caltech.edu
429
+ */
430
+
431
+
432
+ LICENSE.lz4
433
+ --------------------------------------------------------------
434
+ src/xxhash.[ch] src/lz4*.[ch]: git@github.com:lz4/lz4.git e2827775ee80d2ef985858727575df31fc60f1f3
435
+
436
+ LZ4 Library
437
+ Copyright (c) 2011-2016, Yann Collet
438
+ All rights reserved.
439
+
440
+ Redistribution and use in source and binary forms, with or without modification,
441
+ are permitted provided that the following conditions are met:
442
+
443
+ * Redistributions of source code must retain the above copyright notice, this
444
+ list of conditions and the following disclaimer.
445
+
446
+ * Redistributions in binary form must reproduce the above copyright notice, this
447
+ list of conditions and the following disclaimer in the documentation and/or
448
+ other materials provided with the distribution.
449
+
450
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
451
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
452
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
453
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
454
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
455
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
456
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
457
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
458
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
459
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
460
+
461
+
462
+ LICENSE.pycrc
463
+ --------------------------------------------------------------
464
+ The following license applies to the files rdcrc32.c and rdcrc32.h which
465
+ have been generated by the pycrc tool.
466
+ ============================================================================
467
+
468
+ Copyright (c) 2006-2012, Thomas Pircher <tehpeh@gmx.net>
469
+
470
+ Permission is hereby granted, free of charge, to any person obtaining a copy
471
+ of this software and associated documentation files (the "Software"), to deal
472
+ in the Software without restriction, including without limitation the rights
473
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
474
+ copies of the Software, and to permit persons to whom the Software is
475
+ furnished to do so, subject to the following conditions:
476
+
477
+ The above copyright notice and this permission notice shall be included in
478
+ all copies or substantial portions of the Software.
479
+
480
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
481
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
482
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
483
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
484
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
485
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
486
+ THE SOFTWARE.
487
+
488
+
489
+ LICENSE.queue
490
+ --------------------------------------------------------------
491
+ For sys/queue.h:
492
+
493
+ * Copyright (c) 1991, 1993
494
+ * The Regents of the University of California. All rights reserved.
495
+ *
496
+ * Redistribution and use in source and binary forms, with or without
497
+ * modification, are permitted provided that the following conditions
498
+ * are met:
499
+ * 1. Redistributions of source code must retain the above copyright
500
+ * notice, this list of conditions and the following disclaimer.
501
+ * 2. Redistributions in binary form must reproduce the above copyright
502
+ * notice, this list of conditions and the following disclaimer in the
503
+ * documentation and/or other materials provided with the distribution.
504
+ * 4. Neither the name of the University nor the names of its contributors
505
+ * may be used to endorse or promote products derived from this software
506
+ * without specific prior written permission.
507
+ *
508
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
509
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
510
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
511
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
512
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
513
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
514
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
515
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
516
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
517
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
518
+ * SUCH DAMAGE.
519
+ *
520
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
521
+ * $FreeBSD$
522
+
523
+ LICENSE.regexp
524
+ --------------------------------------------------------------
525
+ regexp.c and regexp.h from https://github.com/ccxvii/minilibs sha 875c33568b5a4aa4fb3dd0c52ea98f7f0e5ca684
526
+
527
+ "
528
+ These libraries are in the public domain (or the equivalent where that is not possible). You can do anything you want with them. You have no legal obligation to do anything else, although I appreciate attribution.
529
+ "
530
+
531
+
532
+ LICENSE.snappy
533
+ --------------------------------------------------------------
534
+ ######################################################################
535
+ # LICENSE.snappy covers files: snappy.c, snappy.h, snappy_compat.h #
536
+ # originally retrieved from http://github.com/andikleen/snappy-c #
537
+ # git revision 8015f2d28739b9a6076ebaa6c53fe27bc238d219 #
538
+ ######################################################################
539
+
540
+ The snappy-c code is under the same license as the original snappy source
541
+
542
+ Copyright 2011 Intel Corporation All Rights Reserved.
543
+
544
+ Redistribution and use in source and binary forms, with or without
545
+ modification, are permitted provided that the following conditions are
546
+ met:
547
+
548
+ * Redistributions of source code must retain the above copyright
549
+ notice, this list of conditions and the following disclaimer.
550
+ * Redistributions in binary form must reproduce the above
551
+ copyright notice, this list of conditions and the following disclaimer
552
+ in the documentation and/or other materials provided with the
553
+ distribution.
554
+ * Neither the name of Intel Corporation nor the names of its
555
+ contributors may be used to endorse or promote products derived from
556
+ this software without specific prior written permission.
557
+
558
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
559
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
560
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
561
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
562
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
563
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
564
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
565
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
566
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
567
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
568
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
569
+
570
+
571
+
572
+ LICENSE.tinycthread
573
+ --------------------------------------------------------------
574
+ From https://github.com/tinycthread/tinycthread/README.txt c57166cd510ffb5022dd5f127489b131b61441b9
575
+
576
+ License
577
+ -------
578
+
579
+ Copyright (c) 2012 Marcus Geelnard
580
+ 2013-2014 Evan Nemerson
581
+
582
+ This software is provided 'as-is', without any express or implied
583
+ warranty. In no event will the authors be held liable for any damages
584
+ arising from the use of this software.
585
+
586
+ Permission is granted to anyone to use this software for any purpose,
587
+ including commercial applications, and to alter it and redistribute it
588
+ freely, subject to the following restrictions:
589
+
590
+ 1. The origin of this software must not be misrepresented; you must not
591
+ claim that you wrote the original software. If you use this software
592
+ in a product, an acknowledgment in the product documentation would be
593
+ appreciated but is not required.
594
+
595
+ 2. Altered source versions must be plainly marked as such, and must not be
596
+ misrepresented as being the original software.
597
+
598
+ 3. This notice may not be removed or altered from any source
599
+ distribution.
600
+
601
+
602
+ LICENSE.wingetopt
603
+ --------------------------------------------------------------
604
+ For the files wingetopt.c wingetopt.h downloaded from https://github.com/alex85k/wingetopt
605
+
606
+ /*
607
+ * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
608
+ *
609
+ * Permission to use, copy, modify, and distribute this software for any
610
+ * purpose with or without fee is hereby granted, provided that the above
611
+ * copyright notice and this permission notice appear in all copies.
612
+ *
613
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
614
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
615
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
616
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
617
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
618
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
619
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
620
+ *
621
+ * Sponsored in part by the Defense Advanced Research Projects
622
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
623
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
624
+ */
625
+ /*-
626
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
627
+ * All rights reserved.
628
+ *
629
+ * This code is derived from software contributed to The NetBSD Foundation
630
+ * by Dieter Baron and Thomas Klausner.
631
+ *
632
+ * Redistribution and use in source and binary forms, with or without
633
+ * modification, are permitted provided that the following conditions
634
+ * are met:
635
+ * 1. Redistributions of source code must retain the above copyright
636
+ * notice, this list of conditions and the following disclaimer.
637
+ * 2. Redistributions in binary form must reproduce the above copyright
638
+ * notice, this list of conditions and the following disclaimer in the
639
+ * documentation and/or other materials provided with the distribution.
640
+ *
641
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
642
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
643
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
644
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
645
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
646
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
647
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
648
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
649
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
650
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
651
+ * POSSIBILITY OF SUCH DAMAGE.
652
+ */
653
+
654
+
655
+
656
+ LICENSE.unasync
657
+ --------------------------------------------------------------
658
+ For unasync code in setup.py, derived from
659
+ https://github.com/encode/httpcore/blob/ae46dfbd4330eefaa9cd6ab1560dec18a1d0bcb8/scripts/unasync.py
660
+
661
+ Copyright © 2020, [Encode OSS Ltd](https://www.encode.io/).
662
+ All rights reserved.
663
+
664
+ Redistribution and use in source and binary forms, with or without
665
+ modification, are permitted provided that the following conditions are met:
666
+
667
+ * Redistributions of source code must retain the above copyright notice, this
668
+ list of conditions and the following disclaimer.
669
+
670
+ * Redistributions in binary form must reproduce the above copyright notice,
671
+ this list of conditions and the following disclaimer in the documentation
672
+ and/or other materials provided with the distribution.
673
+
674
+ * Neither the name of the copyright holder nor the names of its
675
+ contributors may be used to endorse or promote products derived from
676
+ this software without specific prior written permission.
677
+
678
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
679
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
680
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
681
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
682
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
683
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
684
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
685
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
686
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
687
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
session_venv/lib/python3.13/site-packages/confluent_kafka-2.14.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ confluent_kafka
session_venv/lib/python3.13/site-packages/confluent_kafka.libs/librdkafka-a760591f.so.1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34496aecb1735f492ba3452df15c5585dfa7f0da2a5e9dda06dbe76dace1ecab
3
+ size 9221633
session_venv/lib/python3.13/site-packages/confluent_kafka/__init__.py ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2020 Confluent Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ import os
20
+
21
+ from ._model import Node # noqa: F401
22
+ from ._model import (
23
+ ConsumerGroupState,
24
+ ConsumerGroupTopicPartitions,
25
+ ConsumerGroupType,
26
+ ElectionType,
27
+ IsolationLevel,
28
+ TopicCollection,
29
+ TopicPartitionInfo,
30
+ )
31
+ from .cimpl import (
32
+ OFFSET_BEGINNING,
33
+ OFFSET_END,
34
+ OFFSET_INVALID,
35
+ OFFSET_STORED,
36
+ TIMESTAMP_CREATE_TIME,
37
+ TIMESTAMP_LOG_APPEND_TIME,
38
+ TIMESTAMP_NOT_AVAILABLE,
39
+ Consumer,
40
+ Message,
41
+ Producer,
42
+ TopicPartition,
43
+ Uuid,
44
+ consistent,
45
+ fnv1a,
46
+ libversion,
47
+ murmur2,
48
+ version,
49
+ )
50
+ from .deserializing_consumer import DeserializingConsumer
51
+ from .error import KafkaError, KafkaException
52
+ from .serializing_producer import SerializingProducer
53
+
54
+ __all__ = [
55
+ "admin",
56
+ "Consumer",
57
+ "aio",
58
+ "KafkaError",
59
+ "KafkaException",
60
+ "kafkatest",
61
+ "libversion",
62
+ "version",
63
+ "murmur2",
64
+ "consistent",
65
+ "fnv1a",
66
+ "Message",
67
+ "OFFSET_BEGINNING",
68
+ "OFFSET_END",
69
+ "OFFSET_INVALID",
70
+ "OFFSET_STORED",
71
+ "Producer",
72
+ "DeserializingConsumer",
73
+ "SerializingProducer",
74
+ "TIMESTAMP_CREATE_TIME",
75
+ "TIMESTAMP_LOG_APPEND_TIME",
76
+ "TIMESTAMP_NOT_AVAILABLE",
77
+ "TopicPartition",
78
+ "Node",
79
+ "ConsumerGroupTopicPartitions",
80
+ "ConsumerGroupState",
81
+ "ConsumerGroupType",
82
+ "Uuid",
83
+ "IsolationLevel",
84
+ "TopicCollection",
85
+ "TopicPartitionInfo",
86
+ "ElectionType",
87
+ ]
88
+
89
+
90
+ __version__ = version()
91
+
92
+
93
+ class ThrottleEvent(object):
94
+ """
95
+ ThrottleEvent contains details about a throttled request.
96
+ Set up a throttle callback by setting the ``throttle_cb`` configuration
97
+ property to a callable that takes a ThrottleEvent object as its only argument.
98
+ The callback will be triggered from poll(), consume() or flush() when a request
99
+ has been throttled by the broker.
100
+
101
+ This class is typically not user instantiated.
102
+
103
+ :ivar str broker_name: The hostname of the broker which throttled the request
104
+ :ivar int broker_id: The broker id
105
+ :ivar float throttle_time: The amount of time (in seconds) the broker throttled (delayed) the request
106
+ """
107
+
108
+ def __init__(self, broker_name: str, broker_id: int, throttle_time: float) -> None:
109
+ self.broker_name = broker_name
110
+ self.broker_id = broker_id
111
+ self.throttle_time = throttle_time
112
+
113
+ def __str__(self) -> str:
114
+ return "{}/{} throttled for {} ms".format(self.broker_name, self.broker_id, int(self.throttle_time * 1000))
115
+
116
+
117
+ def _resolve_plugins(plugins: str) -> str:
118
+ """Resolve embedded plugins from the wheel's library directory.
119
+
120
+ For internal module use only.
121
+
122
+ :param str plugins: The plugin.library.paths value
123
+ """
124
+ from sys import platform
125
+
126
+ # Location of __init__.py and the embedded library directory
127
+ basedir = os.path.dirname(__file__)
128
+
129
+ if platform in ("win32", "cygwin"):
130
+ paths_sep = ";"
131
+ ext = ".dll"
132
+ libdir = basedir
133
+ elif platform in ("linux", "linux2"):
134
+ paths_sep = ":"
135
+ ext = ".so"
136
+ libdir = os.path.join(basedir, ".libs")
137
+ elif platform == "darwin":
138
+ paths_sep = ":"
139
+ ext = ".dylib"
140
+ libdir = os.path.join(basedir, ".dylibs")
141
+ else:
142
+ # Unknown platform, there are probably no embedded plugins.
143
+ return plugins
144
+
145
+ if not os.path.isdir(libdir):
146
+ # No embedded library directory, probably not a wheel installation.
147
+ return plugins
148
+
149
+ resolved = []
150
+ for plugin in plugins.split(paths_sep):
151
+ if "/" in plugin or "\\" in plugin:
152
+ # Path specified, leave unchanged
153
+ resolved.append(plugin)
154
+ continue
155
+
156
+ # See if the plugin can be found in the wheel's
157
+ # embedded library directory.
158
+ # The user might not have supplied a file extension, so try both.
159
+ good = None
160
+ for file in [plugin, plugin + ext]:
161
+ fpath = os.path.join(libdir, file)
162
+ if os.path.isfile(fpath):
163
+ good = fpath
164
+ break
165
+
166
+ if good is not None:
167
+ resolved.append(good)
168
+ else:
169
+ resolved.append(plugin)
170
+
171
+ return paths_sep.join(resolved)
session_venv/lib/python3.13/site-packages/confluent_kafka/_model/__init__.py ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Confluent Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from enum import Enum
16
+ from typing import List, Optional
17
+
18
+ from .. import cimpl
19
+ from ..cimpl import TopicPartition
20
+
21
+
22
+ class Node:
23
+ """
24
+ Represents node information.
25
+ Used by :class:`ConsumerGroupDescription`
26
+
27
+ Parameters
28
+ ----------
29
+ id: int
30
+ The node id of this node.
31
+ id_string:
32
+ String representation of the node id.
33
+ host:
34
+ The host name for this node.
35
+ port: int
36
+ The port for this node.
37
+ rack: str
38
+ The rack for this node.
39
+ """
40
+
41
+ def __init__(self, id: int, host: str, port: int, rack: Optional[str] = None) -> None:
42
+ self.id = id
43
+ self.id_string = str(id)
44
+ self.host = host
45
+ self.port = port
46
+ self.rack = rack
47
+
48
+ def __str__(self) -> str:
49
+ return f"({self.id}) {self.host}:{self.port} {f'(Rack - {self.rack})' if self.rack else ''}"
50
+
51
+
52
+ class ConsumerGroupTopicPartitions:
53
+ """
54
+ Represents consumer group and its topic partition information.
55
+ Used by :meth:`AdminClient.list_consumer_group_offsets` and
56
+ :meth:`AdminClient.alter_consumer_group_offsets`.
57
+
58
+ Parameters
59
+ ----------
60
+ group_id: str
61
+ Id of the consumer group.
62
+ topic_partitions: list(TopicPartition)
63
+ List of topic partitions information.
64
+ """
65
+
66
+ def __init__(self, group_id: str, topic_partitions: Optional[List[TopicPartition]] = None) -> None:
67
+ self.group_id = group_id
68
+ self.topic_partitions = topic_partitions
69
+
70
+
71
+ class ConsumerGroupState(Enum):
72
+ """
73
+ Enumerates the different types of Consumer Group State.
74
+
75
+ Note that the state :py:attr:`UNKOWN` (typo one) is deprecated and will be removed in
76
+ future major release. Use :py:attr:`UNKNOWN` instead.
77
+ """
78
+
79
+ #: State is not known or not set
80
+ UNKNOWN = cimpl.CONSUMER_GROUP_STATE_UNKNOWN
81
+ #: .. deprecated:: 2.3.0
82
+ #:
83
+ #: Use :py:attr:`UNKNOWN` instead.
84
+ UNKOWN = UNKNOWN
85
+ #: Preparing rebalance for the consumer group.
86
+ PREPARING_REBALANCING = cimpl.CONSUMER_GROUP_STATE_PREPARING_REBALANCE
87
+ #: Consumer Group is completing rebalancing.
88
+ COMPLETING_REBALANCING = cimpl.CONSUMER_GROUP_STATE_COMPLETING_REBALANCE
89
+ #: Consumer Group is stable.
90
+ STABLE = cimpl.CONSUMER_GROUP_STATE_STABLE
91
+ #: Consumer Group is dead.
92
+ DEAD = cimpl.CONSUMER_GROUP_STATE_DEAD
93
+ #: Consumer Group is empty.
94
+ EMPTY = cimpl.CONSUMER_GROUP_STATE_EMPTY
95
+
96
+ def __lt__(self, other: object) -> bool:
97
+ if not isinstance(other, ConsumerGroupState):
98
+ return NotImplemented
99
+ return self.value < other.value
100
+
101
+
102
+ class ConsumerGroupType(Enum):
103
+ """
104
+ Enumerates the different types of Consumer Group Type.
105
+
106
+ Values:
107
+ -------
108
+ """
109
+
110
+ #: Type is not known or not set
111
+ UNKNOWN = cimpl.CONSUMER_GROUP_TYPE_UNKNOWN
112
+ #: Consumer Type
113
+ CONSUMER = cimpl.CONSUMER_GROUP_TYPE_CONSUMER
114
+ #: Classic Type
115
+ CLASSIC = cimpl.CONSUMER_GROUP_TYPE_CLASSIC
116
+
117
+ def __lt__(self, other: object) -> bool:
118
+ if not isinstance(other, ConsumerGroupType):
119
+ return NotImplemented
120
+ return self.value < other.value
121
+
122
+
123
+ class TopicCollection:
124
+ """
125
+ Represents collection of topics in the form of different identifiers
126
+ for the topic.
127
+
128
+ Parameters
129
+ ----------
130
+ topic_names: list(str)
131
+ List of topic names.
132
+ """
133
+
134
+ def __init__(self, topic_names: List[str]) -> None:
135
+ self.topic_names = topic_names
136
+
137
+
138
+ class TopicPartitionInfo:
139
+ """
140
+ Represents partition information.
141
+ Used by :class:`TopicDescription`.
142
+
143
+ Parameters
144
+ ----------
145
+ id : int
146
+ Id of the partition.
147
+ leader : Node
148
+ Leader broker for the partition.
149
+ replicas: list(Node)
150
+ Replica brokers for the partition.
151
+ isr: list(Node)
152
+ In-Sync-Replica brokers for the partition.
153
+ """
154
+
155
+ def __init__(self, id: int, leader: Node, replicas: List[Node], isr: List[Node]) -> None:
156
+ self.id = id
157
+ self.leader = leader
158
+ self.replicas = replicas
159
+ self.isr = isr
160
+
161
+
162
+ class IsolationLevel(Enum):
163
+ """
164
+ Enum for Kafka isolation levels.
165
+
166
+ Values:
167
+ -------
168
+ """
169
+
170
+ READ_UNCOMMITTED = cimpl.ISOLATION_LEVEL_READ_UNCOMMITTED #: Receive all the offsets.
171
+ READ_COMMITTED = cimpl.ISOLATION_LEVEL_READ_COMMITTED #: Skip offsets belonging to an aborted transaction.
172
+
173
+ def __lt__(self, other: object) -> bool:
174
+ if not isinstance(other, IsolationLevel):
175
+ return NotImplemented
176
+ return self.value < other.value
177
+
178
+
179
+ class ElectionType(Enum):
180
+ """
181
+ Enumerates the different types of leader elections.
182
+
183
+ Values:
184
+ -------
185
+ """
186
+
187
+ #: Preferred election
188
+ PREFERRED = cimpl.ELECTION_TYPE_PREFERRED
189
+ #: Unclean election
190
+ UNCLEAN = cimpl.ELECTION_TYPE_UNCLEAN
191
+
192
+ def __lt__(self, other: object) -> bool:
193
+ if not isinstance(other, ElectionType):
194
+ return NotImplemented
195
+ return self.value < other.value
session_venv/lib/python3.13/site-packages/confluent_kafka/_types.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # Copyright 2025 Confluent Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ """
20
+ Common type definitions for confluent_kafka package.
21
+
22
+ This module provides centralized type aliases to maintain DRY principle
23
+ and ensure consistency across the package.
24
+ """
25
+
26
+ from typing import Any, Callable, Dict, List, Optional, Tuple, Union
27
+
28
+ # Headers can be either dict format or list of tuples format
29
+ HeadersType = Union[Dict[str, Union[str, bytes, None]], List[Tuple[str, Union[str, bytes, None]]]]
30
+
31
+ # Serializer/Deserializer callback types (will need SerializationContext import where used)
32
+ Serializer = Callable[[Any, Any], bytes] # (obj, SerializationContext) -> bytes
33
+ Deserializer = Callable[[Optional[bytes], Any], Any] # (Optional[bytes], SerializationContext) -> obj
34
+
35
+ # Forward declarations for callback types that reference classes from cimpl
36
+ # These are defined here to avoid circular imports
37
+ DeliveryCallback = Callable[[Optional[Any], Any], None] # (KafkaError, Message) -> None
38
+ RebalanceCallback = Callable[[Any, List[Any]], None] # (Consumer, List[TopicPartition]) -> None
session_venv/lib/python3.13/site-packages/confluent_kafka/_util/__init__.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Confluent Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from .conversion_util import ConversionUtil # noqa: F401
16
+ from .validation_util import ValidationUtil # noqa: F401
session_venv/lib/python3.13/site-packages/confluent_kafka/_util/conversion_util.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Confluent Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from enum import Enum
16
+ from typing import Type, Union
17
+
18
+
19
+ class ConversionUtil:
20
+ @staticmethod
21
+ def convert_to_enum(val: Union[str, int, Enum], enum_clazz: Type[Enum]) -> Enum:
22
+ if type(enum_clazz) is not type(Enum):
23
+ raise TypeError("'enum_clazz' must be of type Enum")
24
+
25
+ if isinstance(val, str):
26
+ # Allow it to be specified as case-insensitive string, for convenience.
27
+ try:
28
+ val = enum_clazz[val.upper()]
29
+ except KeyError:
30
+ raise ValueError("Unknown value \"%s\": should be a %s" % (val, enum_clazz.__name__))
31
+
32
+ elif isinstance(val, int):
33
+ # The C-code passes restype as an int, convert to enum.
34
+ val = enum_clazz(val)
35
+
36
+ elif not isinstance(val, enum_clazz):
37
+ raise TypeError("Unknown value \"%s\": should be a %s" % (val, enum_clazz.__name__))
38
+
39
+ return val
session_venv/lib/python3.13/site-packages/confluent_kafka/_util/validation_util.py ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Confluent Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from typing import Any, List
16
+
17
+ from ..cimpl import KafkaError
18
+
19
+ try:
20
+ string_type = basestring # type: ignore[name-defined]
21
+ except NameError:
22
+ string_type = str
23
+
24
+
25
+ class ValidationUtil:
26
+ @staticmethod
27
+ def check_multiple_not_none(obj: Any, vars_to_check: List[str]) -> None:
28
+ for param in vars_to_check:
29
+ ValidationUtil.check_not_none(obj, param)
30
+
31
+ @staticmethod
32
+ def check_not_none(obj: Any, param: str) -> None:
33
+ if getattr(obj, param) is None:
34
+ raise ValueError("Expected %s to be not None" % (param,))
35
+
36
+ @staticmethod
37
+ def check_multiple_is_string(obj: Any, vars_to_check: List[str]) -> None:
38
+ for param in vars_to_check:
39
+ ValidationUtil.check_is_string(obj, param)
40
+
41
+ @staticmethod
42
+ def check_is_string(obj: Any, param: str) -> None:
43
+ param_value = getattr(obj, param)
44
+ if param_value is not None and not isinstance(param_value, string_type):
45
+ raise TypeError("Expected %s to be a string" % (param,))
46
+
47
+ @staticmethod
48
+ def check_kafka_errors(errors: List[KafkaError]) -> None:
49
+ if not isinstance(errors, list):
50
+ raise TypeError("errors should be None or a list")
51
+ for error in errors:
52
+ if not isinstance(error, KafkaError):
53
+ raise TypeError("Expected list of KafkaError")
54
+
55
+ @staticmethod
56
+ def check_kafka_error(error: KafkaError) -> None:
57
+ if not isinstance(error, KafkaError):
58
+ raise TypeError("Expected error to be a KafkaError")
session_venv/lib/python3.13/site-packages/confluent_kafka/admin/__init__.py ADDED
@@ -0,0 +1,1382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2022 Confluent Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """
16
+ Kafka admin client: create, view, alter, and delete topics and resources.
17
+
18
+ Note: Many imports in this file are marked with "# noqa: F401" because they are
19
+ intentionally unused within this module but are exported as part of the public API.
20
+ These imports allow users to access constants and classes directly from the admin
21
+ module (e.g., "from confluent_kafka.admin import CONFIG_SOURCE_DEFAULT_CONFIG").
22
+ """
23
+
24
+ import concurrent.futures
25
+ import warnings
26
+ from typing import Any, Dict, List, Optional, Set, Tuple, Union
27
+
28
+ from confluent_kafka import ConsumerGroupState as _ConsumerGroupState
29
+ from confluent_kafka import ConsumerGroupTopicPartitions as _ConsumerGroupTopicPartitions
30
+ from confluent_kafka import IsolationLevel as _IsolationLevel
31
+
32
+ from .._model import ConsumerGroupType as _ConsumerGroupType
33
+ from .._model import ElectionType as _ElectionType
34
+ from .._model import TopicCollection as _TopicCollection
35
+ from ..cimpl import KafkaException # noqa: F401
36
+ from ..cimpl import ( # noqa: F401
37
+ CONFIG_SOURCE_DEFAULT_CONFIG,
38
+ CONFIG_SOURCE_DYNAMIC_BROKER_CONFIG,
39
+ CONFIG_SOURCE_DYNAMIC_DEFAULT_BROKER_CONFIG,
40
+ CONFIG_SOURCE_DYNAMIC_TOPIC_CONFIG,
41
+ CONFIG_SOURCE_GROUP_CONFIG,
42
+ CONFIG_SOURCE_STATIC_BROKER_CONFIG,
43
+ CONFIG_SOURCE_UNKNOWN_CONFIG,
44
+ OFFSET_INVALID,
45
+ RESOURCE_ANY,
46
+ RESOURCE_BROKER,
47
+ RESOURCE_GROUP,
48
+ RESOURCE_TOPIC,
49
+ RESOURCE_TRANSACTIONAL_ID,
50
+ RESOURCE_UNKNOWN,
51
+ KafkaError,
52
+ NewPartitions,
53
+ NewTopic,
54
+ )
55
+ from ..cimpl import TopicPartition as _TopicPartition
56
+ from ..cimpl import ( # noqa: F401
57
+ _AdminClientImpl,
58
+ )
59
+ from ._acl import AclOperation # noqa: F401
60
+ from ._acl import AclBinding, AclBindingFilter, AclPermissionType # noqa: F401
61
+ from ._cluster import DescribeClusterResult # noqa: F401
62
+
63
+ # Unused imports are keeped to be accessible using this public module
64
+ from ._config import ConfigSource # noqa: F401
65
+ from ._config import AlterConfigOpType, ConfigEntry, ConfigResource # noqa: F401
66
+ from ._group import ConsumerGroupListing # noqa: F401
67
+ from ._group import ( # noqa: F401
68
+ ConsumerGroupDescription,
69
+ ListConsumerGroupsResult,
70
+ MemberAssignment,
71
+ MemberDescription,
72
+ )
73
+ from ._listoffsets import ListOffsetsResultInfo # noqa: F401
74
+ from ._listoffsets import OffsetSpec # noqa: F401
75
+ from ._metadata import BrokerMetadata # noqa: F401
76
+ from ._metadata import ClusterMetadata, GroupMember, GroupMetadata, PartitionMetadata, TopicMetadata # noqa: F401
77
+ from ._records import DeletedRecords # noqa: F401
78
+ from ._resource import ResourcePatternType # noqa: F401
79
+ from ._resource import ResourceType # noqa: F401
80
+ from ._scram import UserScramCredentialAlteration # noqa: F401
81
+ from ._scram import ( # noqa: F401
82
+ ScramCredentialInfo,
83
+ ScramMechanism,
84
+ UserScramCredentialDeletion,
85
+ UserScramCredentialsDescription,
86
+ UserScramCredentialUpsertion,
87
+ )
88
+ from ._topic import TopicDescription # noqa: F401
89
+
90
+ try:
91
+ string_type = basestring # type: ignore[name-defined]
92
+ except NameError:
93
+ string_type = str
94
+
95
+
96
+ class AdminClient(_AdminClientImpl):
97
+ """
98
+ AdminClient provides admin operations for Kafka brokers, topics, groups,
99
+ and other resource types supported by the broker.
100
+
101
+ The Admin API methods are asynchronous and return a dict of
102
+ concurrent.futures.Future objects keyed by the entity.
103
+ The entity is a topic name for create_topics(), delete_topics(), create_partitions(),
104
+ and a ConfigResource for alter_configs() and describe_configs().
105
+
106
+ All the futures for a single API call will currently finish/fail at
107
+ the same time (backed by the same protocol request), but this might
108
+ change in future versions of the client.
109
+
110
+ See examples/adminapi.py for example usage.
111
+
112
+ For more information see the `Java Admin API documentation
113
+ <https://docs.confluent.io/current/clients/javadocs/org/apache/kafka/clients/admin/package-frame.html>`_.
114
+
115
+ Requires broker version v0.11.0.0 or later.
116
+ """
117
+
118
+ def __init__(self, conf: Dict[str, Union[str, int, float, bool]], **kwargs: Any) -> None:
119
+ """
120
+ Create a new AdminClient using the provided configuration dictionary.
121
+
122
+ The AdminClient is a standard Kafka protocol client, supporting
123
+ the standard librdkafka configuration properties as specified at
124
+ https://github.com/confluentinc/librdkafka/blob/master/CONFIGURATION.md
125
+
126
+ :param dict conf: Configuration properties. At a minimum ``bootstrap.servers`` **should** be set\n"
127
+ :param Logger logger: Optional Logger instance to use as a custom log messages handler.
128
+ """
129
+ super(AdminClient, self).__init__(conf, **kwargs)
130
+
131
+ @staticmethod
132
+ def _make_topics_result(f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]) -> None:
133
+ """
134
+ Map per-topic results to per-topic futures in futmap.
135
+ The result value of each (successful) future is None.
136
+ """
137
+ try:
138
+ result = f.result()
139
+ for topic, error in result.items():
140
+ fut = futmap.get(topic, None)
141
+ if fut is None:
142
+ raise RuntimeError("Topic {} not found in future-map: {}".format(topic, futmap))
143
+
144
+ if error is not None:
145
+ # Topic-level exception
146
+ fut.set_exception(KafkaException(error))
147
+ else:
148
+ # Topic-level success
149
+ fut.set_result(None)
150
+ except Exception as e:
151
+ # Request-level exception, raise the same for all topics
152
+ for topic, fut in futmap.items():
153
+ fut.set_exception(e)
154
+
155
+ @staticmethod
156
+ def _make_resource_result(
157
+ f: concurrent.futures.Future, futmap: Dict[ConfigResource, concurrent.futures.Future]
158
+ ) -> None:
159
+ """
160
+ Map per-resource results to per-resource futures in futmap.
161
+ The result value of each (successful) future is a ConfigResource.
162
+ """
163
+ try:
164
+ result = f.result()
165
+ for resource, configs in result.items():
166
+ fut = futmap.get(resource, None)
167
+ if fut is None:
168
+ raise RuntimeError("Resource {} not found in future-map: {}".format(resource, futmap))
169
+ if resource.error is not None:
170
+ # Resource-level exception
171
+ fut.set_exception(KafkaException(resource.error))
172
+ else:
173
+ # Resource-level success
174
+ # configs will be a dict for describe_configs()
175
+ # and None for alter_configs()
176
+ fut.set_result(configs)
177
+ except Exception as e:
178
+ # Request-level exception, raise the same for all resources
179
+ for resource, fut in futmap.items():
180
+ fut.set_exception(e)
181
+
182
+ @staticmethod
183
+ def _make_list_consumer_groups_result(f: concurrent.futures.Future, futmap: Any) -> None:
184
+ pass
185
+
186
+ @staticmethod
187
+ def _make_consumer_groups_result(
188
+ f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]
189
+ ) -> None:
190
+ """
191
+ Map per-group results to per-group futures in futmap.
192
+ """
193
+ try:
194
+
195
+ results = f.result()
196
+ futmap_values = list(futmap.values())
197
+ len_results = len(results)
198
+ len_futures = len(futmap_values)
199
+ if len_results != len_futures:
200
+ raise RuntimeError(
201
+ "Results length {} is different from future-map length {}".format(len_results, len_futures)
202
+ )
203
+ for i, result in enumerate(results):
204
+ fut = futmap_values[i]
205
+ if isinstance(result, KafkaError):
206
+ fut.set_exception(KafkaException(result))
207
+ else:
208
+ fut.set_result(result)
209
+ except Exception as e:
210
+ # Request-level exception, raise the same for all groups
211
+ for _, fut in futmap.items():
212
+ fut.set_exception(e)
213
+
214
+ @staticmethod
215
+ def _make_consumer_group_offsets_result(
216
+ f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]
217
+ ) -> None:
218
+ """
219
+ Map per-group results to per-group futures in futmap.
220
+ The result value of each (successful) future is ConsumerGroupTopicPartitions.
221
+ """
222
+ try:
223
+
224
+ results = f.result()
225
+ futmap_values = list(futmap.values())
226
+ len_results = len(results)
227
+ len_futures = len(futmap_values)
228
+ if len_results != len_futures:
229
+ raise RuntimeError(
230
+ "Results length {} is different from future-map length {}".format(len_results, len_futures)
231
+ )
232
+ for i, result in enumerate(results):
233
+ fut = futmap_values[i]
234
+ if isinstance(result, KafkaError):
235
+ fut.set_exception(KafkaException(result))
236
+ else:
237
+ fut.set_result(result)
238
+ except Exception as e:
239
+ # Request-level exception, raise the same for all groups
240
+ for _, fut in futmap.items():
241
+ fut.set_exception(e)
242
+
243
+ @staticmethod
244
+ def _make_acls_result(f: concurrent.futures.Future, futmap: Dict[Any, concurrent.futures.Future]) -> None:
245
+ """
246
+ Map create ACL binding results to corresponding futures in futmap.
247
+ For create_acls the result value of each (successful) future is None.
248
+ For delete_acls the result value of each (successful) future is the list of deleted AclBindings.
249
+ """
250
+ try:
251
+ results = f.result()
252
+ futmap_values = list(futmap.values())
253
+ len_results = len(results)
254
+ len_futures = len(futmap_values)
255
+ if len_results != len_futures:
256
+ raise RuntimeError(
257
+ "Results length {} is different from future-map length {}".format(len_results, len_futures)
258
+ )
259
+ for i, result in enumerate(results):
260
+ fut = futmap_values[i]
261
+ if isinstance(result, KafkaError):
262
+ fut.set_exception(KafkaException(result))
263
+ else:
264
+ fut.set_result(result)
265
+ except Exception as e:
266
+ # Request-level exception, raise the same for all the AclBindings or AclBindingFilters
267
+ for resource, fut in futmap.items():
268
+ fut.set_exception(e)
269
+
270
+ @staticmethod
271
+ def _make_futmap_result_from_list(
272
+ f: concurrent.futures.Future, futmap: Dict[Any, concurrent.futures.Future]
273
+ ) -> None:
274
+ try:
275
+
276
+ results = f.result()
277
+ futmap_values = list(futmap.values())
278
+ len_results = len(results)
279
+ len_futures = len(futmap_values)
280
+ if len_results != len_futures:
281
+ raise RuntimeError(
282
+ "Results length {} is different from future-map length {}".format(len_results, len_futures)
283
+ )
284
+ for i, result in enumerate(results):
285
+ fut = futmap_values[i]
286
+ if isinstance(result, KafkaError):
287
+ fut.set_exception(KafkaException(result))
288
+ else:
289
+ fut.set_result(result)
290
+ except Exception as e:
291
+ # Request-level exception, raise the same for all topics
292
+ for _, fut in futmap.items():
293
+ fut.set_exception(e)
294
+
295
+ @staticmethod
296
+ def _make_futmap_result(f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]) -> None:
297
+ try:
298
+ results = f.result()
299
+ len_results = len(results)
300
+ len_futures = len(futmap)
301
+ if len(results) != len_futures:
302
+ raise RuntimeError(f"Results length {len_results} is different from future-map length {len_futures}")
303
+ for key, value in results.items():
304
+ fut = futmap.get(key, None)
305
+ if fut is None:
306
+ raise RuntimeError(f"Key {key} not found in future-map: {futmap}")
307
+ if isinstance(value, KafkaError):
308
+ fut.set_exception(KafkaException(value))
309
+ else:
310
+ fut.set_result(value)
311
+ except Exception as e:
312
+ for _, fut in futmap.items():
313
+ fut.set_exception(e)
314
+
315
+ @staticmethod
316
+ def _create_future() -> concurrent.futures.Future:
317
+ f: concurrent.futures.Future = concurrent.futures.Future()
318
+ if not f.set_running_or_notify_cancel():
319
+ raise RuntimeError("Future was cancelled prematurely")
320
+ return f
321
+
322
+ @staticmethod
323
+ def _make_futures(
324
+ futmap_keys: List[Any], class_check: Optional[type], make_result_fn: Any
325
+ ) -> Tuple[concurrent.futures.Future, Dict[Any, concurrent.futures.Future]]:
326
+ """
327
+ Create futures and a futuremap for the keys in futmap_keys,
328
+ and create a request-level future to be passed to the C API.
329
+
330
+ FIXME: use _make_futures_v2 with TypeError in next major release.
331
+ """
332
+ futmap = {}
333
+ for key in futmap_keys:
334
+ if class_check is not None and not isinstance(key, class_check):
335
+ raise ValueError("Expected list of {}".format(repr(class_check)))
336
+ futmap[key] = AdminClient._create_future()
337
+
338
+ # Create an internal future for the entire request,
339
+ # this future will trigger _make_..._result() and set result/exception
340
+ # per topic,future in futmap.
341
+ f = AdminClient._create_future()
342
+ f.add_done_callback(lambda f: make_result_fn(f, futmap))
343
+
344
+ return f, futmap
345
+
346
+ @staticmethod
347
+ def _make_futures_v2(
348
+ futmap_keys: Union[List[Any], Set[Any]], class_check: Optional[type], make_result_fn: Any
349
+ ) -> Tuple[concurrent.futures.Future, Dict[Any, concurrent.futures.Future]]:
350
+ """
351
+ Create futures and a futuremap for the keys in futmap_keys,
352
+ and create a request-level future to be passed to the C API.
353
+ """
354
+ futmap = {}
355
+ for key in futmap_keys:
356
+ if class_check is not None and not isinstance(key, class_check):
357
+ raise TypeError("Expected list of {}".format(repr(class_check)))
358
+ futmap[key] = AdminClient._create_future()
359
+
360
+ # Create an internal future for the entire request,
361
+ # this future will trigger _make_..._result() and set result/exception
362
+ # per topic,future in futmap.
363
+ f = AdminClient._create_future()
364
+ f.add_done_callback(lambda f: make_result_fn(f, futmap))
365
+
366
+ return f, futmap
367
+
368
+ @staticmethod
369
+ def _make_single_future_pair() -> Tuple[concurrent.futures.Future, concurrent.futures.Future]:
370
+ """
371
+ Create an pair of futures, one for internal usage and one
372
+ to use externally, the external one throws a KafkaException if
373
+ any of the values in the map returned by the first future is
374
+ a KafkaError.
375
+ """
376
+
377
+ def single_future_result(internal_f: concurrent.futures.Future, f: concurrent.futures.Future) -> None:
378
+ try:
379
+ results = internal_f.result()
380
+ for _, value in results.items():
381
+ if isinstance(value, KafkaError):
382
+ f.set_exception(KafkaException(value))
383
+ return
384
+ f.set_result(results)
385
+ except Exception as e:
386
+ f.set_exception(e)
387
+
388
+ f = AdminClient._create_future()
389
+ internal_f = AdminClient._create_future()
390
+ internal_f.add_done_callback(lambda internal_f: single_future_result(internal_f, f))
391
+ return internal_f, f
392
+
393
+ @staticmethod
394
+ def _has_duplicates(items: List[Any]) -> bool:
395
+ return len(set(items)) != len(items)
396
+
397
+ @staticmethod
398
+ def _check_list_consumer_group_offsets_request(request: Optional[List[_ConsumerGroupTopicPartitions]]) -> None:
399
+ if request is None:
400
+ raise TypeError("request cannot be None")
401
+ if not isinstance(request, list):
402
+ raise TypeError("request must be a list")
403
+ if len(request) != 1:
404
+ raise ValueError("Currently we support listing offsets for a single consumer group only")
405
+ for req in request:
406
+ if not isinstance(req, _ConsumerGroupTopicPartitions):
407
+ raise TypeError("Expected list of 'ConsumerGroupTopicPartitions'")
408
+
409
+ if req.group_id is None:
410
+ raise TypeError("'group_id' cannot be None")
411
+ if not isinstance(req.group_id, string_type):
412
+ raise TypeError("'group_id' must be a string")
413
+ if not req.group_id:
414
+ raise ValueError("'group_id' cannot be empty")
415
+
416
+ if req.topic_partitions is not None:
417
+ if not isinstance(req.topic_partitions, list):
418
+ raise TypeError("'topic_partitions' must be a list or None")
419
+ if len(req.topic_partitions) == 0:
420
+ raise ValueError("'topic_partitions' cannot be empty")
421
+ for topic_partition in req.topic_partitions:
422
+ if topic_partition is None:
423
+ raise ValueError("Element of 'topic_partitions' cannot be None")
424
+ if not isinstance(topic_partition, _TopicPartition):
425
+ raise TypeError("Element of 'topic_partitions' must be of type TopicPartition")
426
+ if topic_partition.topic is None:
427
+ raise TypeError("Element of 'topic_partitions' must not have 'topic' attribute as None")
428
+ if not topic_partition.topic:
429
+ raise ValueError("Element of 'topic_partitions' must not have 'topic' attribute as Empty")
430
+ if topic_partition.partition < 0:
431
+ raise ValueError("Element of 'topic_partitions' must not have negative 'partition' value")
432
+ if topic_partition.offset != OFFSET_INVALID:
433
+ raise ValueError("Element of 'topic_partitions' must not have 'offset' value")
434
+
435
+ @staticmethod
436
+ def _check_alter_consumer_group_offsets_request(request: Optional[List[_ConsumerGroupTopicPartitions]]) -> None:
437
+ if request is None:
438
+ raise TypeError("request cannot be None")
439
+ if not isinstance(request, list):
440
+ raise TypeError("request must be a list")
441
+ if len(request) != 1:
442
+ raise ValueError("Currently we support altering offsets for a single consumer group only")
443
+ for req in request:
444
+ if not isinstance(req, _ConsumerGroupTopicPartitions):
445
+ raise TypeError("Expected list of 'ConsumerGroupTopicPartitions'")
446
+ if req.group_id is None:
447
+ raise TypeError("'group_id' cannot be None")
448
+ if not isinstance(req.group_id, string_type):
449
+ raise TypeError("'group_id' must be a string")
450
+ if not req.group_id:
451
+ raise ValueError("'group_id' cannot be empty")
452
+ if req.topic_partitions is None:
453
+ raise ValueError("'topic_partitions' cannot be null")
454
+ if not isinstance(req.topic_partitions, list):
455
+ raise TypeError("'topic_partitions' must be a list")
456
+ if len(req.topic_partitions) == 0:
457
+ raise ValueError("'topic_partitions' cannot be empty")
458
+ for topic_partition in req.topic_partitions:
459
+ if topic_partition is None:
460
+ raise ValueError("Element of 'topic_partitions' cannot be None")
461
+ if not isinstance(topic_partition, _TopicPartition):
462
+ raise TypeError("Element of 'topic_partitions' must be of type TopicPartition")
463
+ if topic_partition.topic is None:
464
+ raise TypeError("Element of 'topic_partitions' must not have 'topic' attribute as None")
465
+ if not topic_partition.topic:
466
+ raise ValueError("Element of 'topic_partitions' must not have 'topic' attribute as Empty")
467
+ if topic_partition.partition < 0:
468
+ raise ValueError("Element of 'topic_partitions' must not have negative value for 'partition' field")
469
+ if topic_partition.offset < 0:
470
+ raise ValueError("Element of 'topic_partitions' must not have negative value for 'offset' field")
471
+
472
+ @staticmethod
473
+ def _check_describe_user_scram_credentials_request(users: Optional[List[str]]) -> None:
474
+ if users is None:
475
+ return
476
+ if not isinstance(users, list):
477
+ raise TypeError("Expected input to be list of String")
478
+ for user in users:
479
+ if user is None:
480
+ raise TypeError("'user' cannot be None")
481
+ if not isinstance(user, string_type):
482
+ raise TypeError("Each value should be a string")
483
+ if not user:
484
+ raise ValueError("'user' cannot be empty")
485
+
486
+ @staticmethod
487
+ def _check_alter_user_scram_credentials_request(alterations: List[UserScramCredentialAlteration]) -> None:
488
+ if not isinstance(alterations, list):
489
+ raise TypeError("Expected input to be list")
490
+ if len(alterations) == 0:
491
+ raise ValueError("Expected at least one alteration")
492
+ for alteration in alterations:
493
+ if not isinstance(alteration, UserScramCredentialAlteration):
494
+ raise TypeError("Expected each element of list to be subclass of UserScramCredentialAlteration")
495
+ if alteration.user is None:
496
+ raise TypeError("'user' cannot be None")
497
+ if not isinstance(alteration.user, string_type):
498
+ raise TypeError("'user' must be a string")
499
+ if not alteration.user:
500
+ raise ValueError("'user' cannot be empty")
501
+
502
+ if isinstance(alteration, UserScramCredentialUpsertion):
503
+ if alteration.password is None:
504
+ raise TypeError("'password' cannot be None")
505
+ if not isinstance(alteration.password, bytes):
506
+ raise TypeError("'password' must be bytes")
507
+ if not alteration.password:
508
+ raise ValueError("'password' cannot be empty")
509
+
510
+ if alteration.salt is not None and not alteration.salt:
511
+ raise ValueError("'salt' can be None but cannot be empty")
512
+ if alteration.salt and not isinstance(alteration.salt, bytes):
513
+ raise TypeError("'salt' must be bytes")
514
+
515
+ if not isinstance(alteration.scram_credential_info, ScramCredentialInfo):
516
+ raise TypeError("Expected credential_info to be ScramCredentialInfo Type")
517
+ if alteration.scram_credential_info.iterations < 1:
518
+ raise ValueError("Iterations should be positive")
519
+ if not isinstance(alteration.scram_credential_info.mechanism, ScramMechanism):
520
+ raise TypeError("Expected the mechanism to be ScramMechanism Type")
521
+ elif isinstance(alteration, UserScramCredentialDeletion):
522
+ if not isinstance(alteration.mechanism, ScramMechanism):
523
+ raise TypeError("Expected the mechanism to be ScramMechanism Type")
524
+ else:
525
+ raise TypeError(
526
+ "Expected each element of list 'alterations' "
527
+ + "to be either a UserScramCredentialUpsertion or a "
528
+ + "UserScramCredentialDeletion"
529
+ )
530
+
531
+ @staticmethod
532
+ def _check_list_offsets_request(
533
+ topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], kwargs: Dict[str, Any]
534
+ ) -> None:
535
+ if not isinstance(topic_partition_offsets, dict):
536
+ raise TypeError(
537
+ "Expected topic_partition_offsets to be "
538
+ + "dict of [TopicPartitions,OffsetSpec] for list offsets request"
539
+ )
540
+
541
+ for topic_partition, offset_spec in topic_partition_offsets.items():
542
+ if topic_partition is None:
543
+ raise TypeError("partition cannot be None")
544
+ if not isinstance(topic_partition, _TopicPartition):
545
+ raise TypeError("partition must be a TopicPartition")
546
+ if topic_partition.topic is None:
547
+ raise TypeError("partition topic name cannot be None")
548
+ if not isinstance(topic_partition.topic, string_type):
549
+ raise TypeError("partition topic name must be string")
550
+ if not topic_partition.topic:
551
+ raise ValueError("partition topic name cannot be empty")
552
+ if topic_partition.partition < 0:
553
+ raise ValueError("partition index must be non-negative")
554
+ if offset_spec is None:
555
+ raise TypeError("OffsetSpec cannot be None")
556
+ if not isinstance(offset_spec, OffsetSpec):
557
+ raise TypeError("Value must be a OffsetSpec")
558
+
559
+ if 'isolation_level' in kwargs:
560
+ if not isinstance(kwargs['isolation_level'], _IsolationLevel):
561
+ raise TypeError("isolation_level argument should be an IsolationLevel")
562
+
563
+ @staticmethod
564
+ def _check_delete_records(request: List[_TopicPartition]) -> None:
565
+ if not isinstance(request, list):
566
+ raise TypeError(f"Expected Request to be a list, got '{type(request).__name__}' ")
567
+ for req in request:
568
+ if not isinstance(req, _TopicPartition):
569
+ raise TypeError(
570
+ "Element of the request list must be of type 'TopicPartition'" + f" got '{type(req).__name__}' "
571
+ )
572
+ if req.partition < 0:
573
+ raise ValueError("'partition' cannot be negative")
574
+
575
+ @staticmethod
576
+ def _check_elect_leaders(election_type: _ElectionType, partitions: Optional[List[_TopicPartition]]) -> None:
577
+ if not isinstance(election_type, _ElectionType):
578
+ raise TypeError("Expected 'election_type' to be of type 'ElectionType'")
579
+ if partitions is not None:
580
+ if not isinstance(partitions, list):
581
+ raise TypeError("Expected 'partitions' to be a list, got " + f"'{type(partitions).__name__}'")
582
+ for partition in partitions:
583
+ if not isinstance(partition, _TopicPartition):
584
+ raise TypeError(
585
+ "Element of the 'partitions' list must be of type 'TopicPartition'"
586
+ + f" got '{type(partition).__name__}' "
587
+ )
588
+ if partition.partition < 0:
589
+ raise ValueError(
590
+ "Elements of the 'partitions' list must not have negative value" + " for 'partition' field"
591
+ )
592
+
593
+ def create_topics( # type: ignore[override]
594
+ self, new_topics: List[NewTopic], **kwargs: Any
595
+ ) -> Dict[str, concurrent.futures.Future]:
596
+ """
597
+ Create one or more new topics.
598
+
599
+ :param list(NewTopic) new_topics: A list of specifictions (NewTopic) for
600
+ the topics that should be created.
601
+ :param float operation_timeout: The operation timeout in seconds,
602
+ controlling how long the CreateTopics request will block
603
+ on the broker waiting for the topic creation to propagate
604
+ in the cluster. A value of 0 returns immediately.
605
+ Default: `socket.timeout.ms/1000.0`
606
+ :param float request_timeout: The overall request timeout in seconds,
607
+ including broker lookup, request transmission, operation time
608
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
609
+ :param bool validate_only: If true, the request is only validated
610
+ without creating the topic. Default: False
611
+
612
+ :returns: A dict of futures for each topic, keyed by the topic name.
613
+ The future result() method returns None.
614
+
615
+ :rtype: dict(<topic_name, future>)
616
+
617
+ :raises KafkaException: Operation failed locally or on broker.
618
+ :raises TypeException: Invalid input.
619
+ :raises ValueException: Invalid input.
620
+ """
621
+
622
+ f, futmap = AdminClient._make_futures([x.topic for x in new_topics], None, AdminClient._make_topics_result)
623
+
624
+ super(AdminClient, self).create_topics(new_topics, f, **kwargs)
625
+
626
+ return futmap
627
+
628
+ def delete_topics( # type: ignore[override]
629
+ self, topics: List[str], **kwargs: Any
630
+ ) -> Dict[str, concurrent.futures.Future]:
631
+ """
632
+ Delete one or more topics.
633
+
634
+ :param list(str) topics: A list of topics to mark for deletion.
635
+ :param float operation_timeout: The operation timeout in seconds,
636
+ controlling how long the DeleteTopics request will block
637
+ on the broker waiting for the topic deletion to propagate
638
+ in the cluster. A value of 0 returns immediately.
639
+ Default: `socket.timeout.ms/1000.0`
640
+ :param float request_timeout: The overall request timeout in seconds,
641
+ including broker lookup, request transmission, operation time
642
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
643
+
644
+ :returns: A dict of futures for each topic, keyed by the topic name.
645
+ The future result() method returns None.
646
+
647
+ :rtype: dict(<topic_name, future>)
648
+
649
+ :raises KafkaException: Operation failed locally or on broker.
650
+ :raises TypeException: Invalid input.
651
+ :raises ValueException: Invalid input.
652
+ """
653
+
654
+ f, futmap = AdminClient._make_futures(topics, None, AdminClient._make_topics_result)
655
+
656
+ super(AdminClient, self).delete_topics(topics, f, **kwargs)
657
+
658
+ return futmap
659
+
660
+ def list_topics(self, *args: Any, **kwargs: Any) -> ClusterMetadata:
661
+ return super(AdminClient, self).list_topics(*args, **kwargs)
662
+
663
+ def list_groups(self, *args: Any, **kwargs: Any) -> List[GroupMetadata]:
664
+ return super(AdminClient, self).list_groups(*args, **kwargs)
665
+
666
+ def create_partitions( # type: ignore[override]
667
+ self, new_partitions: List[NewPartitions], **kwargs: Any
668
+ ) -> Dict[str, concurrent.futures.Future]:
669
+ """
670
+ Create additional partitions for the given topics.
671
+
672
+ :param list(NewPartitions) new_partitions: New partitions to be created.
673
+ :param float operation_timeout: The operation timeout in seconds,
674
+ controlling how long the CreatePartitions request will block
675
+ on the broker waiting for the partition creation to propagate
676
+ in the cluster. A value of 0 returns immediately.
677
+ Default: `socket.timeout.ms/1000.0`
678
+ :param float request_timeout: The overall request timeout in seconds,
679
+ including broker lookup, request transmission, operation time
680
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
681
+ :param bool validate_only: If true, the request is only validated
682
+ without creating the partitions. Default: False
683
+
684
+ :returns: A dict of futures for each topic, keyed by the topic name.
685
+ The future result() method returns None.
686
+
687
+ :rtype: dict(<topic_name, future>)
688
+
689
+ :raises KafkaException: Operation failed locally or on broker.
690
+ :raises TypeException: Invalid input.
691
+ :raises ValueException: Invalid input.
692
+ """
693
+
694
+ f, futmap = AdminClient._make_futures([x.topic for x in new_partitions], None, AdminClient._make_topics_result)
695
+
696
+ super(AdminClient, self).create_partitions(new_partitions, f, **kwargs)
697
+
698
+ return futmap
699
+
700
+ def describe_configs( # type: ignore[override]
701
+ self, resources: List[ConfigResource], **kwargs: Any
702
+ ) -> Dict[ConfigResource, concurrent.futures.Future]:
703
+ """
704
+ Get the configuration of the specified resources.
705
+
706
+ :warning: Multiple resources and resource types may be requested,
707
+ but at most one resource of type RESOURCE_BROKER is allowed
708
+ per call since these resource requests must be sent to the
709
+ broker specified in the resource.
710
+
711
+ :param list(ConfigResource) resources: Resources to get the configuration for.
712
+ :param float request_timeout: The overall request timeout in seconds,
713
+ including broker lookup, request transmission, operation time
714
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
715
+
716
+ :returns: A dict of futures for each resource, keyed by the ConfigResource.
717
+ The type of the value returned by the future result() method is
718
+ dict(<configname, ConfigEntry>).
719
+
720
+ :rtype: dict(<ConfigResource, future>)
721
+
722
+ :raises KafkaException: Operation failed locally or on broker.
723
+ :raises TypeException: Invalid input.
724
+ :raises ValueException: Invalid input.
725
+ """
726
+
727
+ f, futmap = AdminClient._make_futures(resources, ConfigResource, AdminClient._make_resource_result)
728
+
729
+ super(AdminClient, self).describe_configs(resources, f, **kwargs)
730
+
731
+ return futmap
732
+
733
+ def alter_configs( # type: ignore[override]
734
+ self, resources: List[ConfigResource], **kwargs: Any
735
+ ) -> Dict[ConfigResource, concurrent.futures.Future]:
736
+ """
737
+ .. deprecated:: 2.2.0
738
+
739
+ Update configuration properties for the specified resources.
740
+ Updates are not transactional so they may succeed for a subset
741
+ of the provided resources while the others fail.
742
+ The configuration for a particular resource is updated atomically,
743
+ replacing the specified values while reverting unspecified configuration
744
+ entries to their default values.
745
+
746
+ :warning: alter_configs() will replace all existing configuration for
747
+ the provided resources with the new configuration given,
748
+ reverting all other configuration for the resource back
749
+ to their default values.
750
+
751
+ :warning: Multiple resources and resource types may be specified,
752
+ but at most one resource of type RESOURCE_BROKER is allowed
753
+ per call since these resource requests must be sent to the
754
+ broker specified in the resource.
755
+
756
+ :param list(ConfigResource) resources: Resources to update configuration of.
757
+ :param float request_timeout: The overall request timeout in seconds,
758
+ including broker lookup, request transmission, operation time
759
+ on broker, and response. Default: `socket.timeout.ms/1000.0`.
760
+ :param bool validate_only: If true, the request is validated only,
761
+ without altering the configuration. Default: False
762
+
763
+ :returns: A dict of futures for each resource, keyed by the ConfigResource.
764
+ The future result() method returns None or throws a KafkaException.
765
+
766
+ :rtype: dict(<ConfigResource, future>)
767
+
768
+ :raises KafkaException: Operation failed locally or on broker.
769
+ :raises TypeError: Invalid type.
770
+ :raises ValueError: Invalid value.
771
+ """
772
+ warnings.warn(
773
+ "alter_configs has been deprecated. Use incremental_alter_configs instead.",
774
+ category=DeprecationWarning,
775
+ stacklevel=2,
776
+ )
777
+
778
+ f, futmap = AdminClient._make_futures(resources, ConfigResource, AdminClient._make_resource_result)
779
+
780
+ super(AdminClient, self).alter_configs(resources, f, **kwargs)
781
+
782
+ return futmap
783
+
784
+ def incremental_alter_configs( # type: ignore[override]
785
+ self, resources: List[ConfigResource], **kwargs: Any
786
+ ) -> Dict[ConfigResource, concurrent.futures.Future]:
787
+ """
788
+ Update configuration properties for the specified resources.
789
+ Updates are incremental, i.e only the values mentioned are changed
790
+ and rest remain as is.
791
+
792
+ :param list(ConfigResource) resources: Resources to update configuration of.
793
+ :param float request_timeout: The overall request timeout in seconds,
794
+ including broker lookup, request transmission, operation time
795
+ on broker, and response. Default: `socket.timeout.ms/1000.0`.
796
+ :param bool validate_only: If true, the request is validated only,
797
+ without altering the configuration. Default: False
798
+ :param int broker: Broker id to send the request to. When
799
+ altering broker configurations, it's ignored because
800
+ the request needs to go to that broker only.
801
+ Default: controller broker.
802
+
803
+ :returns: A dict of futures for each resource, keyed by the ConfigResource.
804
+ The future result() method returns None or throws a KafkaException.
805
+
806
+ :rtype: dict(<ConfigResource, future>)
807
+
808
+ :raises KafkaException: Operation failed locally or on broker.
809
+ :raises TypeError: Invalid type.
810
+ :raises ValueError: Invalid value.
811
+ """
812
+ f, futmap = AdminClient._make_futures_v2(resources, ConfigResource, AdminClient._make_resource_result)
813
+
814
+ super(AdminClient, self).incremental_alter_configs(resources, f, **kwargs)
815
+
816
+ return futmap
817
+
818
+ def create_acls( # type: ignore[override]
819
+ self, acls: List[AclBinding], **kwargs: Any
820
+ ) -> Dict[AclBinding, concurrent.futures.Future]:
821
+ """
822
+ Create one or more ACL bindings.
823
+
824
+ :param list(AclBinding) acls: A list of unique ACL binding specifications (:class:`.AclBinding`)
825
+ to create.
826
+ :param float request_timeout: The overall request timeout in seconds,
827
+ including broker lookup, request transmission, operation time
828
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
829
+
830
+ :returns: A dict of futures for each ACL binding, keyed by the :class:`AclBinding` object.
831
+ The future result() method returns None on success.
832
+
833
+ :rtype: dict[AclBinding, future]
834
+
835
+ :raises KafkaException: Operation failed locally or on broker.
836
+ :raises TypeException: Invalid input.
837
+ :raises ValueException: Invalid input.
838
+ """
839
+ if AdminClient._has_duplicates(acls):
840
+ raise ValueError("duplicate ACL bindings not allowed")
841
+
842
+ f, futmap = AdminClient._make_futures(acls, AclBinding, AdminClient._make_acls_result)
843
+
844
+ super(AdminClient, self).create_acls(acls, f, **kwargs)
845
+
846
+ return futmap
847
+
848
+ def describe_acls( # type: ignore[override]
849
+ self, acl_binding_filter: AclBindingFilter, **kwargs: Any
850
+ ) -> concurrent.futures.Future:
851
+ """
852
+ Match ACL bindings by filter.
853
+
854
+ :param AclBindingFilter acl_binding_filter: a filter with attributes that
855
+ must match.
856
+ String attributes match exact values or any string if set to None.
857
+ Enums attributes match exact values or any value if equal to `ANY`.
858
+ If :class:`ResourcePatternType` is set to :attr:`ResourcePatternType.MATCH`
859
+ returns ACL bindings with:
860
+ :attr:`ResourcePatternType.LITERAL` pattern type with resource name equal
861
+ to the given resource name;
862
+ :attr:`ResourcePatternType.LITERAL` pattern type with wildcard resource name
863
+ that matches the given resource name;
864
+ :attr:`ResourcePatternType.PREFIXED` pattern type with resource name
865
+ that is a prefix of the given resource name
866
+ :param float request_timeout: The overall request timeout in seconds,
867
+ including broker lookup, request transmission, operation time
868
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
869
+
870
+ :returns: A future returning a list(:class:`AclBinding`) as result
871
+
872
+ :rtype: future
873
+
874
+ :raises KafkaException: Operation failed locally or on broker.
875
+ :raises TypeException: Invalid input.
876
+ :raises ValueException: Invalid input.
877
+ """
878
+
879
+ f = AdminClient._create_future()
880
+
881
+ super(AdminClient, self).describe_acls(acl_binding_filter, f, **kwargs)
882
+
883
+ return f
884
+
885
+ def delete_acls( # type: ignore[override]
886
+ self, acl_binding_filters: List[AclBindingFilter], **kwargs: Any
887
+ ) -> Dict[AclBindingFilter, concurrent.futures.Future]:
888
+ """
889
+ Delete ACL bindings matching one or more ACL binding filters.
890
+
891
+ :param list(AclBindingFilter) acl_binding_filters: a list of unique ACL binding filters
892
+ to match ACLs to delete.
893
+ String attributes match exact values or any string if set to None.
894
+ Enums attributes match exact values or any value if equal to `ANY`.
895
+ If :class:`ResourcePatternType` is set to :attr:`ResourcePatternType.MATCH`
896
+ deletes ACL bindings with:
897
+ :attr:`ResourcePatternType.LITERAL` pattern type with resource name
898
+ equal to the given resource name;
899
+ :attr:`ResourcePatternType.LITERAL` pattern type with wildcard resource name
900
+ that matches the given resource name;
901
+ :attr:`ResourcePatternType.PREFIXED` pattern type with resource name
902
+ that is a prefix of the given resource name
903
+ :param float request_timeout: The overall request timeout in seconds,
904
+ including broker lookup, request transmission, operation time
905
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
906
+
907
+ :returns: A dict of futures for each ACL binding filter, keyed by the :class:`AclBindingFilter` object.
908
+ The future result() method returns a list of :class:`AclBinding`.
909
+
910
+ :rtype: dict[AclBindingFilter, future]
911
+
912
+ :raises KafkaException: Operation failed locally or on broker.
913
+ :raises TypeException: Invalid input.
914
+ :raises ValueException: Invalid input.
915
+ """
916
+ if AdminClient._has_duplicates(acl_binding_filters):
917
+ raise ValueError("duplicate ACL binding filters not allowed")
918
+
919
+ f, futmap = AdminClient._make_futures(acl_binding_filters, AclBindingFilter, AdminClient._make_acls_result)
920
+
921
+ super(AdminClient, self).delete_acls(acl_binding_filters, f, **kwargs)
922
+
923
+ return futmap
924
+
925
+ def list_consumer_groups(self, **kwargs: Any) -> concurrent.futures.Future: # type: ignore[override]
926
+ """
927
+ List consumer groups.
928
+
929
+ :param float request_timeout: The overall request timeout in seconds,
930
+ including broker lookup, request transmission, operation time
931
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
932
+ :param set(ConsumerGroupState) states: only list consumer groups which are currently in
933
+ these states.
934
+ :param set(ConsumerGroupType) types: only list consumer groups of
935
+ these types.
936
+
937
+ :returns: a future. Result method of the future returns :class:`ListConsumerGroupsResult`.
938
+
939
+ :rtype: future
940
+
941
+ :raises KafkaException: Operation failed locally or on broker.
942
+ :raises TypeException: Invalid input.
943
+ :raises ValueException: Invalid input.
944
+ """
945
+ if "states" in kwargs:
946
+ states = kwargs["states"]
947
+ if states is not None:
948
+ if not isinstance(states, set):
949
+ raise TypeError("'states' must be a set")
950
+ for state in states:
951
+ if not isinstance(state, _ConsumerGroupState):
952
+ raise TypeError("All elements of states must be of type ConsumerGroupState")
953
+ kwargs["states_int"] = [state.value for state in states]
954
+ kwargs.pop("states")
955
+ if "types" in kwargs:
956
+ types = kwargs["types"]
957
+ if types is not None:
958
+ if not isinstance(types, set):
959
+ raise TypeError("'types' must be a set")
960
+ for type in types:
961
+ if not isinstance(type, _ConsumerGroupType):
962
+ raise TypeError("All elements of types must be of type ConsumerGroupType")
963
+ kwargs["types_int"] = [type.value for type in types]
964
+ kwargs.pop("types")
965
+
966
+ f, _ = AdminClient._make_futures([], None, AdminClient._make_list_consumer_groups_result)
967
+
968
+ super(AdminClient, self).list_consumer_groups(f, **kwargs)
969
+
970
+ return f
971
+
972
+ def describe_consumer_groups( # type: ignore[override]
973
+ self, group_ids: List[str], **kwargs: Any
974
+ ) -> Dict[str, concurrent.futures.Future]:
975
+ """
976
+ Describe consumer groups.
977
+
978
+ :param list(str) group_ids: List of group_ids which need to be described.
979
+ :param bool include_authorized_operations: If True, fetches group AclOperations. Default: False
980
+ :param float request_timeout: The overall request timeout in seconds,
981
+ including broker lookup, request transmission, operation time
982
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
983
+
984
+ :returns: A dict of futures for each group, keyed by the group_id.
985
+ The future result() method returns :class:`ConsumerGroupDescription`.
986
+
987
+ :rtype: dict[str, future]
988
+
989
+ :raises KafkaException: Operation failed locally or on broker.
990
+ :raises TypeException: Invalid input.
991
+ :raises ValueException: Invalid input.
992
+ """
993
+
994
+ if not isinstance(group_ids, list):
995
+ raise TypeError("Expected input to be list of group ids to be described")
996
+
997
+ if len(group_ids) == 0:
998
+ raise ValueError("Expected at least one group to be described")
999
+
1000
+ f, futmap = AdminClient._make_futures(group_ids, None, AdminClient._make_consumer_groups_result)
1001
+
1002
+ super(AdminClient, self).describe_consumer_groups(group_ids, f, **kwargs)
1003
+
1004
+ return futmap
1005
+
1006
+ def describe_topics( # type: ignore[override]
1007
+ self, topics: _TopicCollection, **kwargs: Any
1008
+ ) -> Dict[str, concurrent.futures.Future]:
1009
+ """
1010
+ Describe topics.
1011
+
1012
+ :param TopicCollection topics: Collection of list of topic names to describe.
1013
+ :param bool include_authorized_operations: If True, fetches topic AclOperations. Default: False
1014
+ :param float request_timeout: The overall request timeout in seconds,
1015
+ including broker lookup, request transmission, operation time
1016
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1017
+
1018
+ :returns: A dict of futures for each topic, keyed by the topic.
1019
+ The future result() method returns :class:`TopicDescription`.
1020
+
1021
+ :rtype: dict[str, future]
1022
+
1023
+ :raises KafkaException: Operation failed locally or on broker.
1024
+ :raises TypeError: Invalid input type.
1025
+ :raises ValueError: Invalid input value.
1026
+ """
1027
+
1028
+ if not isinstance(topics, _TopicCollection):
1029
+ raise TypeError("Expected input to be instance of TopicCollection")
1030
+
1031
+ topic_names = topics.topic_names
1032
+
1033
+ if not isinstance(topic_names, list):
1034
+ raise TypeError("Expected list of topic names to be described")
1035
+
1036
+ f, futmap = AdminClient._make_futures_v2(topic_names, None, AdminClient._make_futmap_result_from_list)
1037
+
1038
+ super(AdminClient, self).describe_topics(topic_names, f, **kwargs) # type: ignore[arg-type]
1039
+
1040
+ return futmap
1041
+
1042
+ def describe_cluster(self, **kwargs: Any) -> concurrent.futures.Future: # type: ignore[override]
1043
+ """
1044
+ Describe cluster.
1045
+
1046
+ :param bool include_authorized_operations: If True, fetches topic AclOperations. Default: False
1047
+ :param float request_timeout: The overall request timeout in seconds,
1048
+ including broker lookup, request transmission, operation time
1049
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1050
+
1051
+ :returns: A future returning description of the cluster as result
1052
+
1053
+ :rtype: future containing the description of the cluster in result.
1054
+
1055
+ :raises KafkaException: Operation failed locally or on broker.
1056
+ :raises TypeError: Invalid input type.
1057
+ :raises ValueError: Invalid input value.
1058
+ """
1059
+
1060
+ f = AdminClient._create_future()
1061
+
1062
+ super(AdminClient, self).describe_cluster(f, **kwargs)
1063
+
1064
+ return f
1065
+
1066
+ def delete_consumer_groups( # type: ignore[override]
1067
+ self, group_ids: List[str], **kwargs: Any
1068
+ ) -> Dict[str, concurrent.futures.Future]:
1069
+ """
1070
+ Delete the given consumer groups.
1071
+
1072
+ :param list(str) group_ids: List of group_ids which need to be deleted.
1073
+ :param float request_timeout: The overall request timeout in seconds,
1074
+ including broker lookup, request transmission, operation time
1075
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1076
+
1077
+ :returns: A dict of futures for each group, keyed by the group_id.
1078
+ The future result() method returns None.
1079
+
1080
+ :rtype: dict[str, future]
1081
+
1082
+ :raises KafkaException: Operation failed locally or on broker.
1083
+ :raises TypeError: Invalid input type.
1084
+ :raises ValueError: Invalid input value.
1085
+ """
1086
+ if not isinstance(group_ids, list):
1087
+ raise TypeError("Expected input to be list of group ids to be deleted")
1088
+
1089
+ if len(group_ids) == 0:
1090
+ raise ValueError("Expected at least one group to be deleted")
1091
+
1092
+ f, futmap = AdminClient._make_futures(group_ids, string_type, AdminClient._make_consumer_groups_result)
1093
+
1094
+ super(AdminClient, self).delete_consumer_groups(group_ids, f, **kwargs)
1095
+
1096
+ return futmap
1097
+
1098
+ def list_consumer_group_offsets( # type: ignore[override]
1099
+ self, list_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any
1100
+ ) -> Dict[str, concurrent.futures.Future]:
1101
+ """
1102
+ List offset information for the consumer group and (optional) topic partition provided in the request.
1103
+
1104
+ :note: Currently, the API supports only a single group.
1105
+
1106
+ :param list(ConsumerGroupTopicPartitions) list_consumer_group_offsets_request: List of
1107
+ :class:`ConsumerGroupTopicPartitions` which consist of group name and topic
1108
+ partition information for which offset detail is expected. If only group name is
1109
+ provided, then offset information of all the topic and partition associated with
1110
+ that group is returned.
1111
+ :param bool require_stable: If True, fetches stable offsets. Default: False
1112
+ :param float request_timeout: The overall request timeout in seconds,
1113
+ including broker lookup, request transmission, operation time
1114
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1115
+
1116
+ :returns: A dict of futures for each group, keyed by the group id.
1117
+ The future result() method returns :class:`ConsumerGroupTopicPartitions`.
1118
+
1119
+ :rtype: dict[str, future]
1120
+
1121
+ :raises KafkaException: Operation failed locally or on broker.
1122
+ :raises TypeException: Invalid input.
1123
+ :raises ValueException: Invalid input.
1124
+ """
1125
+
1126
+ AdminClient._check_list_consumer_group_offsets_request(list_consumer_group_offsets_request)
1127
+
1128
+ f, futmap = AdminClient._make_futures(
1129
+ [request.group_id for request in list_consumer_group_offsets_request],
1130
+ string_type,
1131
+ AdminClient._make_consumer_group_offsets_result,
1132
+ )
1133
+
1134
+ super(AdminClient, self).list_consumer_group_offsets(list_consumer_group_offsets_request, f, **kwargs)
1135
+
1136
+ return futmap
1137
+
1138
+ def alter_consumer_group_offsets( # type: ignore[override]
1139
+ self, alter_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any
1140
+ ) -> Dict[str, concurrent.futures.Future]:
1141
+ """
1142
+ Alter offset for the consumer group and topic partition provided in the request.
1143
+
1144
+ :note: Currently, the API supports only a single group.
1145
+
1146
+ :param list(ConsumerGroupTopicPartitions) alter_consumer_group_offsets_request: List of
1147
+ :class:`ConsumerGroupTopicPartitions` which consist of group name and topic
1148
+ partition; and corresponding offset to be updated.
1149
+ :param float request_timeout: The overall request timeout in seconds,
1150
+ including broker lookup, request transmission, operation time
1151
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1152
+
1153
+ :returns: A dict of futures for each group, keyed by the group id.
1154
+ The future result() method returns :class:`ConsumerGroupTopicPartitions`.
1155
+
1156
+ :rtype: dict[ConsumerGroupTopicPartitions, future]
1157
+
1158
+ :raises KafkaException: Operation failed locally or on broker.
1159
+ :raises TypeException: Invalid input.
1160
+ :raises ValueException: Invalid input.
1161
+ """
1162
+
1163
+ AdminClient._check_alter_consumer_group_offsets_request(alter_consumer_group_offsets_request)
1164
+
1165
+ f, futmap = AdminClient._make_futures(
1166
+ [request.group_id for request in alter_consumer_group_offsets_request],
1167
+ string_type,
1168
+ AdminClient._make_consumer_group_offsets_result,
1169
+ )
1170
+
1171
+ super(AdminClient, self).alter_consumer_group_offsets(alter_consumer_group_offsets_request, f, **kwargs)
1172
+
1173
+ return futmap
1174
+
1175
+ def set_sasl_credentials(self, username: str, password: str) -> None:
1176
+ """
1177
+ Sets the SASL credentials used for this client.
1178
+ These credentials will overwrite the old ones, and will be used the
1179
+ next time the client needs to authenticate.
1180
+ This method will not disconnect existing broker connections that
1181
+ have been established with the old credentials.
1182
+ This method is applicable only to SASL PLAIN and SCRAM mechanisms.
1183
+
1184
+ :param str username: The username to set.
1185
+ :param str password: The password to set.
1186
+
1187
+ :rtype: None
1188
+
1189
+ :raises KafkaException: Operation failed locally or on broker.
1190
+ :raises TypeException: Invalid input.
1191
+ """
1192
+ super(AdminClient, self).set_sasl_credentials(username, password)
1193
+
1194
+ def describe_user_scram_credentials( # type: ignore[override]
1195
+ self, users: Optional[List[str]] = None, **kwargs: Any
1196
+ ) -> Union[concurrent.futures.Future, Dict[str, concurrent.futures.Future]]:
1197
+ """
1198
+ Describe user SASL/SCRAM credentials.
1199
+
1200
+ :param list(str) users: List of user names to describe.
1201
+ Duplicate users aren't allowed. Can be None
1202
+ to describe all user's credentials.
1203
+ :param float request_timeout: The overall request timeout in seconds,
1204
+ including broker lookup, request transmission, operation time
1205
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1206
+
1207
+ :returns: In case None is passed it returns a single future.
1208
+ The future yields a dict[str, UserScramCredentialsDescription]
1209
+ or raises a KafkaException
1210
+
1211
+ In case a list of user names is passed, it returns
1212
+ a dict[str, future[UserScramCredentialsDescription]].
1213
+ The futures yield a :class:`UserScramCredentialsDescription`
1214
+ or raise a KafkaException
1215
+
1216
+ :rtype: Union[future[dict[str, UserScramCredentialsDescription]],
1217
+ dict[str, future[UserScramCredentialsDescription]]]
1218
+
1219
+ :raises TypeError: Invalid input type.
1220
+ :raises ValueError: Invalid input value.
1221
+ """
1222
+ AdminClient._check_describe_user_scram_credentials_request(users)
1223
+
1224
+ if users is None:
1225
+ internal_f, ret_fut = AdminClient._make_single_future_pair()
1226
+ else:
1227
+ internal_f, ret_fut = AdminClient._make_futures_v2( # type: ignore[assignment]
1228
+ users, None, AdminClient._make_futmap_result
1229
+ )
1230
+ super(AdminClient, self).describe_user_scram_credentials(users, internal_f, **kwargs)
1231
+ return ret_fut
1232
+
1233
+ def alter_user_scram_credentials( # type: ignore[override]
1234
+ self, alterations: List[UserScramCredentialAlteration], **kwargs: Any
1235
+ ) -> Dict[str, concurrent.futures.Future]:
1236
+ """
1237
+ Alter user SASL/SCRAM credentials.
1238
+
1239
+ :param list(UserScramCredentialAlteration) alterations: List of
1240
+ :class:`UserScramCredentialAlteration` to apply.
1241
+ The pair (user, mechanism) must be unique among alterations.
1242
+ :param float request_timeout: The overall request timeout in seconds,
1243
+ including broker lookup, request transmission, operation time
1244
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1245
+
1246
+ :returns: A dict of futures keyed by user name.
1247
+ The future result() method returns None or
1248
+ raises KafkaException
1249
+
1250
+ :rtype: dict[str, future]
1251
+
1252
+ :raises TypeError: Invalid input type.
1253
+ :raises ValueError: Invalid input value.
1254
+ """
1255
+ AdminClient._check_alter_user_scram_credentials_request(alterations)
1256
+
1257
+ f, futmap = AdminClient._make_futures_v2(
1258
+ set([alteration.user for alteration in alterations]), None, AdminClient._make_futmap_result
1259
+ )
1260
+
1261
+ super(AdminClient, self).alter_user_scram_credentials(alterations, f, **kwargs)
1262
+ return futmap
1263
+
1264
+ def list_offsets( # type: ignore[override]
1265
+ self, topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], **kwargs: Any
1266
+ ) -> Dict[_TopicPartition, concurrent.futures.Future]:
1267
+ """
1268
+ Enables to find the beginning offset,
1269
+ end offset as well as the offset matching a timestamp
1270
+ or the offset with max timestamp in partitions.
1271
+
1272
+ :param dict([TopicPartition, OffsetSpec]) topic_partition_offsets: Dictionary of
1273
+ TopicPartition objects associated with the corresponding OffsetSpec to query for.
1274
+ :param IsolationLevel isolation_level: The isolation level to use when
1275
+ querying.
1276
+ :param float request_timeout: The overall request timeout in seconds,
1277
+ including broker lookup, request transmission, operation time
1278
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1279
+
1280
+ :returns: A dict of futures keyed by TopicPartition.
1281
+ The future result() method returns ListOffsetsResultInfo
1282
+ raises KafkaException
1283
+
1284
+ :rtype: dict[TopicPartition, future]
1285
+
1286
+ :raises TypeError: Invalid input type.
1287
+ :raises ValueError: Invalid input value.
1288
+ """
1289
+ AdminClient._check_list_offsets_request(topic_partition_offsets, kwargs)
1290
+
1291
+ if 'isolation_level' in kwargs:
1292
+ kwargs['isolation_level_value'] = kwargs['isolation_level'].value
1293
+ del kwargs['isolation_level']
1294
+
1295
+ topic_partition_offsets_list = [
1296
+ _TopicPartition(topic_partition.topic, int(topic_partition.partition), int(offset_spec._value))
1297
+ for topic_partition, offset_spec in topic_partition_offsets.items()
1298
+ ]
1299
+
1300
+ f, futmap = AdminClient._make_futures_v2(
1301
+ topic_partition_offsets_list, _TopicPartition, AdminClient._make_futmap_result
1302
+ )
1303
+
1304
+ super(AdminClient, self).list_offsets(topic_partition_offsets_list, f, **kwargs)
1305
+ return futmap
1306
+
1307
+ def delete_records( # type: ignore[override]
1308
+ self, topic_partition_offsets: List[_TopicPartition], **kwargs: Any
1309
+ ) -> Dict[_TopicPartition, concurrent.futures.Future]:
1310
+ """
1311
+ Deletes all the records before the specified offsets (not including),
1312
+ in the specified topics and partitions.
1313
+
1314
+ :param list(TopicPartition) topic_partition_offsets: A list of
1315
+ :class:`.TopicPartition` objects having `offset` field set to the offset
1316
+ before which all the records should be deleted.
1317
+ `offset` can be set to :py:const:`OFFSET_END` (-1) to delete all records
1318
+ in the partition.
1319
+ :param float request_timeout: The overall request timeout in seconds,
1320
+ including broker lookup, request transmission, operation time
1321
+ on broker, and response. Default: `socket.timeout.ms/1000.0`
1322
+ :param float operation_timeout: The operation timeout in seconds,
1323
+ controlling how long the `delete_records` request will block
1324
+ on the broker waiting for the record deletion to propagate
1325
+ in the cluster. A value of 0 returns immediately.
1326
+ Default: `socket.timeout.ms/1000.0`
1327
+
1328
+ :returns: A dict of futures keyed by the :class:`.TopicPartition`.
1329
+ The future result() method returns :class:`.DeletedRecords`
1330
+ or raises :class:`.KafkaException`
1331
+
1332
+ :rtype: dict[TopicPartition, future]
1333
+
1334
+ :raises KafkaException: Operation failed locally or on broker.
1335
+ :raises TypeError: Invalid input type.
1336
+ :raises ValueError: Invalid input value.
1337
+ """
1338
+ AdminClient._check_delete_records(topic_partition_offsets)
1339
+
1340
+ f, futmap = AdminClient._make_futures_v2(
1341
+ topic_partition_offsets, _TopicPartition, AdminClient._make_futmap_result
1342
+ )
1343
+
1344
+ super(AdminClient, self).delete_records(topic_partition_offsets, f, **kwargs)
1345
+ return futmap
1346
+
1347
+ def elect_leaders( # type: ignore[override]
1348
+ self, election_type: _ElectionType, partitions: Optional[List[_TopicPartition]] = None, **kwargs: Any
1349
+ ) -> concurrent.futures.Future:
1350
+ """
1351
+ Perform Preferred or Unclean leader election for
1352
+ all the specified partitions or all partitions in the cluster.
1353
+
1354
+ :param ElectionType election_type: The type of election to perform.
1355
+ :param List[TopicPartition]|None partitions: The topic partitions to perform
1356
+ the election on. Use ``None`` to perform on all the topic partitions.
1357
+ :param float request_timeout: The overall request timeout in seconds,
1358
+ including broker lookup, request transmission, operation time
1359
+ on broker, and response. Default: `socket.timeout.ms*1000.0`
1360
+ :param float operation_timeout: The operation timeout in seconds,
1361
+ controlling how long the 'elect_leaders' request will block
1362
+ on the broker waiting for the election to propagate
1363
+ in the cluster. A value of 0 returns immediately.
1364
+ Default: `socket.timeout.ms/1000.0`
1365
+
1366
+ :returns: A future. Method result() of the future returns
1367
+ dict[TopicPartition, KafkaException|None].
1368
+
1369
+ :rtype: future
1370
+
1371
+ :raises KafkaException: Operation failed locally or on broker.
1372
+ :raises TypeError: Invalid input type.
1373
+ :raises ValueError: Invalid input value.
1374
+ """
1375
+
1376
+ AdminClient._check_elect_leaders(election_type, partitions)
1377
+
1378
+ f = AdminClient._create_future()
1379
+
1380
+ super(AdminClient, self).elect_leaders(election_type.value, partitions, f, **kwargs)
1381
+
1382
+ return f