Skip to content

Commit

Permalink
Update code for linting
Browse files Browse the repository at this point in the history
Signed-off-by: selfkilla666 <[email protected]>
  • Loading branch information
selfkilla666 committed Feb 17, 2024
1 parent 513fbcd commit 23fa034
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion glyphify/classes/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def __init__(
eel.init(str(EEL_DIRECTORY))

# Initialize Discord RPC activity
self.discord_rpc = GlyphifyDiscordRPC(logger = self.logger)
self.discord_rpc = GlyphifyDiscordRPC(logger=self.logger)

self.APPLICATION_TITLE = self.application_title_with_emoji

Expand Down
8 changes: 5 additions & 3 deletions glyphify/classes/discord_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from discordrpc import RPC as DiscordRPCActivity # type: ignore[import-untyped]
from discordrpc import button
from discordrpc.exceptions import Error
from discordrpc.exceptions import Error # type: ignore[import-untyped]

if TYPE_CHECKING:
from loguru import Logger
Expand Down Expand Up @@ -48,7 +48,9 @@ class GlyphifyDiscordRPC:
rpc: DiscordRPCActivity
buttons: list[dict[str, str]]

def __init__(self, *, application_id: Optional[int] = None, logger: Optional[Logger] = None) -> None:
def __init__(
self, *, application_id: Optional[int] = None, logger: Optional[Logger] = None
) -> None:
"""
Initialize the GlyphifyDiscordRPC instance.
Expand Down Expand Up @@ -108,7 +110,7 @@ def setup(self) -> None:

if self.logger is not None:
self.logger.info("Discord RPC activity is set up!")
except:
except Exception:
if self.logger is not None:
self.logger.error("Unable to initialize Discord RPC")

Expand Down
9 changes: 4 additions & 5 deletions glyphify/services/fonts/auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@


class AutoFontProcessor(BaseFontProcessor):

NAME: str = "auto"
MAP: FontMap

def __init__(self, input_text: str, NAME: str, MAP: FontMap, *args, **kwargs) -> None:

def __init__(
self, input_text: str, NAME: str, MAP: FontMap, *args, **kwargs
) -> None:
self.NAME: str = NAME
self.MAP: FontMap = MAP

super(AutoFontProcessor, self).__init__(input_text, *args, **kwargs)

def _process(self, text: Optional[str] = None, *args, **kwargs) -> str:

if text:
self.input_text = text

Expand All @@ -37,4 +36,4 @@ def _process(self, text: Optional[str] = None, *args, **kwargs) -> str:
char = self.MAP["output"][self.MAP["input"].index(char)]
result += char

return result
return result
10 changes: 5 additions & 5 deletions glyphify/services/fonts/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@


class JsonBasedFontProcessor(AutoFontProcessor):

NAME: str = "json-based"
MAP: FontMap

def __init__(self, input_text: str, NAME: str, json_path: Path, *args, **kwargs) -> None:

def __init__(
self, input_text: str, NAME: str, json_path: Path, *args, **kwargs
) -> None:
json: dict = load_json_file(json_path)

self.NAME: str = json.get("name") or NAME
self.MAP: FontMap = FontMap(input=json.get("input"), output=json.get("output")) # type: ignore[typeddict-item]
self.MAP: FontMap = FontMap(input=json.get("input"), output=json.get("output")) # type: ignore[typeddict-item]

super(JsonBasedFontProcessor, self).__init__(input_text, *args, **kwargs)
super(JsonBasedFontProcessor, self).__init__(input_text, *args, **kwargs)
2 changes: 1 addition & 1 deletion glyphify/services/fonts/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

class FontMap(TypedDict):
input: str | list[str]
output: str | list[str]
output: str | list[str]

0 comments on commit 23fa034

Please sign in to comment.