Skip to content

Commit 66c4435

Browse files
committed
mv
1 parent db72428 commit 66c4435

File tree

9 files changed

+48
-506
lines changed

9 files changed

+48
-506
lines changed

‎docs/_data/sidebars/home_sidebar.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ entries:
1010
title: Overview
1111
url: /
1212
- output: web,pdf
13-
title: ghtop
13+
title: ghtop API
1414
url: ghtop.html
1515
output: web
1616
title: ghtop

‎docs/ghtop.html‎

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22

3-
title: ghtop
3+
title: ghtop API
44

55

66
keywords: fastai
77
sidebar: home_sidebar
88

9-
summary: "I cannot believe this library name is not already taken on pypi."
10-
description: "I cannot believe this library name is not already taken on pypi."
11-
nb_path: "00_ghtop.ipynb"
9+
summary: "API details"
10+
description: "API details"
11+
nb_path: "nbs/00_ghtop.ipynb"
1212
---
1313
<!--
1414
1515
#################################################
1616
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
1717
#################################################
18-
# file to edit: 00_ghtop.ipynb
18+
# file to edit: nbs/00_ghtop.ipynb
1919
# command to build the docs after a change: nbdev_build_docs
2020
2121
-->
@@ -126,28 +126,14 @@ <h4 id="github_auth_device" class="doc_header"><code>github_auth_device</code><a
126126

127127
<div class="cell border-box-sizing code_cell rendered">
128128

129-
</div>
130-
{% endraw %}
131-
132-
{% raw %}
133-
134-
<div class="cell border-box-sizing code_cell rendered">
135-
136-
</div>
137-
{% endraw %}
138-
139-
{% raw %}
140-
141-
<div class="cell border-box-sizing code_cell rendered">
142-
143129
<div class="output_wrapper">
144130
<div class="output">
145131

146132
<div class="output_area">
147133

148134

149135
<div class="output_markdown rendered_html output_subarea ">
150-
<h4 id="limit_cb" class="doc_header"><code>limit_cb</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L57" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>limit_cb</code>(<strong><code>rem</code></strong>, <strong><code>quota</code></strong>)</p>
136+
<h4 id="limit_cb" class="doc_header"><code>limit_cb</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L43" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>limit_cb</code>(<strong><code>rem</code></strong>, <strong><code>quota</code></strong>)</p>
151137
</blockquote>
152138
<p>Callback to warn user when close to using up hourly quota</p>
153139

@@ -191,16 +177,6 @@ <h4 id="limit_cb" class="doc_header"><code>limit_cb</code><a href="https://githu
191177
{% raw %}
192178

193179
<div class="cell border-box-sizing code_cell rendered">
194-
<div class="input">
195-
196-
<div class="inner_cell">
197-
<div class="input_area">
198-
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">api</span> <span class="o">=</span> <span class="n">GhApi</span><span class="p">(</span><span class="n">limit_cb</span><span class="o">=</span><span class="n">limit_cb</span><span class="p">,</span> <span class="n">token</span><span class="o">=</span><span class="n">token</span><span class="p">)</span>
199-
</pre></div>
200-
201-
</div>
202-
</div>
203-
</div>
204180

205181
</div>
206182
{% endraw %}
@@ -216,7 +192,7 @@ <h4 id="limit_cb" class="doc_header"><code>limit_cb</code><a href="https://githu
216192

217193

218194
<div class="output_markdown rendered_html output_subarea ">
219-
<h4 id="fetch_events" class="doc_header"><code>fetch_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L66" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>fetch_events</code>(<strong><code>types</code></strong>=<em><code>None</code></em>)</p>
195+
<h4 id="fetch_events" class="doc_header"><code>fetch_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L62" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>fetch_events</code>(<strong><code>types</code></strong>=<em><code>None</code></em>)</p>
220196
</blockquote>
221197
<p>Generate an infinite stream of events optionally filtered to <code>types</code></p>
222198

@@ -310,7 +286,7 @@ <h4 id="fetch_events" class="doc_header"><code>fetch_events</code><a href="https
310286

311287

312288
<div class="output_markdown rendered_html output_subarea ">
313-
<h4 id="print_event" class="doc_header"><code>print_event</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L96" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>print_event</code>(<strong><code>e</code></strong>, <strong><code>commits_counter</code></strong>)</p>
289+
<h4 id="print_event" class="doc_header"><code>print_event</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L92" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>print_event</code>(<strong><code>e</code></strong>, <strong><code>commits_counter</code></strong>)</p>
314290
</blockquote>
315291

