mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
flake8 and isort linting
This commit is contained in:
parent
d2d6835d53
commit
ef64100d8f
@ -10,8 +10,8 @@ For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.2/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
from os import environ
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@ -91,16 +91,16 @@ DATABASES = {
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', # noqa: E501
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', # noqa: E501
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', # noqa: E501
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', # noqa: E501
|
||||
},
|
||||
]
|
||||
|
||||
|
@ -14,7 +14,7 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('home.urls')),
|
||||
|
@ -6,18 +6,16 @@ Functionality:
|
||||
"""
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import os
|
||||
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
|
||||
import requests
|
||||
import yt_dlp as youtube_dl
|
||||
|
||||
from home.src.index import YoutubeChannel, index_new_video
|
||||
from home.src.config import AppConfig
|
||||
from home.src.helper import clean_string, DurationConverter, set_message
|
||||
from home.src.helper import DurationConverter, clean_string, set_message
|
||||
from home.src.index import YoutubeChannel, index_new_video
|
||||
|
||||
|
||||
class PendingList:
|
||||
|
@ -10,8 +10,8 @@ import string
|
||||
import subprocess
|
||||
import unicodedata
|
||||
|
||||
import requests
|
||||
import redis
|
||||
import requests
|
||||
|
||||
REDIS_HOST = os.environ.get('REDIS_HOST')
|
||||
|
||||
|
@ -6,19 +6,16 @@ Functionality:
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
import os
|
||||
|
||||
import requests
|
||||
import yt_dlp as youtube_dl
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from home.src.config import AppConfig
|
||||
from home.src.helper import clean_string, DurationConverter
|
||||
from home.src.helper import DurationConverter, clean_string
|
||||
|
||||
|
||||
class YoutubeChannel:
|
||||
|
@ -9,14 +9,11 @@ Functionality:
|
||||
import json
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
from home.src.config import AppConfig
|
||||
|
||||
|
||||
# expected mapping and settings
|
||||
INDEX_CONFIG = [
|
||||
{
|
||||
|
@ -8,28 +8,18 @@ Functionality:
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import shutil
|
||||
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
from math import ceil
|
||||
from time import sleep
|
||||
|
||||
import requests
|
||||
|
||||
from home.src.download import ChannelSubscription, PendingList, VideoDownloader
|
||||
from home.src.config import AppConfig
|
||||
from home.src.index import (
|
||||
YoutubeChannel,
|
||||
YoutubeVideo,
|
||||
index_new_video
|
||||
)
|
||||
from home.src.helper import (
|
||||
get_total_hits,
|
||||
clean_string,
|
||||
set_message,
|
||||
get_message
|
||||
)
|
||||
from home.src.download import ChannelSubscription, PendingList, VideoDownloader
|
||||
from home.src.helper import (clean_string, get_message, get_total_hits,
|
||||
set_message)
|
||||
from home.src.index import YoutubeChannel, YoutubeVideo, index_new_video
|
||||
|
||||
|
||||
class Reindex:
|
||||
@ -430,7 +420,7 @@ class ManualImport:
|
||||
video_file, ext = os.path.splitext(file_name)
|
||||
|
||||
# make sure youtube_id is in filename
|
||||
if not youtube_id in video_file:
|
||||
if youtube_id not in video_file:
|
||||
video_file = f'{video_file}_{youtube_id}'
|
||||
|
||||
# move, convert if needed
|
||||
|
@ -9,14 +9,11 @@ Functionality:
|
||||
import math
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import requests
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from home.src.config import AppConfig
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class SearchHandler:
|
||||
|
@ -7,17 +7,11 @@ Functionality:
|
||||
import os
|
||||
|
||||
from celery import Celery, shared_task
|
||||
|
||||
from home.src.download import (
|
||||
PendingList,
|
||||
ChannelSubscription,
|
||||
VideoDownloader
|
||||
)
|
||||
from home.src.config import AppConfig
|
||||
from home.src.reindex import reindex_old_documents, ManualImport
|
||||
from home.src.index_management import backup_all_indexes
|
||||
from home.src.download import ChannelSubscription, PendingList, VideoDownloader
|
||||
from home.src.helper import get_lock
|
||||
|
||||
from home.src.index_management import backup_all_indexes
|
||||
from home.src.reindex import ManualImport, reindex_old_documents
|
||||
|
||||
CONFIG = AppConfig().config
|
||||
REDIS_HOST = CONFIG['application']['REDIS_HOST']
|
||||
@ -94,6 +88,7 @@ def run_manual_import():
|
||||
if have_lock:
|
||||
my_lock.release()
|
||||
|
||||
|
||||
@shared_task
|
||||
def run_backup():
|
||||
""" called from settings page, dump backup to zip file """
|
||||
|
@ -1,16 +1,8 @@
|
||||
""" all home app urls """
|
||||
|
||||
from django.urls import path
|
||||
|
||||
from home.views import (
|
||||
HomeView,
|
||||
DownloadView,
|
||||
ChannelView,
|
||||
ChannelIdView,
|
||||
VideoView,
|
||||
SettingsView,
|
||||
AboutView
|
||||
)
|
||||
from home.views import (AboutView, ChannelIdView, ChannelView, DownloadView,
|
||||
HomeView, SettingsView, VideoView)
|
||||
|
||||
from . import views
|
||||
|
||||
@ -22,6 +14,9 @@ urlpatterns = [
|
||||
path('process/', views.process, name='process'),
|
||||
path('downloads/progress', views.progress, name='progress'),
|
||||
path('channel/', ChannelView.as_view(), name='channel'),
|
||||
path('channel/<slug:channel_id_detail>/', ChannelIdView.as_view(), name='channel_id'),
|
||||
path(
|
||||
'channel/<slug:channel_id_detail>/',
|
||||
ChannelIdView.as_view(), name='channel_id'
|
||||
),
|
||||
path('video/<slug:video_id>/', VideoView.as_view(), name='video')
|
||||
]
|
||||
|
@ -4,36 +4,23 @@ Functionality:
|
||||
- process post data received from frontend via ajax
|
||||
"""
|
||||
|
||||
import urllib.parse
|
||||
import json
|
||||
|
||||
import urllib.parse
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
|
||||
import requests
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import JsonResponse
|
||||
from django.views import View
|
||||
from django.shortcuts import redirect, render
|
||||
from django.utils.http import urlencode
|
||||
|
||||
from home.src.download import PendingList, ChannelSubscription
|
||||
from home.src.searching import SearchHandler, Pagination
|
||||
from django.views import View
|
||||
from home.src.config import AppConfig
|
||||
from home.src.helper import (
|
||||
process_url_list,
|
||||
get_dl_message,
|
||||
get_message,
|
||||
set_message
|
||||
)
|
||||
from home.tasks import (
|
||||
update_subscribed,
|
||||
download_pending,
|
||||
extrac_dl,
|
||||
download_single,
|
||||
run_manual_import,
|
||||
run_backup
|
||||
)
|
||||
from home.src.download import ChannelSubscription, PendingList
|
||||
from home.src.helper import (get_dl_message, get_message, process_url_list,
|
||||
set_message)
|
||||
from home.src.searching import Pagination, SearchHandler
|
||||
from home.tasks import (download_pending, download_single, extrac_dl,
|
||||
run_backup, run_manual_import, update_subscribed)
|
||||
|
||||
|
||||
class HomeView(View):
|
||||
|
@ -5,6 +5,7 @@ import sys
|
||||
|
||||
|
||||
def main():
|
||||
# pylint: disable=import-outside-toplevel
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
|
||||
try:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
""" check requirements.txt for outdated packages """
|
||||
|
||||
import sys
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
@ -113,5 +113,6 @@ def main():
|
||||
print('cancle update...')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user