Skip to content

Commit e5916d6

Browse files
committed
fix test and deprecation
1 parent 61f27f5 commit e5916d6

File tree

3 files changed

+237
-102
lines changed

3 files changed

+237
-102
lines changed

00_core.ipynb

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"from urllib.request import Request\n",
3434
"from urllib.error import HTTPError\n",
3535
"from urllib.parse import quote\n",
36-
"from datetime import datetime,timedelta\n",
36+
"from datetime import datetime, timedelta, timezone\n",
3737
"from pprint import pprint\n",
3838
"from time import sleep\n",
3939
"import os, shutil, tempfile, git"
@@ -272,7 +272,7 @@
272272
"text/markdown": [
273273
"---\n",
274274
"\n",
275-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L123){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
275+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L123){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
276276
"\n",
277277
"### GhApi.__call__\n",
278278
"\n",
@@ -285,7 +285,7 @@
285285
"text/plain": [
286286
"---\n",
287287
"\n",
288-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L123){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
288+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L123){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
289289
"\n",
290290
"### GhApi.__call__\n",
291291
"\n",
@@ -331,9 +331,9 @@
331331
"text/markdown": [
332332
"```json\n",
333333
"{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
334-
" 'object': { 'sha': '276fb019036d9fbc868313f243cc4bf88f8255a3',\n",
334+
" 'object': { 'sha': '958659bf10a8c275fb04f2f6832f1a0f4d07fa85',\n",
335335
" 'type': 'commit',\n",
336-
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/276fb019036d9fbc868313f243cc4bf88f8255a3'},\n",
336+
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/958659bf10a8c275fb04f2f6832f1a0f4d07fa85'},\n",
337337
" 'ref': 'refs/heads/master',\n",
338338
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n",
339339
"```"
@@ -342,9 +342,9 @@
342342
"{'ref': 'refs/heads/master',\n",
343343
" 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
344344
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n",
345-
" 'object': {'sha': '276fb019036d9fbc868313f243cc4bf88f8255a3',\n",
345+
" 'object': {'sha': '958659bf10a8c275fb04f2f6832f1a0f4d07fa85',\n",
346346
" 'type': 'commit',\n",
347-
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/276fb019036d9fbc868313f243cc4bf88f8255a3'}}"
347+
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/958659bf10a8c275fb04f2f6832f1a0f4d07fa85'}}"
348348
]
349349
},
350350
"execution_count": null,
@@ -367,7 +367,7 @@
367367
"text/markdown": [
368368
"---\n",
369369
"\n",
370-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L147){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
370+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L147){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
371371
"\n",
372372
"### GhApi.__getitem__\n",
373373
"\n",
@@ -378,7 +378,7 @@
378378
"text/plain": [
379379
"---\n",
380380
"\n",
381-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L147){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
381+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L147){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
382382
"\n",
383383
"### GhApi.__getitem__\n",
384384
"\n",
@@ -413,9 +413,9 @@
413413
"text/markdown": [
414414
"```json\n",
415415
"{ 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
416-
" 'object': { 'sha': '276fb019036d9fbc868313f243cc4bf88f8255a3',\n",
416+
" 'object': { 'sha': '958659bf10a8c275fb04f2f6832f1a0f4d07fa85',\n",
417417
" 'type': 'commit',\n",
418-
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/276fb019036d9fbc868313f243cc4bf88f8255a3'},\n",
418+
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/958659bf10a8c275fb04f2f6832f1a0f4d07fa85'},\n",
419419
" 'ref': 'refs/heads/master',\n",
420420
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master'}\n",
421421
"```"
@@ -424,9 +424,9 @@
424424
"{'ref': 'refs/heads/master',\n",
425425
" 'node_id': 'MDM6UmVmMzE1NzEyNTg4OnJlZnMvaGVhZHMvbWFzdGVy',\n",
426426
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/refs/heads/master',\n",
427-
" 'object': {'sha': '276fb019036d9fbc868313f243cc4bf88f8255a3',\n",
427+
" 'object': {'sha': '958659bf10a8c275fb04f2f6832f1a0f4d07fa85',\n",
428428
" 'type': 'commit',\n",
429-
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/276fb019036d9fbc868313f243cc4bf88f8255a3'}}"
429+
" 'url': 'https://api.github.com/repos/fastai/ghapi-test/git/commits/958659bf10a8c275fb04f2f6832f1a0f4d07fa85'}}"
430430
]
431431
},
432432
"execution_count": null,
@@ -460,7 +460,7 @@
460460
{
461461
"data": {
462462
"text/plain": [
463-
"'276fb019036d9fbc868313f243cc4bf88f8255a3'"
463+
"'958659bf10a8c275fb04f2f6832f1a0f4d07fa85'"
464464
]
465465
},
466466
"execution_count": null,
@@ -497,7 +497,7 @@
497497
"name": "stdout",
498498
"output_type": "stream",
499499
"text": [
500-
"Quota remaining: 4996 of 5000\n"
500+
"Quota remaining: 4907 of 5000\n"
501501
]
502502
},
503503
{
@@ -533,7 +533,7 @@
533533
{
534534
"data": {
535535
"text/plain": [
536-
"'4996'"
536+
"'4907'"
537537
]
538538
},
539539
"execution_count": null,
@@ -599,13 +599,15 @@
599599
"- [api_insights](https://docs.github.com/rest/reference/api-insights)\n",
600600
"- [apps](https://docs.github.com/rest/reference/apps)\n",
601601
"- [billing](https://docs.github.com/rest/reference/billing)\n",
602+
"- [campaigns](https://docs.github.com/rest/reference/campaigns)\n",
602603
"- [checks](https://docs.github.com/rest/reference/checks)\n",
603604
"- [classroom](https://docs.github.com/rest/reference/classroom)\n",
604605
"- [code_scanning](https://docs.github.com/rest/reference/code-scanning)\n",
605606
"- [code_security](https://docs.github.com/rest/reference/code-security)\n",
606607
"- [codes_of_conduct](https://docs.github.com/rest/reference/codes-of-conduct)\n",
607608
"- [codespaces](https://docs.github.com/rest/reference/codespaces)\n",
608609
"- [copilot](https://docs.github.com/rest/reference/copilot)\n",
610+
"- [credentials](https://docs.github.com/rest/reference/credentials)\n",
609611
"- [dependabot](https://docs.github.com/rest/reference/dependabot)\n",
610612
"- [dependency_graph](https://docs.github.com/rest/reference/dependency-graph)\n",
611613
"- [emojis](https://docs.github.com/rest/reference/emojis)\n",
@@ -624,6 +626,7 @@
624626
"- [packages](https://docs.github.com/rest/reference/packages)\n",
625627
"- [private_registries](https://docs.github.com/rest/reference/private-registries)\n",
626628
"- [projects](https://docs.github.com/rest/reference/projects)\n",
629+
"- [projects_classic](https://docs.github.com/rest/reference/projects-classic)\n",
627630
"- [pulls](https://docs.github.com/rest/reference/pulls)\n",
628631
"- [rate_limit](https://docs.github.com/rest/reference/rate-limit)\n",
629632
"- [reactions](https://docs.github.com/rest/reference/reactions)\n",
@@ -949,18 +952,10 @@
949952
"execution_count": null,
950953
"metadata": {},
951954
"outputs": [
952-
{
953-
"name": "stderr",
954-
"output_type": "stream",
955-
"text": [
956-
"/var/folders/hz/fg03h5c13x96l0g9420_qvlm0000gn/T/ipykernel_71467/3678695839.py:1: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).\n",
957-
" dt = date2gh(datetime.utcnow() - timedelta(weeks=4))\n"
958-
]
959-
},
960955
{
961956
"data": {
962957
"text/plain": [
963-
"1"
958+
"0"
964959
]
965960
},
966961
"execution_count": null,
@@ -969,7 +964,7 @@
969964
}
970965
],
971966
"source": [
972-
"dt = date2gh(datetime.utcnow() - timedelta(weeks=4))\n",
967+
"dt = date2gh(datetime.now(timezone.utc) - timedelta(weeks=4))\n",
973968
"issues = GhApi('fastai').issues.list_for_repo(repo='fastcore', since=dt)\n",
974969
"len(issues)"
975970
]
@@ -990,18 +985,10 @@
990985
"cell_type": "code",
991986
"execution_count": null,
992987
"metadata": {},
993-
"outputs": [
994-
{
995-
"name": "stdout",
996-
"output_type": "stream",
997-
"text": [
998-
"2023-06-29T17:44:49Z -> 2023-06-29 17:44:49\n"
999-
]
1000-
}
1001-
],
988+
"outputs": [],
1002989
"source": [
1003-
"created = issues[0].created_at\n",
1004-
"print(created, '->', gh2date(created))"
990+
"# created = issues[0].created_at\n",
991+
"# print(created, '->', gh2date(created))"
1005992
]
1006993
},
1007994
{
@@ -1101,7 +1088,7 @@
11011088
"name": "stdout",
11021089
"output_type": "stream",
11031090
"text": [
1104-
"https://gist.github.com/KeremTurgutlu/81232c80389c9257a82bcf4ddeaffac0\n"
1091+
"https://gist.github.com/jph00/634c4553fac5fdd3b2d810dcdae2d841\n"
11051092
]
11061093
}
11071094
],
@@ -1139,7 +1126,7 @@
11391126
"name": "stdout",
11401127
"output_type": "stream",
11411128
"text": [
1142-
"https://gist.github.com/KeremTurgutlu/82af4d178db85fcb585029854b495bae\n"
1129+
"https://gist.github.com/jph00/dbd28d7ef14117b4aa4b0d8fc9a9aa81\n"
11431130
]
11441131
}
11451132
],
@@ -1156,7 +1143,7 @@
11561143
{
11571144
"data": {
11581145
"text/plain": [
1159-
"'some image\\n\\n![image](https://gist.githubusercontent.com/KeremTurgutlu/82af4d178db85fcb585029854b495bae/raw/c7f420c839f58c6ac0c05f1116317645d31d7e80/puppy.jpg)'"
1146+
"'some image\\n\\n![image](https://gist.githubusercontent.com/jph00/dbd28d7ef14117b4aa4b0d8fc9a9aa81/raw/c7f420c839f58c6ac0c05f1116317645d31d7e80/puppy.jpg)'"
11601147
]
11611148
},
11621149
"execution_count": null,
@@ -1299,7 +1286,7 @@
12991286
"text/markdown": [
13001287
"---\n",
13011288
"\n",
1302-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L173){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
1289+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L191){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
13031290
"\n",
13041291
"### GhApi.delete_release\n",
13051292
"\n",
@@ -1310,7 +1297,7 @@
13101297
"text/plain": [
13111298
"---\n",
13121299
"\n",
1313-
"[source](https://github.com/fastai/ghapi/blob/master/ghapi/core.py#L173){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
1300+
"[source](https://github.com/fastai/ghapi/blob/main/ghapi/core.py#L191){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
13141301
"\n",
13151302
"### GhApi.delete_release\n",
13161303
"\n",

ghapi/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from urllib.request import Request
1515
from urllib.error import HTTPError
1616
from urllib.parse import quote
17-
from datetime import datetime,timedelta
17+
from datetime import datetime, timedelta, timezone
1818
from pprint import pprint
1919
from time import sleep
2020
import os, shutil, tempfile, git

0 commit comments

Comments
 (0)