fix pre-commit and update requirements

This commit is contained in:
bobokun 2024-02-10 11:15:41 -05:00
parent 0a6e31eebd
commit 51a10de7e3
No known key found for this signature in database
GPG key ID: B73932169607D927
18 changed files with 50 additions and 35 deletions

View file

@ -31,17 +31,19 @@ repos:
hooks:
- id: yamlfix
exclude: ^.github/
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
name: isort (python)
args: [--force-single-line-imports, --profile, black]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py3-plus]
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
language_version: python3

View file

@ -1 +1 @@
4.0.8
4.0.9-develop1

View file

@ -1,4 +1,5 @@
"""Apprise notification class"""
import time
from modules import util

View file

@ -1,4 +1,5 @@
"""Module for BeyondHD (BHD) tracker."""
from json import JSONDecodeError
from modules import util

View file

@ -1,4 +1,5 @@
"""Config class for qBittorrent-Manage"""
import os
import re
import stat
@ -13,9 +14,9 @@ from modules.apprise import Apprise
from modules.bhd import BeyondHD
from modules.notifiarr import Notifiarr
from modules.qbittorrent import Qbt
from modules.util import check
from modules.util import Failed
from modules.util import YAML
from modules.util import Failed
from modules.util import check
from modules.webhooks import Webhooks
logger = util.logger

View file

@ -2,8 +2,8 @@ from qbittorrentapi import NotFound404Error
from qbittorrentapi import TrackerStatus
from modules import util
from modules.util import list_in_text
from modules.util import TorrentMessages
from modules.util import list_in_text
logger = util.logger

View file

@ -1,4 +1,5 @@
"""Logging module"""
import io
import logging
import os

View file

@ -1,4 +1,5 @@
"""Qbittorrent Module"""
import os
import sys
@ -10,8 +11,8 @@ from qbittorrentapi import Version
from modules import util
from modules.util import Failed
from modules.util import list_in_text
from modules.util import TorrentMessages
from modules.util import list_in_text
logger = util.logger

View file

@ -1,4 +1,5 @@
""" Utility functions for qBit Manage. """
import json
import logging
import os

View file

@ -1,4 +1,5 @@
"""Class to handle webhooks."""
import time
from json import JSONDecodeError

View file

@ -11,6 +11,7 @@ from datetime import timedelta
try:
import schedule
from modules.logs import MyLogger
except ModuleNotFoundError:
print("Requirements Error: Requirements are not installed")
@ -231,7 +232,8 @@ def get_arg(env_str, default, arg_bool=False, arg_int=False):
try:
from git import Repo, InvalidGitRepositoryError
from git import InvalidGitRepositoryError
from git import Repo
try:
git_branch = Repo(path=".").head.ref.name # noqa
@ -340,16 +342,16 @@ from modules import util # noqa
util.logger = logger
from modules.config import Config # noqa
from modules.util import GracefulKiller # noqa
from modules.util import Failed # noqa
from modules.core.category import Category # noqa
from modules.core.tags import Tags # noqa
from modules.core.remove_unregistered import RemoveUnregistered # noqa
from modules.core.cross_seed import CrossSeed # noqa
from modules.core.recheck import ReCheck # noqa
from modules.core.tag_nohardlinks import TagNoHardLinks # noqa
from modules.core.remove_orphaned import RemoveOrphaned # noqa
from modules.core.remove_unregistered import RemoveUnregistered # noqa
from modules.core.share_limits import ShareLimits # noqa
from modules.core.tag_nohardlinks import TagNoHardLinks # noqa
from modules.core.tags import Tags # noqa
from modules.util import Failed # noqa
from modules.util import GracefulKiller # noqa
def my_except_hook(exctype, value, tbi):

View file

@ -3,5 +3,5 @@ GitPython==3.1.41
qbittorrent-api==2024.1.58
requests==2.31.0
retrying==1.3.4
ruamel.yaml==0.18.5
ruamel.yaml==0.18.6
schedule==1.2.1

View file

