before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
import os, re, sys, platform, shutil, importlib, subprocess, json
from packaging.version import Version, InvalidVersion
from importlib.metadata import version, PackageNotFoundError
from packaging.specifiers import SpecifierSet
from packaging.markers import Marker
from functools import cached_property
from lib.conf im... | The logic here is inverted. Lines 434-489 check conditions and print errors when they fail, but the final `return 1` on line 490 is executed for ALL cases that reach it, including successful cases where `device_info_str` is valid.
The issue is:
- Line 434: if `device_info_str` is truthy (valid), it enters the block
- ... | subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', 'deepspeed'])
numpy_version = Version(self.get_package_version('numpy'))
if Version(torch_version)... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 0.786 | bug | 947 | 488 | 34 | false | v25.12.4b14 | 1,258 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', torch_pkg, torchaudio_pkg])
if device_info['name'] == 'jetson':
subprocess.check_call([sys.executable, '-m', '... | This error message is incorrect. It says "device_info_str is empty", but this block is reached when `device_info` (the parsed JSON) is falsy/empty, not when `device_info_str` is empty. The error message should be: "install_device_packages() error: device_info is empty or invalid after parsing"
```suggestion
... | torchaudio_pkg = f'{url}/{tag}/torchaudio-{torch_version_base}+{tag}-{tag_py}-{os_env}_{arch}.whl'
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', torch_pkg, torchaudio_pkg])
... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 421 | 29 | 39 | false | v25.12.4b14 | 1,258 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if device_info['name'] == 'cuda':
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', 'deepspeed'])
numpy_version = Version(self.get_package_version('numpy'))
... | This error message is misleading. This else block is reached when `device_info_str` is falsy (empty/None), not when json.loads() fails. If json.loads() actually fails, it will raise a JSONDecodeError exception which should be caught separately. The error message should be: "install_device_packages() error: device_info_... | subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--force-reinstall', '--no-cache-dir', '--use-pep517', '--no-binary', 'scikit-learn', 'scikit-learn'])
if device_info['name'] == 'cuda':
... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 451 | 26 | 36 | false | v25.12.4b14 | 1,258 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def check_dictionary(self)->bool:
import unidic
unidic_path = unidic.DICDIR
dicrc = os.path.join(unidic_path, 'dicrc')
if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0:
try:
error = 'UniDic dictionary not found or incomplete. Downloading now...'... | `non_standard_tag` is referenced on line 445 but is only defined when `current_tag is not None`. If `current_tag` is None, this will cause an UnboundLocalError. Either initialize `non_standard_tag = None` before the if statement on line 443, or adjust the logic to handle this case properly.
```suggestion
... | def check_dictionary(self)->bool:
import unidic
unidic_path = unidic.DICDIR
dicrc = os.path.join(unidic_path, 'dicrc')
if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0:
try:
error = 'UniDic dictionary not found or incomplete. Downloading now...'... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 429 | 51 | 51 | false | v25.12.4b14 | 1,258 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', torch_pkg, torchaudio_pkg])
if device_info['name'] == 'jetson':
subprocess.check_call([sys.executable, '-m', '... | The error message states "device_info_str is empty" but this branch is actually reached when `device_info` (the parsed JSON object) is falsy, not when `device_info_str` is empty. The message should be "device_info is empty or invalid" to accurately reflect the condition.
```suggestion
error = 'insta... | torchaudio_pkg = f'{url}/{tag}/torchaudio-{torch_version_base}+{tag}-{tag_py}-{os_env}_{arch}.whl'
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', torch_pkg, torchaudio_pkg])
... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 384 | 29 | 39 | false | v25.12.4b14 | 1,259 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if device_info['name'] == 'cuda':
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--no-cache-dir', '--use-pep517', 'deepspeed'])
numpy_version = Version(self.get_package_version('numpy'))
... | The error message states "json.loads() could not decode device_info_str" but this branch is reached when `device_info_str` is empty or None (the outer `if device_info_str:` check on line 434 fails). The message should be "device_info_str is empty or None" to accurately reflect the condition. JSON decode errors would be... | subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', '--force-reinstall', '--no-cache-dir', '--use-pep517', '--no-binary', 'scikit-learn', 'scikit-learn'])
if device_info['name'] == 'cuda':
... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 501 | 26 | 36 | false | v25.12.4b14 | 1,259 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
exit 1
;;
esac
shift
done
if [[ "${arguments[script_mode]}" != "" ]]; then
if [[ "${arguments[script_mode]}" == "$BUILD_DOCKER" ]]; then
SCRIPT_MODE="${arguments[script_mode]}"
else
echo "Error: Invalid script mode argument: $SCRIPT_MODE"
exit 1
fi
fi
if [[ -n "${arguments[doc... | The validation logic checks if `arguments[script_mode]` is defined on line 92, but this check is redundant because the same key was already validated on lines 77-84. Additionally, the validation for `--script_mode` requiring a value (line 93) would never trigger because line 78 already checks if it equals `$BUILD_DOCKE... | exit 1
;;
esac
shift
done
if [[ "${arguments[script_mode]}" != "" ]]; then
if [[ "${arguments[script_mode]}" == "$BUILD_DOCKER" ]]; then
SCRIPT_MODE="${arguments[script_mode]}"
else
echo "Error: Invalid script mode argument: ${arguments[script_mode]}"
exit 1
fi
fi
if [[ -n "${arguments[docker_device]+... | @@ -55,36 +55,51 @@ ARGS=("$@")
# Parse arguments
while (( $# > 0 )); do
- case "$1" in
- --*)
- key="${1#--}"
- if [[ -n "$2" && "$2" != --* ]]; then
- arguments[$key]="$2"
- shift 2
- continue
- else
- arguments... | ebook2audiobook.sh | 26 | Shell | 0.643 | suggestion | 442 | 51 | 51 | false | v25.12.4b14 | 1,259 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
def check_dictionary(self)->bool:
import unidic
unidic_path = unidic.DICDIR
dicrc = os.path.join(unidic_path, 'dicrc')
if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0:
try:
error = 'UniDic dictionary not found or incomplete. Downloading now...'... | The variable `non_standard_tag` is only defined when `current_tag is not None`, but it's used unconditionally in line 445. If `current_tag` is None, this will raise an `UnboundLocalError`. This should be initialized before the if statement, e.g., `non_standard_tag = None` before line 443.
```suggestion
... | def check_dictionary(self)->bool:
import unidic
unidic_path = unidic.DICDIR
dicrc = os.path.join(unidic_path, 'dicrc')
if not os.path.exists(dicrc) or os.path.getsize(dicrc) == 0:
try:
error = 'UniDic dictionary not found or incomplete. Downloading now...'... | @@ -429,54 +429,64 @@ def check_dictionary(self)->bool:
return False
return True
- def install_device_packages(self, device_info_str:str)->bool:
+ def install_device_packages(self, device_info_str:str)->int:
try:
- device_info = json.loads(device_info_str)... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 427 | 51 | 51 | false | v25.12.4b14 | 1,259 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
script_path="$0"
fi
export SCRIPT_DIR="$(cd "$(dirname "$script_path")" >/dev/null 2>&1 && pwd -P)"
export PYTHONUTF8="1"
export PYTHONIOENCODING="utf-8"
export TTS_CACHE="$SCRIPT_DIR/models"
export TESSDATA_PREFIX="$SCRIPT_DIR/models/tessdata"
export TMPDIR="$SCRIPT_DIR/tmp"
export CONDA_HOME="$HOME/Miniforge3"
expo... | The HOST_PROGRAMS array includes both "cargo" and "rust", but the installation handler on line 443 only checks for "rust" or "rustc". When "cargo" is missing, it will attempt to install it via the package manager (line 511) rather than via rustup. Consider either: 1) removing "cargo" from HOST_PROGRAMS since it's insta... | script_path="$0"
fi
export SCRIPT_DIR="$(cd "$(dirname "$script_path")" >/dev/null 2>&1 && pwd -P)"
export PYTHONUTF8="1"
export PYTHONIOENCODING="utf-8"
export TTS_CACHE="$SCRIPT_DIR/models"
export TESSDATA_PREFIX="$SCRIPT_DIR/models/tessdata"
export TMPDIR="$SCRIPT_DIR/tmp"
export CONDA_HOME="$HOME/Miniforge3"
expo... | @@ -35,7 +35,7 @@ SCRIPT_MODE="$NATIVE"
APP_NAME="ebook2audiobook"
APP_VERSION=$(<"$SCRIPT_DIR/VERSION.txt")
OS_LANG=$(echo "${LANG:-en}" | cut -d_ -f1 | tr '[:upper:]' '[:lower:]')
-HOST_PROGRAMS=("curl" "pkg-config" "calibre" "ffmpeg" "nodejs" "espeak-ng" "rust" "sox" "tesseract")
+HOST_PROGRAMS=("curl" "pkg-confi... | ebook2audiobook.sh | 26 | Shell | 1 | suggestion | 637 | 51 | 51 | false | v25.12.4b14 | 1,259 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
print(error)
missing_packages.append(package)
continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=1)[0].strip()
try:
installed_versio... | The function returns an integer (1) on InvalidVersion error, but the function signature indicates it returns a bool. This creates an inconsistency - the function should return False instead of 1 to match the return type annotation.
```suggestion
return False
``` | continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=1)[0].strip()
try:
installed_version = version(pkg_name)
except PackageNotFoundError:
error =... | @@ -339,13 +337,17 @@ def check_and_install_requirements(self)->bool:
else:
spec_str = clean_pkg[len(pkg_name):].strip()
if spec_str:
+ from packaging.specifiers import SpecifierSet
+ from packaging.version import V... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 290 | 51 | 51 | false | v25.12.13 | 1,289 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
PACK_MGR="zypper install"
PACK_MGR_OPTIONS="-y"
elif command -v pacman &> /dev/null; then
PACK_MGR="pacman -Sy --noconfirm"
elif command -v apt-get &> /dev/null; then
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
PACK_MGR="apk add... | The logic checks for 'installplg' command to set 'un-get install' as the package manager, but this check comes after the 'apk' check. If both 'apk' and 'installplg' commands exist (which is likely on Unraid), PACK_MGR will be set to 'apk add' instead of 'un-get install', making the Unraid-specific setup ineffective. Th... | PACK_MGR="zypper install"
PACK_MGR_OPTIONS="-y"
elif command -v pacman &> /dev/null; then
PACK_MGR="pacman -Sy --noconfirm"
elif command -v apt-get &> /dev/null; then
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
if ! command -v u... | @@ -407,7 +407,23 @@ function install_programs {
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
+ if ! command -v un-get &>/dev/null; then
+ echo "Installing un-get plugin..."
+ curl -L -o /tmp/un-get.plg https://raw.githubusercontent.com/ich777/un-get/master/... | ebook2audiobook.sh | 26 | Shell | 0.5 | suggestion | 376 | 51 | 51 | false | v25.12.13 | 1,289 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
Gradio/GUI:
./ebook2audiobook.sh
Headless mode:
./ebook2audiobook.sh --headless --ebook '/path/to/file' --language eng
Docker build image:
Windows:
ebook2audiobook.cmd --script_mode build_docker
Linux/Mac
./ebook2audiobook.sh --script_mode build_docker
Docker run image:
Gradio/GUI:
... | Double colon (::) should be a single colon (:) in the docker image tag specification. | Gradio/GUI:
./ebook2audiobook.sh
Headless mode:
./ebook2audiobook.sh --headless --ebook '/path/to/file' --language eng
Docker build image:
Windows:
ebook2audiobook.cmd --script_mode build_docker
Linux/Mac
./ebook2audiobook.sh --script_mode build_docker
Docker run image:
Gradio/GUI:
... | @@ -100,26 +100,26 @@ def main()->None:
Docker run image:
Gradio/GUI:
CPU:
- docker run --rm -it -v "$(pwd)/audiobooks:/app/audiobooks" -p 7860:7860 ebook2audiobook:cpu
+ docker run --rm -it -v "$(pwd)":/app:rw -p 7860:7860 ebook2audiobook:cpu
CUDA:
- docker run --gpus all -... | app.py | 26 | Python | 0.286 | suggestion | 85 | 51 | 51 | false | v25.12.13 | 1,289 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | The `install_programs` branch for `apk` unconditionally downloads the `un-get` plugin from `https://raw.githubusercontent.com/ich777/un-get/master/un-get.plg` and immediately runs it via `installplg` without any integrity verification or pinning to an immutable commit. This creates a supply chain risk: if that GitHub r... | if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | @@ -407,7 +407,23 @@ function install_programs {
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
+ if ! command -v un-get &>/dev/null; then
+ echo "Installing un-get plugin..."
+ curl -L -o /tmp/un-get.plg https://raw.githubusercontent.com/ich777/un-get/master/... | ebook2audiobook.sh | 26 | Shell | 0.643 | security | 683 | 51 | 51 | false | v25.12.13 | 1,289 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
PACK_MGR="zypper install"
PACK_MGR_OPTIONS="-y"
elif command -v pacman &> /dev/null; then
PACK_MGR="pacman -Sy --noconfirm"
elif command -v apt-get &> /dev/null; then
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
PACK_MGR="apk add... | The logic here checks for 'installplg' command but this check is unreachable because it comes after the 'apk' check. On systems with both 'apk' and 'installplg', the 'apk' branch will always execute first. Consider reordering these checks or documenting this priority. | PACK_MGR="zypper install"
PACK_MGR_OPTIONS="-y"
elif command -v pacman &> /dev/null; then
PACK_MGR="pacman -Sy --noconfirm"
elif command -v apt-get &> /dev/null; then
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
if ! command -v u... | @@ -407,7 +407,23 @@ function install_programs {
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
+ if ! command -v un-get &>/dev/null; then
+ echo "Installing un-get plugin..."
+ curl -L -o /tmp/un-get.plg https://raw.githubusercontent.com/ich777/un-get/master/... | ebook2audiobook.sh | 26 | Shell | 0.5 | suggestion | 268 | 51 | 51 | false | v25.12.13 | 1,290 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
Gradio/GUI:
./ebook2audiobook.sh
Headless mode:
./ebook2audiobook.sh --headless --ebook '/path/to/file' --language eng
Docker build image:
Windows:
ebook2audiobook.cmd --script_mode build_docker
Linux/Mac
./ebook2audiobook.sh --script_mode build_docker
Docker run image:
Gradio/GUI:
... | There's a typo with double colons '::' instead of a single colon ':' in the image tag. It should be 'ebook2audiobook:cu[...]' not 'ebook2audiobook::cu[...]'. | Gradio/GUI:
./ebook2audiobook.sh
Headless mode:
./ebook2audiobook.sh --headless --ebook '/path/to/file' --language eng
Docker build image:
Windows:
ebook2audiobook.cmd --script_mode build_docker
Linux/Mac
./ebook2audiobook.sh --script_mode build_docker
Docker run image:
Gradio/GUI:
... | @@ -100,26 +100,26 @@ def main()->None:
Docker run image:
Gradio/GUI:
CPU:
- docker run --rm -it -v "$(pwd)/audiobooks:/app/audiobooks" -p 7860:7860 ebook2audiobook:cpu
+ docker run --rm -it -v "$(pwd)":/app:rw -p 7860:7860 ebook2audiobook:cpu
CUDA:
- docker run --gpus all -... | app.py | 26 | Python | 0.429 | suggestion | 157 | 51 | 51 | false | v25.12.13 | 1,290 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
print(error)
missing_packages.append(package)
continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=1)[0].strip()
try:
installed_versio... | Returning the integer 1 instead of a boolean False is inconsistent with the function's return type annotation (->bool). This should return False to match the function signature and other return paths in this function.
```suggestion
return False
``` | continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=1)[0].strip()
try:
installed_version = version(pkg_name)
except PackageNotFoundError:
error =... | @@ -339,13 +337,17 @@ def check_and_install_requirements(self)->bool:
else:
spec_str = clean_pkg[len(pkg_name):].strip()
if spec_str:
+ from packaging.specifiers import SpecifierSet
+ from packaging.version import V... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 276 | 51 | 51 | false | v25.12.13 | 1,290 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | The new Unraid/`un-get` flow downloads a plugin directly from `https://raw.githubusercontent.com/ich777/un-get/master/un-get.plg` via `curl` and immediately executes it with `installplg`, without any pinning (e.g., to a commit hash) or integrity verification. If the `ich777/un-get` repository, the `master` branch, or t... | if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | @@ -407,7 +407,23 @@ function install_programs {
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
elif command -v apk &> /dev/null; then
+ if ! command -v un-get &>/dev/null; then
+ echo "Installing un-get plugin..."
+ curl -L -o /tmp/un-get.plg https://raw.githubusercontent.com/ich777/un-get/master/... | ebook2audiobook.sh | 26 | Shell | 0.643 | security | 645 | 51 | 51 | false | v25.12.13 | 1,290 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
]
except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading ... | Missing space before 'else' in the ternary expression. Add a space between the closing parenthesis and 'else' to improve code readability (should be ')else False' → ') else False').
```suggestion
use_gpu = True if (session['device'] == devices['CUDA']['proc'] and not devices['JETSON']['found'] and d... | ]
except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading ... | @@ -729,8 +729,7 @@ def get_chapters(epubBook:EpubBook, id:str)->tuple[Any,Any]:
msg = f"NLP model {stanza_model} loaded!"
print(msg)
else:
- #use_gpu = False
- use_gpu = True if (session['device'] == devices['CUDA']['proc'... | lib/functions.py | 26 | Python | 0.857 | suggestion | 515 | 51 | 51 | false | v25.12.13 | 1,291 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | Typo in the uname command: there's a space between the dash and 'a' (uname - a) which should be (uname -a). This will cause the command to fail or produce unexpected results. The uname utility expects the flag to be attached to the dash without a space.
```suggestion
out = try_cmd('uname -a')
``` | name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | @@ -181,20 +181,52 @@ def jetpack_version(text:str)->str:
raw = tegra_version()
jp_code, msg = jetpack_version(raw)
if jp_code in ['unsupported', 'unknown']:
- tag = 'cpu'
+ pass
elif os.path.exists('/etc/nv_tegra_release'):
... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 309 | 51 | 51 | false | v25.12.13 | 1,291 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading order)
... | The condition on this line is very long and difficult to read. Consider breaking it into multiple lines or storing intermediate boolean values in variables (e.g., is_cuda_and_not_jetson, is_rocm, is_xpu) to improve readability and maintainability. The missing space before 'else' in 'XPU']['found'])else False' also hurt... | except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading order)
... | @@ -729,8 +729,7 @@ def get_chapters(epubBook:EpubBook, id:str)->tuple[Any,Any]:
msg = f"NLP model {stanza_model} loaded!"
print(msg)
else:
- #use_gpu = False
- use_gpu = True if (session['device'] == devices['CUDA']['proc'... | lib/functions.py | 26 | Python | 0.857 | suggestion | 1,398 | 51 | 51 | false | v25.12.13 | 1,291 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | The `curl` + `installplg` flow downloads and executes the `un-get` plugin directly from `https://raw.githubusercontent.com/ich777/un-get/master/un-get.plg` without any pinning or integrity verification, creating a supply-chain RCE risk if that upstream repository or transport is compromised. An attacker who controls or... | if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | @@ -406,9 +406,9 @@ function install_programs {
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
- elif command -v apk &> /dev/null; then
+ elif [[ -f /etc/unraid-version ]] || command -v installplg &>/dev/null; then
if ! command -v un-get &>/dev/null; then
- echo "Installing u... | ebook2audiobook.sh | 26 | Shell | 0.643 | security | 587 | 51 | 51 | false | v25.12.13 | 1,291 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | The command 'uname - a' has incorrect spacing. It should be 'uname -a' without spaces around the hyphen. The current command will fail because 'uname' doesn't recognize '- a' as a valid option.
```suggestion
out = try_cmd('uname -a')
``` | name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | @@ -181,20 +181,52 @@ def jetpack_version(text:str)->str:
raw = tegra_version()
jp_code, msg = jetpack_version(raw)
if jp_code in ['unsupported', 'unknown']:
- tag = 'cpu'
+ pass
elif os.path.exists('/etc/nv_tegra_release'):
... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 249 | 51 | 51 | false | v25.12.13 | 1,292 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
]
except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading ... | This line is excessively long (over 200 characters) and difficult to read. The complex boolean expression should be split across multiple lines for better readability and maintainability. Additionally, there's a missing space before 'else' in the ternary expression.
```suggestion
use_gpu = True if (... | ]
except Exception as toc_error:
error = f'Error extracting Table of Content: {toc_error}'
show_alert({"type": "warning", "msg": error})
# Get spine item IDs
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading ... | @@ -729,8 +729,7 @@ def get_chapters(epubBook:EpubBook, id:str)->tuple[Any,Any]:
msg = f"NLP model {stanza_model} loaded!"
print(msg)
else:
- #use_gpu = False
- use_gpu = True if (session['device'] == devices['CUDA']['proc'... | lib/functions.py | 26 | Python | 0.857 | suggestion | 802 | 51 | 51 | false | v25.12.13 | 1,292 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | The `un-get` plugin is downloaded and installed directly from a mutable GitHub `master` branch (`https://raw.githubusercontent.com/ich777/un-get/master/un-get.plg`) and then executed via `installplg` without any integrity or authenticity verification. If the upstream repository or the network path is compromised, an at... | if [[ "$SUDO" == "sudo" ]]; then
echo -e "\e[33mInstalling required programs. NOTE: you must have 'sudo' priviliges to install ebook2audiobook.\e[0m"
fi
local PACK_MGR_OPTIONS=""
if command -v emerge &> /dev/null; then
PACK_MGR="emerge"
elif command -v dnf &> /dev/null; then
PACK_MGR="dnf install"
... | @@ -406,9 +406,9 @@ function install_programs {
$SUDO apt-get update
PACK_MGR="apt-get install"
PACK_MGR_OPTIONS="-y"
- elif command -v apk &> /dev/null; then
+ elif [[ -f /etc/unraid-version ]] || command -v installplg &>/dev/null; then
if ! command -v un-get &>/dev/null; then
- echo "Installing u... | ebook2audiobook.sh | 26 | Shell | 0.643 | security | 704 | 51 | 51 | false | v25.12.13 | 1,292 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
else:
return ('61', msg)
msg = 'Unrecognized JetPack 6.x version. Falling back to CPU.'
return ('unknown', msg)
name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ==================================... | The removal of devices['CUDA']['found'] = True for Jetson devices in the condition above may break compatibility. Jetson devices use CUDA under the hood, and code that checks for CUDA availability (like PyTorch CUDA operations) may fail if only devices['JETSON']['found'] is set. The original code at line 186 set both f... | else:
return ('61', msg)
msg = 'Unrecognized JetPack 6.x version. Falling back to CPU.'
return ('unknown', msg)
name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ==================================... | @@ -190,11 +190,10 @@ def jetpack_version(text:str)->str:
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
if 'tegra' in out: | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 634 | 51 | 51 | false | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading order)
all_docs = [
item for item in epubBook.get_items_of_type(ebooklib.ITEM_DOCUMENT)
if item.id in spine_ids
]
if not all_docs:
error = 'No documen... | Duplicate assignment to use_gpu variable. Line 732 assigns the value, but then lines 733-737 immediately reassign it, making line 732 dead code. The first assignment on line 732 includes JETSON device checking, while the second assignment excludes it when CUDA is found. This inconsistency could lead to incorrect GPU de... | spine_ids = [item[0] for item in epubBook.spine]
# Filter only spine documents (i.e., reading order)
all_docs = [
item for item in epubBook.get_items_of_type(ebooklib.ITEM_DOCUMENT)
if item.id in spine_ids
]
if not all_docs:
error = 'No documen... | @@ -729,7 +729,12 @@ def get_chapters(epubBook:EpubBook, id:str)->tuple[Any,Any]:
msg = f"NLP model {stanza_model} loaded!"
print(msg)
else:
- use_gpu = True if (session['device'] == devices['CUDA']['proc'] and not devices['JETSON']['found'] ... | lib/functions.py | 26 | Python | 0.643 | bug | 389 | 51 | 51 | false | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os, platform, json, psutil, subprocess, re
from typing import Any
class VRAMDetector:
def __init__(self):
self.system = platform.system().lower()
@staticmethod
def _fmt(b:int)->float:
if not b: return 0.0
return float(f"{b/(1024**3):.2f}")
def detect_vram(self, device:s... | The torch import at line 16 is placed inside the detect_vram method but outside the try block. If the import fails, it will raise an exception that won't be caught by the except block starting at line 39, which only catches exceptions from the Jetson detection logic. Additionally, torch is imported again at line 55 ins... | import os, platform, json, psutil, subprocess, re
from typing import Any
class VRAMDetector:
def __init__(self):
self.system = platform.system().lower()
@staticmethod
def _fmt(b:int)->float:
if not b: return 0.0
return float(f"{b/(1024**3):.2f}")
def detect_vram(self, device:s... | @@ -12,42 +12,43 @@ def _fmt(b:int)->float:
def detect_vram(self, device:str, as_json:bool=False)->Any:
info = {}
-
# ───────────────────────────── Jetson (Unified Memory)
- if os.path.exists('/etc/nv_tegra_release'):
- try:
- out = subprocess.check_output(['teg... | lib/classes/vram_detector.py | 17 | Python | 1 | bug | 495 | 42 | 42 | false | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
"os":self.system,
"device_type":"jetson",
"device_name":"NVIDIA Jetson (Unified Memory)",
"used_bytes":used,
"free_bytes":free,
"total_bytes":total,
"us... | The exception handler for Jetson detection will always execute when device is not 'jetson', even when no actual error occurs. This is because the try block only contains code that runs when device == 'jetson', so when device is something else, the try block completes successfully but returns nothing, causing the code t... | info={
"os":self.system,
"device_type":"jetson",
"device_name":"NVIDIA Jetson (Unified Memory)",
"used_bytes":used,
"free_bytes":free,
... | @@ -12,42 +12,43 @@ def _fmt(b:int)->float:
def detect_vram(self, device:str, as_json:bool=False)->Any:
info = {}
-
# ───────────────────────────── Jetson (Unified Memory)
- if os.path.exists('/etc/nv_tegra_release'):
- try:
- out = subprocess.check_output(['teg... | lib/classes/vram_detector.py | 26 | Python | 0.643 | suggestion | 489 | 51 | 51 | false | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
args['session'] = 'ba800d22-ee51-11ef-ac34-d4ae52cfd9ce' if args['workflow'] else args['session'] if args['session'] else None
args['share'] = args['share'] if args['share'] else False
args['ebook_list'] = None
print(f"v{prog_version} {args['script_mode']} mode")
if ar... | Duplicate assignment in the same statement: "args['device'] = args['device'] = ...". This redundant assignment is unnecessary and should be simplified to a single assignment. Remove one of the "args['device'] =" parts.
```suggestion
args['device'] = devices.get(args['device'].upper(), {}).get('proc') or dev... | args['session'] = 'ba800d22-ee51-11ef-ac34-d4ae52cfd9ce' if args['workflow'] else args['session'] if args['session'] else None
args['share'] = args['share'] if args['share'] else False
args['ebook_list'] = None
print(f"v{prog_version} {args['script_mode']} mode")
if ar... | @@ -241,7 +241,7 @@ def main()->None:
args['chapters_preview'] = False
args['event'] = ''
args['audiobooks_dir'] = os.path.abspath(args['output_dir']) if args['output_dir'] else audiobooks_cli_dir
- args['device'] = devices['CUDA'] if args['device'] == devices['CUDA'] e... | app.py | 26 | Python | 0.857 | refactor | 343 | 51 | 51 | false | v25.12.14 | 1,295 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
current_tag = m.group(1) if m else None
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is no... | This line contains an orphaned string literal that is not assigned to any variable or used in any way. It appears to be leftover code that should either be removed or properly integrated into the MPS installation logic. This will cause a syntax error or be interpreted as a statement with no effect.
```suggestion
``` | non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag'])):
... | @@ -445,18 +444,25 @@ def install_device_packages(self, device_info_str:str)->int:
tag = device_info['tag']
url = torch_matrix[device_info['tag']]['url']
toolkit_version = "".join(c for c in tag if c.isdigit()... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 318 | 51 | 51 | false | v25.12.14 | 1,296 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
print(f"Hardware detected: {device_info['name']}")
m = re.search(r'\+(.+)$', torch_version)
current_tag = m.group(1) if m else None
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_t... | Variables torch_tag_py and torchaudio_tag_py are defined but then the wrong variable tag_py is used in the URL construction. The code should use torch_tag_py for torch_pkg and torchaudio_tag_py for torchaudio_pkg, otherwise the defined variables are unused and the URLs will reference an undefined variable.
```suggestio... | m = re.search(r'\+(.+)$', torch_version)
current_tag = m.group(1) if m else None
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is N... | @@ -445,18 +444,25 @@ def install_device_packages(self, device_info_str:str)->int:
tag = device_info['tag']
url = torch_matrix[device_info['tag']]['url']
toolkit_version = "".join(c for c in tag if c.isdigit()... | lib/classes/device_installer.py | 26 | Python | 1 | bug | 603 | 51 | 51 | false | v25.12.14 | 1,296 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
info={
"os":self.system,
"device_type":"jetson",
"device_name":"NVIDIA Jetson (Unified Memory)",
"used_bytes":used,
"free_bytes":free,
... | The fallback info dictionary for Jetson is missing the used_bytes field, which is present in the successful tegrastats case above. This inconsistency could break code that expects used_bytes to always be present in the Jetson device info. | free=total-used
info={
"os":self.system,
"device_type":"jetson",
"device_name":"NVIDIA Jetson (Unified Memory)",
"used_bytes":used,
... | @@ -12,48 +12,46 @@ def _fmt(b:int)->float:
def detect_vram(self, device:str, as_json:bool=False)->Any:
info = {}
- # ───────────────────────────── Jetson (Unified Memory)
- import torch
try:
+ import torch
+ # ───────────────────────────── Jetson (Unified Me... | lib/classes/vram_detector.py | 26 | Python | 0.5 | style | 238 | 51 | 51 | false | v25.12.14 | 1,296 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os, platform, json, psutil, subprocess, re
from typing import Any
class VRAMDetector:
def __init__(self):
self.system = platform.system().lower()
@staticmethod
def _fmt(b:int)->float:
if not b: return 0.0
return float(f"{b/(1024**3):.2f}")
def detect_vram(self, device:s... | The comment has trailing whitespace that should be removed for consistency.
```suggestion
# ───────────────────────────── Jetson (Unified Memory)
``` | import os, platform, json, psutil, subprocess, re
from typing import Any
class VRAMDetector:
def __init__(self):
self.system = platform.system().lower()
@staticmethod
def _fmt(b:int)->float:
if not b: return 0.0
return float(f"{b/(1024**3):.2f}")
def detect_vram(self, device:s... | @@ -12,48 +12,46 @@ def _fmt(b:int)->float:
def detect_vram(self, device:str, as_json:bool=False)->Any:
info = {}
- # ───────────────────────────── Jetson (Unified Memory)
- import torch
try:
+ import torch
+ # ───────────────────────────── Jetson (Unified Me... | lib/classes/vram_detector.py | 17 | Python | 0.929 | suggestion | 161 | 42 | 42 | false | v25.12.14 | 1,297 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag'])):
... | Line 461 contains invalid Python syntax. This appears to be a leftover comment or debugging line that should be removed. It's not a valid statement and will cause a syntax error when this code executes. | non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is None and current_tag != device_info['tag']) or (non_standard_tag is not None and non_standard_tag != device_info['tag'])):
... | @@ -445,18 +444,24 @@ def install_device_packages(self, device_info_str:str)->int:
tag = device_info['tag']
url = torch_matrix[device_info['tag']]['url']
toolkit_version = "".join(c for c in tag if c.isdigit()... | lib/classes/device_installer.py | 26 | Python | 0.643 | bug | 202 | 51 | 51 | false | v25.12.14 | 1,297 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
m = re.search(r'\+(.+)$', torch_version)
current_tag = m.group(1) if m else None
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is N... | The variables tag_py and tag_py are used in the URL templates on lines 458-459, but they reference undefined variables. The code defines torch_tag_py and torchaudio_tag_py on lines 456-457, but then uses tag_py which was never assigned. This should be corrected to use torch_tag_py for torch_pkg and torchaudio_tag_py fo... | m = re.search(r'\+(.+)$', torch_version)
current_tag = m.group(1) if m else None
non_standard_tag = re.fullmatch(r'[0-9a-f]{7,40}', current_tag) if current_tag is not None else None
if ((non_standard_tag is N... | @@ -445,18 +444,24 @@ def install_device_packages(self, device_info_str:str)->int:
tag = device_info['tag']
url = torch_matrix[device_info['tag']]['url']
toolkit_version = "".join(c for c in tag if c.isdigit()... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 646 | 51 | 51 | false | v25.12.14 | 1,297 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw =... | This conditional is overly complex with multiple checks on the same line. Consider breaking it into a separate function or multiple lines with descriptive variable names to improve readability and maintainability. | # ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw =... | @@ -199,7 +199,7 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or os.path.exists('/usr/local/cuda/bin/nvcc'):
+ elif has_cmd('nvcc... | lib/classes/device_installer.py | 26 | Python | 0.5 | suggestion | 213 | 51 | 51 | false | v25.12.14 | 1,302 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
# ============================================================
# ROCm
# ============================================================
elif has_cmd('rocminfo') or os.path.exists('/opt/rocm'):
... | On Windows (when `os.name == 'nt'`), the code calls `lspci` which is a Linux-specific command and will not be available. This will cause `try_cmd('lspci')` to fail or return empty output, breaking the Intel GPU detection logic on Windows.
```suggestion
if os.name == 'nt':
out = try_cmd('dxdi... | msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
# ============================================================
# ROCm
# ============================================================
elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os... | @@ -243,18 +243,10 @@ def jetpack_version(text:str)->str:
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
- # ============================================================
- # APPLE MPS
- # ===============================================... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 424 | 51 | 51 | false | v25.12.14 | 1,302 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw =... | This condition is excessively long and complex, making it difficult to read and maintain. Consider breaking it into multiple boolean variables with descriptive names (e.g., `has_nvcc_unix`, `has_nvcc_windows`, `has_cuda_env`) and combining them with logical OR operations. | # ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw =... | @@ -199,7 +199,7 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or os.path.exists('/usr/local/cuda/bin/nvcc'):
+ elif has_cmd('nvcc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 272 | 51 | 51 | false | v25.12.14 | 1,303 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
tag = f'cu{major}{minor}'
else:
msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
# ============================================================
# ROCm
# ============================================================
... | The Windows Intel XPU detection uses `dxdiag` which is a generic DirectX diagnostic tool, not specific to Intel GPUs. This could lead to false positives on Windows systems with any GPU. Consider using a more specific detection method for Intel XPU on Windows, or document why this broad check is acceptable. | tag = f'cu{major}{minor}'
else:
msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
# ============================================================
# ROCm
# ============================================================
... | @@ -243,18 +243,10 @@ def jetpack_version(text:str)->str:
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
- # ============================================================
- # APPLE MPS
- # ===============================================... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 307 | 51 | 51 | false | v25.12.14 | 1,303 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw = tegra_version()
jp_code, msg = jetpack_version(raw)
if jp_code ... | The removal of the inline comment explaining that the code forces nvcc into PATH reduces code clarity. While the print statement on line 204 indicates hardware detection, the original comment provided valuable context about why the PATH manipulation on lines 205-207 exists. Consider restoring the comment or adding a br... | # ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
print("---> Hardware detected: JETSON")
raw = tegra_version()
jp_code... | @@ -200,7 +201,7 @@ def jetpack_version(text:str)->str:
# CUDA
# ============================================================
elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (os.name == 'nt' and os.environ.get('CUDA_PATH') and os.path.exists(os.pat... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 515 | 51 | 51 | false | v25.12.15 | 1,308 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']:
print(f"Hardware detected: {device_info['name']}")
m = re.search(r'\+(.+)$', torch_version)
current_tag = m.group(1) if m else None
... | Removing the `--no-binary` flag for scikit-learn installation changes the behavior from building from source to using pre-built binary wheels. On Jetson platforms, pre-built wheels may not be optimized for ARM architecture or may have compatibility issues with custom PyTorch builds. If this change was made to speed up ... | device_info = json.loads(device_info_str)
if device_info:
torch_version = self.get_package_version('torch')
if torch_version:
if device_info['tag'] not in ['cpu', 'unknown', 'unsupported']:
m = re... | @@ -454,7 +457,7 @@ def install_device_packages(self, device_info_str:str)->int:
torchaudio_pkg = f"{url}/v{toolkit_version}/torchaudio-{jetson_torch_version_base[tag]}+{tag}-{tag_py}-{os_env}_{arch}.whl"
subprocess.check_call([sys.execut... | lib/classes/device_installer.py | 26 | Python | 1 | performance | 645 | 51 | 51 | false | v25.12.15 | 1,308 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return False
msg = '\nAll required packages are installed.'
print(msg)
return self.check_dictionary()
except Exception as e:
error = f'install_python_packages() error: {e}'
print(error)
return False
... | Printing the entire device_info dictionary may produce unclear output. Consider printing specific fields like device_info['name'] or device_info['tag'] to provide a clearer message matching the format of the removed print statements (e.g., '---> Hardware detected: JETSON').
```suggestion
print(f"---... | except Exception as e:
error = f'install_python_packages() error: {e}'
print(error)
return False
def check_dictionary(self)->bool:
import unidic
unidic_path = unidic.DICDIR
dicrc = os.path.join(unidic_path, 'dicrc')
if not os.pat... | @@ -434,6 +430,7 @@ def install_device_packages(self, device_info_str:str)->int:
if device_info_str:
device_info = json.loads(device_info_str)
if device_info:
+ print(f'---> Hardware detected: {device_info}') | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 407 | 51 | 51 | false | v25.12.15 | 1,310 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if jp_code in ['unsupported', 'unknown']:
pass
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):... | File handle is not properly closed after reading. Use a context manager (with statement) to ensure the file is closed properly, preventing resource leaks. | if jp_code in ['unsupported', 'unknown']:
pass
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 154 | 51 | 51 | false | optimize cuda hardware detection | 1,323 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# CUDA
# ============================================================
elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (os.name == 'nt' and os.environ.get('CUDA_PATH') and os.path.e... | The same wmic command is executed twice unnecessarily. Store the result in a variable and check both conditions against it to avoid redundant command execution.
```suggestion
(lambda wmic_out: 'nvidia' in wmic_out or 'ven_10de' in wmic_out)(
try_cmd('wmic path win32_V... | # ============================================================
# CUDA
# ============================================================
elif (
(
os.name == 'posix' and (
(has_cmd('lspci') and '10de:' in try_cmd('lspci -nn').lower()) or
... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 395 | 51 | 51 | false | optimize cuda hardware detection | 1,323 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | If '/sys/bus/pci/devices' does not exist, os.listdir() will raise FileNotFoundError. Wrap this logic in a try-except block or check if the directory exists before attempting to list it.
```suggestion
(
any(
os.path.exists(f'/sys/bus/pci/devices/{d}... | elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.929 | suggestion | 657 | 51 | 51 | false | optimize cuda hardware detection | 1,323 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw = tegra_version()
jp_code, msg = jetpack_version(raw)
if jp_code ... | This complex nested condition spanning 37 lines is difficult to read and maintain. Consider extracting the hardware detection logic into separate helper functions like `_has_nvidia_gpu_posix()` and `_has_nvidia_gpu_windows()`, and the CUDA toolkit check into `_has_cuda_toolkit()`. | # ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw = tegra_version()
jp_code, msg = jetpack_version(raw)
if jp_code ... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 281 | 51 | 51 | false | optimize cuda hardware detection | 1,323 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if jp_code in ['unsupported', 'unknown']:
pass
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):... | File handle is not being closed after reading. Use a context manager (with statement) to ensure proper resource cleanup. | if jp_code in ['unsupported', 'unknown']:
pass
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 120 | 51 | 51 | false | optimize cuda hardware detection | 1,324 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# CUDA
# ============================================================
elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (os.name == 'nt' and os.environ.get('CUDA_PATH') and os.path.e... | The same wmic command is executed twice. Store the result in a variable and reuse it to avoid redundant system calls.
```suggestion
(lambda wmic_out: (
'nvidia' in wmic_out or
'ven_10de' in wmic_out
))(try_cmd(
... | # ============================================================
# CUDA
# ============================================================
elif (
(
os.name == 'posix' and (
(has_cmd('lspci') and '10de:' in try_cmd('lspci -nn').lower()) or
... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 436 | 51 | 51 | false | optimize cuda hardware detection | 1,324 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | If /sys/bus/pci/devices does not exist, os.listdir will raise FileNotFoundError. Add existence check for the directory before calling os.listdir.
```suggestion
(
os.path.exists('/sys/bus/pci/devices') and any(
os.path.exists(f'/sys/bus/pci/devices/... | elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | @@ -199,7 +199,43 @@ def jetpack_version(text:str)->str:
# ============================================================
# CUDA
# ============================================================
- elif has_cmd('nvcc') or has_cmd('nvcc.exe') or os.path.exists('/usr/local/cuda/bin/nvcc') or (... | lib/classes/device_installer.py | 26 | Python | 0.929 | suggestion | 608 | 51 | 51 | false | optimize cuda hardware detection | 1,324 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
minor = parts[1] if len(parts) > 1 else 0
patch = parts[2] if len(parts) > 2 else 0
name = 'cuda'
tag = f'cu{major}{minor}'
else:
msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
... | File handle opened in a generator expression without being properly closed. If an exception occurs or the generator is not fully consumed, this will leak file descriptors. Use a context manager (with statement) or a try-finally block. | elif cmp == 1:
msg = f'CUDA {version_str} > max {cuda_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['CUDA']['found'] = True
parts = version_str.split(".")
major = parts[0]
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 234 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# INTEL XPU
# ============================================================
elif os.path.exists('/dev/dri/renderD128') or (os.name == 'nt' and has_cmd('dxdiag')):
if os.name == 'nt':
out = try_cmd('... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | for d in os.listdir('/sys/bus/pci/devices')
if os.path.isdir(f'/sys/bus/pci/devices/{d}')
) or
os.path.exists('/dev/kfd')
)
) or (
os.name == 'nt' and (
(has_cmd('wmic'... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
error = f'Unrecognized git package: {package}'
print(error)
missing_packages.append(package)
continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | ) or (
os.name == 'nt' and (
(has_cmd('wmic') and (
'intel' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_8086' in try_cmd(
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
missing_packages.append(package)
continue
if '+' in installed_version:
continue
else:
spec_str = clean_pkg[len(pkg_name):].strip()
if spec_str:
from packaging.speci... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | 'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice ... | This code pattern for reading version files from multiple paths is duplicated across CUDA, ROCm, and Intel XPU detection sections. Consider extracting this logic into a helper function to reduce code duplication and improve maintainability. | (has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 0.5 | refactor | 240 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
).lower())
)
)
) and (
has_cmd('nvcc') or
has_cmd('nvcc.exe') or
os.path.exists('/usr/local/cuda/bin/nvcc') or
(os.name == 'nt' and os.environ.get('CUDA_PATH') and
os.path.exists(os.path.join(os.environ[... | If toolkit_version_parse returns None (e.g., if the version file content doesn't match the expected patterns), toolkit_version_compare will return None, but the subsequent if-elif chain doesn't handle this case. This will cause the code to fall through to the else clause on line 266, which may not be the appropriate er... | version_out = ''
if os.name == 'posix':
for p in (
'/usr/local/cuda/version.json',
'/usr/local/cuda/version.txt',
):
if os.path.exists(p):
version_out = open(p, 'r', encoding='utf-... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 552 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
from packaging.version import Version, InvalidVersion
spec = SpecifierSet(spec_str)
norm_match = re.match(r'^(\d+\.\d+(?:\.\d+)?)', installed_version)
short_version = norm_match.group(1) if norm_match else installed_version
... | If toolkit_version_parse returns None (e.g., if the version file content doesn't match the expected patterns), toolkit_version_compare will return None, but the subsequent if-elif chain doesn't handle this case. This will cause the code to fall through to the else clause on line 413, which may not be the appropriate er... | for p in (
'/opt/intel/oneapi/version.txt',
'/opt/intel/oneapi/compiler/latest/version.txt',
'/opt/intel/oneapi/runtime/latest/version.txt',
):
if os.path.exists(p):
version_out = open... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 581 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
).lower() or
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | )) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if cmp == -1 or cmp == 1:
msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.'
elif cmp == 0 and (has_cmd('sycl-ls') or has_cmd('clinfo')):
devices['XPU']['found'] = True
name = 'xpu'
... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | 'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/version',
'/opt/rocm/version'... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import importlib
from tqdm import tqdm
with open(requirements_file, 'r') as f:
contents = f.read().replace('\r', '\n')
packages = [pkg.strip() for pkg in contents.splitlines() if pkg.strip() and re.search(r'[a-zA-Z0-9]', pkg)]
if sy... | File handle opened in a generator expression without being properly closed. If an exception occurs or the generator is not fully consumed, this will leak file descriptors. Use a context manager (with statement) or a try-finally block. | msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 234 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# CPU
# ============================================================
if tag is None:
name = 'cpu'
tag = 'cpu'
return (name, tag, msg)
def install_python_packages(self)->bool:
... | The ROCm tag format is inconsistent with the torch_matrix defined in lib/conf.py. This code generates tags like "rocm55" or "rocm60", but torch_matrix expects tags like "rocm5.5" or "rocm6.0" (with dots). This will cause the generated tag to not match any entry in torch_matrix, leading to installation failures. The tag... | os.path.join(base, '.info', 'version'),
):
if os.path.exists(p):
version_out = open(p, 'r', encoding='utf-8', errors='ignore').read()
break
if version_out:
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 442 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
name = 'xpu'
tag = 'xpu'
# ============================================================
# APPLE MPS
# ============================================================
elif sys.platform == 'darwin' and arch in ('arm64', 'aarch64'):
devices['MPS']['... | If toolkit_version_parse returns None (e.g., if the version file content doesn't match the expected patterns), toolkit_version_compare will return None, but the subsequent if-elif chain doesn't handle this case. This will cause the code to fall through to the else clause on line 342, which may not be the appropriate er... | ):
if os.path.exists(p):
version_out = open(p, 'r', encoding='utf-8', errors='ignore').read()
break
elif os.name == 'nt':
for env in ('ROCM_PATH', 'HIP_PATH'):
base = os.environ.get(env)
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 593 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
) or
os.path.exists('/dev/nvidiactl') or
os.path.exists('/dev/nvidia0')
)
) or
(
os.name == 'nt' and (
(has_cmd('wmic') and (
'nvidia' in try_cmd(
... | File handle opened without being properly closed. Use a context manager (with statement) or explicitly close the file to avoid resource leaks. | )
) or (
os.name == 'nt' and (
(has_cmd('wmic') and (
'nvidia' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_10de' in... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 0.571 | suggestion | 142 | 51 | 51 | false | v25.12.16 | 1,327 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
) or
os.path.exists('/dev/nvidiactl') or
os.path.exists('/dev/nvidia0')
)
) or
(
os.name == 'nt' and (
(has_cmd('wmic') and (
'nvidia' in try_cmd(
... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | )
) or (
os.name == 'nt' and (
(has_cmd('wmic') and (
'nvidia' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_10de' in... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
minor = parts[1] if len(parts) > 1 else 0
patch = parts[2] if len(parts) > 2 else 0
name = 'cuda'
tag = f'cu{major}{minor}'
else:
msg = 'Cuda GPU detected but not compatible or Cuda runtime is missing.'
... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | elif cmp == 1:
msg = f'CUDA {version_str} > max {cuda_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['CUDA']['found'] = True
parts = version_str.split(".")
major = parts[0]
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# INTEL XPU
# ============================================================
elif os.path.exists('/dev/dri/renderD128') or (os.name == 'nt' and has_cmd('dxdiag')):
if os.name == 'nt':
out = try_cmd('... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | for d in os.listdir('/sys/bus/pci/devices')
if os.path.isdir(f'/sys/bus/pci/devices/{d}')
) or
os.path.exists('/dev/kfd')
)
) or (
os.name == 'nt' and (
(has_cmd('wmic'... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
if cmp == -1 or cmp == 1:
msg = f'XPU {version_str} out of supported range {xpu_version_range}. Falling back to CPU.'
elif cmp == 0 and (has_cmd('sycl-ls') or has_cmd('clinfo')):
devices['XPU']['found'] = True
name = 'xpu'
... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | 'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/version',
'/opt/rocm/version'... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice ... | The code checks for version.json files but toolkit_version_parse() uses regex patterns expecting text like 'cuda version: X.Y'. JSON files typically have structured data that may not match these patterns. Consider either parsing JSON properly using json.loads() or prioritizing .txt files over .json files.
```suggestion... | (has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 2,685 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
).lower() or
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | )) or
(has_cmd('powershell') and 'ven_10de' in try_cmd(
'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
... | @@ -229,22 +225,32 @@ def jetpack_version(text:str)->str:
).lower())
)
)
- ) and (
- has_cmd('nvcc') or
- has_cmd('nvcc.exe') or
- os.path.exists('/usr/local/cuda/bin/nvcc') or
- (os.name == 'nt' and os.environ.get('CU... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import importlib
from tqdm import tqdm
with open(requirements_file, 'r') as f:
contents = f.read().replace('\r', '\n')
packages = [pkg.strip() for pkg in contents.splitlines() if pkg.strip() and re.search(r'[a-zA-Z0-9]', pkg)]
if sy... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
error = f'Unrecognized git package: {package}'
print(error)
missing_packages.append(package)
continue
clean_pkg = re.sub(r'\[.*?\]', '', package)
pkg_name = re.split(r'[<>=]', clean_pkg, maxsplit=... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | ) or (
os.name == 'nt' and (
(has_cmd('wmic') and (
'intel' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_8086' in try_cmd(
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
missing_packages.append(package)
continue
if '+' in installed_version:
continue
else:
spec_str = clean_pkg[len(pkg_name):].strip()
if spec_str:
from packaging.speci... | File handle is opened but never explicitly closed. This can lead to resource leaks, especially if this code runs frequently or if an exception occurs. Use a context manager (with statement) to ensure the file is properly closed. | 'powershell -Command "Get-PnpDevice -Class Display | '
'Select-Object -ExpandProperty InstanceId"'
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.643 | suggestion | 228 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
# ============================================================
# CPU
# ============================================================
if tag is None:
name = 'cpu'
tag = 'cpu'
return (name, tag, msg)
def install_python_packages(self)->bool:
... | The ROCm tag format is incorrect. It should be 'rocm{major}.{minor}' (with a dot separator) to match the torch_matrix entries in lib/conf.py (e.g., 'rocm5.5', 'rocm6.0'). The current format 'rocm{major}{minor}' would produce tags like 'rocm55' instead of 'rocm5.5', causing lookup failures.
```suggestion
... | os.path.join(base, '.info', 'version'),
):
if os.path.exists(p):
version_out = open(p, 'r', encoding='utf-8', errors='ignore').read()
break
if version_out:
... | @@ -263,47 +269,149 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif has_cmd('rocminfo') or os.path.exists('/opt/rocm') or os.path.exists('/opt/rocm/bin/roc... | lib/classes/device_installer.py | 26 | Python | 0.857 | bug | 357 | 51 | 51 | false | v25.12.16 | 1,328 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
m = re.search(r'cuda\s*version\s*[:=]?\s*([0-9]+(?:\.[0-9]+)?)', text, re.IGNORECASE)
if m:
return m.group(1)
# ----- ROCm -----
m = re.search(r'rocm\s*version\s*[:=]?\s*([0-9]+(?:\.[0-9]+){0,2})', text, re.IGNORECASE)
if m:
par... | The first CUDA regex pattern requires the 'version' keyword and expects 1-2 decimal components (e.g., '12.1' or '12.1.0'), but it won't match 'cuda version 12' or 'cuda version: 12' because the pattern requires at least one dot with `{1,2}`. The old pattern used `[:=]?` to match optional separators like colons and equa... | if text.startswith('{'):
try:
import json
obj = json.loads(text)
if isinstance(obj, dict):
# New CUDA JSON
if 'cuda' in obj and isinstance(obj['cuda'], dict):
v = obj['cuda'].get('version... | @@ -72,35 +72,68 @@ def try_cmd(cmd:str)->str:
except Exception:
return ''
- def toolkit_version_parse(text:str)->Union[str, None]:
- if not text:
- return None
- # ----- CUDA -----
- m = re.search(r'cuda\s*version\s*[:=]?\s*([0-9]+(... | lib/classes/device_installer.py | 26 | Python | 0.786 | suggestion | 504 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
) or
os.path.exists('/dev/kfd')
)
) or (
os.name == 'nt' and (
(has_cmd('wmic') and '1002' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()) or
... | There is an extra leading space before `elif`, making the indentation incorrect (9 spaces instead of 8). This will cause a syntax error. The line should start with exactly 8 spaces to align with the previous `elif` at line 232.
```suggestion
elif (
``` | version_out = f.read()
break
if not version_out:
msg = 'CUDA hardware detected but CUDA toolkit version file not found.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolki... | @@ -269,18 +306,21 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif (
+ elif ( | lib/classes/device_installer.py | 26 | Python | 1 | bug | 260 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'nvidia' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
)... | File handles opened within the generator expression are not explicitly closed. While Python's garbage collector will eventually close these files, it's better practice to use a helper function or ensure proper cleanup. Consider refactoring to read the vendor file content in a way that guarantees the file is closed imme... | elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | @@ -200,11 +233,14 @@ def jetpack_version(text:str)->str:
(
os.name == 'posix' and (
(has_cmd('lspci') and '10de:' in try_cmd('lspci -nn').lower()) or
- any(
- os.path.exists(f'/sys/bus/pci/devices/{d}/vendor') and
- ... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 342 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/version',
'/opt/rocm/version',
):
if os.path.exists(p):
... | File handles opened within the generator expression are not explicitly closed. While Python's garbage collector will eventually close these files, it's better practice to use a helper function or ensure proper cleanup. Consider refactoring to read the vendor file content in a way that guarantees the file is closed imme... | msg = f'CUDA {version_str} > max {cuda_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['CUDA']['found'] = True
parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(p... | @@ -269,18 +306,21 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif (
+ elif (
(
os.name == 'posix' and (
... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 342 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'ven_8086' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_8086' in try_cmd(
'powershell -Command "Get-PnpDevice ... | File handles opened within the generator expression are not explicitly closed. While Python's garbage collector will eventually close these files, it's better practice to use a helper function or ensure proper cleanup. Consider refactoring to read the vendor file content in a way that guarantees the file is closed imme... | msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
... | @@ -348,12 +385,13 @@ def jetpack_version(text:str)->str:
elif (
(
os.name == 'posix' and (
- (
- os.path.exists('/dev/dri/renderD128') and (
- (has_cmd('lspci') and '8086:' in try_cmd('lspci -nn').lower()) or
+ ... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 342 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return 0
parts = version_str.split('.')
major = int(parts[0])
minor = int(parts[1]) if len(parts) > 1 else 0
patch = int(parts[2]) if len(parts) > 2 else 0
current = (major, minor)
if min_tuple != (0, 0) and current < min_tuple:
... | The function `toolkit_version_parse` has incorrect indentation. It should be indented with 8 spaces (2 levels) to be a nested function inside `detect_device`, but it currently has only 4 spaces (1 level), making it appear as a class method. This breaks the code structure since this function is called from within `detec... | return m.group(1)
m = re.search(
r'rocm\s*version\s*([0-9]+(?:\.[0-9]+){0,2})',
text,
re.IGNORECASE
)
if m:
parts = m.group(1).split('.')
return f"{parts[0]}.{parts[1] if len(parts) > 1 else 0}"
m = re.search(
... | @@ -72,35 +72,68 @@ def try_cmd(cmd:str)->str:
except Exception:
return ''
- def toolkit_version_parse(text:str)->Union[str, None]:
- if not text:
- return None
- # ----- CUDA -----
- m = re.search(r'cuda\s*version\s*[:=]?\s*([0-9]+(... | lib/classes/device_installer.py | 26 | Python | 0.643 | bug | 507 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
return m
return 'unknown'
def detect_device(self)->str:
def has_cmd(cmd:str)->bool:
return shutil.which(cmd) is not None
def try_cmd(cmd:str)->str:
try:
out = subprocess.check_output(
cmd,
shell = ... | The `json` module is imported locally at line 81, but it's already imported at the module level on line 1. The local import is unnecessary and should be removed for consistency and clarity.
```suggestion
``` | return m
return 'unknown'
def detect_device(self)->str:
def has_cmd(cmd:str)->bool:
return shutil.which(cmd) is not None
def try_cmd(cmd:str)->str:
try:
out = subprocess.check_output(
cmd,
shell = ... | @@ -72,35 +72,68 @@ def try_cmd(cmd:str)->str:
except Exception:
return ''
- def toolkit_version_parse(text:str)->Union[str, None]:
- if not text:
- return None
- # ----- CUDA -----
- m = re.search(r'cuda\s*version\s*[:=]?\s*([0-9]+(... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 208 | 51 | 51 | false | v25.12.16 | 1,330 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'nvidia' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower() or
'ven_10de' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
)... | File handle is not being closed properly. While this is within a generator expression making context managers difficult, consider adding proper resource cleanup or using a helper function with context manager. | elif os.path.exists('/etc/nv_tegra_release'):
devices['JETSON']['found'] = True
name = 'jetson'
tag = f'jetson{jp_code}'
elif os.path.exists('/proc/device-tree/compatible'):
out = try_cmd('cat /proc/device-tree/compatible')
... | @@ -200,11 +233,14 @@ def jetpack_version(text:str)->str:
(
os.name == 'posix' and (
(has_cmd('lspci') and '10de:' in try_cmd('lspci -nn').lower()) or
- any(
- os.path.exists(f'/sys/bus/pci/devices/{d}/vendor') and
- ... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 209 | 51 | 51 | false | v25.12.16 | 1,331 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
).lower())
)
)
):
version_out = ''
if os.name == 'posix':
for p in (
'/opt/rocm/.info/version',
'/opt/rocm/version',
):
if os.path.exists(p):
... | File handle is not being closed properly. While this is within a generator expression making context managers difficult, consider adding proper resource cleanup or using a helper function with context manager. | msg = f'CUDA {version_str} > max {cuda_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['CUDA']['found'] = True
parts = version_str.split(".")
major = parts[0]
minor = parts[1] if len(p... | @@ -269,18 +306,21 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif (
+ elif (
(
os.name == 'posix' and (
... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 209 | 51 | 51 | false | v25.12.16 | 1,331 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'ven_8086' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()
)) or
(has_cmd('powershell') and 'ven_8086' in try_cmd(
'powershell -Command "Get-PnpDevice ... | File handle is not being closed properly. While this is within a generator expression making context managers difficult, consider adding proper resource cleanup or using a helper function with context manager. | msg = f'ROCm {version_str} < min {rocm_version_range["min"]}. Please upgrade.'
elif cmp == 1:
msg = f'ROCm {version_str} > max {rocm_version_range["max"]}. Falling back to CPU.'
elif cmp == 0:
devices['ROCM']['found'] = True
... | @@ -348,12 +385,13 @@ def jetpack_version(text:str)->str:
elif (
(
os.name == 'posix' and (
- (
- os.path.exists('/dev/dri/renderD128') and (
- (has_cmd('lspci') and '8086:' in try_cmd('lspci -nn').lower()) or
+ ... | lib/classes/device_installer.py | 26 | Python | 0.643 | refactor | 209 | 51 | 51 | false | v25.12.16 | 1,331 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
) or
os.path.exists('/dev/kfd')
)
) or (
os.name == 'nt' and (
(has_cmd('wmic') and '1002' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceID'
).lower()) or
... | Extra leading space before 'elif'. The indentation should align with the previous 'if' statement.
```suggestion
elif (
``` | version_out = f.read()
break
if not version_out:
msg = 'CUDA hardware detected but CUDA toolkit version file not found.'
else:
version_str = toolkit_version_parse(version_out)
cmp = toolki... | @@ -269,18 +306,21 @@ def jetpack_version(text:str)->str:
# ============================================================
# ROCm
# ============================================================
- elif (
+ elif ( | lib/classes/device_installer.py | 26 | Python | 0.786 | suggestion | 130 | 51 | 51 | false | v25.12.16 | 1,331 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid
import regex as re
import numpy as np
import soundfile as sf
from multiprocessing.managers import DictProxy
from typing import Any
from pathlib import Path
from huggingface_hub import hf_hub_download
from lib.classes.vram_detector im... | The `types` module is used here but is not imported. This will result in a NameError at runtime when torch.distributed is not available. Add `import types` at the top of the file with the other imports. | import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid
import regex as re
import numpy as np
import soundfile as sf
from multiprocessing.managers import DictProxy
from typing import Any
from pathlib import Path
from huggingface_hub import hf_hub_download
from lib.classes.vram_detector im... | @@ -17,6 +17,21 @@
#import logging
#logging.basicConfig(level=logging.DEBUG)
+if not hasattr(torch, "distributed"):
+ torch.distributed = types.SimpleNamespace() | lib/classes/tts_engines/coqui.py | 21 | Python | 0.786 | suggestion | 202 | 46 | 46 | false | v25.12.16 | 1,339 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
missing_packages = []
cuda_markers = ('+cu', '+xpu', '+nv', '+git')
for package in packages:
if ';' in package:
pkg_part, marker_part = package.split(';', 1)
marker_part = marker_part.strip()
try:
... | Inconsistent capitalization: "Cuda" should be "CUDA" to match the capitalization used elsewhere in the file (lines 493, 499, 501, etc.).
```suggestion
msg = 'CUDA GPU detected but not compatible or CUDA runtime is missing.'
``` | os.path.join(cuda_path, 'version.json'),
os.path.join(cuda_path, 'version.txt'),
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
ver... | @@ -378,43 +463,56 @@ def jetpack_version(text:str)->str:
tag = f'rocm{major}{minor}'
else:
msg = 'ROCm GPU detected but not compatible or ROCm runtime is missing.'
+
+ # ============================================================
+ ... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 247 | 51 | 51 | false | v25.12.16 | 1,339 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
'/usr/local/cuda/version.txt',
):
if os.path.exists(p):
with open(p, 'r', encoding='utf-8', errors='ignore') as f:
version_out = f.read()
break
elif os.name == 'nt':
... | The has_nvidia_gpu_pci function returns True if nvidia-smi command exists, without actually checking if it works or if GPUs are detected. This creates redundancy with has_working_cuda which already runs nvidia-smi -L. Consider removing the nvidia-smi check from this function since has_working_cuda already validates the... | if sys.platform == "darwin":
return False
# ---------- Linux ----------
if os.name == "posix":
sysfs = "/sys/bus/pci/devices"
if os.path.isdir(sysfs):
for d in os.listdir(sysfs):
dev = os.path... | @@ -199,6 +199,197 @@ def jetpack_version(text:str)->str:
msg = 'Unrecognized JetPack 6.x version. Falling back to CPU.'
return ('unknown', msg)
+ def has_amd_gpu_pci():
+ # macOS: no ROCm-capable AMD GPUs
+ if sys.platform == "darwin":
+ retur... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 430 | 51 | 51 | false | v25.12.16 | 1,339 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
)
)
)
)
) or (
os.name == 'nt' and (
(has_cmd('wmic') and (
'intel' in try_cmd(
'wmic path win32_VideoController get Name,PNPDeviceI... | The reordering of GPU detection logic now prioritizes ROCm over CUDA. On systems with both AMD and NVIDIA GPUs, ROCm will be selected. This changes the previous behavior where CUDA was checked first. Consider documenting this priority change or adding a comment explaining the reasoning, especially since this could affe... |
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/etc/nv_tegra_release') or 'tegra' in try_cmd('cat /proc/device-tree/compatible')):
raw ... | @@ -226,116 +417,10 @@ def jetpack_version(text:str)->str:
if 'tegra' in out:
msg = 'Jetson GPU detected but not (yes) compatible'
- # ============================================================
- # CUDA
- # ==========================================... | lib/classes/device_installer.py | 26 | Python | 0.857 | suggestion | 735 | 51 | 51 | false | v25.12.16 | 1,339 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid
import regex as re
import numpy as np
import soundfile as sf
from multiprocessing.managers import DictProxy
from typing import Any
from pathlib import Path
from huggingface_hub import hf_hub_download
from lib.classes.vram_detector im... | The code uses `types.SimpleNamespace()` but the `types` module is not imported. This will cause a `NameError` at runtime when the condition `not hasattr(torch, "distributed")` is true. Add `import types` at the top of the file with the other imports. | import threading, torch, torchaudio, random, gc, shutil, subprocess, tempfile, uuid
import regex as re
import numpy as np
import soundfile as sf
from multiprocessing.managers import DictProxy
from typing import Any
from pathlib import Path
from huggingface_hub import hf_hub_download
from lib.classes.vram_detector im... | @@ -17,6 +17,21 @@
#import logging
#logging.basicConfig(level=logging.DEBUG)
+if not hasattr(torch, "distributed"):
+ torch.distributed = types.SimpleNamespace() | lib/classes/tts_engines/coqui.py | 21 | Python | 0.786 | suggestion | 250 | 46 | 46 | false | v25.12.16 | 1,340 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | The error message has been changed from "not (yes) compatible" to "not(?) compatible". While this appears to be clarifying uncertainty, the removal of the space before the parenthesis makes it less readable. Consider using "not (?) compatible" or "possibly not compatible" for better clarity.
```suggestion
... | name = None
tag = None
msg = ''
arch = platform.machine().lower()
# ============================================================
# JETSON
# ============================================================
if arch in ('aarch64','arm64') and (os.path.exists('/e... | @@ -415,7 +415,7 @@ def has_working_xpu():
tag = f'jetson{jp_code}'
out = try_cmd('uname -a')
if 'tegra' in out:
- msg = 'Jetson GPU detected but not (yes) compatible'
+ msg = 'Jetson GPU detected but not(?) compatible' | lib/classes/device_installer.py | 26 | Python | 1 | suggestion | 377 | 51 | 51 | false | v25.12.17 | 1,342 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Insta... | The indentation structure appears incorrect here. The llvm@15 installation block (lines 387-392) is inside the darwin-specific conditional that checks for Homebrew (lines 377-386), but it should be at the same level as the brew existence check. This means the llvm@15 installation will only run if Homebrew was just inst... | programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
if ! command -v brew &> /dev/null; then
echo -e "\e[33mHomebrew is not installed. Install... | @@ -374,16 +374,22 @@ function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
- if ! command -v brew &> /dev/null; then
- echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
- /usr/bin/env bash -c "$(... | ebook2audiobook.sh | 26 | Shell | 1 | bug | 718 | 51 | 51 | false | v25.12.17 | 1,342 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
[[ "$program" == "nodejs" ]] && bin="node"
[[ "$program" == "rust" ]] && bin="rustc"
# Special case: tesseract OCR
if [[ "$program" == "tesseract" || "$program" == "tesseract-ocr" ]]; then
bin="tesseract"
if command -v zypper >/dev/null 2>&1 || command -v apt-get >/dev/null 2>&1 || command -v apk >/dev/... | The Homebrew installation step downloads the installer script from `$BREW_INSTALLER_URL` with `curl` and immediately executes it via `/usr/bin/env bash -c`, without any integrity or authenticity verification. If the remote host, DNS, or TLS channel is compromised, an attacker can serve a modified installer and achieve ... | [[ "$program" == "nodejs" ]] && bin="node"
[[ "$program" == "rust" ]] && bin="rustc"
# Special case: tesseract OCR
if [[ "$program" == "tesseract" || "$program" == "tesseract-ocr" ]]; then
bin="tesseract"
if command -v zypper >/dev/null 2>&1 || command -v apt-get >/dev/null 2>&1 || command -v apk >/dev/... | @@ -374,16 +374,22 @@ function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"
- if ! command -v brew &> /dev/null; then
- echo -e "\e[33mHomebrew is not installed. Installing Homebrew...\e[0m"
- /usr/bin/env bash -c "$(... | ebook2audiobook.sh | 26 | Shell | 0.643 | security | 605 | 51 | 51 | false | v25.12.17 | 1,342 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
fi
if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"... | Typo in command: "brew instal" should be "brew install" (missing 'l' at the end). This will cause the installation of llvm@15 to fail on macOS systems. | fi
if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"... | @@ -386,7 +386,7 @@ function install_programs {
fi
if ! brew list --versions llvm@15 >/dev/null 2>&1; then
echo "Installing llvm@15 (required for numba/llvmlite on macOS)"
- brew install llvm@15
+ brew instal llvm@15 | ebook2audiobook.sh | 26 | Shell | 0.429 | bug | 151 | 51 | 51 | false | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
else:
error = 'convert2epub() failed!'
else:
error = f"Your device has not enough memory ({total_vram_gb}GB) to run {session['tts_engine']} engine ({device_vram_required}GB)"
... | NameError: The variable 'audiobook' is not defined in this scope. Looking at similar code patterns in the codebase (e.g., line 2339), this should likely be 'session['final_name']' instead. This will cause a runtime error when attempting to clean up the process directory in headless mode. | else:
error = f"Your device has not enough memory ({total_vram_gb}GB) to run {session['tts_engine']} engine ({device_vram_required}GB)"
else:
error = f"Temporary directory {session['process_dir']} not removed... | @@ -2463,6 +2461,9 @@ def finalize_audiobook(id:str)->tuple:
show_alert({"type": "info", "msg": msg})
exported_files = combine_audio_chapters(session['id'])
if exported_files is not None:
+ if not session['is_gui_process']:
+ proces... | lib/functions.py | 26 | Python | 0.643 | refactor | 288 | 51 | 51 | false | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
conda update --all -y
conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda dea... | Duplicate 'pip' argument in upgrade command. The command includes 'pip' twice: '--upgrade pip pip setuptools wheel'. This is redundant and should be '--upgrade pip setuptools wheel'. Additionally, the output is redirected to 'nul' which is a Windows convention; on Unix/Linux systems, it should be '/dev/null'. | conda update --all -y
conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda dea... | @@ -627,6 +627,8 @@ function install_python_packages {
echo "[ebook2audiobook] Installing dependencies..."
python3 -m pip cache purge > /dev/null 2>&1
python3 -m pip install --upgrade pip > /dev/null 2>&1
+ python3 -m pip install --upgrade pip pip setuptools wheel >nul 2>&1 | ebook2audiobook.sh | 26 | Shell | 0.643 | refactor | 310 | 51 | 51 | false | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import librosa
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.models import default_voice_detection_model
class BackgroundDetector:
def __init__(self,wav_file:str):
self.wav_file=wav_file
... | The 'onset' and 'offset' hyperparameters have been removed from the VoiceActivityDetection configuration. These parameters control the activation thresholds for detecting voice activity (onset at 0.5 and offset at 0.5 in the previous version). Removing these may cause the pipeline to use default values that could diffe... | import os
import torch
import librosa
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.models import default_voice_detection_model
class BackgroundDetector:
def __init__(self, wav_file:str):
self.wav_file = wav_file
... | @@ -8,29 +8,35 @@
from lib.models import default_voice_detection_model
class BackgroundDetector:
- def __init__(self,wav_file:str):
- self.wav_file=wav_file
- model=Model.from_pretrained(default_voice_detection_model,cache_dir=tts_dir)
- self.pipeline=VoiceActivityDetection(segmentation=mode... | lib/classes/background_detector.py | 25 | Python | 0.643 | performance | 532 | 36 | 42 | false | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda deactivate > /dev/null 2>&1... | Missing output redirection for error stream. While this command is installing critical packages (llvmlite and numba), stdout is not redirected but stderr is also not handled. Consider adding error handling or at least capturing stderr for debugging, especially since this is using --only-binary flag which may fail if bi... | conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda deactivate > /dev/null 2>&1... | @@ -627,6 +627,8 @@ function install_python_packages {
echo "[ebook2audiobook] Installing dependencies..."
python3 -m pip cache purge > /dev/null 2>&1
python3 -m pip install --upgrade pip > /dev/null 2>&1
+ python3 -m pip install --upgrade pip pip setuptools wheel >nul 2>&1
+ python3 -m pip install --upgrade llvm... | ebook2audiobook.sh | 26 | Shell | 0.643 | bug | 367 | 51 | 51 | false | v25.12.18 | 1,352 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
fi
if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"... | Typo in brew install command. "instal" should be "install".
```suggestion
brew install llvm@15
``` | fi
if ! command -v "$bin" &>/dev/null; then
echo -e "\e[33m$pkg is not installed.\e[0m"
programs_missing+=("$pkg")
fi
done
(( ${#programs_missing[@]} == 0 ))
}
function install_programs {
if [[ "$OSTYPE" == darwin* ]]; then
echo -e "\e[33mInstalling required programs...\e[0m"
PACK_MGR="brew install"... | @@ -386,7 +386,7 @@ function install_programs {
fi
if ! brew list --versions llvm@15 >/dev/null 2>&1; then
echo "Installing llvm@15 (required for numba/llvmlite on macOS)"
- brew install llvm@15
+ brew instal llvm@15 | ebook2audiobook.sh | 26 | Shell | 0.786 | suggestion | 100 | 51 | 51 | false | v25.12.18 | 1,353 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
import os
import numpy as np
import librosa
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.models import default_voice_detection_model
class BackgroundDetector:
def __init__(self,wav_file:str):
self.wav_file=wav_file
... | The comments for "onset" and "offset" thresholds were removed from the hyper_params dictionary. These comments were helpful for understanding what values were previously used (0.5 for both) and why they were removed. Consider adding a comment explaining why these parameters are no longer needed. | import os
import torch
import librosa
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.models import default_voice_detection_model
class BackgroundDetector:
def __init__(self, wav_file:str):
self.wav_file = wav_file
... | @@ -8,29 +8,35 @@
from lib.models import default_voice_detection_model
class BackgroundDetector:
- def __init__(self,wav_file:str):
- self.wav_file=wav_file
- model=Model.from_pretrained(default_voice_detection_model,cache_dir=tts_dir)
- self.pipeline=VoiceActivityDetection(segmentation=mode... | lib/classes/background_detector.py | 24 | Python | 0.5 | suggestion | 296 | 36 | 42 | false | v25.12.18 | 1,353 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
conda update --all -y
conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda dea... | Duplicate "pip" in the upgrade command. The command includes "--upgrade pip pip setuptools wheel" which has "pip" listed twice. This is redundant and should be corrected to "--upgrade pip setuptools wheel".
```suggestion
python3 -m pip install --upgrade pip setuptools wheel >nul 2>&1
``` | conda update --all -y
conda clean --index-cache -y
conda clean --packages --tarballs -y
conda create --prefix "$SCRIPT_DIR/$PYTHON_ENV" python=$PYTHON_VERSION -y || return 1
source "$CONDA_ENV" || return 1
conda activate "$SCRIPT_DIR/$PYTHON_ENV" || return 1
install_python_packages || return 1
conda dea... | @@ -627,6 +627,8 @@ function install_python_packages {
echo "[ebook2audiobook] Installing dependencies..."
python3 -m pip cache purge > /dev/null 2>&1
python3 -m pip install --upgrade pip > /dev/null 2>&1
+ python3 -m pip install --upgrade pip pip setuptools wheel >nul 2>&1 | ebook2audiobook.sh | 26 | Shell | 0.857 | refactor | 289 | 51 | 51 | false | v25.12.18 | 1,353 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
os.environ['COQUI_TOS_AGREED'] = '1'
os.environ['PYTHONIOENCODING'] = 'utf-8'
os.environ['CALIBRE_NO_NATIVE_FILEDIALOGS'] = '1'
os.environ['CALIBRE_TEMP_DIR'] = tmp_dir
os.environ['CALIBRE_CACHE_DIRECTORY'] = tmp_dir
os.environ['CALIBRE_CONFIG_DIRECTORY'] = tmp_dir
os.environ['TMPDIR'] = tmp_dir
os.environ['GRAD... | The LD_PRELOAD environment variable is being set unconditionally with an aarch64-specific library path. This will cause issues on non-aarch64 platforms (x86_64, Windows, macOS) where this library path does not exist. The code should check the platform architecture before setting this environment variable, similar to ho... | os.environ['COQUI_TOS_AGREED'] = '1'
os.environ['PYTHONIOENCODING'] = 'utf-8'
os.environ['CALIBRE_NO_NATIVE_FILEDIALOGS'] = '1'
os.environ['CALIBRE_TEMP_DIR'] = tmp_dir
os.environ['CALIBRE_CACHE_DIRECTORY'] = tmp_dir
os.environ['CALIBRE_CONFIG_DIRECTORY'] = tmp_dir
os.environ['TMPDIR'] = tmp_dir
os.environ['GRAD... | @@ -49,6 +49,7 @@
os.environ['PYTORCH_ENABLE_MPS_FALLBACK'] = '1'
os.environ['PYTORCH_NO_CUDA_MEMORY_CACHING'] = '1'
os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'max_split_size_mb:32,garbage_collection_threshold:0.6,expandable_segments:True'
+os.environ["LD_PRELOAD"] = f"/usr/lib/aarch64-linux-gnu/libgomp.so.1:{os.en... | lib/conf.py | 26 | Python | 0.5 | suggestion | 381 | 51 | 51 | false | v25.12.18 | 1,356 | DrewThomasson/ebook2audiobook | 13,365 | Python | Copilot | ROBERT-MCDOWELL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.