316292
</div>
@@ -391,7 +367,7 @@ <h4 id="print_event" class="doc_header"><code>print_event</code><a href="https:/
391367

392368

393369
<div class="output_markdown rendered_html output_subarea ">
394-
<h4 id="tail_events" class="doc_header"><code>tail_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L108" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>tail_events</code>()</p>
370+
<h4 id="tail_events" class="doc_header"><code>tail_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L104" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>tail_events</code>()</p>
395371
</blockquote>
396372
<p>Print events from <a href="/ghtop/ghtop.html#fetch_events"><code>fetch_events</code></a> along with a counter of push events</p>
397373

@@ -423,7 +399,7 @@ <h4 id="tail_events" class="doc_header"><code>tail_events</code><a href="https:/
423399

424400

425401
<div class="output_markdown rendered_html output_subarea ">
426-
<h4 id="batch_events" class="doc_header"><code>batch_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L115" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>batch_events</code>(<strong><code>size</code></strong>, <strong><code>types</code></strong>=<em><code>None</code></em>)</p>
402+
<h4 id="batch_events" class="doc_header"><code>batch_events</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L111" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>batch_events</code>(<strong><code>size</code></strong>, <strong><code>types</code></strong>=<em><code>None</code></em>)</p>
427403
</blockquote>
428404
<p>Generate an infinite stream of batches of events of <code>size</code> optionally filtered to <code>types</code></p>
429405

@@ -455,7 +431,7 @@ <h4 id="batch_events" class="doc_header"><code>batch_events</code><a href="https
455431

456432

457433
<div class="output_markdown rendered_html output_subarea ">
458-
<h4 id="watch_users" class="doc_header"><code>watch_users</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L121" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>watch_users</code>()</p>
434+
<h4 id="watch_users" class="doc_header"><code>watch_users</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L117" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>watch_users</code>()</p>
459435
</blockquote>
460436
<p>Print a table of the users with the most events</p>
461437

@@ -487,7 +463,7 @@ <h4 id="watch_users" class="doc_header"><code>watch_users</code><a href="https:/
487463

488464

489465
<div class="output_markdown rendered_html output_subarea ">
490-
<h4 id="quad_logs" class="doc_header"><code>quad_logs</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L139" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>quad_logs</code>()</p>
466+
<h4 id="quad_logs" class="doc_header"><code>quad_logs</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L135" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>quad_logs</code>()</p>
491467
</blockquote>
492468
<p>Print 4 panels, showing most recent issues, commits, PRs, and releases</p>
493469

@@ -519,7 +495,7 @@ <h4 id="quad_logs" class="doc_header"><code>quad_logs</code><a href="https://git
519495

520496

521497
<div class="output_markdown rendered_html output_subarea ">
522-
<h4 id="simple" class="doc_header"><code>simple</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L156" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>simple</code>()</p>
498+
<h4 id="simple" class="doc_header"><code>simple</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L152" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>simple</code>()</p>
523499
</blockquote>
524500

525501
</div>
@@ -550,7 +526,7 @@ <h4 id="simple" class="doc_header"><code>simple</code><a href="https://github.co
550526

551527

552528
<div class="output_markdown rendered_html output_subarea ">
553-
<h4 id="main" class="doc_header"><code>main</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L168" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>main</code>(<strong><code>mode</code></strong>:"Operation mode to run")</p>
529+
<h4 id="main" class="doc_header"><code>main</code><a href="https://github.com/fastai/ghtop/tree/master/ghtop/ghtop.py#L164" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>main</code>(<strong><code>mode</code></strong>:"Operation mode to run")</p>
554530
</blockquote>
555531

556532
</div>

‎docs/sidebar.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"ghtop": {
33
"Overview": "/",
4-
"ghtop": "ghtop.html"
4+
"ghtop API": "ghtop.html"
55
}
66
}

