Skip to content

Commit

Permalink
feat: refactor and clean up imports in multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
versun committed Jun 24, 2024
1 parent df6e308 commit 4c42272
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
"""

import os
from django.contrib import admin
from django.urls import path, include, re_path
from django.urls import path, include
from django.conf import settings
from django.views.generic.base import RedirectView
from django.contrib.auth.decorators import login_required
Expand Down
2 changes: 1 addition & 1 deletion core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.conf import settings
from django.shortcuts import render
from django.urls import path
from django.shortcuts import render, redirect
from django.shortcuts import redirect
from django.core.paginator import Paginator
from django.contrib.auth.models import User, Group
from django.urls import reverse
Expand Down
2 changes: 1 addition & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.core.validators import MinValueValidator, MaxValueValidator
from tagulous.models import TagField, SingleTagField
from tagulous.models import SingleTagField


class O_Feed(models.Model):
Expand Down
5 changes: 2 additions & 3 deletions core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from datetime import datetime, timezone
import logging
import os
import re
from pathlib import Path
from time import mktime

Expand All @@ -12,7 +11,7 @@
from django.db import IntegrityError

from huey.contrib.djhuey import HUEY as huey
from huey.contrib.djhuey import on_startup, on_shutdown, task, db_task
from huey.contrib.djhuey import on_startup, db_task

from .models import O_Feed, T_Feed
from translator.models import TranslatorEngine, Translated_Content
Expand All @@ -23,7 +22,7 @@
from bs4 import BeautifulSoup
import mistune
import newspaper
from typing import List, Tuple, Optional
from typing import Optional


# from huey_monitor.models import TaskModel
Expand Down
2 changes: 1 addition & 1 deletion core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json

from django.conf import settings
from django.http import HttpResponse, Http404, StreamingHttpResponse, JsonResponse
from django.http import HttpResponse, StreamingHttpResponse, JsonResponse
from django.utils.encoding import smart_str
from django.views.decorators.cache import cache_page
from django.views.decorators.http import condition
Expand Down
1 change: 0 additions & 1 deletion translator/models/caiyun.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging
from django.db import models
from encrypted_model_fields.fields import EncryptedCharField
from django.utils.translation import gettext_lazy as _


class CaiYunTranslator(TranslatorEngine):
Expand Down
2 changes: 1 addition & 1 deletion translator/models/deeplx.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def validate(self) -> bool:
try:
resp = self.translate("Hello World", "Chinese Simplified")
return resp.get("text") != ""
except Exception as e:
except Exception:
return False

def translate(self, text: str, target_language: str, **kwargs) -> dict:
Expand Down
1 change: 0 additions & 1 deletion translator/models/google_translate_web.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import httpx
from time import sleep
from .base import TranslatorEngine
import logging
Expand Down
2 changes: 1 addition & 1 deletion utils/feed_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# import json

# import xml.dom.minidom
from datetime import datetime, timezone, date, timedelta
from datetime import datetime, timezone, timedelta
from time import mktime

# from dateutil import parser
Expand Down
1 change: 0 additions & 1 deletion utils/text_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from bs4 import Comment
import tiktoken
import html2text
from translator.models import TranslatorEngine
from langdetect import detect

def detect_language(entry):
Expand Down

0 comments on commit 4c42272

Please sign in to comment.