Skip to content

Commit

Permalink
fix: linter issues based on superlinter rules!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Dec 28, 2023
1 parent 1c9790f commit 655df70
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 20 deletions.
9 changes: 4 additions & 5 deletions celery_app/server.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from celery import Celery

from utils.credentials import load_rabbitmq_credentials

rabbit_creds = load_rabbitmq_credentials()
user = rabbit_creds['user']
password = rabbit_creds['password']
host = rabbit_creds['host']
port = rabbit_creds['port']
user = rabbit_creds["user"]
password = rabbit_creds["password"]
host = rabbit_creds["host"]
port = rabbit_creds["port"]

app = Celery("celery_app/tasks", broker=f"pyamqp://{user}:{password}@{host}:{port}//")
app.autodiscover_tasks(["celery_app"])
9 changes: 5 additions & 4 deletions celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
from celery_app.server import app

from utils.credentials import load_rabbitmq_credentials

# TODO: Write tasks that match our requirements


@app.task
def add(x, y):
rabbit_creds = load_rabbitmq_credentials()
username = rabbit_creds['user']
password = rabbit_creds['password']
broker_url = rabbit_creds['host']
port = rabbit_creds['port']
username = rabbit_creds["user"]
password = rabbit_creds["password"]
broker_url = rabbit_creds["host"]
port = rabbit_creds["port"]

res = x + y
job_send(broker_url, port, username, password, res)
Expand Down
4 changes: 2 additions & 2 deletions discord_query.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from llama_index import QueryBundle
from llama_index.vector_stores import ExactMatchFilter, FilterCondition, MetadataFilters
from bot.retrievers.forum_summary_retriever import ForumBasedSummaryRetriever
from bot.retrievers.process_dates import process_dates
from bot.retrievers.utils.load_hyperparams import load_hyperparams
from llama_index import QueryBundle
from llama_index.vector_stores import ExactMatchFilter, FilterCondition, MetadataFilters
from tc_hivemind_backend.embeddings.cohere import CohereEmbedding
from tc_hivemind_backend.pg_vector_access import PGVectorAccess

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_discord_summary_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from unittest import TestCase
from unittest.mock import MagicMock

from bot.retrievers.forum_summary_retriever import ForumBasedSummaryRetriever
from dateutil import parser
from llama_index import Document, MockEmbedding, ServiceContext, VectorStoreIndex
from bot.retrievers.forum_summary_retriever import ForumBasedSummaryRetriever


class TestDiscordSummaryRetriever(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_load_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def test_rabbitmq_envs_values(self):
self.assertIsInstance(rabbitmq_creds["user"], str)
self.assertIsInstance(rabbitmq_creds["password"], str)
self.assertIsInstance(rabbitmq_creds["host"], str)
self.assertIsInstance(rabbitmq_creds["port"], str)
self.assertIsInstance(rabbitmq_creds["port"], str)
2 changes: 1 addition & 1 deletion tests/unit/test_summary_retriever_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from unittest import TestCase
from unittest.mock import MagicMock

from bot.retrievers.summary_retriever_base import BaseSummarySearch
from llama_index import Document, MockEmbedding, ServiceContext, VectorStoreIndex
from llama_index.schema import NodeWithScore
from bot.retrievers.summary_retriever_base import BaseSummarySearch


class TestSummaryRetrieverBase(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion utils/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ def load_rabbitmq_credentials() -> dict[str, str]:
rabbitmq_creds["host"] = os.getenv("RABBIT_HOST", "")
rabbitmq_creds["port"] = os.getenv("RABBIT_PORT", "")

return rabbitmq_creds
return rabbitmq_creds
9 changes: 4 additions & 5 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from tc_messageBroker import RabbitMQ
from tc_messageBroker.rabbit_mq.event import Event
from tc_messageBroker.rabbit_mq.queue import Queue

from utils.credentials import load_rabbitmq_credentials


Expand Down Expand Up @@ -32,9 +31,9 @@ def job_recieve(broker_url, port, username, password):

if __name__ == "__main__":
rabbit_creds = load_rabbitmq_credentials()
username = rabbit_creds['user']
password = rabbit_creds['password']
broker_url = rabbit_creds['host']
port = rabbit_creds['port']
username = rabbit_creds["user"]
password = rabbit_creds["password"]
broker_url = rabbit_creds["host"]
port = rabbit_creds["port"]

job_recieve(broker_url, port, username, password)

0 comments on commit 655df70

Please sign in to comment.