mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Merge pull request #1594 from clinton-hall/quality/flake8
Quality/flake8
This commit is contained in:
commit
627b453d3b
14 changed files with 89 additions and 73 deletions
|
@ -1,8 +1,5 @@
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
import core
|
import core
|
||||||
|
|
|
@ -42,7 +42,8 @@ def auto_fork(section, input_category):
|
||||||
logger.info('Attempting to verify {category} fork'.format
|
logger.info('Attempting to verify {category} fork'.format
|
||||||
(category=input_category))
|
(category=input_category))
|
||||||
url = '{protocol}{host}:{port}{root}/api/rootfolder'.format(
|
url = '{protocol}{host}:{port}{root}/api/rootfolder'.format(
|
||||||
protocol=protocol, host=host, port=port, root=web_root)
|
protocol=protocol, host=host, port=port, root=web_root
|
||||||
|
)
|
||||||
headers = {'X-Api-Key': apikey}
|
headers = {'X-Api-Key': apikey}
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, headers=headers, stream=True, verify=False)
|
r = requests.get(url, headers=headers, stream=True, verify=False)
|
||||||
|
@ -65,10 +66,12 @@ def auto_fork(section, input_category):
|
||||||
|
|
||||||
if apikey:
|
if apikey:
|
||||||
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=help&subject=postprocess'.format(
|
url = '{protocol}{host}:{port}{root}/api/{apikey}/?cmd=help&subject=postprocess'.format(
|
||||||
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey)
|
protocol=protocol, host=host, port=port, root=web_root, apikey=apikey
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
url = '{protocol}{host}:{port}{root}/home/postprocess/'.format(
|
url = '{protocol}{host}:{port}{root}/home/postprocess/'.format(
|
||||||
protocol=protocol, host=host, port=port, root=web_root)
|
protocol=protocol, host=host, port=port, root=web_root
|
||||||
|
)
|
||||||
|
|
||||||
# attempting to auto-detect fork
|
# attempting to auto-detect fork
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -5,7 +5,6 @@ import guessit
|
||||||
import requests
|
import requests
|
||||||
from six import text_type
|
from six import text_type
|
||||||
|
|
||||||
import core
|
|
||||||
from core import logger
|
from core import logger
|
||||||
from core.utils.naming import sanitize_name
|
from core.utils.naming import sanitize_name
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import re
|
import re
|
||||||
import core
|
|
||||||
|
|
||||||
|
|
||||||
def sanitize_name(name):
|
def sanitize_name(name):
|
||||||
|
|
|
@ -1,48 +1,47 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import datetime
|
|
||||||
import os
|
import core
|
||||||
import sys
|
|
||||||
|
|
||||||
def test_eol():
|
def test_eol():
|
||||||
import eol
|
import eol
|
||||||
eol.check()
|
eol.check()
|
||||||
|
|
||||||
|
|
||||||
def test_cleanup():
|
def test_cleanup():
|
||||||
import cleanup
|
import cleanup
|
||||||
cleanup.clean(cleanup.FOLDER_STRUCTURE)
|
cleanup.clean(cleanup.FOLDER_STRUCTURE)
|
||||||
|
|
||||||
|
|
||||||
def test_import_core():
|
def test_import_core():
|
||||||
import core
|
pass
|
||||||
from core import logger, main_db
|
|
||||||
|
|
||||||
def test_import_core_auto_process():
|
def test_import_core_auto_process():
|
||||||
from core.auto_process import comics, games, movies, music, tv
|
pass
|
||||||
from core.auto_process.common import ProcessResult
|
|
||||||
|
|
||||||
def test_import_core_plugins():
|
def test_import_core_plugins():
|
||||||
from core.plugins.downloaders.nzb.utils import get_nzoid
|
pass
|
||||||
from core.plugins.plex import plex_update
|
|
||||||
|
|
||||||
def test_import_core_user_scripts():
|
def test_import_core_user_scripts():
|
||||||
from core.user_scripts import external_script
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_import_six():
|
def test_import_six():
|
||||||
from six import text_type
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_import_core_utils():
|
def test_import_core_utils():
|
||||||
from core.utils import (
|
pass
|
||||||
char_replace, clean_dir, convert_to_ascii,
|
|
||||||
extract_files, get_dirs, get_download_info,
|
|
||||||
update_download_info_status, replace_links,
|
|
||||||
)
|
|
||||||
|
|
||||||
import core
|
|
||||||
from core import logger, main_db
|
|
||||||
|
|
||||||
def test_initial():
|
def test_initial():
|
||||||
core.initialize()
|
core.initialize()
|
||||||
del core.MYAPP
|
del core.MYAPP
|
||||||
|
|
||||||
|
|
||||||
def test_core_parameters():
|
def test_core_parameters():
|
||||||
assert core.CHECK_MEDIA == 1
|
assert core.CHECK_MEDIA == 1
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import datetime
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
import requests
|
|
||||||
|
|
||||||
import core
|
import core
|
||||||
from core import logger, transcoder
|
from core import transcoder
|
||||||
|
|
||||||
|
|
||||||
def test_transcoder_check():
|
def test_transcoder_check():
|
||||||
assert transcoder.is_video_good(core.TEST_FILE, 0) == True
|
assert transcoder.is_video_good(core.TEST_FILE, 0) is True
|
||||||
|
|
24
tox.ini
24
tox.ini
|
@ -29,6 +29,30 @@ deps =
|
||||||
commands =
|
commands =
|
||||||
{posargs:pytest --cov --cov-report=term-missing tests}
|
{posargs:pytest --cov --cov-report=term-missing tests}
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 79
|
||||||
|
verbose = 2
|
||||||
|
statistics = True
|
||||||
|
ignore =
|
||||||
|
; -- flake8 --
|
||||||
|
; E501 line too long
|
||||||
|
E501
|
||||||
|
|
||||||
|
per-file-ignores =
|
||||||
|
; F401 imported but unused
|
||||||
|
; E402 module level import not at top of file
|
||||||
|
core/__init__.py: E402, F401
|
||||||
|
core/utils/__init__.py: F401
|
||||||
|
core/plugins/downloaders/configuration.py: F401
|
||||||
|
core/plugins/downloaders/utils.py: F401
|
||||||
|
|
||||||
|
[testenv:check]
|
||||||
|
deps =
|
||||||
|
flake8
|
||||||
|
skip_install = true
|
||||||
|
commands =
|
||||||
|
flake8 core tests setup.py
|
||||||
|
|
||||||
[coverage:run]
|
[coverage:run]
|
||||||
omit =
|
omit =
|
||||||
libs/*
|
libs/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue