Skip to content

Commit

Permalink
Refactor: Improve import paths and file organization
Browse files Browse the repository at this point in the history
This commit refactors the import paths and file organization for improved clarity and maintainability. It moves the `api` module into a subdirectory and adjusts relative imports accordingly. This helps to better separate concerns and improve the overall structure of the codebase.
  • Loading branch information
RedAtman committed Jul 30, 2024
1 parent 45c9737 commit 47389e7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions _config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def __init_subclass__(cls, **kwargs):

DEBUG: bool = False
TESTING: bool = False
# BASE_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR: str = os.path.abspath(os.path.dirname(__file__))
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
# BASE_DIR: str = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, BASE_DIR)
LOG_DIR: str = os.path.join(BASE_DIR, "logs")
os.makedirs(LOG_DIR, exist_ok=True)
Expand Down
3 changes: 1 addition & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import sublime

from api import Simplenote

from .api import Simplenote
from .utils.decorator import class_property
from .utils.tree.redblacktree import rbtree as RedBlackTree

Expand Down
5 changes: 2 additions & 3 deletions operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

import sublime

from gui import SIMPLENOTE_BASE_DIR, SIMPLENOTE_SETTINGS_FILE, _show_message, open_view, remove_status
from models import Note

from .gui import SIMPLENOTE_BASE_DIR, SIMPLENOTE_SETTINGS_FILE, _show_message, open_view, remove_status
from .models import Note
from .utils.patterns.singleton.base import Singleton


Expand Down
5 changes: 2 additions & 3 deletions simplenote.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
# https://www.sublimetext.com/docs/api_reference.html
import sublime

from gui import close_view, open_view
from models import SIMPLENOTE_NOTES_DIR, Note

from .gui import close_view, open_view
from .models import SIMPLENOTE_NOTES_DIR, Note
from .utils.patterns.singleton.base import Singleton


Expand Down
11 changes: 5 additions & 6 deletions simplenotecommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import sublime
import sublime_plugin

from gui import SIMPLENOTE_PACKAGE_DIR, SIMPLENOTE_SETTINGS_FILE, close_view, open_view, remove_status, show_message
from models import Note
from operations import NoteCreator, NoteDeleter, NotesIndicator, NoteUpdater, OperationManager
from simplenote import clear_orphaned_filepaths, on_note_changed
from .gui import SIMPLENOTE_BASE_DIR, SIMPLENOTE_SETTINGS_FILE, close_view, open_view, remove_status, show_message
from .models import Note
from .operations import NoteCreator, NoteDeleter, NotesIndicator, NoteUpdater, OperationManager
from .simplenote import clear_orphaned_filepaths, on_note_changed


__all__ = [
Expand Down Expand Up @@ -251,8 +251,7 @@ def start():
sync()
SIMPLENOTE_STARTED = True
else:
filepath = os.path.join(SIMPLENOTE_PACKAGE_DIR, SIMPLENOTE_SETTINGS_FILE)
sublime.active_window().open_file(filepath)
sublime.active_window().open_file(os.path.join(SIMPLENOTE_BASE_DIR, SIMPLENOTE_SETTINGS_FILE))
show_message("Simplenote: Please configure username/password")
sublime.set_timeout(remove_status, 2000)
SIMPLENOTE_STARTED = False
Expand Down

0 comments on commit 47389e7

Please sign in to comment.