diff --git a/src/dialogs.py b/src/dialogs.py
index 225aafb..9a4c3c9 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -6,8 +6,8 @@ import os
import logging
from pytube import YouTube
from html2text import html2text
-from . import connection_handler
from gi.repository import Adw, Gtk
+from . import connection_handler
logger = logging.getLogger(__name__)
# CLEAR CHAT | WORKS
@@ -307,8 +307,8 @@ def attach_file_response(self, file_dialog, result):
return
self.attach_file(file.get_path(), file_type)
-def attach_file(self, filter):
- file_dialog = Gtk.FileDialog(default_filter=filter)
+def attach_file(self, file_filter):
+ file_dialog = Gtk.FileDialog(default_filter=file_filter)
file_dialog.open(self, None, lambda file_dialog, result: attach_file_response(self, file_dialog, result))
# YouTube caption | WORKS
diff --git a/src/internal.py b/src/internal.py
index b41e415..2a9bdfe 100644
--- a/src/internal.py
+++ b/src/internal.py
@@ -1,18 +1,21 @@
+# internal.py
+"""
+Handles paths, they can be different if the app is running as a Flatpak
+"""
import os
-app_id = "com.jeffser.Alpaca"
+APP_ID = "com.jeffser.Alpaca"
-in_flatpak = True if os.getenv("FLATPAK_ID") else False
+IN_FLATPAK = bool(os.getenv("FLATPAK_ID"))
def get_xdg_home(env, default):
- if in_flatpak:
+ if IN_FLATPAK:
return os.getenv(env)
- else:
- base = os.getenv(env) or os.path.expanduser(default)
- path = os.path.join(base, app_id)
- if not os.path.exists(path):
- os.makedirs(path)
- return path
+ base = os.getenv(env) or os.path.expanduser(default)
+ path = os.path.join(base, APP_ID)
+ if not os.path.exists(path):
+ os.makedirs(path)
+ return path
data_dir = get_xdg_home("XDG_DATA_HOME", "~/.local/share")
diff --git a/src/local_instance.py b/src/local_instance.py
index 1866f83..7ea3636 100644
--- a/src/local_instance.py
+++ b/src/local_instance.py
@@ -1,5 +1,10 @@
# local_instance.py
-import subprocess, os, threading
+"""
+Handles running, stopping and resetting the integrated Ollama instance
+"""
+import subprocess
+import os
+import threading
from time import sleep
from logging import getLogger
from .internal import data_dir, cache_dir
@@ -39,4 +44,3 @@ def reset():
stop()
sleep(1)
start()
-
diff --git a/src/main.py b/src/main.py
index 8a9cd58..ee4f91c 100644
--- a/src/main.py
+++ b/src/main.py
@@ -16,7 +16,9 @@
# along with this program. If not, see .
#
# SPDX-License-Identifier: GPL-3.0-or-later
-
+"""
+Main script run at launch, handles actions, about dialog and the app itself (not the window)
+"""
import sys
import logging
import gi
diff --git a/src/table_widget.py b/src/table_widget.py
index 20da25a..3bc45fb 100644
--- a/src/table_widget.py
+++ b/src/table_widget.py
@@ -1,3 +1,8 @@
+#table_widget
+"""
+Handles the table widget shown in chat responses
+"""
+
import gi
from gi.repository import Adw
from gi.repository import Gtk, GObject, Gio
diff --git a/src/window.py b/src/window.py
index 68030a2..f4ec393 100644
--- a/src/window.py
+++ b/src/window.py
@@ -16,6 +16,9 @@
# along with this program. If not, see .
#
# SPDX-License-Identifier: GPL-3.0-or-later
+"""
+Handles the main window
+"""
import gi
gi.require_version('GtkSource', '5')