מודולים ראשיים
תיעוד מפורט של המודולים הראשיים בפרויקט.
File Management
- class file_manager.BackupInfo(backup_id, user_id, created_at, file_count, total_size, backup_type, status, file_path, repo, path, metadata)[מקור]
Bases:
object
מידע על גיבוי
- פרמטרים:
- __init__(backup_id, user_id, created_at, file_count, total_size, backup_type, status, file_path, repo, path, metadata)[מקור]
- class file_manager.BackupManager[מקור]
Bases:
object
מנהל גיבויים
- __init__()[מקור]
- save_backup_bytes(data, metadata)[מקור]
שומר ZIP של גיבוי בהתאם למצב האחסון ומחזיר backup_id או None במקרה כשל.
אם storage==mongo: שומר ל-GridFS עם המטאדטה. אם storage==fs: שומר לקובץ תחת backup_dir.
- save_backup_file(file_path)[מקור]
שומר קובץ ZIP קיים לאחסון היעד (Mongo/FS) ומחזיר backup_id אם הצליח.
- list_backups(user_id)[מקור]
מחזירה רשימת קבצי ZIP ששייכים למשתמש המבקש בלבד.
כל פריט חייב להיות מסווג כשייך ל-user_id דרך אחד מהבאים: - metadata.json בתוך ה-ZIP עם שדה user_id תואם - דפוס מזהה בשם: backup_<user_id>_*
ZIPים ללא שיוך ברור למשתמש לא ייכללו כדי למנוע זליגת מידע.
- Return type:
- פרמטרים:
user_id (int)
- restore_from_backup(user_id, backup_path, overwrite=True, purge=False, extra_tags=None)[מקור]
משחזר קבצים מ-ZIP למסד הנתונים. :rtype:
Dict
[str
,Any
]purge=True: מסמן את כל הקבצים הקיימים של המשתמש כלא פעילים לפני השחזור
overwrite=True: שמירה תמיד כגרסה חדשה עבור אותו שם (כברירת מחדל)
החזרה: dict עם restored_files ו-errors
- delete_backups(user_id, backup_ids)[מקור]
מוחק מספר גיבויי ZIP לפי backup_id ממערכת הקבצים ומ-GridFS (אם בשימוש).
החזרה: {”deleted“: int, ”errors“: [str, …]}
GitHub Integration
- github_menu_handler.safe_html_escape(text)[מקור]
Escape text for Telegram HTML; preserves / / and keeps existing HTML entities.
- github_menu_handler.format_bytes(num)[מקור]
פורמט נחמד לגודל קובץ
- class github_menu_handler.GitHubMenuHandler[מקור]
Bases:
object
- __init__()[מקור]
- get_user_session(user_id)[מקור]
מחזיר או יוצר סשן משתמש בזיכרון
- async show_browse_ref_menu(update, context)[מקור]
תפריט בחירת ref (ענף/תג) עם עימוד וטאבים.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_browse_search_results(update, context)[מקור]
חיפוש לפי שם קובץ (prefix/contains) עם עימוד ותוצאות לפתיחה.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async check_rate_limit(github_client, update_or_query)[מקור]
בודק את מגבלת ה-API של GitHub
- Return type:
- פרמטרים:
github_client (github.Github)
- get_user_token(user_id)[מקור]
מקבל טוקן של משתמש - מהסשן או מהמסד נתונים
- async show_import_branch_menu(update, context)[מקור]
מציג בחירת ענף לייבוא ריפו (עימוד).
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async import_repo_from_zip(update, context, repo_full, branch)[מקור]
מוריד ZIP רשמי של GitHub (zipball) לענף, מחלץ ל-tmp, ומקליט קבצים ל-DB עם תגיות repo/source.
שמירה: CodeSnippet לקבצים טקסטואליים קטנים (עד IMPORT_MAX_FILE_BYTES) עד סך IMPORT_MAX_TOTAL_BYTES ומקס« IMPORT_MAX_FILES. מדלג על בינאריים, קבצי ענק, ותיקיות מיותרות. מנקה tmp בסוף.
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
repo_full (str)
branch (str)
- async github_menu_command(update, context)[מקור]
מציג תפריט GitHub
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_menu_callback(update, context)[מקור]
Handle menu button clicks
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_repo_selection(query, context)[מקור]
Show repository selection menu
- פרמטרים:
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_repos(update, context, page=0, query=None)[מקור]
מציג רשימת ריפוזיטוריז עם pagination
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
page (int)
- async show_upload_other_files(update, context)[מקור]
מציג רק קבצים שאינם מתויגים repo: ואינם קבצים גדולים, עם עימוד ואימוג’י לפי שפה.
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_upload_repos(update, context)[מקור]
מציג תפריט ריפואים לבחירת קבצים שמורים עם תגית repo: להעלאה
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_upload_repo_files(update, context, _repo_tag)[מקור]
מציג קבצים שמורים תחת תגית ריפו שנבחרה ומאפשר להעלותם עם עימוד
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
_repo_tag (str)
- async upload_large_files_menu(update, context)[מקור]
מציג רשימת קבצים גדולים להעלאה לריפו הנבחר
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_large_file_upload(update, context, file_id)[מקור]
מעלה קובץ גדול שנבחר לגיטהאב (עם אותן בדיקות כמו קובץ שמור רגיל)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
file_id (str)
- async handle_saved_file_upload(update, context, file_id)[מקור]
מטפל בהעלאת קובץ שמור ל-GitHub
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
file_id (str)
- async handle_file_upload(update, context)[מקור]
Handle file upload
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_text_input(update, context)[מקור]
Handle text input for various states
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_analyze_repo_menu(update, context)[מקור]
מציג תפריט לניתוח ריפו
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async request_repo_url(update, context)[מקור]
מבקש URL של ריפו לניתוח
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async analyze_another_repo(update, context)[מקור]
מציג תפריט בחירה לניתוח ריפו אחר
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async analyze_repository(update, context, repo_url)[מקור]
מנתח ריפוזיטורי ומציג תוצאות
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
repo_url (str)
- async show_improvement_suggestions(update, context)[מקור]
מציג הצעות לשיפור
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_suggestion_details(update, context, suggestion_index)[מקור]
מציג פרטי הצעה ספציפית
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
suggestion_index (int)
- async show_full_analysis(update, context)[מקור]
מציג ניתוח מלא
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async download_analysis_json(update, context)[מקור]
שולח קובץ JSON עם הניתוח המלא
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_analyze_results_menu(update, context)[מקור]
מציג מחדש את תפריט התוצאות
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_repo_url_input(update, context)[מקור]
מטפל בקלט של URL לניתוח
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_delete_file_menu(update, context)[מקור]
מציג תפריט מחיקת קובץ מהריפו (דפדוף בכפתורים)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_delete_repo_menu(update, context)[מקור]
מציג תפריט מחיקת ריפו שלם עם אזהרות
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_delete_file(update, context)[מקור]
מבצע מחיקת קובץ לאחר אישור
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_delete_repo_step1(update, context)[מקור]
מסך אישור סופי לפני מחיקת ריפו, מפנה ללחצן מחיקה סופי
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_delete_repo(update, context)[מקור]
מבצע מחיקת ריפו שלם לאחר אישור
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_danger_delete_menu(update, context)[מקור]
מציג תפריט מחיקות מסוכן
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_download_file_menu(update, context)[מקור]
מציג תפריט הורדת קובץ מהריפו (דפדוף בכפתורים)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_repo_browser(update, context, only_keyboard=False)[מקור]
מציג דפדפן ריפו לפי נתיב ושימוש (view/download/delete), כולל breadcrumbs ועימוד.
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
only_keyboard (bool)
- async handle_inline_query(update, context)[מקור]
Inline mode: חיפוש/ביצוע פעולות ישירות מכל צ’אט
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_notifications_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async toggle_notifications(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async toggle_notifications_pr(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async toggle_notifications_issues(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async set_notifications_interval(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async notifications_check_now(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_pr_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_create_pr_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_confirm_create_pr(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_create_pr(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_merge_pr_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_confirm_merge_pr(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_merge_pr(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async git_checkpoint(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_pre_upload_check(update, context)[מקור]
מציג בדיקות לפני העלאת קובץ שמור (הרשאות/קיום קובץ/ענף/תיקייה).
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async confirm_saved_upload(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async refresh_saved_checks(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_upload_branch_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_upload_folder_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async ask_upload_folder(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async create_checkpoint_doc(update, context, kind, name)[מקור]
יוצר קובץ הוראות שחזור לנקודת שמירה ושולח ל-flow של העלאה
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
kind (str)
name (str)
- async show_restore_checkpoint_menu(update, context)[מקור]
מציג רשימת תגיות נקודות שמירה לבחירה לשחזור
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_restore_tag_actions(update, context, tag_name)[מקור]
מציג פעולות אפשריות לשחזור מתגית נתונה
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
tag_name (str)
- async create_branch_from_tag(update, context, tag_name)[מקור]
יוצר ענף חדש שמצביע ל-commit של התגית לשחזור נוח
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
tag_name (str)
- async open_pr_from_branch(update, context, branch_name)[מקור]
פותח Pull Request מהענף שנוצר אל הענף הראשי של הריפו
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
branch_name (str)
- async create_revert_pr_from_tag(update, context, tag_name)[מקור]
יוצר PR שמשחזר את מצב הריפו לתגית ע“י יצירת commit חדש עם עץ התגית על גבי base. כך תמיד יהיה diff וה-PR ייפתח בהצלחה.
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
tag_name (str)
- async show_github_backup_menu(update, context)[מקור]
מציג תפריט גיבוי/שחזור עבור הריפו הנבחר
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async restore_zip_file_to_repo(update, context, zip_path, purge_first)[מקור]
שחזור קבצים מ-ZIP מקומי לריפו הנוכחי באמצעות Trees API (commit אחד)
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
zip_path (str)
purge_first (bool)
- async github_upload_fix.github_upload_new_file(update, context)[מקור]
בקשה להעלאת קובץ חדש לגיטהאב
- async github_upload_fix.handle_document_fixed(update, context)[מקור]
טיפול בקובץ שהתקבל
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async github_upload_fix.upload_to_github_fixed(update, context, status_message)[מקור]
העלאה מתוקנת לגיטהאב
- async github_upload_fix.setup_minimal_commands(application)[מקור]
מחיקת כל הפקודות והשארת רק stats למנהל
- Return type:
- פרמטרים:
application (telegram.ext.Application)
- async github_upload_fix.stats_command_secured(update, context)[מקור]
הצג סטטיסטיקות - רק לאמיר בירון
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async github_upload_fix.check_commands(update, context)[מקור]
בדיקת הפקודות הזמינות (רק לאמיר)
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
Backup System
- class backup_menu_handler.BackupMenuHandler[מקור]
Bases:
object
תפריט גיבוי ושחזור מלא + נקודות שמירה בגיט
- __init__()[מקור]
- async show_backup_menu(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async handle_callback_query(update, context)[מקור]
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async send_rating_prompt(update, context, backup_id)[מקור]
שולח הודעת תיוג עם 3 כפתורים עבור גיבוי מסוים.
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
backup_id (str)
Code Processing
מנהל תצוגה מקדימה של קוד Code Preview Manager
Search Engine
Repository Analysis
- class repo_analyzer.RepoAnalyzer(github_token=None)[מקור]
Bases:
object
מנתח ריפוזיטורי GitHub ומציע שיפורים
- פרמטרים:
github_token (str | None)
- MAX_FILE_SIZE = 102400
- MAX_FILES = 50
- LARGE_FILE_LINES = 500
- LONG_FUNCTION_LINES = 50
- CODE_EXTENSIONS = {'.c', '.cpp', '.cs', '.go', '.java', '.js', '.jsx', '.kt', '.m', '.php', '.py', '.r', '.rb', '.rs', '.scala', '.swift', '.ts', '.tsx'}
- CONFIG_FILES = {'Cargo.toml', 'Gemfile', 'Package.swift', 'Pipfile', 'build.gradle', 'composer.json', 'go.mod', 'package.json', 'pom.xml', 'pyproject.toml', 'requirements.txt'}
- IMPORTANT_FILES = {'.dockerignore', '.github/workflows', '.gitignore', '.gitlab-ci.yml', 'Dockerfile', 'LICENSE', 'LICENSE.md', 'LICENSE.txt', 'README', 'README.md', 'README.rst', 'README.txt', 'azure-pipelines.yml', 'docker-compose.yaml', 'docker-compose.yml'}
- parse_github_url(url)[מקור]
מחלץ owner ו-repo מ-URL של GitHub
- async fetch_and_analyze_repo(repo_url)[מקור]
שולף ומנתח ריפוזיטורי מ-GitHub
Batch Processing
מעבד Batch לעיבוד מרובה קבצים Batch Processor for Multiple Files
- class batch_processor.BatchJob(job_id, user_id, operation, files, status='pending', progress=0, total=0, results=None, error_message='', start_time=0, end_time=0)[מקור]
Bases:
object
עבודת batch
- פרמטרים:
-
job_id:
str
-
user_id:
int
-
operation:
str
-
status:
str
= 'pending'
-
progress:
int
= 0
-
total:
int
= 0
-
error_message:
str
= ''
-
start_time:
float
= 0
-
end_time:
float
= 0
- __init__(job_id, user_id, operation, files, status='pending', progress=0, total=0, results=None, error_message='', start_time=0, end_time=0)
- class batch_processor.BatchProcessor[מקור]
Bases:
object
מעבד batch לפעולות על מרובה קבצים
- __init__()[מקור]
- create_job(user_id, operation, files)[מקור]
יצירת עבודת batch חדשה
- async process_files_batch(job_id, operation_func, **kwargs)[מקור]
עיבוד batch של קבצים
- async analyze_files_batch(user_id, file_names)[מקור]
ניתוח batch של קבצים
- async validate_files_batch(user_id, file_names)[מקור]
בדיקת תקינות batch של קבצים
- async export_files_batch(user_id, file_names, export_format='zip')[מקור]
ייצוא batch של קבצים
- get_job_status(job_id)[מקור]
קבלת סטטוס עבודת batch
פקודות Batch לעיבוד מרובה קבצים Batch Commands for Multiple File Processing
- async batch_commands.batch_analyze_command(update, context)[מקור]
פקודת ניתוח batch של קבצים
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async batch_commands.batch_validate_command(update, context)[מקור]
פקודת בדיקת תקינות batch
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async batch_commands.job_status_command(update, context)[מקור]
בדיקת סטטוס עבודת batch
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async batch_commands.large_file_command(update, context)[מקור]
פקודת הצגת קובץ גדול עם lazy loading
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async batch_commands.handle_batch_callbacks(update, context)[מקור]
טיפול בcallbacks של batch operations
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- batch_commands.setup_batch_handlers(application)[מקור]
הוספת handlers לפקודות batch
Large Files Handling
טיפול בקבצים גדולים עם ממשק כפתורים מתקדם Large Files Handler with Advanced Button Interface
- class large_files_handler.LargeFilesHandler[מקור]
Bases:
object
מנהל קבצים גדולים עם ממשק מתקדם
- __init__()[מקור]
- async show_large_files_menu(update, context, page=1)[מקור]
מציג תפריט קבצים גדולים עם ניווט בין עמודים
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
page (int)
- async handle_file_selection(update, context)[מקור]
טיפול בבחירת קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async view_large_file(update, context)[מקור]
הצגת קובץ גדול - תצוגה מקדימה או שליחה כקובץ
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async download_large_file(update, context)[מקור]
הורדת קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async delete_large_file_confirm(update, context)[מקור]
אישור מחיקת קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async delete_large_file(update, context)[מקור]
מחיקת קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async show_file_info(update, context)[מקור]
הצגת מידע מפורט על קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async edit_large_file(update, context)[מקור]
התחלת תהליך עריכת קובץ גדול
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
Cache Management
מנהל Cache מתקדם עם Redis Advanced Cache Manager with Redis
- class cache_manager.CacheManager[מקור]
Bases:
object
מנהל Cache מתקדם עם Redis
- __init__()[מקור]
- connect()[מקור]
התחברות ל-Redis
- set(key, value, expire_seconds=300)[מקור]
שמירת ערך ב-cache
- delete_pattern(pattern)[מקור]
מחיקת כל המפתחות שמתאימים לתבנית
- cache_manager.cached(expire_seconds=300, key_prefix='default')[מקור]
דקורטור לcaching פונקציות
- cache_manager.async_cached(expire_seconds=300, key_prefix='default')[מקור]
דקורטור לcaching פונקציות async
פקודות ניהול Cache לבוט Cache Management Commands for Bot
- async cache_commands.cache_stats_command(update, context)[מקור]
הצגת סטטיסטיקות cache
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async cache_commands.clear_cache_command(update, context)[מקור]
ניקוי cache של המשתמש
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- cache_commands.setup_cache_handlers(application)[מקור]
הוספת handlers לפקודות cache
User Statistics
Activity Reporting
קובץ פשוט לדיווח פעילות - העתק את הקובץ הזה לכל בוט
- class activity_reporter.SimpleActivityReporter(mongodb_uri, service_id, service_name=None)[מקור]
Bases:
object
- __init__(mongodb_uri, service_id, service_name=None)[מקור]
mongodb_uri: חיבור למונגו (אותו מהבוט המרכזי) service_id: מזהה השירות ב-Render service_name: שם הבוט (אופציונלי)
- report_activity(user_id)[מקור]
דיווח פעילות פשוט
- activity_reporter.create_reporter(mongodb_uri, service_id, service_name=None)[מקור]
יצירת reporter פשוט
Utilities
פונקציות עזר כלליות לבוט שומר קבצי קוד General Utility Functions for Code Keeper Bot
- class utils.CodeErrorLogger[מקור]
Bases:
object
מערכת לוגים ייעודית לשגיאות עיבוד קוד
- __init__()[מקור]
- log_code_processing_error(user_id, error_type, error_message, context=None)[מקור]
רישום שגיאות עיבוד קוד
- log_code_activity(user_id, activity_type, details=None)[מקור]
רישום פעילות עיבוד קוד
- log_validation_failure(user_id, code_length, error_reason)[מקור]
רישום כשל באימות קוד
- class utils.TimeUtils[מקור]
Bases:
object
כלים לעבודה עם זמן ותאריכים
- static format_relative_time(dt)[מקור]
פורמט זמן יחסי (לפני 5 דקות, אתמול וכו«)
- static parse_date_string(date_str)[מקור]
פרסור מחרוזת תאריך לאובייקט datetime
- class utils.TextUtils[מקור]
Bases:
object
כלים לעבודה עם טקסט
- static truncate_text(text, max_length=100, suffix='...')[מקור]
קיצור טקסט עם סיומת
- static escape_markdown(text, version=2)[מקור]
הגנה על תווים מיוחדים ב-Markdown
- static clean_filename(filename)[מקור]
ניקוי שם קובץ מתווים לא חוקיים
- static highlight_text(text, query, tag='**')[מקור]
הדגשת מילות חיפוש בטקסט
- static format_file_size(size_bytes)[מקור]
פורמט גודל קובץ (bytes -> KB/MB/GB)
- class utils.SecurityUtils[מקור]
Bases:
object
כלים אמינות ובטיחות
- static generate_secure_token(length=32)[מקור]
יצירת טוקן מאובטח
- static hash_content(content, algorithm='sha256')[מקור]
יצירת hash לתוכן
- static validate_user_input(text, max_length=10000, forbidden_patterns=None)[מקור]
בדיקת קלט משתמש
- class utils.TelegramUtils[מקור]
Bases:
object
כלים לעבודה עם Telegram
- async static send_typing_action(update, context)[מקור]
שליחת אקשן »כותב…«
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async static send_document_action(update, context)[מקור]
שליחת אקשן »שולח מסמך…«
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- static get_user_mention(user)[מקור]
קבלת מנשן למשתמש
- Return type:
- פרמטרים:
user (telegram.User)
- static split_long_message(text, max_length=4096)[מקור]
חלוקת הודעה ארוכה לחלקים
- async static safe_edit_message_text(query, text, reply_markup=None, parse_mode=None)[מקור]
עריכת טקסט הודעה בבטיחות: מתעלם משגיאת »Message is not modified«.
- class utils.CallbackQueryGuard[מקור]
Bases:
object
Guard גורף ללחיצות כפולות על כפתורי CallbackQuery.
מבוסס על טביעת אצבע של המשתמש/הודעה/הנתון (callback_data) כדי לחסום את אותה פעולה בחלון זמן קצר, בלי לחסום פעולות שונות.
-
DEFAULT_WINDOW_SECONDS:
float
= 1.2
- static should_block(update, context, window_seconds=None)[מקור]
בודק האם יש לחסום את העדכון כלחיצה כפולה.
אם זו אותה טביעת אצבע בתוך חלון הזמן – נחסום; אחרת נסמן ונאפשר.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
window_seconds (float | None)
- async static should_block_async(update, context, window_seconds=None)[מקור]
בודק בצורה אטומית (עם נעילה) אם לחסום לחיצה כפולה של אותו משתמש.
חסימה מבוססת חלון זמן פר-משתמש, ללא תלות ב-message_id/data, כדי למנוע מרוץ.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
window_seconds (float | None)
-
DEFAULT_WINDOW_SECONDS:
- class utils.AsyncUtils[מקור]
Bases:
object
כלים לעבודה אסינכרונית
- class utils.PerformanceUtils[מקור]
Bases:
object
כלים למדידת ביצועים
- static timing_decorator(func)[מקור]
דקורטור למדידת זמן ביצוע
- class utils.ValidationUtils[מקור]
Bases:
object
כלים לוולידציה
- static is_valid_filename(filename)[מקור]
בדיקת תקינות שם קובץ
- class utils.FileUtils[מקור]
Bases:
object
כלים לעבודה עם קבצים
- async static download_file(url, max_size=10485760)[מקור]
הורדת קובץ מ-URL
- static get_mime_type(filename)[מקור]
קבלת MIME type של קובץ
- class utils.ConfigUtils[מקור]
Bases:
object
כלים לקונפיגורציה
- static load_json_config(file_path, default=None)[מקור]
טעינת קונפיגורציה מקובץ JSON
- class utils.CacheUtils[מקור]
Bases:
object
כלים לקאש זמני
- classmethod set(key, value, ttl=300)[מקור]
שמירה בקאש עם TTL (שניות)
- classmethod get(key, default=None)[מקור]
קבלה מהקאש
- classmethod clear()[מקור]
ניקוי כל הקאש
- utils.setup_logging(level='INFO', log_file=None)[מקור]
הגדרת לוגים
- utils.generate_summary_stats(files_data)[מקור]
יצירת סיכום סטטיסטיקות
- utils.detect_language_from_filename(filename)[מקור]
זיהוי שפת תכנות לפי סיומת הקובץ
- utils.get_language_emoji(language)[מקור]
מחזיר אימוג’י מתאים לשפת התכנות
- class utils.SensitiveDataFilter(name='')[מקור]
Bases:
Filter
מסנן שמטשטש טוקנים ונתונים רגישים בלוגים.
- utils.install_sensitive_filter()[מקור]
התקנת המסנן על כל ה-handlers הקיימים.
Lazy Loading
מנהל Lazy Loading לקבצים גדולים Lazy Loading Manager for Large Files
- class lazy_loader.FileChunk(file_name, chunk_index, start_line, end_line, content, total_chunks, total_lines)[מקור]
Bases:
object
חלק מקובץ גדול
- פרמטרים:
-
file_name:
str
-
chunk_index:
int
-
start_line:
int
-
end_line:
int
-
content:
str
-
total_chunks:
int
-
total_lines:
int
- class lazy_loader.LazyLoader[מקור]
Bases:
object
מנהל Lazy Loading לקבצים גדולים
- __init__()[מקור]
- create_chunks(code, file_name)[מקור]
חלוקת קובץ גדול לchunks
- get_file_chunk(user_id, file_name, chunk_index)[מקור]
קבלת chunk ספציפי מקובץ
- get_file_summary(code, file_name, programming_language)[מקור]
יוצר סיכום של קובץ גדול
- format_chunk_message(chunk, programming_language)[מקור]
פורמט הודעה לchunk
- get_navigation_keyboard(chunk, user_id)[מקור]
יוצר מקלדת ניווט לchunks
Integrations
Terminal Commands
Terminal commands: sandboxed command execution via Docker containers.
- async terminal_commands.run_in_sandbox(command, timeout_sec=10, max_output_chars=3500)[מקור]
Run a shell command inside a locked-down Docker container and return (rc, output).
- async terminal_commands.terminal_enter(update, context)[מקור]
Enter terminal mode if Docker is available.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async terminal_commands.terminal_exit(update, context)[מקור]
Exit terminal mode.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async terminal_commands.terminal_run_command(update, context)[מקור]
Run a command string inside the sandbox and send the output.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- async terminal_commands.terminal_command(update, context)[מקור]
/terminal command to enter terminal mode.
- Return type:
- פרמטרים:
update (telegram.Update)
context (telegram.ext.ContextTypes.DEFAULT_TYPE)
- terminal_commands.setup_terminal_handlers(application)[מקור]
Register terminal conversation handlers and commands (disabled on Render).
- פרמטרים:
application (telegram.ext.Application)
Autocomplete Manager
מנהל אוטו-השלמה לשמות קבצים ותגיות Autocomplete Manager for File Names and Tags
- class autocomplete_manager.AutocompleteManager[מקור]
Bases:
object
מנהל אוטו-השלמה חכם
- __init__()[מקור]
- get_user_filenames(user_id)[מקור]
קבלת כל שמות הקבצים של משתמש לאוטו-השלמה
- get_user_tags(user_id)[מקור]
קבלת כל התגיות של משתמש לאוטו-השלמה
- suggest_filenames(user_id, partial_name, limit=5)[מקור]
הצעות שמות קבצים בהתבסס על קלט חלקי
- suggest_tags(user_id, partial_tag, limit=5)[מקור]
הצעות תגיות בהתבסס על קלט חלקי
- get_smart_suggestions(user_id, input_text, suggestion_type='auto')[מקור]
הצעות חכמות בהתבסס על הקשר
- get_recent_files(user_id, limit=5)[מקור]
קבלת שמות הקבצים שנערכו לאחרונה