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