‎ghtop/_nbdev.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
index = {"term": "00_ghtop.ipynb",
66
"logfile": "00_ghtop.ipynb",
77
"github_auth_device": "00_ghtop.ipynb",
8-
"token": "00_ghtop.ipynb",
98
"limit_cb": "00_ghtop.ipynb",
109
"api": "00_ghtop.ipynb",
1110
"fetch_events": "00_ghtop.ipynb",

‎ghtop/ghtop.py‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_ghtop.ipynb (unless otherwise specified).
1+
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/00_ghtop.ipynb (unless otherwise specified).
22

3-
__all__ = ['term', 'logfile', 'github_auth_device', 'token', 'limit_cb', 'api', 'fetch_events', 'Events', 'seen',
4-
'print_event', 'tail_events', 'batch_events', 'watch_users', 'quad_logs', 'simple', 'main']
3+
__all__ = ['term', 'logfile', 'github_auth_device', 'limit_cb', 'api', 'fetch_events', 'Events', 'seen', 'print_event',
4+
'tail_events', 'batch_events', 'watch_users', 'quad_logs', 'simple', 'main']
55

66
# Cell
77
import time, sys, signal, shutil, os, json, enlighten, emoji, blessed
@@ -40,27 +40,23 @@ def _exit(msg):
4040
sys.exit()
4141

4242
# Cell
43-
def _get_token():
43+
def limit_cb(rem,quota):
44+
"Callback to warn user when close to using up hourly quota"
45+
w='WARNING '*7
46+
if rem < 1000: print(f"{w}\nRemaining calls: {rem} out of {quota}\n{w}", file=sys.stderr)
47+
48+
# Cell
49+
def _get_api():
4450
path = Path.home()/".ghtop_token"
4551
if path.is_file():
4652
try: return path.read_text().strip()
4753
except: _exit("Error reading token")
4854

4955
token = github_auth_device()
5056
path.write_text(token)
51-
return token
52-
53-
# Cell
54-
token = _get_token()
55-
56-
# Cell
57-
def limit_cb(rem,quota):
58-
"Callback to warn user when close to using up hourly quota"
59-
w='WARNING '*7
60-
if rem < 1000: print(f"{w}\nRemaining calls: {rem} out of {quota}\n{w}", file=sys.stderr)
57+
return GhApi(limit_cb=limit_cb, token=token)
6158

62-
# Cell
63-
api = GhApi(limit_cb=limit_cb, token=token)
59+
api = _get_api()
6460

6561
# Cell
6662
def fetch_events(types=None):

‎00_ghtop.ipynb‎ renamed to ‎nbs/00_ghtop.ipynb‎

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"cell_type": "markdown",
1414
"metadata": {},
1515
"source": [
16-
"# ghtop\n",
16+
"# ghtop API\n",
1717
"\n",
18-
"> I cannot believe this library name is not already taken on pypi."
18+
"> API details"
1919
]
2020
},
2121
{
@@ -108,34 +108,6 @@
108108
" sys.exit()"
109109
]
110110
},
111-
{
112-
"cell_type": "code",
113-
"execution_count": 58,
114-
"metadata": {},
115-
"outputs": [],
116-
"source": [
117-
"#export\n",
118-
"def _get_token():\n",
119-
" path = Path.home()/\".ghtop_token\"\n",
120-
" if path.is_file():\n",
121-
" try: return path.read_text().strip()\n",
122-
" except: _exit(\"Error reading token\")\n",
123-
"\n",
124-
" token = github_auth_device()\n",
125-
" path.write_text(token)\n",
126-
" return token"
127-
]
128-
},
129-
{
130-
"cell_type": "code",
131-
"execution_count": 59,
132-
"metadata": {},
133-
"outputs": [],
134-
"source": [
135-
"#export\n",
136-
"token = _get_token()"
137-
]
138-
},
139111
{
140112
"cell_type": "code",
141113
"execution_count": 60,
@@ -158,12 +130,22 @@
158130
},
159131
{
160132
"cell_type": "code",
161-
"execution_count": 61,
133+
"execution_count": 81,
162134
"metadata": {},
163135
"outputs": [],
164136
"source": [
165-
"#exports\n",
166-
"api = GhApi(limit_cb=limit_cb, token=token)"
137+
"#export\n",
138+
"def _get_api():\n",
139+
" path = Path.home()/\".ghtop_token\"\n",
140+
" if path.is_file():\n",
141+
" try: return path.read_text().strip()\n",
142+
" except: _exit(\"Error reading token\")\n",
143+
"\n",
144+
" token = github_auth_device()\n",
145+
" path.write_text(token)\n",
146+
" return GhApi(limit_cb=limit_cb, token=token)\n",
147+
"\n",
148+
"api = _get_api()"
167149
]
168150
},
169151
{
File renamed without changes.

0 commit comments

Comments
 (0)