mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 21:33:13 -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
|
@ -870,7 +870,7 @@ def configure_utility_locations():
|
|||
|
||||
else:
|
||||
if SYS_PATH:
|
||||
os.environ['PATH'] += ':'+SYS_PATH
|
||||
os.environ['PATH'] += ':' + SYS_PATH
|
||||
try:
|
||||
SEVENZIP = subprocess.Popen(['which', '7z'], stdout=subprocess.PIPE).communicate()[0].strip().decode()
|
||||
except Exception:
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# coding=utf-8
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import requests
|
||||
|
||||
import core
|
||||
|
|
|
@ -42,7 +42,8 @@ def auto_fork(section, input_category):
|
|||
logger.info('Attempting to verify {category} fork'.format
|
||||
(category=input_category))
|
||||
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}
|
||||
try:
|
||||
r = requests.get(url, headers=headers, stream=True, verify=False)
|
||||
|
@ -65,10 +66,12 @@ def auto_fork(section, input_category):
|
|||
|
||||
if apikey:
|
||||
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:
|
||||
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
|
||||
try:
|
||||
|
|
|
@ -5,7 +5,6 @@ import guessit
|
|||
import requests
|
||||
from six import text_type
|
||||
|
||||
import core
|
||||
from core import logger
|
||||
from core.utils.naming import sanitize_name
|
||||
|
||||
|
@ -90,13 +89,13 @@ def find_imdbid(dir_name, input_name, omdb_api_key):
|
|||
def category_search(input_directory, input_name, input_category, root, categories):
|
||||
tordir = False
|
||||
|
||||
#try:
|
||||
# try:
|
||||
# input_name = input_name.encode(core.SYS_ENCODING)
|
||||
#except Exception:
|
||||
# except Exception:
|
||||
# pass
|
||||
#try:
|
||||
# try:
|
||||
# input_directory = input_directory.encode(core.SYS_ENCODING)
|
||||
#except Exception:
|
||||
# except Exception:
|
||||
# pass
|
||||
|
||||
if input_directory is None: # =Nothing to process here.
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
import core
|
||||
|
||||
|
||||
def sanitize_name(name):
|
||||
|
@ -20,9 +19,9 @@ def sanitize_name(name):
|
|||
|
||||
# remove leading/trailing periods and spaces
|
||||
name = name.strip(' .')
|
||||
#try:
|
||||
# try:
|
||||
# name = name.encode(core.SYS_ENCODING)
|
||||
#except Exception:
|
||||
# except Exception:
|
||||
# pass
|
||||
|
||||
return name
|
||||
|
|
|
@ -1,48 +1,47 @@
|
|||
#! /usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
|
||||
import core
|
||||
|
||||
|
||||
def test_eol():
|
||||
import eol
|
||||
eol.check()
|
||||
|
||||
|
||||
def test_cleanup():
|
||||
import cleanup
|
||||
cleanup.clean(cleanup.FOLDER_STRUCTURE)
|
||||
|
||||
|
||||
def test_import_core():
|
||||
import core
|
||||
from core import logger, main_db
|
||||
pass
|
||||
|
||||
|
||||
def test_import_core_auto_process():
|
||||
from core.auto_process import comics, games, movies, music, tv
|
||||
from core.auto_process.common import ProcessResult
|
||||
pass
|
||||
|
||||
|
||||
def test_import_core_plugins():
|
||||
from core.plugins.downloaders.nzb.utils import get_nzoid
|
||||
from core.plugins.plex import plex_update
|
||||
pass
|
||||
|
||||
|
||||
def test_import_core_user_scripts():
|
||||
from core.user_scripts import external_script
|
||||
pass
|
||||
|
||||
|
||||
def test_import_six():
|
||||
from six import text_type
|
||||
pass
|
||||
|
||||
|
||||
def test_import_core_utils():
|
||||
from core.utils import (
|
||||
char_replace, clean_dir, convert_to_ascii,
|
||||
extract_files, get_dirs, get_download_info,
|
||||
update_download_info_status, replace_links,
|
||||
)
|
||||
pass
|
||||
|
||||
import core
|
||||
from core import logger, main_db
|
||||
|
||||
def test_initial():
|
||||
core.initialize()
|
||||
del core.MYAPP
|
||||
|
||||
|
||||
def test_core_parameters():
|
||||
assert core.CHECK_MEDIA == 1
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
#! /usr/bin/env python
|
||||
from __future__ import print_function
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import requests
|
||||
|
||||
import core
|
||||
from core import logger, transcoder
|
||||
from core import transcoder
|
||||
|
||||
|
||||
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 =
|
||||
{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]
|
||||
omit =
|
||||
libs/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue