text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
"""GitHub API scraper for all 7 JKU orgs.""" from __future__ import annotations import base64 from pathlib import PurePosixPath from typing import Any import orjson from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper f...
jku-encyclopedia
src/jku_kb/scrapers/github.py
Python
ed73d2245853bf1ae54cad801db7fe3de56ab511b982f4ca0aa91b4f756ac44e
0
896
.metadata.get("org") == org])) return items async def _do_fetch(self, item: RawItem) -> FetchResult: """Fetch README, file tree, and source files. Called by BaseScraper.fetch() template method.""" # Guard: skip fork repos immediately if item.metadata.get("fork"): return...
jku-encyclopedia
src/jku_kb/scrapers/github.py
Python
32920d0d4ede4c0574fb6d8675ec64e9237a6d1fbb89e2442f569a95833e3a1f
1
896
BaseScraper.extract_year(created) return RawItem( item_id=f"{org}_{name}", source_id="github_jku", url=repo.get("html_url", ""), title=f"{org}/{name}", author=org, description=repo.get("description", "") or "", language="en", year=year, modali...
jku-encyclopedia
src/jku_kb/scrapers/github.py
Python
c81dd63f6880567f620f51b81d59d340e4b7df00510cf353c9d4835f1ae4a526
2
223
"""Standalone BFS HTML crawler for recursive page discovery. Exposes crawl_html() as a pure async function that accepts a fetch callable and a url_passes_filter predicate, making it fully testable and reusable. Can be wired to BaseScraper._rate_limited_get and web_crawl._url_passes_filter. """ from __future__ import ...
jku-encyclopedia
src/jku_kb/scrapers/html_crawler.py
Python
9691551892ddee97e357246ae73575d571d591fe9e4d6acf3d4cc75e30f98c4d
0
896
str], Awaitable[httpx.Response]], ) -> RobotFileParser | None: """Fetch and parse robots.txt for the given domain. Returns a RobotFileParser, or None if fetch fails (treat as allow-all). """ robots_url = f"{scheme}://{domain}/robots.txt" try: resp = await fetch(robots_url) if resp.s...
jku-encyclopedia
src/jku_kb/scrapers/html_crawler.py
Python
0c2d66fccd2d38b4e5b5e76dea7fc7507f9cb5df6f312b378772279a503f90ea
1
896
in content_type: continue # Skip non-HTML without downloading body except (asyncio.TimeoutError, Exception): pass # Fall through to full GET on HEAD failure # --- Fetch the page --- try: resp = await asyncio.wait_for(fetch(url), timeout=per_...
jku-encyclopedia
src/jku_kb/scrapers/html_crawler.py
Python
27c2d3b3b6a8dc2fd0a25f6c10ae2e91645cd7b6df7846d3fc2fed71c9b3011d
2
287
"""HuggingFace API scraper for JKU models and datasets.""" from __future__ import annotations from typing import Any from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import BaseScraper HF_A...
jku-encyclopedia
src/jku_kb/scrapers/huggingface.py
Python
5ac17191232f395a0856ea940b965e839a3e93c0c53e55acf8cc2a1bea533e45
0
896
("modelId", "") if not model_id: return None return RawItem( item_id=model_id.replace("/", "_"), source_id="huggingface_jku", url=f"https://huggingface.co/{model_id}", title=model_id, author=author, description=model.get("description", ""), modali...
jku-encyclopedia
src/jku_kb/scrapers/huggingface.py
Python
70abe8195f4c26773a4865c909bc2cdaa7c91346ea7a27e12f816276969bcde8
1
312
"""Media file downloader — reads media_discovery.jsonl, downloads with validation.""" from __future__ import annotations import hashlib from pathlib import Path from urllib.parse import urlparse import filetype import orjson from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Moda...
jku-encyclopedia
src/jku_kb/scrapers/media_fetch.py
Python
33986212ed41dd2abe2a0621702c25e8514eab466e0c4b96203ee9f0b1dd0bce
0
896
("alt_text", ""), modality=modality, file_type=Path(urlparse(url).path).suffix.lstrip(".").lower(), metadata={ "discovered_from": entry.get("discovered_from", ""), "page_ti...
jku-encyclopedia
src/jku_kb/scrapers/media_fetch.py
Python
9f850d488fca5ec2ecc27886fe5aa0787c0bc012d2957f78db4e2f7bbf523fb4
1
586
"""OpenAlex API scraper for JKU publications.""" from __future__ import annotations from typing import Any import orjson from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import BaseScraper ...
jku-encyclopedia
src/jku_kb/scrapers/openalex.py
Python
36d91f9612fb740cd60b7f6295465c28513f7ab5e32ab5dbb2c21839b074def2
0
896
.FETCHED, ) def _extract_arxiv_id(work: dict[str, Any]) -> str: """Extract and normalize arXiv ID from a work's locations list. Checks all location entries for a landing_page_url containing "arxiv.org/abs/" and normalizes the extracted ID. """ locations = work.get("locations", []) or [] ...
jku-encyclopedia
src/jku_kb/scrapers/openalex.py
Python
9ff74de220a8b1c3ee9a8732debcda9f440e4de88790f7e4d08972779bdcf04a
1
893
"""Shared utility for reading OpenAlex cross-reference data. Both arXiv and Semantic Scholar scrapers use this to discover papers via OpenAlex's reliable ROR-based affiliation filtering. """ from __future__ import annotations from pathlib import Path import orjson def read_openalex_xref(cache_dir: Path) -> tuple[l...
jku-encyclopedia
src/jku_kb/scrapers/openalex_xref.py
Python
23d9afd218a50a4becd9f16b5be6fdb81ddc5c49492975553588749eba60856a
0
316
"""OpenCast scraper for media.jku.at — the highest-value source. Scrapes JKU's OpenCast instance via its public search API. Each episode contains dual-stream video (presenter + slides), thumbnails, and captions. """ from __future__ import annotations from pathlib import Path from typing import Any from jku_kb.confi...
jku-encyclopedia
src/jku_kb/scrapers/opencast.py
Python
2c93fb9febf47260d0bf87f24fdbaaa20a1602a42d265ea5c103d5d6be59b1ae
0
896
().st_size > 0: self.log.debug("track_cached", item_id=item.item_id, track_type=track_type) downloaded_paths.append(dest) continue try: size, _ = await self._download_file(url, dest, headers=headers) self.log.info( ...
jku-encyclopedia
src/jku_kb/scrapers/opencast.py
Python
0f9d5c01cbb50076e5e63859a3891a159781b7ef59c0d2e2046c2538d0327d4f
1
896
candidates.sort(reverse=True) return candidates[0][1] def _extract_results(data: dict[str, Any]) -> list[dict[str, Any]]: """Extract episode results from API response, handling varying structures. The API may return results at top level (``{"result": [...]}``), or nested under ``search-results`` (``{...
jku-encyclopedia
src/jku_kb/scrapers/opencast.py
Python
fda5eeed1b992d040fdb87d8e90ce255aaaac6a574384bebd559b40682d80e4a
2
896
) except Exception: return None def _extract_media_items( mediapackage: dict[str, Any], section_key: str, item_key: str, fields: list[str], ) -> list[dict[str, Any]]: """Extract items from a mediapackage section, handling dict-or-list. Args: mediapackage: The episode media...
jku-encyclopedia
src/jku_kb/scrapers/opencast.py
Python
7f14aeccc04876f81f5bb38fc1acfc1bf0888babbda03f2031127c5ba1c9aa6a
3
246
"""Direct PDF downloader for fileadmin/gruppen and RISC reports.""" from __future__ import annotations from pathlib import Path from urllib.parse import urljoin import orjson from bs4 import BeautifulSoup from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from j...
jku-encyclopedia
src/jku_kb/scrapers/pdf_fetch.py
Python
c8e9e8da69e49e21adbdf34644cfcf72dab8af5bb2f274bb7b277faf89a06e55
0
896
self, division: str) -> list[RawItem]: """Scrape a single RISC division listing page for PDF links.""" items: list[RawItem] = [] self.log.debug("discovering_page", endpoint=f"risc_{division}", source_id=self.source_id) try: response = await self._rate_limited_get( ...
jku-encyclopedia
src/jku_kb/scrapers/pdf_fetch.py
Python
a275e0a739287c08dd90a15361a40a48c61ecf0ba85b1fcc4494811edaacfd35
1
633
"""RSS feed podcast scraper.""" from __future__ import annotations import hashlib import re from typing import Any import feedparser from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import ...
jku-encyclopedia
src/jku_kb/scrapers/podcast.py
Python
3bbcc149fbcfdd7893ee6de81bd9a6925607920d06b9195f788a3c1f9efe24b0
0
896
audio_url: links = getattr(entry, "links", []) for link in links: if "audio" in link.get("type", ""): audio_url = link.get("href", "") break published = getattr(entry, "published", "") year = None if published: year_match = re.search(r"20\...
jku-encyclopedia
src/jku_kb/scrapers/podcast.py
Python
3465bf63baebd10c6072aa36c254bf86cba1f2fcf996caae2b11efc0e668c10b
1
228
"""Semantic Scholar API scraper.""" from __future__ import annotations from typing import Any from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import BaseScraper from jku_kb.scrapers.openale...
jku-encyclopedia
src/jku_kb/scrapers/semantic_scholar.py
Python
fe14415f0cb86eb6de91e75544fcb527e8a348d28f0fb58202d296cf50e68e33
0
896
str(exc)) continue if response.status_code != 200: self.log.error("xref_batch_error", status=response.status_code) continue papers = response.json() if not isinstance(papers, list): continue for paper in pa...
jku-encyclopedia
src/jku_kb/scrapers/semantic_scholar.py
Python
6506dcb94cfceafa1a0d24474b289a75092401d05659047d86acc81a0490075b
1
725
"""Web crawler for JKU websites (TYPO3 sites, institute pages).""" from __future__ import annotations import hashlib import re import warnings from urllib.parse import urljoin, urlparse from xml.etree import ElementTree as ET import orjson from bs4 import BeautifulSoup, XMLParsedAsHTMLWarning warnings.filterwarning...
jku-encyclopedia
src/jku_kb/scrapers/web_crawl.py
Python
c131eb283d3a41533a276c53812bdfd52a66821d3cf8fdcf42fc728f68878c28
0
896
): self.log.debug("discovering_page", sitemap=start_url, source_id=self.source_id) try: sitemap_urls = await self._parse_sitemap(start_url) urls.update(sitemap_urls) except Exception as exc: ...
jku-encyclopedia
src/jku_kb/scrapers/web_crawl.py
Python
e773e679ef4ba66b7cc56a1a82aeb20a126f76d1d5484c479625972583aa3897
1
896
(text.encode("utf-8")), content_hash=self.compute_hash(text.encode("utf-8")), fetch_status=FetchStatus.FETCHED, ) def _append_pdf_links(self, pdf_links: list[dict[str, str]]) -> None: """Append discovered PDF links to pdf_discovery.jsonl.""" discovery_path = self.cac...
jku-encyclopedia
src/jku_kb/scrapers/web_crawl.py
Python
c845a7bef72e59a6817228b05f31acd4032ba55f6852c09bf1ccf9af5135205e
2
896
"" return urlparse(url).path.lower().endswith(".svg") def _modality_from_extension(url: str) -> str | None: """Return modality string based on URL file extension, or None if not a media file.""" parsed = urlparse(url) path = parsed.path.lower() dot_idx = path.rfind(".") if dot_idx == -1: ...
jku-encyclopedia
src/jku_kb/scrapers/web_crawl.py
Python
07c5e435c5638ea19071f462fc49724308c94b3c15958b852871c1c2dd72b3b2
3
896
if modality is None: continue if modality == "image" and (_is_decorative(full_url) or _is_svg(full_url)): continue _add_media(media_links, seen_urls, full_url, page_url, str(page_title), modality, "", "a") except Exception: pass...
jku-encyclopedia
src/jku_kb/scrapers/web_crawl.py
Python
9d9148bb5442c367c06657bb4e097a534ef8dc8c43e65d2f878ce5a687b35e8d
4
438
"""Wikidata SPARQL scraper for JKU-related entities.""" from __future__ import annotations from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import BaseScraper WIKIDATA_SPARQL = "https://quer...
jku-encyclopedia
src/jku_kb/scrapers/wikidata.py
Python
0b121fa748d07bd51edd609fb7ebbc0975b4518efb77166ed7ed8d42cf7dd24d
0
896
(self, item: RawItem) -> FetchResult: """Fetch full entity claims via Wikidata REST EntityData endpoint.""" dest = self.cache_dir / f"{item.item_id}.txt" url = WIKIDATA_ENTITY_URL.format(qid=item.item_id) response = await self._rate_limited_get(url) if response.status_code != 2...
jku-encyclopedia
src/jku_kb/scrapers/wikidata.py
Python
9801df5664417cf441aa51312215b0ddaebae9ca74dbc4787afb04d5ae646bdc
1
670
"""JKU Knowledge Base — YouTube Data API v3 scraper (metadata only).""" from __future__ import annotations from typing import Any import orjson from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.b...
jku-encyclopedia
src/jku_kb/scrapers/youtube.py
Python
3868ca9013c7003170ab166bd2faafdaf39280be984efda54e944672bdbc552e
0
896
.title, "description": item.description, "url": item.url, "year": item.year, "metadata": item.metadata, } ) dest = self.cache_dir / f"{item.item_id}.json" dest.write_bytes(content) return FetchResult( ...
jku-encyclopedia
src/jku_kb/scrapers/youtube.py
Python
b7c61e1ab2acfa57aadde899a0008c31c5661881bb3a5164443774e56478a34e
1
370
"""Zenodo API scraper.""" from __future__ import annotations from pathlib import Path from typing import Any from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, Modality, RawItem from jku_kb.scrapers import register_scraper from jku_kb.scrapers.base import BaseScraper API_BASE = "...
jku-encyclopedia
src/jku_kb/scrapers/zenodo.py
Python
41f973c2641edff8966263f992e4d28aecdda6a427e025bf592e7cd95e1bd245
0
896
= creators[0].get("name", "") if creators else "" files = hit.get("files", []) file_url = files[0].get("links", {}).get("self", "") if files else "" file_key = files[0].get("key", "") if files else "" ext = Path(file_key).suffix if file_key else "" pub_date = metadata.get("publication_date", "") ...
jku-encyclopedia
src/jku_kb/scrapers/zenodo.py
Python
ea8ec3533c98703d649d8538f28d47a2c20f1689ccb4bdfe31c2f78a681ae8e9
1
287
"""Storage module providing Qdrant vector store, Neo4j graph store, and local filesystem clients."""
jku-encyclopedia
src/jku_kb/storage/__init__.py
Python
17587b0ef4d6e0b973eac8d6a590c83c572d2f8a055ab0438871372df3f03955
0
22
"""Deduplication engine — DOI, arXiv ID, and title+author+year matching.""" from __future__ import annotations import datetime import hashlib import re from pathlib import Path import orjson from jku_kb.logging import get_logger from jku_kb.models import RawItem def write_dedup_decision( audit_path: Path, ...
jku-encyclopedia
src/jku_kb/storage/dedup.py
Python
f726183749ee42ebab2cb3ef46d3179593d8de412ee009399ae3b4dd0ccdb458
0
896
"" arxiv_id = arxiv_id.strip() arxiv_id = re.sub(r"^https?://arxiv\.org/abs/", "", arxiv_id) arxiv_id = re.sub(r"v\d+$", "", arxiv_id) # remove version return arxiv_id.lower() def _title_author_hash(title: str, author: str, year: int | None) -> str: """Create a fuzzy hash from title + first autho...
jku-encyclopedia
src/jku_kb/storage/dedup.py
Python
e658549ef617e7eda7ce5d13aac26b8b1dbe22bed7bd882e69596255d256b81c
1
268
"""Local filesystem cache for raw downloads.""" from __future__ import annotations import hashlib from pathlib import Path from jku_kb.config import Settings from jku_kb.logging import get_logger class LocalFileStore: """Manages local file cache for downloaded content.""" def __init__(self, settings: Sett...
jku-encyclopedia
src/jku_kb/storage/local_fs.py
Python
cff2e1d5017a9f638f5fa78ec0e3b510612b08ea5e3af14fc0ac9d5d232cd588
0
695
"""Neo4j graph store client.""" from __future__ import annotations from typing import Any from neo4j import AsyncDriver, AsyncGraphDatabase from jku_kb.config import Settings from jku_kb.logging import get_logger from jku_kb.models import Chunk NEO4J_BATCH_SIZE = 1000 # Cypher queries for schema setup SCHEMA_QUER...
jku-encyclopedia
src/jku_kb/storage/neo4j.py
Python
ce82c2f474df1d177c86cb7d910cd6ae3acd63dbc818d00ed847c914ecfb0f34
0
896
.item_id, "modality": c.modality.value, "title": c.title, "url": c.url, "chunk_index": c.chunk_index, "chunk_total": c.chunk_total, "language": c.language, "author": c.author, "year": c.year o...
jku-encyclopedia
src/jku_kb/storage/neo4j.py
Python
5b0bcc1a7a889844e66bc2ddbf694e4c72b99a414fa7ec2aa5b9bc93bbc76ea0
1
896
: $chunk_id}), (t:Topic {name: $topic_name}) MERGE (c)-[:TAGGED_WITH]->(t) """ async with self._driver.session() as session: await session.run(query, {"chunk_id": chunk_id, "topic_name": topic_name}) async def create_similarity_edge(self, source_id: str, target_id: str, score: f...
jku-encyclopedia
src/jku_kb/storage/neo4j.py
Python
b0731306ce8e7d27456d4ffe2980476fcde216a7044c46438c2d02cdcda7e566
2
896
: await tx.rollback() raise async def create_next_chunk_edges(self, chunk_ids_ordered: list[str]) -> None: """Create NEXT_CHUNK edges for sequential ordering with explicit transaction.""" assert self._driver is not None if len(chunk_ids_ordered) < 2: ...
jku-encyclopedia
src/jku_kb/storage/neo4j.py
Python
53682bf493cdc03bd9e37ca4da9da559b795dafc16e90bb2fdb66d3af661204c
3
699
"""Qdrant vector store client.""" from __future__ import annotations from typing import Any from qdrant_client import AsyncQdrantClient, models from jku_kb.config import Settings from jku_kb.logging import get_logger from jku_kb.models import Chunk, EmbeddingResult QDRANT_BATCH_SIZE = 500 # Qdrant filter conditio...
jku-encyclopedia
src/jku_kb/storage/qdrant.py
Python
50c46b93306316f2df1b0df8ee74e9f658618f5ee442806a75cf53dcf504046f
0
896
=self.collection_name, points=batch, ) except Exception as batch_err: self.log.warning( "batch_upsert_failed_retrying_individually", batch_start=i, batch_size=len(batch), error...
jku-encyclopedia
src/jku_kb/storage/qdrant.py
Python
11373d874c13dfdcb0588146d33258c97709091cb610b291739c4c439b83f40c
1
896
"duration_seconds": chunk.duration_seconds, } def _deterministic_id(chunk_id: str) -> str: """Create a deterministic UUID-like ID from chunk_id.""" import hashlib import uuid h = hashlib.md5(chunk_id.encode()).hexdigest() return str(uuid.UUID(h))
jku-encyclopedia
src/jku_kb/storage/qdrant.py
Python
3e195d2c08643d76594d501c9532f9f1147aa333360bd8c08b5149a99e4d8a41
2
66
"""Minimal type stub for feedparser covering project usage.""" from typing import Any class FeedParserDict(dict[str, Any]): bozo: int entries: list[dict[str, Any]] feed: dict[str, Any] status: int def parse(url_file_stream_or_string: str, **kwargs: Any) -> FeedParserDict: ...
jku-encyclopedia
src/stubs/feedparser/__init__.pyi
Python
c40b819fd84f8e035ecfebcd49c2295e8e0c24b0fd115067350c470fd2a33ca1
0
75
"""Minimal type stub for ffmpeg-python covering project usage.""" from typing import Any def probe(filename: str, cmd: str = ..., **kwargs: Any) -> dict[str, Any]: ... def input(filename: str, **kwargs: Any) -> _Stream: ... # noqa: A001 def run( stream: _Stream, cmd: str = ..., capture_stdout: bool = ......
jku-encyclopedia
src/stubs/ffmpeg/__init__.pyi
Python
0a75c360f41ceaa2c9762bbf6c8537cf04845edac5189bed921959be304b329a
0
263
"""Shared test fixtures.""" from __future__ import annotations import hashlib import subprocess from pathlib import Path from unittest.mock import AsyncMock, MagicMock import pytest import respx from jku_kb.config import Settings @pytest.fixture def settings(tmp_path: Path) -> Settings: """Create test setting...
jku-encyclopedia
tests/conftest.py
Python
6f9f240c6d1b85126945c9d619bd1bad889e6c73ee40e9703f0d6b8f99f8f667
0
896
-i", "anullsrc=r=44100:cl=mono", "-t", "5", "-c:v", "libx264", "-c:a", "aac", "-shortest", str(video_path), ], check=True, capture_output=True, ) return video_path @pytest.fixtur...
jku-encyclopedia
tests/conftest.py
Python
d09b872d89cc5602145529410e771e75cb9e9d5f25c709e7d625827fe5aa297a
1
550
"""E2E smoke test — runs pipeline on minimal items.""" from __future__ import annotations import hashlib import uuid from pathlib import Path import pytest from jku_kb.config import Settings from jku_kb.models import Chunk, EmbeddingResult, Modality, RawItem # Unique prefix for this test run to avoid collisions _E...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
57911575a06b74d785032522723eed777ffc352235dbf1cd8f2bbcb76ce57b0b
0
896
== "jku_knowledge_base" assert settings.similarity_threshold == 0.75 # --------------------------------------------------------------------------- # Smoke test data: 5 items across 4 modalities # --------------------------------------------------------------------------- SMOKE_ITEMS = [ # Item 1: OpenAle...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
09dbc5ab4381e7fdb103df9a9f5430d06ad331176a62602eedc084d8ff299d3b
1
896
a deterministic embedding for a chunk.""" vector = _deterministic_vector(chunk.chunk_id) return EmbeddingResult( chunk_id=chunk.chunk_id, vector=vector, dimension=len(vector), model="test-deterministic", ) def _create_fixture_files(tmp_path: Path) -> dict[str, Path]: ""...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
cc9840548f47dbf1d11e524d59657c61ababd14ff8d33cf40ddb943572f5dcab
2
896
""Run real chunkers on fixture files, return all chunks.""" from jku_kb.chunkers.code_chunker import CodeChunker from jku_kb.chunkers.image_chunker import ImageChunker from jku_kb.chunkers.pdf_chunker import PdfChunker from jku_kb.chunkers.text_chunker import TextChunker chunkers = { Modali...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
e88cf9c639407f3677ffedd3474318a47fd79ce1fb64cbf8444428c7cd7e0e2d
3
896
:6333", qdrant_collection=self.COLLECTION, neo4j_uri="bolt://localhost:7687", neo4j_user="neo4j", neo4j_password="jku_knowledge_base_2026", ) qdrant = QdrantStore(settings) await qdrant.connect() try: await qdrant.ensure_collec...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
e46db06414077d14498e05bcc75876171c6851edebc11b5f8d90a0d70c8dde78
4
896
"cnt"] == len(all_chunks), ( f"Neo4j idempotency failed: expected {len(all_chunks)}, got {record['cnt']}" ) finally: await neo4j.close() @pytest.mark.asyncio async def test_pipeline_4_modalities_chunked_correctly(self, tmp_path: Path): """Verify a...
jku-encyclopedia
tests/e2e/test_pipeline_smoke.py
Python
7f150e3ad6e2313390b38470e8ac368941c21b10f485c572c02683e5211dbe04
5
543
[ { "name": "xLSTM", "fork": false, "html_url": "https://github.com/ml-jku/xLSTM", "default_branch": "main", "stargazers_count": 1500, "language": "Python", "topics": ["deep-learning"], "license": {"spdx_id": "MIT"}, "created_at": "2024-05-15T12:00:00Z", "description": "Officia...
jku-encyclopedia
tests/fixtures/github_repos.json
JSON
ae83d765cfefa33fa9e57ad5f4a1ec3af21b598ad1e587a7bf1ecba91f959c29
0
345
{ "sha": "abc123", "tree": [ {"path": "README.md", "type": "blob", "size": 5000}, {"path": "src/model.py", "type": "blob", "size": 3000}, {"path": "src/utils.py", "type": "blob", "size": 1500}, {"path": "src/__init__.py", "type": "blob", "size": 100}, {"path": "notebooks/demo.ipynb", "type": "bl...
jku-encyclopedia
tests/fixtures/github_tree.json
JSON
fd0be8f28b6ccc26786614fc92117e899a72905eecc7798abcbff75ce3ba4a32
0
384
{ "result": [ { "dc": { "title": ["Machine Learning Lecture 1"], "publisher": ["Sepp Hochreiter"], "created": ["2024-10-01T08:00:00Z"], "extent": ["PT1H30M"] }, "mediapackage": { "id": "ep-abc-001", "title": "Machine Learning Lecture 1", "d...
jku-encyclopedia
tests/fixtures/opencast_page.json
JSON
1796bc09762087e931c7a94edf05458a5c9c13cdf71ce86987593ce0e61a4419
0
653
"""Integration test: all modalities flow through embed_chunk correctly. Verifies EMBED-04: end-to-end embedding for text, document, image, video, audio. Uses mocked asyncio.to_thread to avoid real API calls. For live API tests, see test_gemini_live.py (requires GEMINI_API_KEY). """ from __future__ import annotations ...
jku-encyclopedia
tests/integration/test_embed_multimodal.py
Python
c5950549225c4c5790f3d4a0f32a5d3c14a686b0a05aa2c593178e331ac5ffc8
0
896
._client.files.delete: return None return MagicMock() with patch("asyncio.to_thread", side_effect=fake_tt): result = await embedder.embed_chunk(chunk) assert result.embed_status == EmbedStatus.EMBEDDED assert result.dimension == 3072 @pytest.mark.asy...
jku-encyclopedia
tests/integration/test_embed_multimodal.py
Python
edcfe9fd4e39bde9d0149c3e23732820a36890e0ca75e3d5b99a5e96a838a3e9
1
896
set(modality_results.values()) assert len(dims) == 1, f"Dimension mismatch across modalities: {modality_results}" assert 3072 in dims @pytest.mark.asyncio async def test_all_embed_calls_include_retrieval_document_config(self, embedder, media_files): """Every embed_content call must incl...
jku-encyclopedia
tests/integration/test_embed_multimodal.py
Python
b0ba03b244a59d6daccea47815b71887ad752e49488ce50ba4d8a3f7cdaa913a
2
320
"""Live integration test for Gemini embedding API. Requires GEMINI_API_KEY environment variable set to a real key. Tests are marked @pytest.mark.live and skip when API key is absent. """ from __future__ import annotations from pathlib import Path import pytest # ----------------------------------------------------...
jku-encyclopedia
tests/integration/test_gemini_live.py
Python
92c605c600d64b24f88f1bd0558e7fcfb2c0f97c3dcca1d2f01ca6be086ee100
0
896
async def test_embed_pdf_returns_vector(self, gemini_available, tmp_path: Path): """Embed a tiny PDF, verify vector dimension matches text embedding.""" from pypdf import PdfWriter from jku_kb.config import Settings from jku_kb.embedders.gemini import GeminiEmbedder from jku_kb....
jku-encyclopedia
tests/integration/test_gemini_live.py
Python
0bdb71c9c9a19b8efc6a57a50c4a13db93fde8d6f84d1b5f7df32e114069bea6
1
238
"""Integration tests that hit real APIs (marked with @pytest.mark.live).""" from __future__ import annotations import httpx import pytest def _extract_opencast_results(data: dict) -> list[dict]: """Extract episode results from OpenCast API response. The API returns results at top level with keys: result, t...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
542ebeceeb2d93c0b4f250de4075f97a4148d7a811b77d34b0b6fb61f5d4f671
0
896
assert field in dc, f"Missing dc field: {field}" # Tracks must exist (as list or dict) media = mp.get("media", {}) tracks = media.get("track") assert tracks is not None, "mediapackage.media.track must exist" @pytest.mark.asyncio async def test_episode_has_attachments(self): ...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
4e04d2634f0fbe963b8a2bc5cff4655132c0ed616b362f6c376968ee15794bd8
1
896
/api.github.com/orgs/ml-jku/repos", params={"per_page": 30, "type": "public"}, ) assert response.status_code == 200 repos = response.json() non_forks = [r for r in repos if not r.get("fork", True)] assert len(non_forks) >= 3, f"Expected at least 3 non-fork re...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
2898fa8b59e784959c72af7f04d5a2cce59790d3e85b3307a66830d46b39d3ba
2
896
{atom_ns}}}entry") assert len(entries) >= 1, "Expected at least 1 entry in arXiv response" entry = entries[0] title = entry.find(f"{{{atom_ns}}}title") entry_id = entry.find(f"{{{atom_ns}}}id") authors = entry.findall(f"{{{atom_ns}}}author") assert title is not None, "E...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
d8c03fe3ce9df1ed34c066318801fdcce3fdcd316cd5eaec5b688c48ab70bf79
3
896
= response.json() hits = data.get("hits", {}).get("hits", []) assert len(hits) >= 1, "Expected at least 1 hit from Zenodo" first_hit = hits[0] assert "metadata" in first_hit, "Hit must have metadata" assert "title" in first_hit["metadata"], "Hit metadata must have title" @pyt...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
a09413ae28a4b1639f7b9883175630d34aa732693d02e5880a7840632e480236
4
896
in models[0]["modelId"] @pytest.mark.live class TestPodcastLive: """Tests that hit the real Podigee podcast feeds.""" @pytest.mark.asyncio async def test_podigee_feed_accessible(self): """Verify JKU Podigee podcast feed is accessible and returns valid RSS.""" async with httpx.AsyncClient(...
jku-encyclopedia
tests/integration/test_live_apis.py
Python
b9b53afb11ecfa9f988fa2787b29583d113f06bbfe3c50024e8a2af628e82019
5
531
"""Integration test: end-to-end multimodal pipeline with bioinf_jku. Verifies INT-03 (3+ modalities in chunk manifest) and INT-04 (cross-modal edges). All external services are mocked for deterministic offline execution. """ from __future__ import annotations from collections import Counter from pathlib import Path f...
jku-encyclopedia
tests/integration/test_pipeline_e2e.py
Python
c74fceed1898d711c54d97310a9c2173d9c91b86fcdfa44bd3e47f92518b886e
0
896
None: """Chunk phase on bioinf_jku fixture produces chunks with 3+ distinct modalities.""" cache_dir, settings = e2e_bioinf_cache # Mock get_scraper to return a scraper pointing at our fixture dir mock_scraper = MagicMock() mock_scraper.cache_dir = cache_dir / "bioinf_jku" ...
jku-encyclopedia
tests/integration/test_pipeline_e2e.py
Python
1b104b561d5ee5245ba70fd868f8d9e2fca48ea1bb2f563888e8d7c6415da3e8
1
896
mock_qdrant.search_similar_with_modality = fake_search # Mock Neo4j mock_neo4j = AsyncMock() mock_neo4j.create_similarity_edges_batch = AsyncMock() # Mock Settings mock_settings = MagicMock() mock_settings.similarity_top_k = 5 mock_settings.similarity_threshold ...
jku-encyclopedia
tests/integration/test_pipeline_e2e.py
Python
8fd7c523f70c3b2f6f81b26d3345d992e9c2a48574ac0b372edb36f68570723c
2
265
"""Integration tests for Qdrant and Neo4j storage roundtrips. Requires Docker containers: docker compose up -d Tests are marked @pytest.mark.live and skip when containers are unreachable. """ from __future__ import annotations import uuid import pytest from jku_kb.config import Settings from jku_kb.models import C...
jku-encyclopedia
tests/integration/test_storage_roundtrip.py
Python
01190082ea9bea39ea8d38ce7a27ae029ad92c8b2b7ddcf64ad7d5e14a69e713
0
896
=[float(i) / 100.0] * dim, dimension=dim, model="test-model", ) for i, c in enumerate(chunks) ] # --------------------------------------------------------------------------- # Qdrant Roundtrip Tests # -------------------------------------------------------------------------...
jku-encyclopedia
tests/integration/test_storage_roundtrip.py
Python
9619cacf2bfb46df25e52a5ea3a60f31fd5f0a868921a5cc64ee0ff5c94d708a
1
896
= _make_chunks(10, f"{_PREFIX}_src_a", _PREFIX) embeddings = _make_embeddings(chunks) # Second upsert of identical data dead_letter = await store.upsert_batch(chunks, embeddings) assert dead_letter == [] # Count should still be 10 + 3 (from src_b) = 13 ...
jku-encyclopedia
tests/integration/test_storage_roundtrip.py
Python
da3d05c44ddebc172b336a5248f79ad672f384473473180f6ba5e26382f49f85
2
896
"sid": self.SOURCE_ID}, ) record = await result.single() count = record["cnt"] assert count == 10, f"Expected 10 Chunk nodes, got {count}" finally: await store.close() @pytest.mark.asyncio async def test_create_edges_and_traver...
jku-encyclopedia
tests/integration/test_storage_roundtrip.py
Python
3c2711e155362c54b5a6dd11009c8e749de663eba1b995bcc7852ad3fafa24fa
3
626
"""Unit tests for BaseScraper ABC using a FakeScraper subclass.""" from __future__ import annotations from pathlib import Path from unittest.mock import AsyncMock, patch import httpx import pytest from jku_kb.config import Settings from jku_kb.models import FetchResult, FetchStatus, ManifestEntry, Modality, RawItem...
jku-encyclopedia
tests/unit/test_base_scraper.py
Python
8c58ea920166616f1ee1bc331a4a7350cfd3fc5d41fbed4b6c38ee564703321d
0
896
" in scraper2._manifest assert scraper2._manifest["item_0"].fetch_status == FetchStatus.FETCHED def test_empty_manifest_creates_no_file(self, fake_settings): """A scraper with no manifest entries should not crash on save.""" scraper = FakeScraper(fake_settings) scraper._save_manifes...
jku-encyclopedia
tests/unit/test_base_scraper.py
Python
8ccbc2af3fe3c016edc9a07208d5eea8ee0c45b0381dc817669afd1192b5d2b7
1
896
manifest_path.exists() assert len(scraper._manifest) == 2 async def test_run_max_items_limits_processing(self, fake_settings): """run(max_items=N) should only process N items.""" items = _make_items(5) scraper = FakeScraper(fake_settings, items=items) results = await scrape...
jku-encyclopedia
tests/unit/test_base_scraper.py
Python
e1a2a097e09b334cfb44d08ee1775db2cf4cd6de68c3f8720cfcd086e8cfcdfc
2
896
item.item_id assert result.source_id == scraper.source_id class TestTemplateMethod: async def test_already_fetched_returns_cached(self, fake_settings): """Template method returns cached result without calling _do_fetch.""" scraper = FakeScraper(fake_settings) item = _make_items(1)[...
jku-encyclopedia
tests/unit/test_base_scraper.py
Python
e6b2448e0b89cec4d0a9392266bd8ddadd3e6c977df8b390f62ff122b942b6f1
3
896
) assert response.status_code == 200 assert call_count == 2 async def test_retries_on_network_error(self, fake_settings): """_rate_limited_get retries on network error and succeeds on next attempt.""" scraper = FakeScraper(fake_settings) call_count = 0 async def m...
jku-encyclopedia
tests/unit/test_base_scraper.py
Python
7267eec69051f6e5a558b2dfbaf3fcb2996fad010755691863826f983cb78bf2
4
744
"""Unit tests for chunkers.""" from __future__ import annotations from pathlib import Path from unittest.mock import MagicMock, patch import pytest from jku_kb.chunkers import get_chunker from jku_kb.chunkers.audio_chunker import AudioChunker from jku_kb.chunkers.caption_chunker import CaptionChunker from jku_kb.ch...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
206490e7365e452a2cbb7d08133b594c66f5871cce749a1d96630acfdffdcb13
0
896
pytest.mark.asyncio async def test_small_code_single_chunk(self, sample_code_file: Path, tmp_path: Path): """Small code file should produce 1 chunk.""" chunker = CodeChunker() item = _make_item(modality=Modality.CODE) output_dir = tmp_path / "chunks" chunks = await chunker.c...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
7ef81d00b9ad675f73f95cf0e8fc147b11f19de68da8263b412e3803e88778f0
1
896
/ "test.jpg" img_path.write_bytes(b"\xff\xd8\xff" + b"\x00" * 100) chunker = ImageChunker() item = _make_item(modality=Modality.IMAGE) output_dir = tmp_path / "chunks" chunks = await chunker.chunk(item, img_path, output_dir) assert len(chunks) == 1 assert chunk...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
75eac7bdb190b404c0a38657d9740bc353c18b42e88228cf2c08a93d2a66386f
2
896
_has_audio_track return True # Subsequent calls are ffmpeg.run — do nothing return None mock_to_thread.side_effect = fake_to_thread_async chunks = await chunker.chunk(item, video_path, output_dir) # With audio trac...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
9d1da80e43c8568634f8a1d7214b55c4b17a5c287549abce3a14c472b41f172f
3
896
= min(110, 110) = 110; step = 110 - 15 = 95 # segments: (0,110), (95,205), (190,300), (285,300) = 4 assert len(chunks) == 4 class TestVideoChunkerAudioDetection: def test_has_audio_track_true(self): """_has_audio_track returns True when ffprobe shows audio stream.""" probe_result =...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
014481f48fb21b148e2fb5941e50882a2e2b7db260ba62d55de9cfd3926d2b06
4
896
.asyncio async def test_vtt_produces_text_chunks(self, sample_vtt_file: Path, tmp_path: Path): """VTT file with 3 cues should produce text chunks with timestamp prefixes.""" chunker = CaptionChunker(max_tokens=100000) item = _make_item(modality=Modality.TEXT) output_dir = tmp_path / ...
jku-encyclopedia
tests/unit/test_chunkers.py
Python
85bce02d72d07e03bae54e6de4225b72d7e95d7c896ad0919ccf2f64b0a1e986
5
548
"""Unit tests for the JKU KB CLI commands.""" from __future__ import annotations from unittest.mock import AsyncMock, MagicMock, patch import pytest from typer.testing import CliRunner from jku_kb.cli import app runner = CliRunner() # --------------------------------------------------------------------------- #...
jku-encyclopedia
tests/unit/test_cli.py
Python
5f24e7c980528dad93cef76af4cef468f0f8d523eec4385dbd283d7b1abc5e0c
0
896
mock_session) mock_session.__aexit__ = AsyncMock(return_value=False) mock_driver = MagicMock() mock_driver.session = MagicMock(return_value=mock_session) mock_neo4j = AsyncMock() mock_neo4j._driver = mock_driver mock_neo4j.__aenter__ = AsyncMock(return_value=mock_neo4j) mock_neo4j.__aexit_...
jku-encyclopedia
tests/unit/test_cli.py
Python
922775d6f44fa806c9de5bb3ccf1cd64808549108b6f92f92762d269ca8a51c4
1
896
----------- # Tests: link command # --------------------------------------------------------------------------- def test_link_mode(): """link --mode similarity passes mode='similarity' to orchestrator.""" mock_result = {"similarity_edges": 200} with ( patch("jku_kb.cli.helpers.get_settings") as m...
jku-encyclopedia
tests/unit/test_cli.py
Python
e1d80f0c96e74f99dd5ff271d653ab21dc531be42c2e77d9d00b6f2f65c0cf5c
2
896
== 0, result.output # Should show Neo4j node table or at least not crash output = result.output assert "Neo4j" in output or "Qdrant" in output or "Cache" in output or "MB" in output def test_stats_neo4j_unavailable(): """stats shows warning when Neo4j is unavailable.""" mock_qdrant = AsyncMock() ...
jku-encyclopedia
tests/unit/test_cli.py
Python
90e1f3afa079249e98688e594288ddb8216a6504e9456410471937add604dad9
3
896
assert "orphan_source" in result.output # --------------------------------------------------------------------------- # Tests: discover command # --------------------------------------------------------------------------- def test_discover_command_success(): """discover calls run_phase_discover and shows table ...
jku-encyclopedia
tests/unit/test_cli.py
Python
55af8855a1138d76d5952998b693e7ec84175c1b84456c50e6244c2d51321455
4
896
log_level = "WARNING" mock_settings_fn.return_value = mock_settings mock_orch = AsyncMock() mock_orch.run_phase_fetch = AsyncMock(return_value=mock_result) mock_orch_cls.return_value = mock_orch result = runner.invoke(app, ["fetch", "--max-items", "10"]) assert result.exit...
jku-encyclopedia
tests/unit/test_cli.py
Python
124c3fdf3508ba6a8bf8188bd6e1ce2462731df6cf6c98c095a48f1f2378bd06
5
896
--------------------------------------------- # Tests: run with specific phases (discover, fetch, embed, link) # --------------------------------------------------------------------------- def test_run_phase_discover(): """run --phase discover calls run_phase_discover.""" mock_result = {"github_jku": 10} ...
jku-encyclopedia
tests/unit/test_cli.py
Python
29359d25e2c1a8237336b4fa43d30055c27d0964b41c6d974294944467e174e1
6
896
------------------------------ def test_status_command(): """status calls get_status and shows table.""" mock_result = { "github_jku": {"discovered": 100, "fetched": 80, "failed": 5, "chunked": 70, "embedded": 60}, } with ( patch("jku_kb.cli.admin.get_settings") as mock_settings_fn, ...
jku-encyclopedia
tests/unit/test_cli.py
Python
0c3d2225f544433e10aa3222b3d631ccdc2bf3900db1262fe27c7e78403b3768
7
896
=False) result = runner.invoke(app, ["export"]) assert result.exit_code == 0, result.output mock_export.assert_awaited_once() assert "100" in result.output or "Exported" in result.output # --------------------------------------------------------------------------- # Tests: stats -- qdrant unavai...
jku-encyclopedia
tests/unit/test_cli.py
Python
444760a4a7182e84ec2f8ba173d2ad80e6da687783185a42044a7f60309538e6
8
896
is None # --- Phase 11: Dashboard, Health & Helpers --- # CLI-01 / CLI-03 / CLI-04 stubs (LiveDashboard, color coding, ETA) def test_live_dashboard_progress_callback(): """LiveDashboard.progress_callback increments item count and sets status to running.""" from jku_kb.cli import LiveDashboard mock_co...
jku-encyclopedia
tests/unit/test_cli.py
Python
960afc4f603e043cd81d9b9ffab14614fbff17d552b9657e4d807a8864f34902
9
896
= mock_orch from jku_kb.cli import _init_pipeline settings, orchestrator, source_ids, effective_ids = _init_pipeline("all", False) assert source_ids is None assert effective_ids == ["github_jku", "openalex_jku"] assert orchestrator is mock_orch assert settings is mock_settings def te...
jku-encyclopedia
tests/unit/test_cli.py
Python
b99afbf8011c5032f5ecdc1acc60bb3ea184bbbfd2fc31f0ee3ad925421305ac
10
896
.strip()) assert isinstance(data, list) assert len(data) == 1 assert data[0]["source_id"] == "json_src" assert data[0]["status"] == "pass" assert data[0]["actual"] == 10 def test_verify_command_exit_code_on_fail(): """verify returns exit code 1 when any source fails.""" from unittest.mock ...
jku-encyclopedia
tests/unit/test_cli.py
Python
58a1d67e02ebf1a660403caa65758065dfe9253fd2b941a3771b016341a77a0d
11
896
ok=True, latency_ms=10.0)] mock_scraper = AsyncMock() mock_scraper.discover = AsyncMock(side_effect=RuntimeError("API timeout")) mock_scraper.__aenter__ = AsyncMock(return_value=mock_scraper) mock_scraper.__aexit__ = AsyncMock(return_value=False) with ( patch("jku_kb.cli.verify.load_source...
jku-encyclopedia
tests/unit/test_cli.py
Python
2788875d323d1ee945600955940598bcb3a200172aed00852b902ee905ffbe02
12
896