Skip to content

Commit

Permalink
chore: tidy codes
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
  • Loading branch information
jfcherng committed Oct 27, 2024
1 parent e618df8 commit 251799b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion boot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def reload_plugin() -> None:
import sys

# remove all previously loaded plugin modules.
# remove all previously loaded plugin modules
prefix = f"{__package__}."
for module_name in tuple(filter(lambda m: m.startswith(prefix) and m != __name__, sys.modules)):
del sys.modules[module_name]
Expand Down
2 changes: 2 additions & 0 deletions plugin/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

assert __package__

PLUGIN_NAME = __package__.partition(".")[0]
2 changes: 1 addition & 1 deletion plugin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def enabled_app_context_menu_sets() -> Generator[AppContextMenuSet, None, None]:


def parse_app_and_target(app_name: str, target_name: str) -> AppContextMenuSet:
if not (app_info := APP_INFOS.get(app_name, None)):
if not (app_info := APP_INFOS.get(app_name)):
raise ValueError

if target_name == "_all_":
Expand Down
4 changes: 2 additions & 2 deletions plugin/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from dataclasses import dataclass
from pathlib import Path
from typing import Literal

import sublime

Expand All @@ -25,11 +26,10 @@ def app_dir(self) -> Path | None:
# convention
if (default := Path(R"C:\Program Files\Sublime Merge")).is_dir():
return default
return None
return None


@dataclass
class MenuTarget:
type: str
type: Literal["file", "directory", "directory_background"]
reg_key: str

0 comments on commit 251799b

Please sign in to comment.