DRY pass #2, batch 8: inkwell.notes stops re-exporting its siblings (#5372)

notes/__init__ re-exported 17 names so it could stand in for the old single
module. Only sync.py and test_notes.py used that, and each now imports from
the module that defines the name; __all__ and the nine imports __init__ held
only for it go. sync.py also drops sa_delete, func, live and NoteLabel,
unused since 8eff5f6 (#5382). The integration test's patch on
inkwell.notes.schedule_unfurls stays: the routes call it from there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 15:08:24 -04:00
co-authored by Claude Opus 5.5
parent 7392ca2e97
commit 45c286a71f
3 changed files with 20 additions and 58 deletions
+1 -36
View File
@@ -4,10 +4,7 @@ The bulk of the shared logic lives in cohesive sibling modules — serialization
(`serialize`), #tags (`tags`), recurring reminders (`recurrence`),
small text/query helpers (`helpers`), and export/import (`import_export`). The
route handlers themselves stay here so blueprint registration is in one place, and
`bp` is defined in `_bp` so every module can import it without a cycle.
External callers import from `inkwell.notes` (see `__all__`); those names are
re-exported here so the package is a drop-in replacement for the old module."""
`bp` is defined in `_bp` so every module can import it without a cycle."""
from __future__ import annotations
import io
@@ -20,7 +17,6 @@ from quart import Response, g, jsonify, request, send_file
from sqlalchemy import func, literal_column, select
from ..auth import login_required
from ..colors import normalize_color
from ..common import coerce_bool, iso, parse_dt
from ..config import Config
from ..db import session_scope
@@ -41,15 +37,12 @@ from .body import write_body
from .helpers import (
ALLOWED_IMAGE_MIMES,
VALID_FILTERS,
_attachment_ext,
_get_editable,
_get_owned,
_get_visible,
_header_filename,
_safe_filename,
_slugify,
apply_filter,
derive_display_title,
is_empty_note,
note_visible,
store_attachment,
@@ -62,40 +55,12 @@ from .import_export import (
_ImportTooLarge,
_OverStorageLimit,
_create_imported_note,
_keep_spec,
_native_spec,
_note_markdown,
_read_import_specs,
_usec_to_dt,
)
from .tags import (
_lift_and_reconcile_tags,
parse_tags,
)
from .recurrence import REMINDER_RECURRENCES, next_occurrence, normalize_recurrence
from .serialize import _labels_for_notes, _serialize_note, _serialize_notes
__all__ = [
"bp",
"derive_display_title",
"is_empty_note",
"parse_list_items",
"parse_tags",
"normalize_color",
"normalize_recurrence",
"next_occurrence",
"_lift_and_reconcile_tags",
"_serialize_notes",
"_safe_filename",
"_attachment_ext",
"_header_filename",
"_slugify",
"_keep_spec",
"_native_spec",
"_usec_to_dt",
]
@bp.get("")
@login_required
async def list_notes():
+6 -9
View File
@@ -18,26 +18,23 @@ import uuid
from datetime import datetime, timezone
from quart import Blueprint, g, jsonify, request
from sqlalchemy import delete as sa_delete
from sqlalchemy import func, select
from sqlalchemy import select
from .auth import login_required
from .colors import normalize_color
from .common import iso, parse_dt
from .db import session_scope
from .labeling import live, named, reconcile_manual_labels, resolve_owned_label_ids, tombstone_label
from .models.label import Label, NoteLabel
from .labeling import named, reconcile_manual_labels, resolve_owned_label_ids, tombstone_label
from .models.label import Label
from .models.note import Note
from .models.note_attachment import NoteAttachment
from .models.note_link_preview import NoteLinkPreview
from .models.share_revocation import ShareRevocation
from .note_state import OWN_FIELDS, join_state, revision_for, set_own_state
from .notes import (
_serialize_notes,
normalize_color,
normalize_recurrence,
)
from .notes.body import write_body
from .notes.helpers import _get_editable, _get_visible, note_visible, store_attachment
from .notes.recurrence import normalize_recurrence
from .notes.serialize import _serialize_notes
from .responses import json_error, not_found, parse_uuid
from .retention import purge_note
from .serialize import serialize_label_sync
+13 -13
View File
@@ -11,27 +11,27 @@ from inkwell.colors import NOTE_COLORS
from inkwell.models.note import Note
from inkwell.notes.checklist import append_item, parse_items, set_item_checked, strip_marker
from inkwell.unfurl_queue import detect_urls
from inkwell.notes import (
_ImportBudget,
from inkwell.colors import normalize_color
from inkwell.notes.helpers import (
_attachment_ext,
_header_filename,
_safe_filename,
_slugify,
derive_display_title,
is_empty_note,
parse_list_items,
)
from inkwell.notes.import_export import (
NATIVE_APP_MARKERS,
_ImportBudget,
_keep_spec,
_native_spec,
_note_markdown,
_read_import_specs,
_safe_filename,
_slugify,
_usec_to_dt,
derive_display_title,
is_empty_note,
next_occurrence,
normalize_color,
normalize_recurrence,
parse_list_items,
parse_tags,
)
from inkwell.notes.import_export import NATIVE_APP_MARKERS
from inkwell.notes.tags import split_body_tags
from inkwell.notes.recurrence import next_occurrence, normalize_recurrence
from inkwell.notes.tags import parse_tags, split_body_tags
@pytest.fixture