mirror of
https://github.com/mruwnik/memory.git
synced 2025-06-08 13:24:41 +02:00
fix ruff
This commit is contained in:
parent
8cfaeaea72
commit
29a2a7ba3a
26
.github/workflows/ci.yml
vendored
Normal file
26
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.11'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install .[all]
|
||||
pip install ruff==0.11.10 pylint
|
||||
- name: Run linters
|
||||
run: |
|
||||
ruff check .
|
||||
pylint $(git ls-files '*.py')
|
||||
- name: Run tests
|
||||
run: pytest -vv
|
@ -10,7 +10,6 @@ from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "d292d48ec74e"
|
||||
|
@ -93,7 +93,7 @@ def initialize_collections(
|
||||
if collections is None:
|
||||
collections = ALL_COLLECTIONS
|
||||
|
||||
logger.info(f"Initializing collections:")
|
||||
logger.info("Initializing collections:")
|
||||
for name, params in collections.items():
|
||||
logger.info(f" - {name}")
|
||||
ensure_collection_exists(
|
||||
|
@ -1,9 +1,8 @@
|
||||
import textwrap
|
||||
from memory.common.parsers.comics import extract_smbc, extract_xkcd
|
||||
import pytest
|
||||
from unittest.mock import patch, Mock
|
||||
import requests
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from memory.common.parsers.comics import extract_smbc, extract_xkcd
|
||||
|
||||
MOCK_SMBC_HTML = """
|
||||
<!DOCTYPE html>
|
||||
|
@ -5,7 +5,7 @@ import email.mime.base
|
||||
|
||||
from datetime import datetime
|
||||
from email.utils import formatdate
|
||||
from unittest.mock import ANY, patch
|
||||
from unittest.mock import ANY
|
||||
import pytest
|
||||
from memory.common.parsers.email import (
|
||||
compute_message_hash,
|
||||
@ -17,9 +17,10 @@ from memory.common.parsers.email import (
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Use a simple counter to generate unique message IDs without calling make_msgid
|
||||
_msg_id_counter = 0
|
||||
|
||||
|
||||
def _generate_test_message_id():
|
||||
"""Generate a simple message ID for testing without expensive calls"""
|
||||
global _msg_id_counter
|
||||
@ -248,8 +249,8 @@ def test_parse_simple_email():
|
||||
"body": "Test body content\n",
|
||||
"attachments": [],
|
||||
"sent_at": ANY,
|
||||
"hash": b'\xed\xa0\x9b\xd4\t4\x06\xb9l\xa4\xb3*\xe4NpZ\x19\xc2\x9b\x87'
|
||||
+ b'\xa6\x12\r\x7fS\xb6\xf1\xbe\x95\x9c\x99\xf1',
|
||||
"hash": b"\xed\xa0\x9b\xd4\t4\x06\xb9l\xa4\xb3*\xe4NpZ\x19\xc2\x9b\x87"
|
||||
+ b"\xa6\x12\r\x7fS\xb6\xf1\xbe\x95\x9c\x99\xf1",
|
||||
}
|
||||
assert abs(result["sent_at"].timestamp() - test_date.timestamp()) < 86400
|
||||
|
||||
|
@ -8,7 +8,6 @@ from memory.common.extract import (
|
||||
as_file,
|
||||
extract_text,
|
||||
extract_content,
|
||||
Page,
|
||||
doc_to_images,
|
||||
extract_image,
|
||||
docx_to_pdf,
|
||||
|
@ -1,6 +1,4 @@
|
||||
from unittest import mock
|
||||
import pytest
|
||||
from datetime import datetime, timedelta
|
||||
from unittest.mock import patch
|
||||
from memory.common.db.models import (
|
||||
EmailAccount,
|
||||
|
@ -1,16 +1,10 @@
|
||||
import email
|
||||
import email.mime.multipart
|
||||
import email.mime.text
|
||||
import email.mime.base
|
||||
import base64
|
||||
import pathlib
|
||||
|
||||
from datetime import datetime
|
||||
from email.utils import formatdate
|
||||
from unittest.mock import ANY, MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
import pytest
|
||||
from memory.common.db.models import (
|
||||
SourceItem,
|
||||
MailMessage,
|
||||
EmailAttachment,
|
||||
EmailAccount,
|
||||
|
Loading…
x
Reference in New Issue
Block a user