Skip to content

Commit 01f44c7

Browse files
committed
refactor(sharing): move import/export modules into sharing package
- Consolidate exporter.py, importer.py, importer_io.py, and url_importer.py under `cue_lib/sharing/` - Add `cue_lib/sharing/__init__.py` to load submodules and re-export `CueImportManager`, `CueExportManager`, and `CueUrlImporter` - Update all internal imports, type stubs, comments, and tests to use the new package paths - Keep the public manager API unchanged No behavioral changes; this is a pure structural refactor.
1 parent 8e27cfc commit 01f44c7

20 files changed

Lines changed: 53 additions & 33 deletions

cue_lib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
from cue_lib import copy_paste
4545
from cue_lib import markers
4646
from cue_lib import trigger
47+
from cue_lib import sharing
4748
from cue_lib import runtime
4849
from cue_lib.ui import dialogs, displayables, icons, popper

cue_lib/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class CueContextType(object):
212212
CUE_IMPORT_MANIFEST_NAME = "manifest.json"
213213

214214
# Characters kept from a SHA1 hex digest for file naming. Shared by
215-
# db._preset_path and importer_io._cue_preset_files -- keep in sync.
215+
# db._preset_path and sharing.importer_io._cue_preset_files -- keep in sync.
216216
CUE_HASH_TRUNC_LEN = 8
217217

218218
# Canonical checkbox order and labels for the 5 categories. Labels are

cue_lib/cue_z.rpy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,7 @@ init -900 python:
199199
CueConfirmDialog, CueMergeDialog, CueIntensityGroupDialog, CueDialogs,
200200
)
201201
from cue_lib.intensity import CueIntensityManager
202-
from cue_lib.importer import CueImportManager
203-
from cue_lib.exporter import CueExportManager
204-
from cue_lib.url_importer import CueUrlImporter
202+
from cue_lib.sharing import CueImportManager, CueExportManager, CueUrlImporter
205203
from cue_lib.settings import CueSettings
206204
from cue_lib.backup import CueBackupManager
207205
from cue_lib.db import CueDatabase

cue_lib/sharing/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# cue_lib/sharing -- the import/export side of the mod.
3+
#
4+
# exporter.py builds a .zip import from this game's data; importer.py scans
5+
# imports/*.zip and activates one as a root-swap overlay or merges categories;
6+
# importer_io.py owns the pure .zip format logic + filesystem ops; and
7+
# url_importer.py downloads a .zip into the drop zone. The package re-exports
8+
# the manager API so consumers keep importing from the package.
9+
#
10+
# Submodules are imported in dependency order (leaf-first) -- Ren'Py's
11+
# import_all() discovers modules through the package namespace, so they must
12+
# be loaded even when only the package name is imported.
13+
14+
# pyright: reportUnusedImport=false
15+
16+
from cue_lib.sharing import importer_io
17+
from cue_lib.sharing import exporter
18+
from cue_lib.sharing import importer
19+
from cue_lib.sharing import url_importer
20+
21+
from cue_lib.sharing.exporter import CueExportManager
22+
from cue_lib.sharing.importer import CueImportManager
23+
from cue_lib.sharing.url_importer import CueUrlImporter
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import threading
1414

1515
from cue_lib.constants import CUE_IMPORT_CATEGORY_ORDER, CueExportFileTypes, CueExportScope
16-
from cue_lib.importer_io import (
16+
from cue_lib.sharing.importer_io import (
1717
_cue_build_import_zip,
1818
_cue_enumerate_import_files,
1919
_cue_replay_assets,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Type stub for cue_lib.exporter
1+
# Type stub for cue_lib.sharing.exporter
22
from typing import Any, Dict, List, Set
33

44
class CueExportManager(object):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from cue_lib.constants import CUE_IMPORT_MANIFEST_NAME, CueImportMatch
1818
from cue_lib.db import _atomic_json_write
19-
from cue_lib.importer_io import (
19+
from cue_lib.sharing.importer_io import (
2020
_cue_extract_import_zip,
2121
_cue_filter_contents,
2222
_cue_load_manifest,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Type stub for cue_lib.importer
1+
# Type stub for cue_lib.sharing.importer
22
from typing import Any, Callable, Dict, List, Optional, Tuple
33

44
def _imp_file_names(imp_dir: str) -> set: ...
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Type stub for cue_lib.importer_io
1+
# Type stub for cue_lib.sharing.importer_io
22
from typing import Any, Dict, Final, List, Optional, Set, Tuple
33

44
CUE_IMPORT_FORMAT_VERSION: Final = 1

0 commit comments

Comments
 (0)