Skip to content

Commit 64f381f

Browse files
CopilotTideDra
andcommitted
Remove normalize_include/ignore_path_patterns wrappers; use normalize_path_patterns directly
Agent-Logs-Url: https://github.com/TideDra/zotero-arxiv-daily/sessions/da2848b7-2e90-4e06-a3ae-4faf74735134 Co-authored-by: TideDra <92413813+TideDra@users.noreply.github.com>
1 parent f84f10c commit 64f381f

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/zotero_arxiv_daily/executor.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,11 @@ def normalize_path_patterns(patterns: list[str] | ListConfig | None, config_key:
2929
return list(patterns)
3030

3131

32-
def normalize_include_path_patterns(include_path: list[str] | ListConfig | None) -> list[str] | None:
33-
return normalize_path_patterns(include_path, "include_path")
34-
35-
36-
def normalize_ignore_path_patterns(ignore_path: list[str] | ListConfig | None) -> list[str] | None:
37-
return normalize_path_patterns(ignore_path, "ignore_path")
38-
39-
4032
class Executor:
4133
def __init__(self, config:DictConfig):
4234
self.config = config
43-
self.include_path_patterns = normalize_include_path_patterns(config.zotero.include_path)
44-
self.ignore_path_patterns = normalize_ignore_path_patterns(config.zotero.ignore_path)
35+
self.include_path_patterns = normalize_path_patterns(config.zotero.include_path, "include_path")
36+
self.ignore_path_patterns = normalize_path_patterns(config.zotero.ignore_path, "ignore_path")
4537
self.retrievers = {
4638
source: get_retriever_cls(source)(config) for source in config.executor.source
4739
}

tests/test_include_path.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
import pytest
55
from omegaconf import OmegaConf
66

7-
from zotero_arxiv_daily.executor import Executor, normalize_path_patterns, normalize_include_path_patterns, normalize_ignore_path_patterns
7+
from zotero_arxiv_daily.executor import Executor, normalize_path_patterns
88
from zotero_arxiv_daily.protocol import CorpusPaper
99

1010

1111
def test_normalize_include_path_patterns_rejects_single_string():
1212
with pytest.raises(TypeError, match="config.zotero.include_path must be a list of glob patterns or null"):
13-
normalize_include_path_patterns("2026/survey/**")
13+
normalize_path_patterns("2026/survey/**", "include_path")
1414

1515

1616
def test_normalize_include_path_patterns_accepts_list_config():
1717
include_path = OmegaConf.create(["2026/survey/**", "2026/reading-group/**"])
1818

19-
assert normalize_include_path_patterns(include_path) == [
19+
assert normalize_path_patterns(include_path, "include_path") == [
2020
"2026/survey/**",
2121
"2026/reading-group/**",
2222
]
@@ -27,7 +27,7 @@ def test_filter_corpus_matches_any_path_against_any_pattern():
2727
executor.config = SimpleNamespace(
2828
zotero=SimpleNamespace(include_path=["2026/survey/**", "2026/reading-group/**"])
2929
)
30-
executor.include_path_patterns = normalize_include_path_patterns(executor.config.zotero.include_path)
30+
executor.include_path_patterns = normalize_path_patterns(executor.config.zotero.include_path, "include_path")
3131
executor.ignore_path_patterns = None
3232

3333
corpus = [
@@ -58,23 +58,23 @@ def test_filter_corpus_matches_any_path_against_any_pattern():
5858

5959
def test_normalize_ignore_path_patterns_rejects_single_string():
6060
with pytest.raises(TypeError, match="config.zotero.ignore_path must be a list of glob patterns or null"):
61-
normalize_ignore_path_patterns("archive/**")
61+
normalize_path_patterns("archive/**", "ignore_path")
6262

6363

6464
def test_normalize_ignore_path_patterns_accepts_list_config():
6565
ignore_path = OmegaConf.create(["archive/**", "2025/**"])
6666

67-
assert normalize_ignore_path_patterns(ignore_path) == ["archive/**", "2025/**"]
67+
assert normalize_path_patterns(ignore_path, "ignore_path") == ["archive/**", "2025/**"]
6868

6969

7070
def test_normalize_ignore_path_patterns_accepts_empty_list():
71-
assert normalize_ignore_path_patterns([]) == []
71+
assert normalize_path_patterns([], "ignore_path") == []
7272

7373

7474
def test_filter_corpus_excludes_papers_matching_ignore_path():
7575
executor = Executor.__new__(Executor)
7676
executor.include_path_patterns = None
77-
executor.ignore_path_patterns = normalize_ignore_path_patterns(["archive/**", "2025/**"])
77+
executor.ignore_path_patterns = normalize_path_patterns(["archive/**", "2025/**"], "ignore_path")
7878

7979
corpus = [
8080
CorpusPaper(
@@ -105,8 +105,8 @@ def test_filter_corpus_excludes_papers_matching_ignore_path():
105105
def test_filter_corpus_ignore_path_takes_precedence_over_include_path():
106106
"""Papers matching both include_path and ignore_path should be excluded."""
107107
executor = Executor.__new__(Executor)
108-
executor.include_path_patterns = normalize_include_path_patterns(["2026/**"])
109-
executor.ignore_path_patterns = normalize_ignore_path_patterns(["2026/ignore/**"])
108+
executor.include_path_patterns = normalize_path_patterns(["2026/**"], "include_path")
109+
executor.ignore_path_patterns = normalize_path_patterns(["2026/ignore/**"], "ignore_path")
110110

111111
corpus = [
112112
CorpusPaper(

0 commit comments

Comments
 (0)