summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2020-12-08 10:09:44 +0100
committerDennis Fink2020-12-08 10:09:44 +0100
commit9eed7e530e68a3faf810d0f00b173f507398eff3 (patch)
tree0a679f6883abc0eef48b7b71c70892f63bb774a3
parentd922fcbe586ab069eb93b6e3b2221beebcd74b48 (diff)
downloadpatternutils-9eed7e530e68a3faf810d0f00b173f507398eff3.tar.gz
patternutils-9eed7e530e68a3faf810d0f00b173f507398eff3.zip
Fix prss and targs
-rw-r--r--patternutils/commands/prss.py6
-rw-r--r--patternutils/commands/targs.py15
2 files changed, 15 insertions, 6 deletions
diff --git a/patternutils/commands/prss.py b/patternutils/commands/prss.py
index d23f67f..1aff122 100644
--- a/patternutils/commands/prss.py
+++ b/patternutils/commands/prss.py
@@ -5,7 +5,7 @@ from typing import Generator
import click
try:
- import feedparser
+ import feedparser # type: ignore
except ImportError:
click.secho("feedparser not installed!", fg="red", err=True)
@@ -67,11 +67,11 @@ def prss(
file_to_search = splitted_href[-1]
try:
- file_index = files.index(file_to_search)
+ file_index = filenames.index(file_to_search)
except ValueError:
click.secho(f"{file_to_search} not found!", fg="red", err=True)
else:
- filename = files[file_index]
+ filename = filenames[file_index]
direntry = direntries[file_index]
entry_values = {
"title": entry.get("title", None),
diff --git a/patternutils/commands/targs.py b/patternutils/commands/targs.py
index bcd2e8e..6478377 100644
--- a/patternutils/commands/targs.py
+++ b/patternutils/commands/targs.py
@@ -11,7 +11,11 @@ import click
from .. import config, template, utils
-def run_command(data: Dict[str, str], run: Callable[..., None], shell: bool,) -> None:
+def run_command(
+ command: str,
+ run: Callable[..., None],
+ shell: bool,
+) -> None:
run(shlex.split(command) if not shell else command)
@@ -113,10 +117,15 @@ def targs(
stdout = subprocess.DEVNULL if redirect_stdout else None
stderr = subprocess.DEVNULL if redirect_stderr else None
patched_subprocess = functools.partial(
- subprocess.run, shell=shell, stdout=stdout, stderr=stderr,
+ subprocess.run,
+ shell=shell,
+ stdout=stdout,
+ stderr=stderr,
)
patched_run_command = functools.partial(
- run_command, run=patched_subprocess, shell=shell,
+ run_command,
+ run=patched_subprocess,
+ shell=shell,
)
max_procs = utils.max_procs() if max_procs == 0 else max_procs