Skip to content

Commit

Permalink
remove unused imports
Browse files Browse the repository at this point in the history
clean up some docstrings
  • Loading branch information
w4ffl35 committed Oct 3, 2024
1 parent 1fc6c70 commit 5f72f6b
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 24 deletions.
4 changes: 1 addition & 3 deletions src/airunner/aihandler/llm/agent/actions/bash_execute.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import subprocess


def bash_execute(self, command: str) -> str:
def bash_execute(command: str) -> str:
"""
Executes a bash command.
Expand All @@ -12,11 +12,9 @@ def bash_execute(self, command: str) -> str:
:param command: str
:return: str
"""
self.logger.debug(f"Executing bash command {command}")
try:
command = command.split(" ")
result = subprocess.check_output(command, shell=False)
return result.decode("utf-8")
except Exception as e:
self.logger.error(e)
return str(e)
2 changes: 1 addition & 1 deletion src/airunner/aihandler/models/settings_db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def get_chatbot_by_id(self, chatbot_id) -> Chatbot:
def create_conversation(self):
with self.get_db_session() as session:
conversation = Conversation(
timestamp=datetime.datetime.utcnow(),
timestamp=datetime.datetime.now(datetime.timezone.utc),
title=""
)
session.add(conversation)
Expand Down
6 changes: 3 additions & 3 deletions src/airunner/aihandler/models/settings_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ class WindowSettings(Base):
class Conversation(Base):
__tablename__ = 'conversations'
id = Column(Integer, primary_key=True, autoincrement=True)
timestamp = Column(DateTime, default=datetime.datetime.utcnow)
timestamp = Column(DateTime, default=datetime.datetime.now(datetime.timezone.utc))
title = Column(String, nullable=True) # New column added
messages = relationship("Message", back_populates="conversation", cascade="all, delete-orphan")

Expand All @@ -562,7 +562,7 @@ class Message(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
role = Column(String, nullable=False)
content = Column(String, nullable=False)
timestamp = Column(DateTime, default=datetime.datetime.utcnow)
timestamp = Column(DateTime, default=datetime.datetime.now(datetime.timezone.utc))
conversation_id = Column(Integer, ForeignKey('conversations.id'))
conversation = relationship("Conversation", back_populates="messages")
name = Column(String, nullable=True) # New column added
Expand All @@ -576,7 +576,7 @@ class Summary(Base):
__tablename__ = 'summaries'
id = Column(Integer, primary_key=True, autoincrement=True)
content = Column(String, nullable=False)
timestamp = Column(DateTime, default=datetime.datetime.utcnow)
timestamp = Column(DateTime, default=datetime.datetime.now(datetime.timezone.utc))
conversation_id = Column(Integer, ForeignKey('conversations.id'))
conversation = relationship("Conversation", back_populates="summaries")

Expand Down
1 change: 1 addition & 0 deletions src/airunner/aihandler/stt/stt_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def run(
"""
Run the model on the given inputs.
:param inputs: str - The transcription of the audio data.
:param role: LLMChatRole - The role of the speaker.
:return:
"""
# Extract the tensor from the BatchFeature object
Expand Down
3 changes: 1 addition & 2 deletions src/airunner/app_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
QObject, QTimer,
)
from PySide6.QtGui import (
Qt,
QWindow, QPixmap, QGuiApplication
Qt, QPixmap, QGuiApplication
)
from PySide6.QtWidgets import (
QApplication, QSplashScreen,
Expand Down
2 changes: 1 addition & 1 deletion src/airunner/widgets/canvas/canvas_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ def do_draw(
self.ui.canvas_container_size = self.ui.canvas_container.viewport().size()

def save_image(self, image_path, image=None):
self.save_image(image_path, image, self.scene.items())
self.save_image(image_path, image)
2 changes: 1 addition & 1 deletion src/airunner/widgets/canvas/custom_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def add_image_to_scene(
):
"""
Adds a given image to the scene
:param image_data: dict containing the image to be added to the scene
:param image: Image object to add to the scene
:param is_outpaint: bool indicating if the image is an outpaint
:param outpaint_box_rect: QPoint indicating the root point of the image
:param border_size: int indicating the size of the border
Expand Down
1 change: 1 addition & 0 deletions src/airunner/widgets/canvas/custom_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def snap_to_grid(self, event: QMouseEvent, use_floor: bool = True) -> QMouseEven
This is used to adjust the selection tool to the grid
in real time during rubberband mode.
:param event:
:param use_floor:
:return:
"""
if self.current_tool is CanvasToolName.SELECTION:
Expand Down
4 changes: 0 additions & 4 deletions src/airunner/widgets/image/image_panel_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ def load_files(self):
def display_thumbnails(self):
"""
Display thumbnails of images from the sorted_files list within the specified range.
Args:
start (int): The starting index of the range.
end (int): The ending index of the range.
"""
for file in self.sorted_files[self.start:self.end]:
if file.endswith(".png"):
Expand Down
6 changes: 3 additions & 3 deletions src/airunner/windows/download_wizard/download_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def run(self):
# repo_type=repo_type
# )
self.hf_downloader.download_model(
path=model["path"],
file_name=filename,
callback=self.progress_updated.emit
requested_path=model["path"],
requested_file_name=filename,
requested_callback=self.progress_updated.emit
)
else:
print("Skipping download for model with no files {}".format(model["name"]))
Expand Down
1 change: 0 additions & 1 deletion src/airunner/windows/main/ai_model_mixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List

from airunner.aihandler.models.settings_models import AIModels
from airunner.enums import SignalCode


Expand Down
2 changes: 1 addition & 1 deletion src/airunner/windows/main/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def on_bash_execute_signal(self, data: dict) -> str:
"""
Takes a message from the LLM and strips bash commands from it.
Passes bash command to the bash_execute function.
:param message:
:param data: dict
:return:
"""
args = data["args"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from PySide6.QtCore import Slot

from airunner.windows.setup_wizard.user_agreement.agreement_page import AgreementPage
from airunner.windows.setup_wizard.ai_runner_license.templates.airunner_license_ui import Ui_airunner_license

Expand Down
4 changes: 2 additions & 2 deletions src/airunner/workers/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import queue
import threading

from PySide6.QtCore import Signal, QThread, QSettings, QObject
from PySide6.QtCore import Signal, QThread, QObject

from airunner.enums import QueueType, SignalCode, WorkerState
from airunner.aihandler.logger import Logger
from airunner.mediator_mixin import MediatorMixin
from airunner.settings import SLEEP_TIME_IN_MS, ORGANIZATION, APPLICATION_NAME
from airunner.settings import SLEEP_TIME_IN_MS
from airunner.windows.main.settings_mixin import SettingsMixin


Expand Down

0 comments on commit 5f72f6b

Please sign in to comment.