lupaxa-github-intel 0.1.0__py3-none-any.whl

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.
Files changed (41) hide show
  1. lupaxa/github_intel/__init__.py +13 -0
  2. lupaxa/github_intel/__main__.py +8 -0
  3. lupaxa/github_intel/app.py +493 -0
  4. lupaxa/github_intel/checks/__init__.py +1 -0
  5. lupaxa/github_intel/checks/base.py +17 -0
  6. lupaxa/github_intel/checks/releases.py +59 -0
  7. lupaxa/github_intel/checks/workflows.py +34 -0
  8. lupaxa/github_intel/cli.py +699 -0
  9. lupaxa/github_intel/config/__init__.py +1 -0
  10. lupaxa/github_intel/config/defaults.py +150 -0
  11. lupaxa/github_intel/config/editor.py +316 -0
  12. lupaxa/github_intel/config/loader.py +412 -0
  13. lupaxa/github_intel/config/models.py +310 -0
  14. lupaxa/github_intel/config/paths.py +84 -0
  15. lupaxa/github_intel/config/profiles.py +143 -0
  16. lupaxa/github_intel/constants.py +54 -0
  17. lupaxa/github_intel/dates.py +179 -0
  18. lupaxa/github_intel/errors.py +72 -0
  19. lupaxa/github_intel/github/__init__.py +1 -0
  20. lupaxa/github_intel/github/auth.py +40 -0
  21. lupaxa/github_intel/github/client.py +239 -0
  22. lupaxa/github_intel/github/rate_limit.py +107 -0
  23. lupaxa/github_intel/layout.py +141 -0
  24. lupaxa/github_intel/logging_setup.py +51 -0
  25. lupaxa/github_intel/present.py +361 -0
  26. lupaxa/github_intel/reports/__init__.py +1 -0
  27. lupaxa/github_intel/reports/render.py +113 -0
  28. lupaxa/github_intel/storage/__init__.py +1 -0
  29. lupaxa/github_intel/storage/database.py +419 -0
  30. lupaxa/github_intel/sync/__init__.py +1 -0
  31. lupaxa/github_intel/sync/engine.py +671 -0
  32. lupaxa/github_intel/sync/summary.py +308 -0
  33. lupaxa/github_intel/tui/__init__.py +1 -0
  34. lupaxa/github_intel/tui/application.py +487 -0
  35. lupaxa/github_intel/views.py +896 -0
  36. lupaxa_github_intel-0.1.0.dist-info/METADATA +180 -0
  37. lupaxa_github_intel-0.1.0.dist-info/RECORD +41 -0
  38. lupaxa_github_intel-0.1.0.dist-info/WHEEL +5 -0
  39. lupaxa_github_intel-0.1.0.dist-info/entry_points.txt +2 -0
  40. lupaxa_github_intel-0.1.0.dist-info/licenses/LICENCE +21 -0
  41. lupaxa_github_intel-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,141 @@
