A loose federation of distributed, typed datasets
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 1022 lines 41 kB view raw
1<!DOCTYPE html> 2<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> 3 4<meta charset="utf-8"> 5<meta name="generator" content="quarto-1.7.34"> 6 7<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> 8 9 10<title>local.localdatasetentry – atdata</title> 11<style> 12code{white-space: pre-wrap;} 13span.smallcaps{font-variant: small-caps;} 14div.columns{display: flex; gap: min(4vw, 1.5em);} 15div.column{flex: auto; overflow-x: auto;} 16div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} 17ul.task-list{list-style: none;} 18ul.task-list li input[type="checkbox"] { 19 width: 0.8em; 20 margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */ 21 vertical-align: middle; 22} 23/* CSS for syntax highlighting */ 24html { -webkit-text-size-adjust: 100%; } 25pre > code.sourceCode { white-space: pre; position: relative; } 26pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } 27pre > code.sourceCode > span:empty { height: 1.2em; } 28.sourceCode { overflow: visible; } 29code.sourceCode > span { color: inherit; text-decoration: inherit; } 30div.sourceCode { margin: 1em 0; } 31pre.sourceCode { margin: 0; } 32@media screen { 33div.sourceCode { overflow: auto; } 34} 35@media print { 36pre > code.sourceCode { white-space: pre-wrap; } 37pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } 38} 39pre.numberSource code 40 { counter-reset: source-line 0; } 41pre.numberSource code > span 42 { position: relative; left: -4em; counter-increment: source-line; } 43pre.numberSource code > span > a:first-child::before 44 { content: counter(source-line); 45 position: relative; left: -1em; text-align: right; vertical-align: baseline; 46 border: none; display: inline-block; 47 -webkit-touch-callout: none; -webkit-user-select: none; 48 -khtml-user-select: none; -moz-user-select: none; 49 -ms-user-select: none; user-select: none; 50 padding: 0 4px; width: 4em; 51 } 52pre.numberSource { margin-left: 3em; padding-left: 4px; } 53div.sourceCode 54 { } 55@media screen { 56pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } 57} 58</style> 59 60 61<script src="../site_libs/quarto-nav/quarto-nav.js"></script> 62<script src="../site_libs/quarto-nav/headroom.min.js"></script> 63<script src="../site_libs/clipboard/clipboard.min.js"></script> 64<script src="../site_libs/quarto-search/autocomplete.umd.js"></script> 65<script src="../site_libs/quarto-search/fuse.min.js"></script> 66<script src="../site_libs/quarto-search/quarto-search.js"></script> 67<meta name="quarto:offset" content="../"> 68<script src="../site_libs/quarto-html/quarto.js" type="module"></script> 69<script src="../site_libs/quarto-html/tabsets/tabsets.js" type="module"></script> 70<script src="../site_libs/quarto-html/popper.min.js"></script> 71<script src="../site_libs/quarto-html/tippy.umd.min.js"></script> 72<script src="../site_libs/quarto-html/anchor.min.js"></script> 73<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet"> 74<link href="../site_libs/quarto-html/quarto-syntax-highlighting-9582434199d49cc9e91654cdeeb4866b.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles"> 75<link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark-8dcd8563ea6803ab7cbb3d71ca5772e1.css" rel="stylesheet" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles"> 76<link href="../site_libs/quarto-html/quarto-syntax-highlighting-9582434199d49cc9e91654cdeeb4866b.css" rel="stylesheet" class="quarto-color-scheme-extra" id="quarto-text-highlighting-styles"> 77<script src="../site_libs/bootstrap/bootstrap.min.js"></script> 78<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet"> 79<link href="../site_libs/bootstrap/bootstrap-62bce24ca844314e7bb1a34dbdfe05cc.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light"> 80<link href="../site_libs/bootstrap/bootstrap-dark-7964ffd8887b0991fe8d71c6c8bc75d6.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark"> 81<link href="../site_libs/bootstrap/bootstrap-62bce24ca844314e7bb1a34dbdfe05cc.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme-extra" id="quarto-bootstrap" data-mode="light"> 82<script id="quarto-search-options" type="application/json">{ 83 "location": "navbar", 84 "copy-button": false, 85 "collapse-after": 3, 86 "panel-placement": "end", 87 "type": "overlay", 88 "limit": 50, 89 "keyboard-shortcut": [ 90 "f", 91 "/", 92 "s" 93 ], 94 "show-item-context": false, 95 "language": { 96 "search-no-results-text": "No results", 97 "search-matching-documents-text": "matching documents", 98 "search-copy-link-title": "Copy link to search", 99 "search-hide-matches-text": "Hide additional matches", 100 "search-more-match-text": "more match in this document", 101 "search-more-matches-text": "more matches in this document", 102 "search-clear-button-title": "Clear", 103 "search-text-placeholder": "", 104 "search-detached-cancel-button-title": "Cancel", 105 "search-submit-button-title": "Submit", 106 "search-label": "Search" 107 } 108}</script> 109 110 111<link rel="stylesheet" href="../assets/styles.css"> 112</head> 113 114<body class="nav-fixed quarto-light"><script id="quarto-html-before-body" type="application/javascript"> 115 const toggleBodyColorMode = (bsSheetEl) => { 116 const mode = bsSheetEl.getAttribute("data-mode"); 117 const bodyEl = window.document.querySelector("body"); 118 if (mode === "dark") { 119 bodyEl.classList.add("quarto-dark"); 120 bodyEl.classList.remove("quarto-light"); 121 } else { 122 bodyEl.classList.add("quarto-light"); 123 bodyEl.classList.remove("quarto-dark"); 124 } 125 } 126 const toggleBodyColorPrimary = () => { 127 const bsSheetEl = window.document.querySelector("link#quarto-bootstrap:not([rel=disabled-stylesheet])"); 128 if (bsSheetEl) { 129 toggleBodyColorMode(bsSheetEl); 130 } 131 } 132 const setColorSchemeToggle = (alternate) => { 133 const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle'); 134 for (let i=0; i < toggles.length; i++) { 135 const toggle = toggles[i]; 136 if (toggle) { 137 if (alternate) { 138 toggle.classList.add("alternate"); 139 } else { 140 toggle.classList.remove("alternate"); 141 } 142 } 143 } 144 }; 145 const toggleColorMode = (alternate) => { 146 // Switch the stylesheets 147 const primaryStylesheets = window.document.querySelectorAll('link.quarto-color-scheme:not(.quarto-color-alternate)'); 148 const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate'); 149 manageTransitions('#quarto-margin-sidebar .nav-link', false); 150 if (alternate) { 151 // note: dark is layered on light, we don't disable primary! 152 enableStylesheet(alternateStylesheets); 153 for (const sheetNode of alternateStylesheets) { 154 if (sheetNode.id === "quarto-bootstrap") { 155 toggleBodyColorMode(sheetNode); 156 } 157 } 158 } else { 159 disableStylesheet(alternateStylesheets); 160 enableStylesheet(primaryStylesheets) 161 toggleBodyColorPrimary(); 162 } 163 manageTransitions('#quarto-margin-sidebar .nav-link', true); 164 // Switch the toggles 165 setColorSchemeToggle(alternate) 166 // Hack to workaround the fact that safari doesn't 167 // properly recolor the scrollbar when toggling (#1455) 168 if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) { 169 manageTransitions("body", false); 170 window.scrollTo(0, 1); 171 setTimeout(() => { 172 window.scrollTo(0, 0); 173 manageTransitions("body", true); 174 }, 40); 175 } 176 } 177 const disableStylesheet = (stylesheets) => { 178 for (let i=0; i < stylesheets.length; i++) { 179 const stylesheet = stylesheets[i]; 180 stylesheet.rel = 'disabled-stylesheet'; 181 } 182 } 183 const enableStylesheet = (stylesheets) => { 184 for (let i=0; i < stylesheets.length; i++) { 185 const stylesheet = stylesheets[i]; 186 if(stylesheet.rel !== 'stylesheet') { // for Chrome, which will still FOUC without this check 187 stylesheet.rel = 'stylesheet'; 188 } 189 } 190 } 191 const manageTransitions = (selector, allowTransitions) => { 192 const els = window.document.querySelectorAll(selector); 193 for (let i=0; i < els.length; i++) { 194 const el = els[i]; 195 if (allowTransitions) { 196 el.classList.remove('notransition'); 197 } else { 198 el.classList.add('notransition'); 199 } 200 } 201 } 202 const isFileUrl = () => { 203 return window.location.protocol === 'file:'; 204 } 205 const hasAlternateSentinel = () => { 206 let styleSentinel = getColorSchemeSentinel(); 207 if (styleSentinel !== null) { 208 return styleSentinel === "alternate"; 209 } else { 210 return false; 211 } 212 } 213 const setStyleSentinel = (alternate) => { 214 const value = alternate ? "alternate" : "default"; 215 if (!isFileUrl()) { 216 window.localStorage.setItem("quarto-color-scheme", value); 217 } else { 218 localAlternateSentinel = value; 219 } 220 } 221 const getColorSchemeSentinel = () => { 222 if (!isFileUrl()) { 223 const storageValue = window.localStorage.getItem("quarto-color-scheme"); 224 return storageValue != null ? storageValue : localAlternateSentinel; 225 } else { 226 return localAlternateSentinel; 227 } 228 } 229 const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => { 230 const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light'; 231 const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark'; 232 let newTheme = ''; 233 if(authorPrefersDark) { 234 newTheme = isAlternate ? baseTheme : alternateTheme; 235 } else { 236 newTheme = isAlternate ? alternateTheme : baseTheme; 237 } 238 const changeGiscusTheme = () => { 239 // From: https://github.com/giscus/giscus/issues/336 240 const sendMessage = (message) => { 241 const iframe = document.querySelector('iframe.giscus-frame'); 242 if (!iframe) return; 243 iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); 244 } 245 sendMessage({ 246 setConfig: { 247 theme: newTheme 248 } 249 }); 250 } 251 const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null; 252 if (isGiscussLoaded) { 253 changeGiscusTheme(); 254 } 255 }; 256 const authorPrefersDark = false; 257 const darkModeDefault = authorPrefersDark; 258 document.querySelector('link#quarto-text-highlighting-styles.quarto-color-scheme-extra').rel = 'disabled-stylesheet'; 259 document.querySelector('link#quarto-bootstrap.quarto-color-scheme-extra').rel = 'disabled-stylesheet'; 260 let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default'; 261 // Dark / light mode switch 262 window.quartoToggleColorScheme = () => { 263 // Read the current dark / light value 264 let toAlternate = !hasAlternateSentinel(); 265 toggleColorMode(toAlternate); 266 setStyleSentinel(toAlternate); 267 toggleGiscusIfUsed(toAlternate, darkModeDefault); 268 window.dispatchEvent(new Event('resize')); 269 }; 270 // Switch to dark mode if need be 271 if (hasAlternateSentinel()) { 272 toggleColorMode(true); 273 } else { 274 toggleColorMode(false); 275 } 276 </script> 277 278<div id="quarto-search-results"></div> 279 <header id="quarto-header" class="headroom fixed-top"> 280 <nav class="navbar navbar-expand-lg " data-bs-theme="dark"> 281 <div class="navbar-container container-fluid"> 282 <div class="navbar-brand-container mx-auto"> 283 <a class="navbar-brand" href="../index.html"> 284 <span class="navbar-title">atdata</span> 285 </a> 286 </div> 287 <div id="quarto-search" class="" title="Search"></div> 288 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }"> 289 <span class="navbar-toggler-icon"></span> 290</button> 291 <div class="collapse navbar-collapse" id="navbarCollapse"> 292 <ul class="navbar-nav navbar-nav-scroll me-auto"> 293 <li class="nav-item"> 294 <a class="nav-link" href="../index.html"> 295<span class="menu-text">Guide</span></a> 296 </li> 297 <li class="nav-item dropdown "> 298 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-tutorials" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 299 <span class="menu-text">Tutorials</span> 300 </a> 301 <ul class="dropdown-menu" aria-labelledby="nav-menu-tutorials"> 302 <li> 303 <a class="dropdown-item" href="../tutorials/quickstart.html"> 304 <span class="dropdown-text">Quick Start</span></a> 305 </li> 306 <li> 307 <a class="dropdown-item" href="../tutorials/local-workflow.html"> 308 <span class="dropdown-text">Local Workflow</span></a> 309 </li> 310 <li> 311 <a class="dropdown-item" href="../tutorials/atmosphere.html"> 312 <span class="dropdown-text">Atmosphere Publishing</span></a> 313 </li> 314 <li> 315 <a class="dropdown-item" href="../tutorials/promotion.html"> 316 <span class="dropdown-text">Promotion Workflow</span></a> 317 </li> 318 </ul> 319 </li> 320 <li class="nav-item dropdown "> 321 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-reference" role="link" data-bs-toggle="dropdown" aria-expanded="false"> 322 <span class="menu-text">Reference</span> 323 </a> 324 <ul class="dropdown-menu" aria-labelledby="nav-menu-reference"> 325 <li> 326 <a class="dropdown-item" href="../reference/architecture.html"> 327 <span class="dropdown-text">Architecture Overview</span></a> 328 </li> 329 <li> 330 <a class="dropdown-item" href="../reference/packable-samples.html"> 331 <span class="dropdown-text">Packable Samples</span></a> 332 </li> 333 <li> 334 <a class="dropdown-item" href="../reference/datasets.html"> 335 <span class="dropdown-text">Datasets</span></a> 336 </li> 337 <li> 338 <a class="dropdown-item" href="../reference/lenses.html"> 339 <span class="dropdown-text">Lenses</span></a> 340 </li> 341 <li> 342 <a class="dropdown-item" href="../reference/local-storage.html"> 343 <span class="dropdown-text">Local Storage</span></a> 344 </li> 345 <li> 346 <a class="dropdown-item" href="../reference/atmosphere.html"> 347 <span class="dropdown-text">Atmosphere</span></a> 348 </li> 349 <li> 350 <a class="dropdown-item" href="../reference/promotion.html"> 351 <span class="dropdown-text">Promotion</span></a> 352 </li> 353 <li> 354 <a class="dropdown-item" href="../reference/load-dataset.html"> 355 <span class="dropdown-text">load_dataset API</span></a> 356 </li> 357 <li> 358 <a class="dropdown-item" href="../reference/protocols.html"> 359 <span class="dropdown-text">Protocols</span></a> 360 </li> 361 <li> 362 <a class="dropdown-item" href="../reference/uri-spec.html"> 363 <span class="dropdown-text">URI Specification</span></a> 364 </li> 365 <li> 366 <a class="dropdown-item" href="../reference/troubleshooting.html"> 367 <span class="dropdown-text">Troubleshooting &amp; FAQ</span></a> 368 </li> 369 <li> 370 <a class="dropdown-item" href="../reference/deployment.html"> 371 <span class="dropdown-text">Deployment Guide</span></a> 372 </li> 373 </ul> 374 </li> 375 <li class="nav-item"> 376 <a class="nav-link" href="../api/index.html"> 377<span class="menu-text">API</span></a> 378 </li> 379</ul> 380 <ul class="navbar-nav navbar-nav-scroll ms-auto"> 381 <li class="nav-item compact"> 382 <a class="nav-link" href="https://github.com/your-org/atdata"> <i class="bi bi-github" role="img"> 383</i> 384<span class="menu-text"></span></a> 385 </li> 386</ul> 387 </div> <!-- /navcollapse --> 388 <div class="quarto-navbar-tools"> 389 <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a> 390</div> 391 </div> <!-- /container-fluid --> 392 </nav> 393</header> 394<!-- content --> 395<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar"> 396<!-- sidebar --> 397<!-- margin-sidebar --> 398 <div id="quarto-margin-sidebar" class="sidebar margin-sidebar"> 399 <nav id="TOC" role="doc-toc" class="toc-active"> 400 <h2 id="toc-title">On this page</h2> 401 402 <ul> 403 <li><a href="#atdata.local.LocalDatasetEntry" id="toc-atdata.local.LocalDatasetEntry" class="nav-link active" data-scroll-target="#atdata.local.LocalDatasetEntry">local.LocalDatasetEntry</a> 404 <ul class="collapse"> 405 <li><a href="#attributes" id="toc-attributes" class="nav-link" data-scroll-target="#attributes">Attributes</a></li> 406 <li><a href="#methods" id="toc-methods" class="nav-link" data-scroll-target="#methods">Methods</a> 407 <ul class="collapse"> 408 <li><a href="#atdata.local.LocalDatasetEntry.from_redis" id="toc-atdata.local.LocalDatasetEntry.from_redis" class="nav-link" data-scroll-target="#atdata.local.LocalDatasetEntry.from_redis">from_redis</a></li> 409 <li><a href="#atdata.local.LocalDatasetEntry.write_to" id="toc-atdata.local.LocalDatasetEntry.write_to" class="nav-link" data-scroll-target="#atdata.local.LocalDatasetEntry.write_to">write_to</a></li> 410 </ul></li> 411 </ul></li> 412 </ul> 413<div class="toc-actions"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/local.LocalDatasetEntry.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/your-org/atdata/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></nav> 414 </div> 415<!-- main --> 416<main class="content" id="quarto-document-content"><header id="title-block-header" class="quarto-title-block"></header> 417 418 419 420 421 422<section id="atdata.local.LocalDatasetEntry" class="level1"> 423<h1>local.LocalDatasetEntry</h1> 424<div class="sourceCode" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>local.LocalDatasetEntry(</span> 425<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> name,</span> 426<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> schema_ref,</span> 427<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> data_urls,</span> 428<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> metadata<span class="op">=</span><span class="va">None</span>,</span> 429<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> _cid<span class="op">=</span><span class="va">None</span>,</span> 430<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> _legacy_uuid<span class="op">=</span><span class="va">None</span>,</span> 431<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> 432<p>Index entry for a dataset stored in the local repository.</p> 433<p>Implements the IndexEntry protocol for compatibility with AbstractIndex. Uses dual identity: a content-addressable CID (ATProto-compatible) and a human-readable name.</p> 434<p>The CID is generated from the entry’s content (schema_ref + data_urls), ensuring the same data produces the same CID whether stored locally or in the atmosphere. This enables seamless promotion from local to ATProto.</p> 435<section id="attributes" class="level2 doc-section doc-section-attributes"> 436<h2 class="doc-section doc-section-attributes anchored" data-anchor-id="attributes">Attributes</h2> 437<table class="caption-top table"> 438<thead> 439<tr class="header"> 440<th>Name</th> 441<th>Type</th> 442<th>Description</th> 443</tr> 444</thead> 445<tbody> 446<tr class="odd"> 447<td>name</td> 448<td><a href="`str`">str</a></td> 449<td>Human-readable name for this dataset.</td> 450</tr> 451<tr class="even"> 452<td>schema_ref</td> 453<td><a href="`str`">str</a></td> 454<td>Reference to the schema for this dataset.</td> 455</tr> 456<tr class="odd"> 457<td>data_urls</td> 458<td><a href="`list`">list</a>[<a href="`str`">str</a>]</td> 459<td>WebDataset URLs for the data.</td> 460</tr> 461<tr class="even"> 462<td>metadata</td> 463<td><a href="`dict`">dict</a> | None</td> 464<td>Arbitrary metadata dictionary, or None if not set.</td> 465</tr> 466</tbody> 467</table> 468</section> 469<section id="methods" class="level2"> 470<h2 class="anchored" data-anchor-id="methods">Methods</h2> 471<table class="caption-top table"> 472<thead> 473<tr class="header"> 474<th>Name</th> 475<th>Description</th> 476</tr> 477</thead> 478<tbody> 479<tr class="odd"> 480<td><a href="#atdata.local.LocalDatasetEntry.from_redis">from_redis</a></td> 481<td>Load an entry from Redis by CID.</td> 482</tr> 483<tr class="even"> 484<td><a href="#atdata.local.LocalDatasetEntry.write_to">write_to</a></td> 485<td>Persist this index entry to Redis.</td> 486</tr> 487</tbody> 488</table> 489<section id="atdata.local.LocalDatasetEntry.from_redis" class="level3"> 490<h3 class="anchored" data-anchor-id="atdata.local.LocalDatasetEntry.from_redis">from_redis</h3> 491<div class="sourceCode" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>local.LocalDatasetEntry.from_redis(redis, cid)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> 492<p>Load an entry from Redis by CID.</p> 493<section id="parameters" class="level4 doc-section doc-section-parameters"> 494<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters">Parameters</h4> 495<table class="caption-top table"> 496<thead> 497<tr class="header"> 498<th>Name</th> 499<th>Type</th> 500<th>Description</th> 501<th>Default</th> 502</tr> 503</thead> 504<tbody> 505<tr class="odd"> 506<td>redis</td> 507<td><a href="`redis.Redis`">Redis</a></td> 508<td>Redis connection to read from.</td> 509<td><em>required</em></td> 510</tr> 511<tr class="even"> 512<td>cid</td> 513<td><a href="`str`">str</a></td> 514<td>Content identifier of the entry to load.</td> 515<td><em>required</em></td> 516</tr> 517</tbody> 518</table> 519</section> 520<section id="returns" class="level4 doc-section doc-section-returns"> 521<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns">Returns</h4> 522<table class="caption-top table"> 523<thead> 524<tr class="header"> 525<th>Name</th> 526<th>Type</th> 527<th>Description</th> 528</tr> 529</thead> 530<tbody> 531<tr class="odd"> 532<td></td> 533<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td> 534<td>LocalDatasetEntry loaded from Redis.</td> 535</tr> 536</tbody> 537</table> 538</section> 539<section id="raises" class="level4 doc-section doc-section-raises"> 540<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises">Raises</h4> 541<table class="caption-top table"> 542<thead> 543<tr class="header"> 544<th>Name</th> 545<th>Type</th> 546<th>Description</th> 547</tr> 548</thead> 549<tbody> 550<tr class="odd"> 551<td></td> 552<td><a href="`KeyError`">KeyError</a></td> 553<td>If entry not found.</td> 554</tr> 555</tbody> 556</table> 557</section> 558</section> 559<section id="atdata.local.LocalDatasetEntry.write_to" class="level3"> 560<h3 class="anchored" data-anchor-id="atdata.local.LocalDatasetEntry.write_to">write_to</h3> 561<div class="sourceCode" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>local.LocalDatasetEntry.write_to(redis)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div> 562<p>Persist this index entry to Redis.</p> 563<p>Stores the entry as a Redis hash with key ‘{REDIS_KEY_DATASET_ENTRY}:{cid}’.</p> 564<section id="parameters-1" class="level4 doc-section doc-section-parameters"> 565<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-1">Parameters</h4> 566<table class="caption-top table"> 567<thead> 568<tr class="header"> 569<th>Name</th> 570<th>Type</th> 571<th>Description</th> 572<th>Default</th> 573</tr> 574</thead> 575<tbody> 576<tr class="odd"> 577<td>redis</td> 578<td><a href="`redis.Redis`">Redis</a></td> 579<td>Redis connection to write to.</td> 580<td><em>required</em></td> 581</tr> 582</tbody> 583</table> 584 585 586</section> 587</section> 588</section> 589</section> 590 591</main> <!-- /main --> 592<script id="quarto-html-after-body" type="application/javascript"> 593 window.document.addEventListener("DOMContentLoaded", function (event) { 594 // Ensure there is a toggle, if there isn't float one in the top right 595 if (window.document.querySelector('.quarto-color-scheme-toggle') === null) { 596 const a = window.document.createElement('a'); 597 a.classList.add('top-right'); 598 a.classList.add('quarto-color-scheme-toggle'); 599 a.href = ""; 600 a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; }; 601 const i = window.document.createElement("i"); 602 i.classList.add('bi'); 603 a.appendChild(i); 604 window.document.body.appendChild(a); 605 } 606 setColorSchemeToggle(hasAlternateSentinel()) 607 const icon = ""; 608 const anchorJS = new window.AnchorJS(); 609 anchorJS.options = { 610 placement: 'right', 611 icon: icon 612 }; 613 anchorJS.add('.anchored'); 614 const isCodeAnnotation = (el) => { 615 for (const clz of el.classList) { 616 if (clz.startsWith('code-annotation-')) { 617 return true; 618 } 619 } 620 return false; 621 } 622 const onCopySuccess = function(e) { 623 // button target 624 const button = e.trigger; 625 // don't keep focus 626 button.blur(); 627 // flash "checked" 628 button.classList.add('code-copy-button-checked'); 629 var currentTitle = button.getAttribute("title"); 630 button.setAttribute("title", "Copied!"); 631 let tooltip; 632 if (window.bootstrap) { 633 button.setAttribute("data-bs-toggle", "tooltip"); 634 button.setAttribute("data-bs-placement", "left"); 635 button.setAttribute("data-bs-title", "Copied!"); 636 tooltip = new bootstrap.Tooltip(button, 637 { trigger: "manual", 638 customClass: "code-copy-button-tooltip", 639 offset: [0, -8]}); 640 tooltip.show(); 641 } 642 setTimeout(function() { 643 if (tooltip) { 644 tooltip.hide(); 645 button.removeAttribute("data-bs-title"); 646 button.removeAttribute("data-bs-toggle"); 647 button.removeAttribute("data-bs-placement"); 648 } 649 button.setAttribute("title", currentTitle); 650 button.classList.remove('code-copy-button-checked'); 651 }, 1000); 652 // clear code selection 653 e.clearSelection(); 654 } 655 const getTextToCopy = function(trigger) { 656 const codeEl = trigger.previousElementSibling.cloneNode(true); 657 for (const childEl of codeEl.children) { 658 if (isCodeAnnotation(childEl)) { 659 childEl.remove(); 660 } 661 } 662 return codeEl.innerText; 663 } 664 const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', { 665 text: getTextToCopy 666 }); 667 clipboard.on('success', onCopySuccess); 668 if (window.document.getElementById('quarto-embedded-source-code-modal')) { 669 const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', { 670 text: getTextToCopy, 671 container: window.document.getElementById('quarto-embedded-source-code-modal') 672 }); 673 clipboardModal.on('success', onCopySuccess); 674 } 675 var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//); 676 var mailtoRegex = new RegExp(/^mailto:/); 677 var filterRegex = new RegExp("https:\/\/github\.com\/your-org\/atdata"); 678 var isInternal = (href) => { 679 return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href); 680 } 681 // Inspect non-navigation links and adorn them if external 682 var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)'); 683 for (var i=0; i<links.length; i++) { 684 const link = links[i]; 685 if (!isInternal(link.href)) { 686 // undo the damage that might have been done by quarto-nav.js in the case of 687 // links that we want to consider external 688 if (link.dataset.originalHref !== undefined) { 689 link.href = link.dataset.originalHref; 690 } 691 } 692 } 693 function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) { 694 const config = { 695 allowHTML: true, 696 maxWidth: 500, 697 delay: 100, 698 arrow: false, 699 appendTo: function(el) { 700 return el.parentElement; 701 }, 702 interactive: true, 703 interactiveBorder: 10, 704 theme: 'quarto', 705 placement: 'bottom-start', 706 }; 707 if (contentFn) { 708 config.content = contentFn; 709 } 710 if (onTriggerFn) { 711 config.onTrigger = onTriggerFn; 712 } 713 if (onUntriggerFn) { 714 config.onUntrigger = onUntriggerFn; 715 } 716 window.tippy(el, config); 717 } 718 const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]'); 719 for (var i=0; i<noterefs.length; i++) { 720 const ref = noterefs[i]; 721 tippyHover(ref, function() { 722 // use id or data attribute instead here 723 let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href'); 724 try { href = new URL(href).hash; } catch {} 725 const id = href.replace(/^#\/?/, ""); 726 const note = window.document.getElementById(id); 727 if (note) { 728 return note.innerHTML; 729 } else { 730 return ""; 731 } 732 }); 733 } 734 const xrefs = window.document.querySelectorAll('a.quarto-xref'); 735 const processXRef = (id, note) => { 736 // Strip column container classes 737 const stripColumnClz = (el) => { 738 el.classList.remove("page-full", "page-columns"); 739 if (el.children) { 740 for (const child of el.children) { 741 stripColumnClz(child); 742 } 743 } 744 } 745 stripColumnClz(note) 746 if (id === null || id.startsWith('sec-')) { 747 // Special case sections, only their first couple elements 748 const container = document.createElement("div"); 749 if (note.children && note.children.length > 2) { 750 container.appendChild(note.children[0].cloneNode(true)); 751 for (let i = 1; i < note.children.length; i++) { 752 const child = note.children[i]; 753 if (child.tagName === "P" && child.innerText === "") { 754 continue; 755 } else { 756 container.appendChild(child.cloneNode(true)); 757 break; 758 } 759 } 760 if (window.Quarto?.typesetMath) { 761 window.Quarto.typesetMath(container); 762 } 763 return container.innerHTML 764 } else { 765 if (window.Quarto?.typesetMath) { 766 window.Quarto.typesetMath(note); 767 } 768 return note.innerHTML; 769 } 770 } else { 771 // Remove any anchor links if they are present 772 const anchorLink = note.querySelector('a.anchorjs-link'); 773 if (anchorLink) { 774 anchorLink.remove(); 775 } 776 if (window.Quarto?.typesetMath) { 777 window.Quarto.typesetMath(note); 778 } 779 if (note.classList.contains("callout")) { 780 return note.outerHTML; 781 } else { 782 return note.innerHTML; 783 } 784 } 785 } 786 for (var i=0; i<xrefs.length; i++) { 787 const xref = xrefs[i]; 788 tippyHover(xref, undefined, function(instance) { 789 instance.disable(); 790 let url = xref.getAttribute('href'); 791 let hash = undefined; 792 if (url.startsWith('#')) { 793 hash = url; 794 } else { 795 try { hash = new URL(url).hash; } catch {} 796 } 797 if (hash) { 798 const id = hash.replace(/^#\/?/, ""); 799 const note = window.document.getElementById(id); 800 if (note !== null) { 801 try { 802 const html = processXRef(id, note.cloneNode(true)); 803 instance.setContent(html); 804 } finally { 805 instance.enable(); 806 instance.show(); 807 } 808 } else { 809 // See if we can fetch this 810 fetch(url.split('#')[0]) 811 .then(res => res.text()) 812 .then(html => { 813 const parser = new DOMParser(); 814 const htmlDoc = parser.parseFromString(html, "text/html"); 815 const note = htmlDoc.getElementById(id); 816 if (note !== null) { 817 const html = processXRef(id, note); 818 instance.setContent(html); 819 } 820 }).finally(() => { 821 instance.enable(); 822 instance.show(); 823 }); 824 } 825 } else { 826 // See if we can fetch a full url (with no hash to target) 827 // This is a special case and we should probably do some content thinning / targeting 828 fetch(url) 829 .then(res => res.text()) 830 .then(html => { 831 const parser = new DOMParser(); 832 const htmlDoc = parser.parseFromString(html, "text/html"); 833 const note = htmlDoc.querySelector('main.content'); 834 if (note !== null) { 835 // This should only happen for chapter cross references 836 // (since there is no id in the URL) 837 // remove the first header 838 if (note.children.length > 0 && note.children[0].tagName === "HEADER") { 839 note.children[0].remove(); 840 } 841 const html = processXRef(null, note); 842 instance.setContent(html); 843 } 844 }).finally(() => { 845 instance.enable(); 846 instance.show(); 847 }); 848 } 849 }, function(instance) { 850 }); 851 } 852 let selectedAnnoteEl; 853 const selectorForAnnotation = ( cell, annotation) => { 854 let cellAttr = 'data-code-cell="' + cell + '"'; 855 let lineAttr = 'data-code-annotation="' + annotation + '"'; 856 const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; 857 return selector; 858 } 859 const selectCodeLines = (annoteEl) => { 860 const doc = window.document; 861 const targetCell = annoteEl.getAttribute("data-target-cell"); 862 const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); 863 const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); 864 const lines = annoteSpan.getAttribute("data-code-lines").split(","); 865 const lineIds = lines.map((line) => { 866 return targetCell + "-" + line; 867 }) 868 let top = null; 869 let height = null; 870 let parent = null; 871 if (lineIds.length > 0) { 872 //compute the position of the single el (top and bottom and make a div) 873 const el = window.document.getElementById(lineIds[0]); 874 top = el.offsetTop; 875 height = el.offsetHeight; 876 parent = el.parentElement.parentElement; 877 if (lineIds.length > 1) { 878 const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); 879 const bottom = lastEl.offsetTop + lastEl.offsetHeight; 880 height = bottom - top; 881 } 882 if (top !== null && height !== null && parent !== null) { 883 // cook up a div (if necessary) and position it 884 let div = window.document.getElementById("code-annotation-line-highlight"); 885 if (div === null) { 886 div = window.document.createElement("div"); 887 div.setAttribute("id", "code-annotation-line-highlight"); 888 div.style.position = 'absolute'; 889 parent.appendChild(div); 890 } 891 div.style.top = top - 2 + "px"; 892 div.style.height = height + 4 + "px"; 893 div.style.left = 0; 894 let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); 895 if (gutterDiv === null) { 896 gutterDiv = window.document.createElement("div"); 897 gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); 898 gutterDiv.style.position = 'absolute'; 899 const codeCell = window.document.getElementById(targetCell); 900 const gutter = codeCell.querySelector('.code-annotation-gutter'); 901 gutter.appendChild(gutterDiv); 902 } 903 gutterDiv.style.top = top - 2 + "px"; 904 gutterDiv.style.height = height + 4 + "px"; 905 } 906 selectedAnnoteEl = annoteEl; 907 } 908 }; 909 const unselectCodeLines = () => { 910 const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; 911 elementsIds.forEach((elId) => { 912 const div = window.document.getElementById(elId); 913 if (div) { 914 div.remove(); 915 } 916 }); 917 selectedAnnoteEl = undefined; 918 }; 919 // Handle positioning of the toggle 920 window.addEventListener( 921 "resize", 922 throttle(() => { 923 elRect = undefined; 924 if (selectedAnnoteEl) { 925 selectCodeLines(selectedAnnoteEl); 926 } 927 }, 10) 928 ); 929 function throttle(fn, ms) { 930 let throttle = false; 931 let timer; 932 return (...args) => { 933 if(!throttle) { // first call gets through 934 fn.apply(this, args); 935 throttle = true; 936 } else { // all the others get throttled 937 if(timer) clearTimeout(timer); // cancel #2 938 timer = setTimeout(() => { 939 fn.apply(this, args); 940 timer = throttle = false; 941 }, ms); 942 } 943 }; 944 } 945 // Attach click handler to the DT 946 const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); 947 for (const annoteDlNode of annoteDls) { 948 annoteDlNode.addEventListener('click', (event) => { 949 const clickedEl = event.target; 950 if (clickedEl !== selectedAnnoteEl) { 951 unselectCodeLines(); 952 const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); 953 if (activeEl) { 954 activeEl.classList.remove('code-annotation-active'); 955 } 956 selectCodeLines(clickedEl); 957 clickedEl.classList.add('code-annotation-active'); 958 } else { 959 // Unselect the line 960 unselectCodeLines(); 961 clickedEl.classList.remove('code-annotation-active'); 962 } 963 }); 964 } 965 const findCites = (el) => { 966 const parentEl = el.parentElement; 967 if (parentEl) { 968 const cites = parentEl.dataset.cites; 969 if (cites) { 970 return { 971 el, 972 cites: cites.split(' ') 973 }; 974 } else { 975 return findCites(el.parentElement) 976 } 977 } else { 978 return undefined; 979 } 980 }; 981 var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]'); 982 for (var i=0; i<bibliorefs.length; i++) { 983 const ref = bibliorefs[i]; 984 const citeInfo = findCites(ref); 985 if (citeInfo) { 986 tippyHover(citeInfo.el, function() { 987 var popup = window.document.createElement('div'); 988 citeInfo.cites.forEach(function(cite) { 989 var citeDiv = window.document.createElement('div'); 990 citeDiv.classList.add('hanging-indent'); 991 citeDiv.classList.add('csl-entry'); 992 var biblioDiv = window.document.getElementById('ref-' + cite); 993 if (biblioDiv) { 994 citeDiv.innerHTML = biblioDiv.innerHTML; 995 } 996 popup.appendChild(citeDiv); 997 }); 998 return popup.innerHTML; 999 }); 1000 } 1001 } 1002 }); 1003 </script> 1004</div> <!-- /content --> 1005<footer class="footer"> 1006 <div class="nav-footer"> 1007 <div class="nav-footer-left"> 1008<p>Built with <a href="https://quarto.org/">Quarto</a></p> 1009</div> 1010 <div class="nav-footer-center"> 1011 &nbsp; 1012 <div class="toc-actions d-sm-block d-md-none"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/local.LocalDatasetEntry.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/your-org/atdata/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></div> 1013 <div class="nav-footer-right"> 1014<p>MIT License</p> 1015</div> 1016 </div> 1017</footer> 1018 1019 1020 1021 1022</body></html>