Skip to content

Commit cd2db91

Browse files
committed
clarify paged
1 parent 69e3495 commit cd2db91

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

03_page.ipynb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"cell_type": "markdown",
139139
"metadata": {},
140140
"source": [
141-
"However, `per_page` has a maximum of `100`, so if you want more, you'll have to pass `page=` to get pages beyond the first. An easy way to iterate through all pages is to use `paged`."
141+
"However, `per_page` has a maximum of `100`, so if you want more, you'll have to pass `page=` to get pages beyond the first. An easy way to iterate through all pages is to use `paged`. `paged` returns a generator "
142142
]
143143
},
144144
{
@@ -191,7 +191,7 @@
191191
{
192192
"data": {
193193
"text/plain": [
194-
"(30, 'fast-image')"
194+
"(30, 'docs')"
195195
]
196196
},
197197
"execution_count": null,
@@ -200,15 +200,15 @@
200200
}
201201
],
202202
"source": [
203-
"repos = api.repos.list_for_org('fastai')\n",
203+
"repos = api.repos.list_for_org(org='fastai')\n",
204204
"len(repos),repos[0].name"
205205
]
206206
},
207207
{
208208
"cell_type": "markdown",
209209
"metadata": {},
210210
"source": [
211-
"To convert this operation into a Python iterator, pass the operation itself, along with any arguments (either keyword or positional) to `paged`:"
211+
"To convert this operation into a Python iterator, pass the operation itself, along with any arguments (either keyword or positional) to `paged`. Note how the function and arguments are passed separately:"
212212
]
213213
},
214214
{
@@ -217,14 +217,14 @@
217217
"metadata": {},
218218
"outputs": [],
219219
"source": [
220-
"repos = paged(api.repos.list_for_org, 'fastai')"
220+
"repos = paged(api.repos.list_for_org, org='fastai')"
221221
]
222222
},
223223
{
224224
"cell_type": "markdown",
225225
"metadata": {},
226226
"source": [
227-
"You can now iterate through `repos` using Python, e.g:"
227+
"Note that the object returned from `paged` is a generator. You can iterate through this generator `repos` in the normal way:"
228228
]
229229
},
230230
{
@@ -236,10 +236,9 @@
236236
"name": "stdout",
237237
"output_type": "stream",
238238
"text": [
239-
"30 fast-image\n",
240-
"30 fastforest\n",
241-
"30 .github\n",
242-
"3 tweetrel\n"
239+
"30 docs\n",
240+
"30 fastscript\n",
241+
"25 wireguard-fast\n"
243242
]
244243
}
245244
],

docs/page.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ <h3 id="Paged-operations">Paged operations<a class="anchor-link" href="#Paged-op
182182

183183
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
184184
<div class="text_cell_render border-box-sizing rendered_html">
185-
<p>However, <code>per_page</code> has a maximum of <code>100</code>, so if you want more, you'll have to pass <code>page=</code> to get pages beyond the first. An easy way to iterate through all pages is to use <a href="/page.html#paged"><code>paged</code></a>.</p>
185+
<p>However, <code>per_page</code> has a maximum of <code>100</code>, so if you want more, you'll have to pass <code>page=</code> to get pages beyond the first. An easy way to iterate through all pages is to use <a href="/page.html#paged"><code>paged</code></a>. <a href="/page.html#paged"><code>paged</code></a> returns a generator</p>
186186

187187
</div>
188188
</div>
@@ -266,7 +266,7 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
266266

267267
<div class="inner_cell">
268268
<div class="input_area">
269-
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">repos</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">list_for_org</span><span class="p">(</span><span class="s1">&#39;fastai&#39;</span><span class="p">)</span>
269+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">repos</span> <span class="o">=</span> <span class="n">api</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">list_for_org</span><span class="p">(</span><span class="n">org</span><span class="o">=</span><span class="s1">&#39;fastai&#39;</span><span class="p">)</span>
270270
<span class="nb">len</span><span class="p">(</span><span class="n">repos</span><span class="p">),</span><span class="n">repos</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">name</span>
271271
</pre></div>
272272

@@ -282,7 +282,7 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
282282

283283

284284
<div class="output_text output_subarea output_execute_result">
285-
<pre>(30, &#39;fast-image&#39;)</pre>
285+
<pre>(30, &#39;docs&#39;)</pre>
286286
</div>
287287

288288
</div>
@@ -295,7 +295,7 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
295295

296296
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
297297
<div class="text_cell_render border-box-sizing rendered_html">
298-
<p>To convert this operation into a Python iterator, pass the operation itself, along with any arguments (either keyword or positional) to <a href="/page.html#paged"><code>paged</code></a>:</p>
298+
<p>To convert this operation into a Python iterator, pass the operation itself, along with any arguments (either keyword or positional) to <a href="/page.html#paged"><code>paged</code></a>. Note how the function and arguments are passed separately:</p>
299299

300300
</div>
301301
</div>
@@ -307,7 +307,7 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
307307

308308
<div class="inner_cell">
309309
<div class="input_area">
310-
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">repos</span> <span class="o">=</span> <span class="n">paged</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">list_for_org</span><span class="p">,</span> <span class="s1">&#39;fastai&#39;</span><span class="p">)</span>
310+
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">repos</span> <span class="o">=</span> <span class="n">paged</span><span class="p">(</span><span class="n">api</span><span class="o">.</span><span class="n">repos</span><span class="o">.</span><span class="n">list_for_org</span><span class="p">,</span> <span class="n">org</span><span class="o">=</span><span class="s1">&#39;fastai&#39;</span><span class="p">)</span>
311311
</pre></div>
312312

313313
</div>
@@ -319,7 +319,7 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
319319

320320
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
321321
<div class="text_cell_render border-box-sizing rendered_html">
322-
<p>You can now iterate through <code>repos</code> using Python, e.g:</p>
322+
<p>Note that the object returned from <a href="/page.html#paged"><code>paged</code></a> is a generator. You can iterate through this generator <code>repos</code> in the normal way:</p>
323323

324324
</div>
325325
</div>
@@ -344,10 +344,9 @@ <h4 id="paged" class="doc_header"><code>paged</code><a href="https://github.com/
344344
<div class="output_area">
345345

346346
<div class="output_subarea output_stream output_stdout output_text">
347-
<pre>30 fast-image
348-
30 fastforest
349-
30 .github
350-
3 tweetrel
347+
<pre>30 docs
348+
30 fastscript
349+
25 wireguard-fast
351350
</pre>
352351
</div>
353352
</div>

0 commit comments

Comments
 (0)