1
+ """Named list and detail field layouts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from dataclasses import dataclass
6
+ from typing import TYPE_CHECKING
7
+
8
+ from lupaxa.github_intel.errors import ConfigError
9
+
10
+ if TYPE_CHECKING:
11
+ from lupaxa.github_intel.config.models import DisplaySettings
12
+ from lupaxa.github_intel.views import RepositoryView
13
+
14
+ __all__ = [
15
+ "CATALOGUE",
16
+ "Layout",
17
+ "RIGHT_ALIGNED",
18
+ "hardcoded_list",
19
+ "parse_labels",
20
+ "resolve_layout",
21
+ "view_names",
22
+ ]
23
+
24
+ CATALOGUE: tuple[str, ...] = (
25
+ "Organisation",
26
+ "Repository",
27
+ "Visibility",
28
+ "Description",
29
+ "Homepage",
30
+ "Language",
31
+ "Topics",
32
+ "Group",
33
+ "Profile",
34
+ "Tags",
35
+ "Enabled",
36
+ "Status",
37
+ "Cache",
38
+ "Archived",
39
+ "Fork",
40
+ "Forks",
41
+ "Last push",
42
+ "Created",
43
+ "Updated",
44
+ "Synchronised",
45
+ "Default branch",
46
+ "Size",
47
+ "Stars",
48
+ "Watchers",
49
+ "Licence",
50
+ "Version",
51
+ "Release date",
52
+ "Ahead",
53
+ "Pull requests",
54
+ "Issues",
55
+ "Quality",
56
+ "Workflows",
57
+ "Dependabot Alerts",
58
+ )
59
+
60
+ RIGHT_ALIGNED: frozenset[str] = frozenset(
61
+ {
62
+ "Size",
63
+ "Stars",
64
+ "Watchers",
65
+ "Forks",
66
+ "Ahead",
67
+ "Pull requests",
68
+ "Issues",
69
+ "Quality",
70
+ "Dependabot Alerts",
71
+ }
72
+ )
73
+
74
+
75
+ @dataclass(frozen=True)
76
+ class Layout:
77
+ """Resolved list and detail columns for one view name."""
78
+
79
+ list_fields: tuple[str, ...]
80
+ detail_fields: tuple[str, ...] | None
81
+
82
+
83
+ def parse_labels(values: list[str]) -> tuple[str, ...]:
84
+ """Normalize configured field names against the catalogue."""
85
+ if not values:
86
+ message = "a view list must not be empty."
87
+ raise ValueError(message)
88
+ folded = {label.casefold(): label for label in CATALOGUE}
89
+ seen: set[str] = set()
90
+ chosen: list[str] = []
91
+ for raw in values:
92
+ text = raw.strip()
93
+ label = folded.get(text.casefold())
94
+ if label is None:
95
+ message = f"unknown display field {raw!r}."
96
+ raise ValueError(message)
97
+ if label in seen:
98
+ message = f"duplicate display field {label}."
99
+ raise ValueError(message)
100
+ seen.add(label)
101
+ chosen.append(label)
102
+ return tuple(chosen)
103
+
104
+
105
+ def hardcoded_list(views: list[RepositoryView]) -> tuple[str, ...]:
106
+ """Return the default list columns. The repository set does not change them."""
107
+ return (
108
+ "Organisation",
109
+ "Repository",
110
+ "Visibility",
111
+ "Language",
112
+ "Status",
113
+ "Version",
114
+ "Release date",
115
+ "Enabled",
116
+ )
117
+
118
+
119
+ def resolve_layout(
120
+ display: DisplaySettings,
121
+ name: str,
122
+ views: list[RepositoryView],
123
+ ) -> Layout:
124
+ """Resolve one named view into list and detail columns."""
125
+ if name != "default" and name not in display.views:
126
+ raise ConfigError(f"Unknown view: {name}.")
127
+ entry = display.views.get(name)
128
+ list_fields = (
129
+ hardcoded_list(views) if entry is None or entry.list is None else entry.list
130
+ )
131
+ detail_fields = None if entry is None or entry.detail is None else entry.detail
132
+ return Layout(list_fields, detail_fields)
133
+
134
+
135
+ def view_names(display: DisplaySettings) -> tuple[str, ...]:
136
+ """Return saved view names with default first."""
137
+ others = sorted(
138
+ (name for name in display.views if name != "default"),
139
+ key=str.casefold,
140
+ )
141
+ return ("default", *others)
@@ -0,0 +1,51 @@
1
+ """Logging that cannot print a GitHub token."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+
7
+ __all__ = ["configure_logging"]
8
+
9
+
10
+ class _RedactingFormatter(logging.Formatter):
11
+ def __init__(self, secrets: list[str]) -> None:
12
+ super().__init__("%(levelname)s %(message)s")
13
+ self._secrets = [secret for secret in secrets if secret]
14
+
15
+ def format(self, record: logging.LogRecord) -> str:
16
+ """
17
+ Format one record and remove known secrets.
18
+
19
+ Args:
20
+ record: Log record.
21
+
22
+ Returns:
23
+ Redacted text.
24
+
25
+ """
26
+
27
+ text = super().format(record)
28
+ for secret in self._secrets:
29
+ text = text.replace(secret, "[redacted]")
30
+ return text
31
+
32
+
33
+ def configure_logging(level: str, secrets: list[str] | None = None) -> None:
34
+ """
35
+ Configure the github-intel logger.
36
+
37
+ Args:
38
+ level: Logging level name.
39
+ secrets: Values that must not appear in log output.
40
+
41
+ """
42
+
43
+ logger = logging.getLogger("github_intel")
44
+ logger.handlers.clear()
45
+ logger.setLevel(level.upper())
46
+ handler = logging.StreamHandler()
47
+ handler.setFormatter(_RedactingFormatter(secrets or []))
48
+ logger.addHandler(handler)
49
+ logger.propagate = False
50
+ logging.getLogger("httpx").setLevel(logging.WARNING)
51
+ logging.getLogger("httpcore").setLevel(logging.WARNING)
@@ -0,0 +1,361 @@
1
+ """Human-readable CLI output. Machine-readable output never uses this module."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Callable, Iterator
6
+ from contextlib import contextmanager
7
+
8
+ from rich.console import Console
9
+ from rich.progress import (
10
+ BarColumn,
11
+ MofNCompleteColumn,
12
+ Progress,
13
+ SpinnerColumn,
14
+ TextColumn,
15
+ TimeElapsedColumn,
16
+ )
17
+ from rich.table import Table
18
+ from rich.text import Text
19
+
20
+ from lupaxa.github_intel.config.profiles import ResolvedProfile
21
+ from lupaxa.github_intel.dates import DEFAULT_DATE_FORMAT, format_timestamp
22
+ from lupaxa.github_intel.layout import RIGHT_ALIGNED, hardcoded_list
23
+ from lupaxa.github_intel.sync.engine import SyncReport
24
+ from lupaxa.github_intel.views import (
25
+ RepositoryView,
26
+ detail_rows,
27
+ field_text,
28
+ status_style,
29
+ visibility_style,
30
+ workflow_text,
31
+ )
32
+
33
+ __all__ = [
34
+ "print_detail",
35
+ "print_profile",
36
+ "print_repos",
37
+ "print_sync",
38
+ "stderr_console",
39
+ "stdout_console",
40
+ "syncing",
41
+ ]
42
+
43
+
44
+ def stdout_console() -> Console:
45
+ """
46
+ Return a console for human stdout.
47
+
48
+ Returns:
49
+ Rich console.
50
+
51
+ """
52
+
53
+ return Console()
54
+
55
+
56
+ def stderr_console() -> Console:
57
+ """
58
+ Return a console for progress and diagnostics.
59
+
60
+ Returns:
61
+ Rich console bound to stderr.
62
+
63
+ """
64
+
65
+ return Console(stderr=True)
66
+
67
+
68
+ def print_repos(
69
+ views: list[RepositoryView],
70
+ *,
71
+ date_format: str = DEFAULT_DATE_FORMAT,
72
+ fields: tuple[str, ...] | None = None,
73
+ ) -> None:
74
+ """
75
+ Print a repository table.
76
+
77
+ Args:
78
+ views: Rows to show.
79
+ date_format: Pattern such as ``DD/MM/YYYY HH:mm UTC``.
80
+ fields: Catalogue labels. ``None`` uses the hardcoded list.
81
+
82
+ """
83
+
84
+ columns = hardcoded_list(views) if fields is None else fields
85
+ table = Table(title="Repositories", header_style="bold cyan")
86
+ for column in columns:
87
+ table.add_column(
88
+ column,
89
+ justify="right" if column in RIGHT_ALIGNED else "left",
90
+ )
91
+ for view in views:
92
+ table.add_row(*list_row(view, columns, date_format))
93
+ stdout_console().print(table)
94
+
95
+
96
+ def print_detail(
97
+ view: RepositoryView,
98
+ *,
99
+ date_format: str = DEFAULT_DATE_FORMAT,
100
+ fields: tuple[str, ...] | None = None,
101
+ ) -> None:
102
+ """
103
+ Print one repository as a field and value table.
104
+
105
+ Args:
106
+ view: Repository to show.
107
+ date_format: Pattern such as ``DD/MM/YYYY HH:mm UTC``.
108
+ fields: Catalogue labels. ``None`` keeps every current row.
109
+
110
+ """
111
+
112
+ table = Table(title=repo_title(view))
113
+ table.add_column("Field", style="cyan")
114
+ table.add_column("Value")
115
+ for field, value in detail_rows(view, date_format=date_format, fields=fields):
116
+ table.add_row(field, _present_cell(field, value, view))
117
+ stdout_console().print(table)
118
+
119
+
120
+ def print_profile(resolved: ResolvedProfile, *, show_sources: bool) -> None:
121
+ """
122
+ Print one profile.
123
+
124
+ Args:
125
+ resolved: Effective flags.
126
+ show_sources: Include the profile that set each flag.
127
+
128
+ """
129
+
130
+ console = stdout_console()
131
+ console.print(f"Profile: {resolved.name}")
132
+ console.print("Inheritance: " + " -> ".join(resolved.chain))
133
+ table = Table()
134
+ table.add_column("Check")
135
+ table.add_column("Enabled")
136
+ if show_sources:
137
+ table.add_column("Source")
138
+ for name in sorted(resolved.enabled):
139
+ enabled = "Yes" if resolved.enabled[name] else "No"
140
+ if show_sources:
141
+ table.add_row(name, enabled, resolved.sources[name])
142
+ else:
143
+ table.add_row(name, enabled)
144
+ console.print(table)
145
+
146
+
147
+ def print_sync(report: SyncReport) -> None:
148
+ """
149
+ Print synchronisation statistics.
150
+
151
+ Args:
152
+ report: Completed or cancelled run.
153
+
154
+ """
155
+
156
+ title = (
157
+ "Synchronisation cancelled" if report.cancelled else "Synchronisation completed"
158
+ )
159
+ lines = [
160
+ title,
161
+ "",
162
+ f"Repositories: {report.repositories}",
163
+ f"Successful: {report.successful}",
164
+ f"Failed: {report.failed}",
165
+ f"Skipped: {report.skipped}",
166
+ "",
167
+ f"API requests: {report.requests}",
168
+ f"Cache hits: {report.cache_hits}",
169
+ f"Not modified: {report.not_modified}",
170
+ "",
171
+ f"Elapsed: {report.elapsed:.1f}s",
172
+ ]
173
+ if report.rate_pauses:
174
+ lines.extend(["", f"Rate-limit pauses: {report.rate_pauses}"])
175
+ stdout_console().print("\n".join(lines))
176
+ for failure in report.failures:
177
+ stderr_console().print(failure)
178
+
179
+
180
+ @contextmanager
181
+ def syncing() -> Iterator[Callable[[SyncReport], None]]:
182
+ """
183
+ Show synchronisation progress on stderr.
184
+
185
+ A terminal gets a status bar. Any other stderr gets one line each time a
186
+ repository finishes.
187
+
188
+ Yields:
189
+ Callback for :meth:`Service.sync`. It must not await.
190
+
191
+ """
192
+
193
+ console = stderr_console()
194
+ if not console.is_terminal:
195
+ seen = {"done": -1, "wait": -1}
196
+
197
+ def emit(report: SyncReport) -> None:
198
+ done = report.successful + report.failed
199
+ waiting = int(report.rate_wait)
200
+ if done == seen["done"] and waiting == seen["wait"]:
201
+ return
202
+ seen["done"] = done
203
+ seen["wait"] = waiting
204
+ console.print(_status_line(report))
205
+
206
+ yield emit
207
+ return
208
+
209
+ progress = Progress(
210
+ SpinnerColumn(),
211
+ TextColumn("[progress.description]{task.description}"),
212
+ BarColumn(),
213
+ MofNCompleteColumn(),
214
+ TimeElapsedColumn(),
215
+ console=console,
216
+ transient=True,
217
+ )
218
+ with progress:
219
+ task = progress.add_task("Synchronising", total=None)
220
+
221
+ def update(report: SyncReport) -> None:
222
+ done = report.successful + report.failed
223
+ progress.update(
224
+ task,
225
+ completed=done,
226
+ total=report.repositories or None,
227
+ description=_status_line(report),
228
+ )
229
+
230
+ yield update
231
+
232
+
233
+ def _status_line(report: SyncReport) -> str:
234
+ done = report.successful + report.failed
235
+ name = report.latest or "Synchronising"
236
+ line = (
237
+ f"{name} {done}/{report.repositories}"
238
+ f" requests {report.requests}"
239
+ f" cache {report.cache_hits}"
240
+ f" failed {report.failed}"
241
+ )
242
+ if report.rate_wait > 0:
243
+ remaining = _wait_label(report.rate_wait)
244
+ return f"{line} waiting for GitHub rate limit, requests resume in {remaining}"
245
+ if report.rate_pauses:
246
+ return f"{line} rate limit pauses {report.rate_pauses}"
247
+ return line
248
+
249
+
250
+ def _wait_label(seconds: float) -> str:
251
+ remaining = max(0, int(seconds + 0.5))
252
+ minutes, secs = divmod(remaining, 60)
253
+ if minutes:
254
+ return f"{minutes}m {secs:02d}s"
255
+ return f"{secs}s"
256
+
257
+
258
+ def list_row(
259
+ view: RepositoryView,
260
+ fields: tuple[str, ...],
261
+ date_format: str,
262
+ ) -> tuple[str | Text, ...]:
263
+ """
264
+ Paint one repository list row.
265
+
266
+ Args:
267
+ view: Repository to show.
268
+ fields: Catalogue labels, in column order.
269
+ date_format: Pattern such as ``DD/MM/YYYY HH:mm UTC``.
270
+
271
+ Returns:
272
+ One cell per field.
273
+
274
+ """
275
+
276
+ cells: list[str | Text] = []
277
+ for label in fields:
278
+ text = field_text(view, label, date_format, detail=False)
279
+ cells.append(_present_cell(label, text, view))
280
+ return tuple(cells)
281
+
282
+
283
+ def repo_title(view: RepositoryView) -> str | Text:
284
+ """Colour the repository id red when its record failed."""
285
+ if view.metadata_error:
286
+ return Text(view.repo, style="red")
287
+ return view.repo
288
+
289
+
290
+ def _present_cell(label: str, value: str, view: RepositoryView) -> str | Text:
291
+ if label == "Workflows" and view.workflows:
292
+ listed = workflow_text(view.workflows)
293
+ if listed.plain == value:
294
+ return listed
295
+ style = _cell_style(label, value, view)
296
+ if not style or not value:
297
+ return value
298
+ return Text(value, style=style)
299
+
300
+
301
+ def _cell_style(label: str, value: str, view: RepositoryView) -> str:
302
+ if label == "Repository" and view.metadata_error:
303
+ return "red"
304
+ if label == "Metadata error":
305
+ return "red"
306
+ if label == "Visibility":
307
+ return visibility_style(value)
308
+ if label == "Status":
309
+ return status_style(view.status)
310
+ if label == "Enabled":
311
+ return {"yes": "green", "no": "dim"}.get(value.strip().casefold(), "")
312
+ if label == "Archived" and value.strip().casefold() == "yes":
313
+ return "yellow"
314
+ if label == "Fork" and value.strip().casefold() == "yes":
315
+ return "cyan"
316
+ if label == "Ahead":
317
+ return _count_style(value, zero="green", positive="yellow")
318
+ if label in {"Quality", "Dependabot Alerts"}:
319
+ counted = _count_style(value, zero="green", positive="yellow")
320
+ return counted or status_style(value)
321
+ if label == "Cache":
322
+ return _cache_style(value)
323
+ return status_style(value)
324
+
325
+
326
+ def _count_style(value: str, *, zero: str, positive: str) -> str:
327
+ text = value.strip()
328
+ if not text.isdigit():
329
+ return ""
330
+ return zero if int(text) == 0 else positive
331
+
332
+
333
+ def _cache_style(value: str) -> str:
334
+ tokens = {part.strip().casefold() for part in value.split(",") if part.strip()}
335
+ if tokens & {"error", "unavailable"}:
336
+ return "red"
337
+ if "stale" in tokens:
338
+ return "yellow"
339
+ if "cached" in tokens:
340
+ return "green"
341
+ return ""
342
+
343
+
344
+ def format_time(
345
+ value: float | None,
346
+ *,
347
+ date_format: str = DEFAULT_DATE_FORMAT,
348
+ ) -> str:
349
+ """
350
+ Format a cache timestamp.
351
+
352
+ Args:
353
+ value: Epoch seconds, or None.
354
+ date_format: Pattern such as ``DD/MM/YYYY HH:mm UTC``.
355
+
356
+ Returns:
357
+ UTC timestamp, or an empty string.
358
+
359
+ """
360
+
361
+ return format_timestamp(value, date_format)
@@ -0,0 +1 @@
1
+ """Reports."""
@@ -0,0 +1,113 @@
1
+ """JSON, CSV, and Markdown reports."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import csv
6
+ import io
7
+ import json
8
+
9
+ from lupaxa.github_intel.dates import DEFAULT_DATE_FORMAT
10
+ from lupaxa.github_intel.views import RepositoryView, field_text
11
+
12
+ __all__ = ["render_report"]
13
+
14
+
15
+ def render_report(
16
+ views: list[RepositoryView],
17
+ report_format: str,
18
+ *,
19
+ date_format: str = DEFAULT_DATE_FORMAT,
20
+ fields: tuple[str, ...],
21
+ detail: bool = False,
22
+ ) -> str:
23
+ """
24
+ Render repository rows.
25
+
26
+ Args:
27
+ views: Rows to export.
28
+ report_format: ``json``, ``csv``, or ``markdown``.
29
+ date_format: Pattern used for date cells.
30
+ fields: Catalogue labels, in display order.
31
+ detail: Use detail wording. A metadata error is the first record key.
32
+
33
+ Returns:
34
+ Report text.
35
+
36
+ Raises:
37
+ ValueError: The format is not supported.
38
+
39
+ """
40
+
41
+ records = [_record(view, date_format, fields, detail=detail) for view in views]
42
+ if report_format == "json":
43
+ return _json(records, detail=detail)
44
+ if report_format == "csv":
45
+ return _csv(records, fields, detail=detail)
46
+ if report_format == "markdown":
47
+ return _markdown(records, fields)
48
+ message = f"Unsupported report format: {report_format}"
49
+ raise ValueError(message)
50
+
51
+
52
+ def _record(
53
+ view: RepositoryView,
54
+ date_format: str,
55
+ fields: tuple[str, ...],
56
+ *,
57
+ detail: bool,
58
+ ) -> dict[str, str]:
59
+ record: dict[str, str] = {}
60
+ if detail and view.metadata_error:
61
+ record["Metadata error"] = view.metadata_error
62
+ for label in fields:
63
+ record[label] = field_text(view, label, date_format, detail=detail)
64
+ return record
65
+
66
+
67
+ def _json(records: list[dict[str, str]], *, detail: bool) -> str:
68
+ if detail:
69
+ return json.dumps(records[0] if records else {}, indent=2) + "\n"
70
+ return json.dumps(records, indent=2) + "\n"
71
+
72
+
73
+ def _csv(
74
+ records: list[dict[str, str]],
75
+ fields: tuple[str, ...],
76
+ *,
77
+ detail: bool,
78
+ ) -> str:
79
+ buffer = io.StringIO()
80
+ writer = csv.DictWriter(
81
+ buffer,
82
+ fieldnames=_fieldnames(records, fields, detail=detail),
83
+ )
84
+ writer.writeheader()
85
+ for record in records:
86
+ writer.writerow(record)
87
+ return buffer.getvalue()
88
+
89
+
90
+ def _fieldnames(
91
+ records: list[dict[str, str]],
92
+ fields: tuple[str, ...],
93
+ *,
94
+ detail: bool,
95
+ ) -> list[str]:
96
+ if detail and any("Metadata error" in record for record in records):
97
+ return ["Metadata error", *fields]
98
+ return list(fields)
99
+
100
+
101
+ def _markdown(records: list[dict[str, str]], fields: tuple[str, ...]) -> str:
102
+ heading = "| " + " | ".join(fields) + " |"
103
+ separator = "| " + " | ".join("---" for _ in fields) + " |"
104
+ lines = ["# GitHub Intel Report", "", heading, separator]
105
+ for record in records:
106
+ cells = (_markdown_cell(record[label]) for label in fields)
107
+ lines.append("| " + " | ".join(cells) + " |")
108
+ lines.append("")
109
+ return "\n".join(lines)
110
+
111
+
112
+ def _markdown_cell(value: str) -> str:
113
+ return value.replace("|", "\\|").replace("\n", "<br>")
@@ -0,0 +1 @@
1
+ """Local cache."""