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