forked from retoor/devplacepy
refactor: split database.py into package (ref.md 3.2)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,230 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from .core import dataset, logging, Path, or_, defaultdict, datetime, timedelta, timezone, TTLCache, DATABASE_URL, DEFAULT_CORRECTION_PROMPT, DEFAULT_MODIFIER_PROMPT, INTERNAL_GATEWAY_URL, ensure_data_dirs, logger, db
|
||||
from .core import refresh_snapshot, _local_cache_versions, _cache_version_cache, _cache_state_ready, _ensure_cache_state, get_cache_version, bump_cache_version, sync_local_cache, _index, _drop_index, _uid_index, get_table, _in_clause, _now_iso
|
||||
from .settings import _settings_cache, get_setting, get_int_setting, set_setting, clear_settings_cache, internal_gateway_key
|
||||
from .users import get_users_by_uids, _admins_cache, invalidate_admins_cache, get_admin_uids, set_user_timezone, get_primary_admin_uid, search_users_by_username
|
||||
from .relations import _relations_cache, get_user_relations, get_blocked_uids, get_muted_uids, get_silenced_uids, invalidate_user_relations
|
||||
from .pagination import PAGE_SIZE, paginate, interleave_by_author, paginate_diverse, get_user_post_count, build_pagination
|
||||
from .soft_delete import SOFT_DELETE_TABLES, ensure_soft_delete_columns, soft_delete, soft_delete_in, restore, purge, list_deleted, count_deleted, restore_event, purge_event
|
||||
from .engagement import _comment_count_cache, get_comment_counts_by_post_uids, get_post_counts_by_user_uids, get_vote_counts, get_user_votes, get_reactions_by_targets, get_user_bookmarks, get_polls_by_post_uids, get_poll_for_post
|
||||
from .usage import _add_usage, _get_usage, add_correction_usage, get_correction_usage, add_modifier_usage, get_modifier_usage, NEWS_USAGE_KEY, add_news_usage, get_news_usage, ISSUE_USAGE_KEY, add_issue_usage, get_issue_usage, SEO_USAGE_KEY, add_seo_usage, get_seo_usage
|
||||
from .seo_meta import SEO_META_TYPES, get_seo_metadata, get_seo_metadata_batch, has_fresh_seo_metadata, upsert_seo_metadata, mark_seo_metadata_stale
|
||||
from .activity import record_activity, record_unique_activity, get_user_activity, _activity_cache, _ACTIVITY_TABLES, get_activity_calendar, _activity_level, get_first_activity_date, HEATMAP_WEEKS, get_activity_heatmap, get_activity_months, get_streaks
|
||||
from .customization import CUSTOMIZATION_GLOBAL_SCOPE, CUSTOMIZATION_LANGS, _customizations_cache, _customization_key, CUSTOMIZATION_PREF_COLUMNS, get_customization_prefs, set_customization_pref, get_custom_overrides, get_custom_override, list_custom_overrides, set_custom_override, delete_custom_override
|
||||
from .email import EMAIL_ACCOUNT_DEFAULTS, list_email_accounts, get_email_account, set_email_account, delete_email_account
|
||||
from .notifications import NOTIFICATION_TYPES, NOTIFICATION_CHANNELS, _NOTIFICATION_CHANNEL_COLUMNS, _NOTIFICATION_CHANNEL_DEFAULTS, _NOTIFICATION_TYPE_KEYS, _notification_prefs_cache, _notification_default, get_notification_default, set_notification_default, _notification_overrides, notification_enabled, get_notification_prefs, set_notification_pref, reset_notification_prefs, mark_notifications_read_by_target
|
||||
from .forks import record_fork, get_fork_parent, count_forks, soft_delete_fork_relations, delete_fork_relations
|
||||
from .follows import get_follow_counts, get_follow_list, get_following_among
|
||||
from .deepsearch import _ds_now, create_deepsearch_session, update_deepsearch_session, get_deepsearch_session, add_deepsearch_message, get_deepsearch_messages, get_cached_deepsearch_url, upsert_deepsearch_url_cache
|
||||
from .ranking import VOTABLE_TARGETS, STAR_TARGETS, _authors_cache, _ranked_authors, _rank_map, get_top_authors, get_leaderboard, get_user_rank, get_user_stars, update_target_stars, soft_delete_engagement, delete_engagement, get_target_owner_uid
|
||||
from .comments import _drop_blocked, _build_comment_items, load_comments, get_recent_comments_by_target_uids, get_recent_comments_by_post_uids, load_comments_by_target_uids
|
||||
from .content import resolve_by_slug, resolve_object_url, get_uids_by_username_match, text_search_clause, get_daily_topic, get_featured_news
|
||||
from .attachments_data import get_attachments, get_attachments_by_type, get_news_images_by_uids, delete_attachment_record, delete_attachments, _delete_attachment_file, get_user_media, get_deleted_media
|
||||
from .stats import _stats_cache, get_site_stats, _analytics_cache, get_platform_analytics, _gist_languages_cache, get_gist_languages
|
||||
from .schema import BUG_TABLE_RENAMES, migrate_bug_tables_to_issue_tables, init_db, _refresh_query_planner_stats, OLD_GATEWAY_URL, migrate_ai_gateway_settings, backfill_api_keys, _backfill_gamification
|
||||
|
||||
__all__ = [
|
||||
"dataset",
|
||||
"logging",
|
||||
"Path",
|
||||
"or_",
|
||||
"defaultdict",
|
||||
"datetime",
|
||||
"timedelta",
|
||||
"timezone",
|
||||
"TTLCache",
|
||||
"DATABASE_URL",
|
||||
"DEFAULT_CORRECTION_PROMPT",
|
||||
"DEFAULT_MODIFIER_PROMPT",
|
||||
"INTERNAL_GATEWAY_URL",
|
||||
"ensure_data_dirs",
|
||||
"logger",
|
||||
"db",
|
||||
"refresh_snapshot",
|
||||
"_local_cache_versions",
|
||||
"_cache_version_cache",
|
||||
"_cache_state_ready",
|
||||
"_ensure_cache_state",
|
||||
"get_cache_version",
|
||||
"bump_cache_version",
|
||||
"sync_local_cache",
|
||||
"_index",
|
||||
"_drop_index",
|
||||
"_uid_index",
|
||||
"get_table",
|
||||
"_in_clause",
|
||||
"_now_iso",
|
||||
"_settings_cache",
|
||||
"get_setting",
|
||||
"get_int_setting",
|
||||
"set_setting",
|
||||
"clear_settings_cache",
|
||||
"internal_gateway_key",
|
||||
"get_users_by_uids",
|
||||
"_admins_cache",
|
||||
"invalidate_admins_cache",
|
||||
"get_admin_uids",
|
||||
"set_user_timezone",
|
||||
"get_primary_admin_uid",
|
||||
"search_users_by_username",
|
||||
"_relations_cache",
|
||||
"get_user_relations",
|
||||
"get_blocked_uids",
|
||||
"get_muted_uids",
|
||||
"get_silenced_uids",
|
||||
"invalidate_user_relations",
|
||||
"PAGE_SIZE",
|
||||
"paginate",
|
||||
"interleave_by_author",
|
||||
"paginate_diverse",
|
||||
"get_user_post_count",
|
||||
"build_pagination",
|
||||
"SOFT_DELETE_TABLES",
|
||||
"ensure_soft_delete_columns",
|
||||
"soft_delete",
|
||||
"soft_delete_in",
|
||||
"restore",
|
||||
"purge",
|
||||
"list_deleted",
|
||||
"count_deleted",
|
||||
"restore_event",
|
||||
"purge_event",
|
||||
"_comment_count_cache",
|
||||
"get_comment_counts_by_post_uids",
|
||||
"get_post_counts_by_user_uids",
|
||||
"get_vote_counts",
|
||||
"get_user_votes",
|
||||
"get_reactions_by_targets",
|
||||
"get_user_bookmarks",
|
||||
"get_polls_by_post_uids",
|
||||
"get_poll_for_post",
|
||||
"_add_usage",
|
||||
"_get_usage",
|
||||
"add_correction_usage",
|
||||
"get_correction_usage",
|
||||
"add_modifier_usage",
|
||||
"get_modifier_usage",
|
||||
"NEWS_USAGE_KEY",
|
||||
"add_news_usage",
|
||||
"get_news_usage",
|
||||
"ISSUE_USAGE_KEY",
|
||||
"add_issue_usage",
|
||||
"get_issue_usage",
|
||||
"SEO_USAGE_KEY",
|
||||
"add_seo_usage",
|
||||
"get_seo_usage",
|
||||
"SEO_META_TYPES",
|
||||
"get_seo_metadata",
|
||||
"get_seo_metadata_batch",
|
||||
"has_fresh_seo_metadata",
|
||||
"upsert_seo_metadata",
|
||||
"mark_seo_metadata_stale",
|
||||
"record_activity",
|
||||
"record_unique_activity",
|
||||
"get_user_activity",
|
||||
"_activity_cache",
|
||||
"_ACTIVITY_TABLES",
|
||||
"get_activity_calendar",
|
||||
"_activity_level",
|
||||
"get_first_activity_date",
|
||||
"HEATMAP_WEEKS",
|
||||
"get_activity_heatmap",
|
||||
"get_activity_months",
|
||||
"get_streaks",
|
||||
"CUSTOMIZATION_GLOBAL_SCOPE",
|
||||
"CUSTOMIZATION_LANGS",
|
||||
"_customizations_cache",
|
||||
"_customization_key",
|
||||
"CUSTOMIZATION_PREF_COLUMNS",
|
||||
"get_customization_prefs",
|
||||
"set_customization_pref",
|
||||
"get_custom_overrides",
|
||||
"get_custom_override",
|
||||
"list_custom_overrides",
|
||||
"set_custom_override",
|
||||
"delete_custom_override",
|
||||
"EMAIL_ACCOUNT_DEFAULTS",
|
||||
"list_email_accounts",
|
||||
"get_email_account",
|
||||
"set_email_account",
|
||||
"delete_email_account",
|
||||
"NOTIFICATION_TYPES",
|
||||
"NOTIFICATION_CHANNELS",
|
||||
"_NOTIFICATION_CHANNEL_COLUMNS",
|
||||
"_NOTIFICATION_CHANNEL_DEFAULTS",
|
||||
"_NOTIFICATION_TYPE_KEYS",
|
||||
"_notification_prefs_cache",
|
||||
"_notification_default",
|
||||
"get_notification_default",
|
||||
"set_notification_default",
|
||||
"_notification_overrides",
|
||||
"notification_enabled",
|
||||
"get_notification_prefs",
|
||||
"set_notification_pref",
|
||||
"reset_notification_prefs",
|
||||
"mark_notifications_read_by_target",
|
||||
"record_fork",
|
||||
"get_fork_parent",
|
||||
"count_forks",
|
||||
"soft_delete_fork_relations",
|
||||
"delete_fork_relations",
|
||||
"get_follow_counts",
|
||||
"get_follow_list",
|
||||
"get_following_among",
|
||||
"_ds_now",
|
||||
"create_deepsearch_session",
|
||||
"update_deepsearch_session",
|
||||
"get_deepsearch_session",
|
||||
"add_deepsearch_message",
|
||||
"get_deepsearch_messages",
|
||||
"get_cached_deepsearch_url",
|
||||
"upsert_deepsearch_url_cache",
|
||||
"VOTABLE_TARGETS",
|
||||
"STAR_TARGETS",
|
||||
"_authors_cache",
|
||||
"_ranked_authors",
|
||||
"_rank_map",
|
||||
"get_top_authors",
|
||||
"get_leaderboard",
|
||||
"get_user_rank",
|
||||
"get_user_stars",
|
||||
"update_target_stars",
|
||||
"soft_delete_engagement",
|
||||
"delete_engagement",
|
||||
"get_target_owner_uid",
|
||||
"_drop_blocked",
|
||||
"_build_comment_items",
|
||||
"load_comments",
|
||||
"get_recent_comments_by_target_uids",
|
||||
"get_recent_comments_by_post_uids",
|
||||
"load_comments_by_target_uids",
|
||||
"resolve_by_slug",
|
||||
"resolve_object_url",
|
||||
"get_uids_by_username_match",
|
||||
"text_search_clause",
|
||||
"get_daily_topic",
|
||||
"get_featured_news",
|
||||
"get_attachments",
|
||||
"get_attachments_by_type",
|
||||
"get_news_images_by_uids",
|
||||
"delete_attachment_record",
|
||||
"delete_attachments",
|
||||
"_delete_attachment_file",
|
||||
"get_user_media",
|
||||
"get_deleted_media",
|
||||
"_stats_cache",
|
||||
"get_site_stats",
|
||||
"_analytics_cache",
|
||||
"get_platform_analytics",
|
||||
"_gist_languages_cache",
|
||||
"get_gist_languages",
|
||||
"BUG_TABLE_RENAMES",
|
||||
"migrate_bug_tables_to_issue_tables",
|
||||
"init_db",
|
||||
"_refresh_query_planner_stats",
|
||||
"OLD_GATEWAY_URL",
|
||||
"migrate_ai_gateway_settings",
|
||||
"backfill_api_keys",
|
||||
"_backfill_gamification",
|
||||
]
|
||||
Reference in New Issue
Block a user