A loose federation of distributed, typed datasets
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>lensloader – 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 & 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.atmosphere.LensLoader" id="toc-atdata.atmosphere.LensLoader" class="nav-link active" data-scroll-target="#atdata.atmosphere.LensLoader">LensLoader</a>
404 <ul class="collapse">
405 <li><a href="#examples" id="toc-examples" class="nav-link" data-scroll-target="#examples">Examples</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.atmosphere.LensLoader.find_by_schemas" id="toc-atdata.atmosphere.LensLoader.find_by_schemas" class="nav-link" data-scroll-target="#atdata.atmosphere.LensLoader.find_by_schemas">find_by_schemas</a></li>
409 <li><a href="#atdata.atmosphere.LensLoader.get" id="toc-atdata.atmosphere.LensLoader.get" class="nav-link" data-scroll-target="#atdata.atmosphere.LensLoader.get">get</a></li>
410 <li><a href="#atdata.atmosphere.LensLoader.list_all" id="toc-atdata.atmosphere.LensLoader.list_all" class="nav-link" data-scroll-target="#atdata.atmosphere.LensLoader.list_all">list_all</a></li>
411 </ul></li>
412 </ul></li>
413 </ul>
414<div class="toc-actions"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/LensLoader.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>
415 </div>
416<!-- main -->
417<main class="content" id="quarto-document-content"><header id="title-block-header" class="quarto-title-block"></header>
418
419
420
421
422
423<section id="atdata.atmosphere.LensLoader" class="level1">
424<h1>LensLoader</h1>
425<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>atmosphere.LensLoader(client)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
426<p>Loads lens records from ATProto.</p>
427<p>This class fetches lens transformation records. Note that actually using a lens requires installing the referenced code and importing it manually.</p>
428<section id="examples" class="level2 doc-section doc-section-examples">
429<h2 class="doc-section doc-section-examples anchored" data-anchor-id="examples">Examples</h2>
430<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><span class="op">>>></span> client <span class="op">=</span> AtmosphereClient()</span>
431<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> loader <span class="op">=</span> LensLoader(client)</span>
432<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span></span>
433<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> record <span class="op">=</span> loader.get(<span class="st">"at://did:plc:abc/ac.foundation.dataset.lens/xyz"</span>)</span>
434<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="bu">print</span>(record[<span class="st">"name"</span>])</span>
435<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="bu">print</span>(record[<span class="st">"sourceSchema"</span>])</span>
436<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="bu">print</span>(record.get(<span class="st">"getterCode"</span>, {}).get(<span class="st">"repository"</span>))</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
437</section>
438<section id="methods" class="level2">
439<h2 class="anchored" data-anchor-id="methods">Methods</h2>
440<table class="caption-top table">
441<thead>
442<tr class="header">
443<th>Name</th>
444<th>Description</th>
445</tr>
446</thead>
447<tbody>
448<tr class="odd">
449<td><a href="#atdata.atmosphere.LensLoader.find_by_schemas">find_by_schemas</a></td>
450<td>Find lenses that transform between specific schemas.</td>
451</tr>
452<tr class="even">
453<td><a href="#atdata.atmosphere.LensLoader.get">get</a></td>
454<td>Fetch a lens record by AT URI.</td>
455</tr>
456<tr class="odd">
457<td><a href="#atdata.atmosphere.LensLoader.list_all">list_all</a></td>
458<td>List lens records from a repository.</td>
459</tr>
460</tbody>
461</table>
462<section id="atdata.atmosphere.LensLoader.find_by_schemas" class="level3">
463<h3 class="anchored" data-anchor-id="atdata.atmosphere.LensLoader.find_by_schemas">find_by_schemas</h3>
464<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>atmosphere.LensLoader.find_by_schemas(</span>
465<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> source_schema_uri,</span>
466<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> target_schema_uri<span class="op">=</span><span class="va">None</span>,</span>
467<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> repo<span class="op">=</span><span class="va">None</span>,</span>
468<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
469<p>Find lenses that transform between specific schemas.</p>
470<section id="parameters" class="level4 doc-section doc-section-parameters">
471<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters">Parameters</h4>
472<table class="caption-top table">
473<thead>
474<tr class="header">
475<th>Name</th>
476<th>Type</th>
477<th>Description</th>
478<th>Default</th>
479</tr>
480</thead>
481<tbody>
482<tr class="odd">
483<td>source_schema_uri</td>
484<td><a href="`str`">str</a></td>
485<td>AT URI of the source schema.</td>
486<td><em>required</em></td>
487</tr>
488<tr class="even">
489<td>target_schema_uri</td>
490<td><a href="`typing.Optional`">Optional</a>[<a href="`str`">str</a>]</td>
491<td>Optional AT URI of the target schema. If not provided, returns all lenses from the source.</td>
492<td><code>None</code></td>
493</tr>
494<tr class="odd">
495<td>repo</td>
496<td><a href="`typing.Optional`">Optional</a>[<a href="`str`">str</a>]</td>
497<td>The DID of the repository to search.</td>
498<td><code>None</code></td>
499</tr>
500</tbody>
501</table>
502</section>
503<section id="returns" class="level4 doc-section doc-section-returns">
504<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns">Returns</h4>
505<table class="caption-top table">
506<thead>
507<tr class="header">
508<th>Name</th>
509<th>Type</th>
510<th>Description</th>
511</tr>
512</thead>
513<tbody>
514<tr class="odd">
515<td></td>
516<td><a href="`list`">list</a>[<a href="`dict`">dict</a>]</td>
517<td>List of matching lens records.</td>
518</tr>
519</tbody>
520</table>
521</section>
522</section>
523<section id="atdata.atmosphere.LensLoader.get" class="level3">
524<h3 class="anchored" data-anchor-id="atdata.atmosphere.LensLoader.get">get</h3>
525<div class="sourceCode" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>atmosphere.LensLoader.get(uri)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
526<p>Fetch a lens record by AT URI.</p>
527<section id="parameters-1" class="level4 doc-section doc-section-parameters">
528<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-1">Parameters</h4>
529<table class="caption-top table">
530<thead>
531<tr class="header">
532<th>Name</th>
533<th>Type</th>
534<th>Description</th>
535<th>Default</th>
536</tr>
537</thead>
538<tbody>
539<tr class="odd">
540<td>uri</td>
541<td><a href="`str`">str</a> | <a href="`atdata.atmosphere._types.AtUri`">AtUri</a></td>
542<td>The AT URI of the lens record.</td>
543<td><em>required</em></td>
544</tr>
545</tbody>
546</table>
547</section>
548<section id="returns-1" class="level4 doc-section doc-section-returns">
549<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-1">Returns</h4>
550<table class="caption-top table">
551<thead>
552<tr class="header">
553<th>Name</th>
554<th>Type</th>
555<th>Description</th>
556</tr>
557</thead>
558<tbody>
559<tr class="odd">
560<td></td>
561<td><a href="`dict`">dict</a></td>
562<td>The lens record as a dictionary.</td>
563</tr>
564</tbody>
565</table>
566</section>
567<section id="raises" class="level4 doc-section doc-section-raises">
568<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises">Raises</h4>
569<table class="caption-top table">
570<thead>
571<tr class="header">
572<th>Name</th>
573<th>Type</th>
574<th>Description</th>
575</tr>
576</thead>
577<tbody>
578<tr class="odd">
579<td></td>
580<td><a href="`ValueError`">ValueError</a></td>
581<td>If the record is not a lens record.</td>
582</tr>
583</tbody>
584</table>
585</section>
586</section>
587<section id="atdata.atmosphere.LensLoader.list_all" class="level3">
588<h3 class="anchored" data-anchor-id="atdata.atmosphere.LensLoader.list_all">list_all</h3>
589<div class="sourceCode" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>atmosphere.LensLoader.list_all(repo<span class="op">=</span><span class="va">None</span>, limit<span class="op">=</span><span class="dv">100</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
590<p>List lens records from a repository.</p>
591<section id="parameters-2" class="level4 doc-section doc-section-parameters">
592<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-2">Parameters</h4>
593<table class="caption-top table">
594<thead>
595<tr class="header">
596<th>Name</th>
597<th>Type</th>
598<th>Description</th>
599<th>Default</th>
600</tr>
601</thead>
602<tbody>
603<tr class="odd">
604<td>repo</td>
605<td><a href="`typing.Optional`">Optional</a>[<a href="`str`">str</a>]</td>
606<td>The DID of the repository. Defaults to authenticated user.</td>
607<td><code>None</code></td>
608</tr>
609<tr class="even">
610<td>limit</td>
611<td><a href="`int`">int</a></td>
612<td>Maximum number of records to return.</td>
613<td><code>100</code></td>
614</tr>
615</tbody>
616</table>
617</section>
618<section id="returns-2" class="level4 doc-section doc-section-returns">
619<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-2">Returns</h4>
620<table class="caption-top table">
621<thead>
622<tr class="header">
623<th>Name</th>
624<th>Type</th>
625<th>Description</th>
626</tr>
627</thead>
628<tbody>
629<tr class="odd">
630<td></td>
631<td><a href="`list`">list</a>[<a href="`dict`">dict</a>]</td>
632<td>List of lens records.</td>
633</tr>
634</tbody>
635</table>
636
637
638</section>
639</section>
640</section>
641</section>
642
643</main> <!-- /main -->
644<script id="quarto-html-after-body" type="application/javascript">
645 window.document.addEventListener("DOMContentLoaded", function (event) {
646 // Ensure there is a toggle, if there isn't float one in the top right
647 if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
648 const a = window.document.createElement('a');
649 a.classList.add('top-right');
650 a.classList.add('quarto-color-scheme-toggle');
651 a.href = "";
652 a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
653 const i = window.document.createElement("i");
654 i.classList.add('bi');
655 a.appendChild(i);
656 window.document.body.appendChild(a);
657 }
658 setColorSchemeToggle(hasAlternateSentinel())
659 const icon = "";
660 const anchorJS = new window.AnchorJS();
661 anchorJS.options = {
662 placement: 'right',
663 icon: icon
664 };
665 anchorJS.add('.anchored');
666 const isCodeAnnotation = (el) => {
667 for (const clz of el.classList) {
668 if (clz.startsWith('code-annotation-')) {
669 return true;
670 }
671 }
672 return false;
673 }
674 const onCopySuccess = function(e) {
675 // button target
676 const button = e.trigger;
677 // don't keep focus
678 button.blur();
679 // flash "checked"
680 button.classList.add('code-copy-button-checked');
681 var currentTitle = button.getAttribute("title");
682 button.setAttribute("title", "Copied!");
683 let tooltip;
684 if (window.bootstrap) {
685 button.setAttribute("data-bs-toggle", "tooltip");
686 button.setAttribute("data-bs-placement", "left");
687 button.setAttribute("data-bs-title", "Copied!");
688 tooltip = new bootstrap.Tooltip(button,
689 { trigger: "manual",
690 customClass: "code-copy-button-tooltip",
691 offset: [0, -8]});
692 tooltip.show();
693 }
694 setTimeout(function() {
695 if (tooltip) {
696 tooltip.hide();
697 button.removeAttribute("data-bs-title");
698 button.removeAttribute("data-bs-toggle");
699 button.removeAttribute("data-bs-placement");
700 }
701 button.setAttribute("title", currentTitle);
702 button.classList.remove('code-copy-button-checked');
703 }, 1000);
704 // clear code selection
705 e.clearSelection();
706 }
707 const getTextToCopy = function(trigger) {
708 const codeEl = trigger.previousElementSibling.cloneNode(true);
709 for (const childEl of codeEl.children) {
710 if (isCodeAnnotation(childEl)) {
711 childEl.remove();
712 }
713 }
714 return codeEl.innerText;
715 }
716 const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
717 text: getTextToCopy
718 });
719 clipboard.on('success', onCopySuccess);
720 if (window.document.getElementById('quarto-embedded-source-code-modal')) {
721 const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
722 text: getTextToCopy,
723 container: window.document.getElementById('quarto-embedded-source-code-modal')
724 });
725 clipboardModal.on('success', onCopySuccess);
726 }
727 var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
728 var mailtoRegex = new RegExp(/^mailto:/);
729 var filterRegex = new RegExp("https:\/\/github\.com\/your-org\/atdata");
730 var isInternal = (href) => {
731 return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
732 }
733 // Inspect non-navigation links and adorn them if external
734 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)');
735 for (var i=0; i<links.length; i++) {
736 const link = links[i];
737 if (!isInternal(link.href)) {
738 // undo the damage that might have been done by quarto-nav.js in the case of
739 // links that we want to consider external
740 if (link.dataset.originalHref !== undefined) {
741 link.href = link.dataset.originalHref;
742 }
743 }
744 }
745 function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
746 const config = {
747 allowHTML: true,
748 maxWidth: 500,
749 delay: 100,
750 arrow: false,
751 appendTo: function(el) {
752 return el.parentElement;
753 },
754 interactive: true,
755 interactiveBorder: 10,
756 theme: 'quarto',
757 placement: 'bottom-start',
758 };
759 if (contentFn) {
760 config.content = contentFn;
761 }
762 if (onTriggerFn) {
763 config.onTrigger = onTriggerFn;
764 }
765 if (onUntriggerFn) {
766 config.onUntrigger = onUntriggerFn;
767 }
768 window.tippy(el, config);
769 }
770 const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
771 for (var i=0; i<noterefs.length; i++) {
772 const ref = noterefs[i];
773 tippyHover(ref, function() {
774 // use id or data attribute instead here
775 let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
776 try { href = new URL(href).hash; } catch {}
777 const id = href.replace(/^#\/?/, "");
778 const note = window.document.getElementById(id);
779 if (note) {
780 return note.innerHTML;
781 } else {
782 return "";
783 }
784 });
785 }
786 const xrefs = window.document.querySelectorAll('a.quarto-xref');
787 const processXRef = (id, note) => {
788 // Strip column container classes
789 const stripColumnClz = (el) => {
790 el.classList.remove("page-full", "page-columns");
791 if (el.children) {
792 for (const child of el.children) {
793 stripColumnClz(child);
794 }
795 }
796 }
797 stripColumnClz(note)
798 if (id === null || id.startsWith('sec-')) {
799 // Special case sections, only their first couple elements
800 const container = document.createElement("div");
801 if (note.children && note.children.length > 2) {
802 container.appendChild(note.children[0].cloneNode(true));
803 for (let i = 1; i < note.children.length; i++) {
804 const child = note.children[i];
805 if (child.tagName === "P" && child.innerText === "") {
806 continue;
807 } else {
808 container.appendChild(child.cloneNode(true));
809 break;
810 }
811 }
812 if (window.Quarto?.typesetMath) {
813 window.Quarto.typesetMath(container);
814 }
815 return container.innerHTML
816 } else {
817 if (window.Quarto?.typesetMath) {
818 window.Quarto.typesetMath(note);
819 }
820 return note.innerHTML;
821 }
822 } else {
823 // Remove any anchor links if they are present
824 const anchorLink = note.querySelector('a.anchorjs-link');
825 if (anchorLink) {
826 anchorLink.remove();
827 }
828 if (window.Quarto?.typesetMath) {
829 window.Quarto.typesetMath(note);
830 }
831 if (note.classList.contains("callout")) {
832 return note.outerHTML;
833 } else {
834 return note.innerHTML;
835 }
836 }
837 }
838 for (var i=0; i<xrefs.length; i++) {
839 const xref = xrefs[i];
840 tippyHover(xref, undefined, function(instance) {
841 instance.disable();
842 let url = xref.getAttribute('href');
843 let hash = undefined;
844 if (url.startsWith('#')) {
845 hash = url;
846 } else {
847 try { hash = new URL(url).hash; } catch {}
848 }
849 if (hash) {
850 const id = hash.replace(/^#\/?/, "");
851 const note = window.document.getElementById(id);
852 if (note !== null) {
853 try {
854 const html = processXRef(id, note.cloneNode(true));
855 instance.setContent(html);
856 } finally {
857 instance.enable();
858 instance.show();
859 }
860 } else {
861 // See if we can fetch this
862 fetch(url.split('#')[0])
863 .then(res => res.text())
864 .then(html => {
865 const parser = new DOMParser();
866 const htmlDoc = parser.parseFromString(html, "text/html");
867 const note = htmlDoc.getElementById(id);
868 if (note !== null) {
869 const html = processXRef(id, note);
870 instance.setContent(html);
871 }
872 }).finally(() => {
873 instance.enable();
874 instance.show();
875 });
876 }
877 } else {
878 // See if we can fetch a full url (with no hash to target)
879 // This is a special case and we should probably do some content thinning / targeting
880 fetch(url)
881 .then(res => res.text())
882 .then(html => {
883 const parser = new DOMParser();
884 const htmlDoc = parser.parseFromString(html, "text/html");
885 const note = htmlDoc.querySelector('main.content');
886 if (note !== null) {
887 // This should only happen for chapter cross references
888 // (since there is no id in the URL)
889 // remove the first header
890 if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
891 note.children[0].remove();
892 }
893 const html = processXRef(null, note);
894 instance.setContent(html);
895 }
896 }).finally(() => {
897 instance.enable();
898 instance.show();
899 });
900 }
901 }, function(instance) {
902 });
903 }
904 let selectedAnnoteEl;
905 const selectorForAnnotation = ( cell, annotation) => {
906 let cellAttr = 'data-code-cell="' + cell + '"';
907 let lineAttr = 'data-code-annotation="' + annotation + '"';
908 const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
909 return selector;
910 }
911 const selectCodeLines = (annoteEl) => {
912 const doc = window.document;
913 const targetCell = annoteEl.getAttribute("data-target-cell");
914 const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
915 const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
916 const lines = annoteSpan.getAttribute("data-code-lines").split(",");
917 const lineIds = lines.map((line) => {
918 return targetCell + "-" + line;
919 })
920 let top = null;
921 let height = null;
922 let parent = null;
923 if (lineIds.length > 0) {
924 //compute the position of the single el (top and bottom and make a div)
925 const el = window.document.getElementById(lineIds[0]);
926 top = el.offsetTop;
927 height = el.offsetHeight;
928 parent = el.parentElement.parentElement;
929 if (lineIds.length > 1) {
930 const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
931 const bottom = lastEl.offsetTop + lastEl.offsetHeight;
932 height = bottom - top;
933 }
934 if (top !== null && height !== null && parent !== null) {
935 // cook up a div (if necessary) and position it
936 let div = window.document.getElementById("code-annotation-line-highlight");
937 if (div === null) {
938 div = window.document.createElement("div");
939 div.setAttribute("id", "code-annotation-line-highlight");
940 div.style.position = 'absolute';
941 parent.appendChild(div);
942 }
943 div.style.top = top - 2 + "px";
944 div.style.height = height + 4 + "px";
945 div.style.left = 0;
946 let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
947 if (gutterDiv === null) {
948 gutterDiv = window.document.createElement("div");
949 gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
950 gutterDiv.style.position = 'absolute';
951 const codeCell = window.document.getElementById(targetCell);
952 const gutter = codeCell.querySelector('.code-annotation-gutter');
953 gutter.appendChild(gutterDiv);
954 }
955 gutterDiv.style.top = top - 2 + "px";
956 gutterDiv.style.height = height + 4 + "px";
957 }
958 selectedAnnoteEl = annoteEl;
959 }
960 };
961 const unselectCodeLines = () => {
962 const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
963 elementsIds.forEach((elId) => {
964 const div = window.document.getElementById(elId);
965 if (div) {
966 div.remove();
967 }
968 });
969 selectedAnnoteEl = undefined;
970 };
971 // Handle positioning of the toggle
972 window.addEventListener(
973 "resize",
974 throttle(() => {
975 elRect = undefined;
976 if (selectedAnnoteEl) {
977 selectCodeLines(selectedAnnoteEl);
978 }
979 }, 10)
980 );
981 function throttle(fn, ms) {
982 let throttle = false;
983 let timer;
984 return (...args) => {
985 if(!throttle) { // first call gets through
986 fn.apply(this, args);
987 throttle = true;
988 } else { // all the others get throttled
989 if(timer) clearTimeout(timer); // cancel #2
990 timer = setTimeout(() => {
991 fn.apply(this, args);
992 timer = throttle = false;
993 }, ms);
994 }
995 };
996 }
997 // Attach click handler to the DT
998 const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
999 for (const annoteDlNode of annoteDls) {
1000 annoteDlNode.addEventListener('click', (event) => {
1001 const clickedEl = event.target;
1002 if (clickedEl !== selectedAnnoteEl) {
1003 unselectCodeLines();
1004 const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
1005 if (activeEl) {
1006 activeEl.classList.remove('code-annotation-active');
1007 }
1008 selectCodeLines(clickedEl);
1009 clickedEl.classList.add('code-annotation-active');
1010 } else {
1011 // Unselect the line
1012 unselectCodeLines();
1013 clickedEl.classList.remove('code-annotation-active');
1014 }
1015 });
1016 }
1017 const findCites = (el) => {
1018 const parentEl = el.parentElement;
1019 if (parentEl) {
1020 const cites = parentEl.dataset.cites;
1021 if (cites) {
1022 return {
1023 el,
1024 cites: cites.split(' ')
1025 };
1026 } else {
1027 return findCites(el.parentElement)
1028 }
1029 } else {
1030 return undefined;
1031 }
1032 };
1033 var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
1034 for (var i=0; i<bibliorefs.length; i++) {
1035 const ref = bibliorefs[i];
1036 const citeInfo = findCites(ref);
1037 if (citeInfo) {
1038 tippyHover(citeInfo.el, function() {
1039 var popup = window.document.createElement('div');
1040 citeInfo.cites.forEach(function(cite) {
1041 var citeDiv = window.document.createElement('div');
1042 citeDiv.classList.add('hanging-indent');
1043 citeDiv.classList.add('csl-entry');
1044 var biblioDiv = window.document.getElementById('ref-' + cite);
1045 if (biblioDiv) {
1046 citeDiv.innerHTML = biblioDiv.innerHTML;
1047 }
1048 popup.appendChild(citeDiv);
1049 });
1050 return popup.innerHTML;
1051 });
1052 }
1053 }
1054 });
1055 </script>
1056</div> <!-- /content -->
1057<footer class="footer">
1058 <div class="nav-footer">
1059 <div class="nav-footer-left">
1060<p>Built with <a href="https://quarto.org/">Quarto</a></p>
1061</div>
1062 <div class="nav-footer-center">
1063
1064 <div class="toc-actions d-sm-block d-md-none"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/LensLoader.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>
1065 <div class="nav-footer-right">
1066<p>MIT License</p>
1067</div>
1068 </div>
1069</footer>
1070
1071
1072
1073
1074</body></html>