@ -4,13 +4,13 @@ You can also allow incomplete torrents to be deleted.
Torrents will be deleted starting with the ones with the most seeds, only torrents with a single hardlink will be deleted.
Only torrents on configured drive path will be deleted. To monitor multiple drives, use multiple copies of this script.
"""
import os
import shutil
import time
import qbittorrentapi
"""===Config==="""
# qBittorrent WebUi Login
qbt_login = {"host": "localhost", "port": 8080, "username": "???", "password": "???"}

View file

@ -14,7 +14,9 @@ NEW_TRACKER = "https://blutopia.cc" # This is the tracker you want to replace i
# --START SCRIPT--#
try:
from qbittorrentapi import Client, LoginFailed, APIConnectionError
from qbittorrentapi import APIConnectionError
from qbittorrentapi import Client
from qbittorrentapi import LoginFailed
except ModuleNotFoundError:
print('Requirements Error: qbittorrent-api not installed. Please install using the command "pip install qbittorrent-api"')
sys.exit(1)

View file

@ -18,7 +18,9 @@ parser.add_argument("--days_to", help="Set Number of Days to stop torrents betwe
# --START SCRIPT--#
try:
from qbittorrentapi import Client, LoginFailed, APIConnectionError
from qbittorrentapi import APIConnectionError
from qbittorrentapi import Client
from qbittorrentapi import LoginFailed
except ModuleNotFoundError:
print('Requirements Error: qbittorrent-api not installed. Please install using the command "pip install qbittorrent-api"')
sys.exit(1)

View file

@ -1,9 +1,7 @@
#!/bin/bash
staged_changes=$(git diff-index --cached HEAD | wc -l | awk '{print $1}')
# Check if there are any changes staged for commit
if [ "$staged_changes" -eq 0 ]; then
if [[ -z $(git diff --cached --name-only) ]]; then
echo "There are no changes staged for commit. Skipping version update."
exit 0
fi
@ -15,19 +13,17 @@ if git diff --cached --name-only | grep -q "VERSION"; then
fi
# Read the current version from the VERSION file
current_version=$(cat VERSION)
current_version=$(<VERSION)
echo "Current version: $current_version"
# Check if "develop" is not present in the version string
if [[ $current_version != *"develop"* ]]; then
echo "The word 'develop' is not present in the version string."
exit 0
fi
# Get the version number from the HEAD commit
current_version=$(git show HEAD:VERSION 2>/dev/null)
# Extract the version number after "develop"
version_number=$(echo "$current_version" | grep -oP '(?<=develop)\d+')
version_number=$(echo "$current_version" | sed -n 's/.*develop\([0-9]*\).*/\1/p')
# Increment the version number
new_version_number=$((version_number + 1))
@ -36,6 +32,6 @@ new_version_number=$((version_number + 1))
new_version=$(echo "$current_version" | sed "s/develop$version_number/develop$new_version_number/")
# Update the VERSION file
echo "$new_version" > VERSION
sed -i "s/$current_version/$new_version/" VERSION
echo "Version updated to: $new_version"

View file

@ -1,8 +1,10 @@
import os
from distutils.core import setup
from setuptools import find_packages
from modules import __version__
# User-friendly description from README.md
current_directory = os.path.dirname(os.path.abspath(__file__))
try:
@ -11,20 +13,17 @@ try:
except Exception:
long_description = ""
try:
with open(os.path.join(current_directory, "VERSION"), encoding="utf-8") as f:
version_no = f.read()
except Exception:
version_no = ""
setup(
# Name of the package
name="qbit_manage",
# Packages to include into the distribution
packages=find_packages("."),
package_data={"": ["../*"]},
include_package_data=True,
# Start with a small number and increase it with
# every change you make https://semver.org
version=version_no,
version=__version__,
# Chose a license from here: https: //
# help.github.com / articles / licensing - a -
# repository. For example: MIT

View file

@ -32,3 +32,8 @@ max-line-length = 130
[pep8]
extend-ignore = E722,E402
[tool.isort]
add_imports = ["from __future__ import annotations"]
force_single_line = true
profile = "black"