cdindex-parser 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chris K.Y. Fung
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,114 @@
1
+ Metadata-Version: 2.4
2
+ Name: cdindex-parser
3
+ Version: 1.0.0
4
+ Summary: Parse CD Index 2 IDX/FILE files into CSV/JSON
5
+ Author-email: Chris Fung <chris@example.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/chriskyfung/cdindex-parser
8
+ Project-URL: Documentation, https://chriskyfung.github.io/cdindex-parser/
9
+ Project-URL: Repository, https://github.com/chriskyfung/cdindex-parser
10
+ Project-URL: Issues, https://github.com/chriskyfung/cdindex-parser/issues
11
+ Project-URL: Changelog, https://github.com/chriskyfung/cdindex-parser/blob/main/CHANGELOG.md
12
+ Keywords: cd-index,cdindex,parser,csv,json,legacy,dosdate,big5
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Utilities
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=8; extra == "dev"
29
+ Requires-Dist: pytest-cov>=5; extra == "dev"
30
+ Requires-Dist: coverage[toml]>=7; extra == "dev"
31
+ Requires-Dist: mypy>=1.11; extra == "dev"
32
+ Requires-Dist: ruff>=0.6; extra == "dev"
33
+ Requires-Dist: build>=1.2; extra == "dev"
34
+ Requires-Dist: twine>=5; extra == "dev"
35
+ Requires-Dist: pre-commit>=3.8; extra == "dev"
36
+ Provides-Extra: docs
37
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
38
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
39
+ Dynamic: license-file
40
+
41
+ # CD Index 2 Parser
42
+
43
+ [![CI](https://github.com/chriskyfung/cdindex-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/chriskyfung/cdindex-parser/actions/workflows/ci.yml)
44
+ [![PyPI](https://img.shields.io/pypi/v/cdindex-parser)](https://pypi.org/project/cdindex-parser/)
45
+ [![Python Versions](https://img.shields.io/pypi/pyversions/cdindex-parser)](https://pypi.org/project/cdindex-parser/)
46
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/chriskyfung/cdindex-parser/blob/main/LICENSE)
47
+
48
+ **CD Index 2 Parser** converts legacy `*.IDX` and `*.FILE` files from CD Index 2 (光碟索引大師) into modern CSV/JSON formats, preserving the full file tree structure, sizes, and modification timestamps.
49
+
50
+ This tool is for anyone who has old CD/DVD index catalogs from this popular legacy software and wants to access them with modern tools.
51
+
52
+ **📖 Full Documentation: https://chriskyfung.github.io/cdindex-parser/**
53
+
54
+ ---
55
+
56
+ ## Features
57
+
58
+ - Parses file and directory structures from `.IDX` and `.FILE` pairs
59
+ - Correctly decodes the 32-bit MS-DOS FAT timestamps
60
+ - Reconstructs full file paths from tab-indented tree structures
61
+ - Outputs clean CSV or JSON
62
+ - Supports encodings like UTF-16, Big5, and CP950 for Traditional Chinese file names
63
+ - Zero runtime dependencies — pure Python standard library
64
+ - Typed API with frozen dataclasses — importable as a library
65
+
66
+ ---
67
+
68
+ ## Quick Start
69
+
70
+ Install from PyPI:
71
+
72
+ ```bash
73
+ pip install cdindex-parser
74
+ ```
75
+
76
+ Parse a pair of `.IDX`/`.FILE` files into CSV:
77
+
78
+ ```bash
79
+ cdindex-parser mydisk results.csv
80
+ ```
81
+
82
+ Or parse into JSON:
83
+
84
+ ```bash
85
+ cdindex-parser mydisk results.json --format json
86
+ ```
87
+
88
+ Use it as a Python library:
89
+
90
+ ```python
91
+ from cdindex_parser import parse_catalog
92
+
93
+ catalog = parse_catalog("mydisk.IDX", encoding="utf-16")
94
+ for entry in catalog:
95
+ print(f"{entry.path} is_dir={entry.is_dir} size={entry.size_bytes}")
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 📖 Documentation
101
+
102
+ | Document | Link |
103
+ |---|---|
104
+ | Installation | [Docs › Installation](https://chriskyfung.github.io/cdindex-parser/installation.html) |
105
+ | Usage | [Docs › Usage](https://chriskyfung.github.io/cdindex-parser/usage.html) |
106
+ | File Format | [Docs › File Format](https://chriskyfung.github.io/cdindex-parser/file-format.html) |
107
+ | API Reference | [Docs › API Reference](https://chriskyfung.github.io/cdindex-parser/api.html) |
108
+ | Troubleshooting | [Docs › Troubleshooting](https://chriskyfung.github.io/cdindex-parser/troubleshooting.html) |
109
+
110
+ ---
111
+
112
+ ## License
113
+
114
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,74 @@
1
+ # CD Index 2 Parser
2
+
3
+ [![CI](https://github.com/chriskyfung/cdindex-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/chriskyfung/cdindex-parser/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/cdindex-parser)](https://pypi.org/project/cdindex-parser/)
5
+ [![Python Versions](https://img.shields.io/pypi/pyversions/cdindex-parser)](https://pypi.org/project/cdindex-parser/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/chriskyfung/cdindex-parser/blob/main/LICENSE)
7
+
8
+ **CD Index 2 Parser** converts legacy `*.IDX` and `*.FILE` files from CD Index 2 (光碟索引大師) into modern CSV/JSON formats, preserving the full file tree structure, sizes, and modification timestamps.
9
+
10
+ This tool is for anyone who has old CD/DVD index catalogs from this popular legacy software and wants to access them with modern tools.
11
+
12
+ **📖 Full Documentation: https://chriskyfung.github.io/cdindex-parser/**
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ - Parses file and directory structures from `.IDX` and `.FILE` pairs
19
+ - Correctly decodes the 32-bit MS-DOS FAT timestamps
20
+ - Reconstructs full file paths from tab-indented tree structures
21
+ - Outputs clean CSV or JSON
22
+ - Supports encodings like UTF-16, Big5, and CP950 for Traditional Chinese file names
23
+ - Zero runtime dependencies — pure Python standard library
24
+ - Typed API with frozen dataclasses — importable as a library
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ Install from PyPI:
31
+
32
+ ```bash
33
+ pip install cdindex-parser
34
+ ```
35
+
36
+ Parse a pair of `.IDX`/`.FILE` files into CSV:
37
+
38
+ ```bash
39
+ cdindex-parser mydisk results.csv
40
+ ```
41
+
42
+ Or parse into JSON:
43
+
44
+ ```bash
45
+ cdindex-parser mydisk results.json --format json
46
+ ```
47
+
48
+ Use it as a Python library:
49
+
50
+ ```python
51
+ from cdindex_parser import parse_catalog
52
+
53
+ catalog = parse_catalog("mydisk.IDX", encoding="utf-16")
54
+ for entry in catalog:
55
+ print(f"{entry.path} is_dir={entry.is_dir} size={entry.size_bytes}")
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 📖 Documentation
61
+
62
+ | Document | Link |
63
+ |---|---|
64
+ | Installation | [Docs › Installation](https://chriskyfung.github.io/cdindex-parser/installation.html) |
65
+ | Usage | [Docs › Usage](https://chriskyfung.github.io/cdindex-parser/usage.html) |
66
+ | File Format | [Docs › File Format](https://chriskyfung.github.io/cdindex-parser/file-format.html) |
67
+ | API Reference | [Docs › API Reference](https://chriskyfung.github.io/cdindex-parser/api.html) |
68
+ | Troubleshooting | [Docs › Troubleshooting](https://chriskyfung.github.io/cdindex-parser/troubleshooting.html) |
69
+
70
+ ---
71
+
72
+ ## License
73
+
74
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,94 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cdindex-parser"
7
+ version = "1.0.0"
8
+ description = "Parse CD Index 2 IDX/FILE files into CSV/JSON"
9
+ authors = [{name = "Chris Fung", email = "chris@example.com"}]
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ readme = "README.md"
13
+ requires-python = ">=3.10"
14
+ dependencies = []
15
+ keywords = ["cd-index", "cdindex", "parser", "csv", "json", "legacy", "dosdate", "big5"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Utilities",
27
+ "Typing :: Typed",
28
+ ]
29
+
30
+
31
+
32
+ [tool.pytest.ini_options]
33
+ minversion = "8.0"
34
+ addopts = "-ra --strict-markers --strict-config"
35
+ testpaths = ["tests"]
36
+ pythonpath = ["src"]
37
+ xfail_strict = true
38
+ filterwarnings = ["error"]
39
+ [tool.ruff]
40
+ line-length = 88
41
+ target-version = "py310"
42
+ src = ["src", "tests"]
43
+
44
+ [tool.ruff.lint]
45
+ select = ["E", "F", "W", "I", "N", "UP", "B", "C4", "SIM", "RUF", "D", "PT", "S"]
46
+ ignore = ["D203", "D213"]
47
+
48
+ [tool.ruff.lint.per-file-ignores]
49
+ "tests/**" = ["D", "S101", "PLR2004"]
50
+
51
+ [tool.coverage.run]
52
+ branch = true
53
+ source = ["cdindex_parser"]
54
+
55
+ [tool.coverage.report]
56
+ show_missing = true
57
+ fail_under = 80
58
+ exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "raise NotImplementedError"]
59
+
60
+ [project.optional-dependencies]
61
+ dev = [
62
+ "pytest>=8",
63
+ "pytest-cov>=5",
64
+ "coverage[toml]>=7",
65
+ "mypy>=1.11",
66
+ "ruff>=0.6",
67
+ "build>=1.2",
68
+ "twine>=5",
69
+ "pre-commit>=3.8",
70
+ ]
71
+ docs = ["mkdocs-material>=9.5", "mkdocstrings[python]>=0.26"]
72
+
73
+ [project.scripts]
74
+ cdindex-parser = "cdindex_parser.cli:main"
75
+
76
+ [project.urls]
77
+ Homepage = "https://github.com/chriskyfung/cdindex-parser"
78
+ Documentation = "https://chriskyfung.github.io/cdindex-parser/"
79
+ Repository = "https://github.com/chriskyfung/cdindex-parser"
80
+ Issues = "https://github.com/chriskyfung/cdindex-parser/issues"
81
+ Changelog = "https://github.com/chriskyfung/cdindex-parser/blob/main/CHANGELOG.md"
82
+
83
+ [tool.setuptools.packages.find]
84
+ where = ["src"]
85
+ include = ["cdindex_parser*"]
86
+
87
+ [tool.setuptools.package-data]
88
+ cdindex_parser = ["py.typed"]
89
+
90
+ [tool.mypy]
91
+ python_version = "3.10"
92
+ files = ["src"]
93
+ strict = true
94
+ warn_unreachable = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ """Public API for cdindex-parser."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ from .exporters import to_csv, to_json
6
+ from .models import Catalog, Entry, FileRecord, NameRecord
7
+ from .parser import parse_catalog, parse_file_line, parse_name_line, resolve_input_path
8
+
9
+ try:
10
+ __version__ = version("cdindex-parser")
11
+ except PackageNotFoundError:
12
+ __version__ = "0.0.0+unknown"
13
+
14
+ __all__ = [
15
+ "Catalog",
16
+ "Entry",
17
+ "FileRecord",
18
+ "NameRecord",
19
+ "__version__",
20
+ "parse_catalog",
21
+ "parse_file_line",
22
+ "parse_name_line",
23
+ "resolve_input_path",
24
+ "to_csv",
25
+ "to_json",
26
+ ]
@@ -0,0 +1,6 @@
1
+ """Module entry point for ``python -m cdindex_parser``."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,89 @@
1
+ """Command-line interface for cdindex-parser."""
2
+
3
+ import argparse
4
+ import sys
5
+ from collections.abc import Sequence
6
+ from importlib import metadata
7
+ from pathlib import Path
8
+
9
+ from .exporters import to_csv, to_json
10
+ from .models import Catalog
11
+ from .parser import parse_catalog, resolve_input_path
12
+
13
+
14
+ def build_parser() -> argparse.ArgumentParser:
15
+ """Build the argument parser for the CLI."""
16
+ parser = argparse.ArgumentParser(
17
+ prog="cdindex-parser",
18
+ description="Parse CD Index 2 (光碟索引大師) IDX/FILE catalogs into CSV/JSON",
19
+ )
20
+ parser.add_argument(
21
+ "input",
22
+ help=(
23
+ "Base name or path of the IDX/FILE pair "
24
+ "(e.g. mydisk, mydisk.IDX, path/to/disk)"
25
+ ),
26
+ )
27
+ parser.add_argument(
28
+ "-o",
29
+ "--output",
30
+ required=False,
31
+ help="Output file path (CSV or JSON, inferred from suffix unless overridden)",
32
+ )
33
+ parser.add_argument(
34
+ "--format",
35
+ choices=["csv", "json"],
36
+ default=None,
37
+ help="Output format (csv or json); default inferred from --output suffix",
38
+ )
39
+ parser.add_argument(
40
+ "--encoding",
41
+ default="utf-16",
42
+ help="Input encoding (utf-16, big5, cp950); default utf-16 with BOM detection",
43
+ )
44
+ parser.add_argument(
45
+ "--version",
46
+ action="version",
47
+ version=f"cdindex-parser {metadata.version('cdindex-parser')}",
48
+ )
49
+ return parser
50
+
51
+
52
+ def main(argv: Sequence[str] | None = None) -> int:
53
+ """Parse arguments and run the conversion pipeline.
54
+
55
+ Returns an exit code suitable for ``sys.exit``.
56
+ """
57
+ parser = build_parser()
58
+ args = parser.parse_args(argv)
59
+
60
+ idx_path, _ = resolve_input_path(args.input)
61
+ try:
62
+ catalog: Catalog = parse_catalog(args.input, encoding=args.encoding)
63
+ except Exception as exc:
64
+ print(f"Error: {exc}", file=sys.stderr)
65
+ return 1
66
+
67
+ # Determine output path and format
68
+ output_path: str | Path
69
+ fmt: str
70
+
71
+ if args.output:
72
+ output_path = Path(args.output)
73
+ fmt = args.format or output_path.suffix.lstrip(".").lower() or "csv"
74
+ else:
75
+ # Default: same base name with .csv extension
76
+ base = Path(idx_path).with_suffix("")
77
+ output_path = base.with_suffix(".csv")
78
+ fmt = "csv"
79
+
80
+ if fmt == "csv":
81
+ to_csv(catalog, output_path)
82
+ elif fmt == "json":
83
+ to_json(catalog, output_path)
84
+ else:
85
+ print(f"Error: unknown format '{fmt}'", file=sys.stderr)
86
+ return 1
87
+
88
+ print(f"Wrote {fmt.upper()} output to {output_path}")
89
+ return 0
@@ -0,0 +1,30 @@
1
+ """Exception hierarchy for cdindex-parser."""
2
+
3
+
4
+ class CDIndexError(Exception):
5
+ """Base exception for all cdindex-parser errors."""
6
+
7
+
8
+ class InputNotFoundError(CDIndexError, FileNotFoundError):
9
+ """Raised when an input file cannot be found."""
10
+
11
+
12
+ class EncodingError(CDIndexError, UnicodeDecodeError):
13
+ """Raised when the input encoding is incorrect."""
14
+
15
+
16
+ class LineCountMismatchError(CDIndexError, ValueError):
17
+ """Raised when .IDX and .FILE line counts differ."""
18
+
19
+
20
+ class IndentMismatchError(CDIndexError, ValueError):
21
+ """Raised when an indentation mismatch is found."""
22
+
23
+
24
+ class MalformedRecordError(CDIndexError, ValueError):
25
+ """Raised when a record cannot be parsed."""
26
+
27
+ def __init__(self, message: str, line_number: int | None = None):
28
+ """Initialize with an optional line number for error context."""
29
+ self.line_number = line_number
30
+ super().__init__(message)
@@ -0,0 +1,74 @@
1
+ """CSV and JSON exporters for cdindex-parser catalogs."""
2
+
3
+ import csv
4
+ import json
5
+ from collections.abc import Iterator
6
+ from pathlib import Path
7
+
8
+ from .models import Catalog
9
+
10
+ CSV_COLUMNS = ("FullPath", "IsDir", "SizeBytes", "MtimeStr")
11
+
12
+
13
+ def iter_rows(catalog: Catalog) -> Iterator[dict[str, object]]:
14
+ """Yield each ``Entry`` as a dict with CSV-column keys.
15
+
16
+ The ``mtime`` is formatted as an ISO-8601-compatible string
17
+ ``YYYY-MM-DDTHH:MM:SS``.
18
+ """
19
+ for entry in catalog:
20
+ mtime_str = entry.mtime.strftime("%Y-%m-%dT%H:%M:%S")
21
+ yield {
22
+ "FullPath": entry.path,
23
+ "IsDir": "1" if entry.is_dir else "0",
24
+ "SizeBytes": entry.size_bytes,
25
+ "MtimeStr": mtime_str,
26
+ }
27
+
28
+
29
+ def to_csv(catalog: Catalog, out: str | Path) -> None:
30
+ """Write a ``Catalog`` to CSV format.
31
+
32
+ The output uses ``newline=""`` (as recommended for ``csv.writer`` on
33
+ Windows) and ``csv.QUOTE_MINIMAL`` quoting.
34
+ """
35
+ out_path = Path(out)
36
+ with open(out_path, "w", encoding="utf-8", newline="") as f:
37
+ writer = csv.writer(f, quoting=csv.QUOTE_MINIMAL)
38
+ writer.writerow(CSV_COLUMNS)
39
+ for row in iter_rows(catalog):
40
+ writer.writerow([row[c] for c in CSV_COLUMNS])
41
+
42
+
43
+ def to_json(catalog: Catalog, out: str | Path) -> None:
44
+ """Write a ``Catalog`` to JSON format.
45
+
46
+ Output schema version 1:
47
+
48
+ .. code-block:: json
49
+
50
+ {
51
+ "version": 1,
52
+ "entries": [
53
+ {
54
+ "path": "dir/file.txt",
55
+ "is_dir": false,
56
+ "size_bytes": 226,
57
+ "mtime": "2013-11-03T14:38:30"
58
+ }
59
+ ]
60
+ }
61
+ """
62
+ out_path = Path(out)
63
+ entries_data = [
64
+ {
65
+ "path": entry.path,
66
+ "is_dir": entry.is_dir,
67
+ "size_bytes": entry.size_bytes,
68
+ "mtime": entry.mtime.strftime("%Y-%m-%dT%H:%M:%S"),
69
+ }
70
+ for entry in catalog
71
+ ]
72
+ data = {"version": 1, "entries": entries_data}
73
+ with open(out_path, "w", encoding="utf-8") as f:
74
+ json.dump(data, f, ensure_ascii=False, indent=2)
@@ -0,0 +1,54 @@
1
+ """Data models for cdindex-parser catalogs."""
2
+
3
+ from collections.abc import Iterator
4
+ from dataclasses import dataclass
5
+ from datetime import datetime
6
+
7
+ FILE_TYPE_DIR = "D"
8
+ FILE_TYPE_FILE = "F"
9
+
10
+
11
+ @dataclass(frozen=True, slots=True)
12
+ class FileRecord:
13
+ """A single record from a ``.FILE`` line."""
14
+
15
+ indent: int
16
+ type: str # "D" | "F"
17
+ size: int
18
+ ts: int
19
+ mtime: datetime
20
+
21
+
22
+ @dataclass(frozen=True, slots=True)
23
+ class NameRecord:
24
+ """A single record from a ``.IDX`` line."""
25
+
26
+ indent: int
27
+ name: str
28
+
29
+
30
+ @dataclass(frozen=True, slots=True)
31
+ class Entry:
32
+ """A resolved catalog entry with full path."""
33
+
34
+ depth: int
35
+ name: str
36
+ is_dir: bool
37
+ size_bytes: int
38
+ mtime: datetime
39
+ path: str
40
+
41
+
42
+ @dataclass(frozen=True, slots=True)
43
+ class Catalog:
44
+ """A collection of resolved catalog entries."""
45
+
46
+ entries: tuple[Entry, ...]
47
+
48
+ def __iter__(self) -> Iterator[Entry]:
49
+ """Iterate over the catalog entries."""
50
+ return iter(self.entries)
51
+
52
+ def __len__(self) -> int:
53
+ """Return the number of entries."""
54
+ return len(self.entries)