github-to-sqlite 2.9__py3-none-any.whl → 2.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- github_to_sqlite/cli.py +7 -4
- github_to_sqlite/utils.py +9 -4
- {github_to_sqlite-2.9.dist-info → github_to_sqlite-2.9.1.dist-info}/METADATA +11 -11
- github_to_sqlite-2.9.1.dist-info/RECORD +8 -0
- {github_to_sqlite-2.9.dist-info → github_to_sqlite-2.9.1.dist-info}/WHEEL +1 -2
- {github_to_sqlite-2.9.dist-info → github_to_sqlite-2.9.1.dist-info}/entry_points.txt +1 -0
- github_to_sqlite-2.9.dist-info/RECORD +0 -9
- github_to_sqlite-2.9.dist-info/top_level.txt +0 -1
- {github_to_sqlite-2.9.dist-info → github_to_sqlite-2.9.1.dist-info/licenses}/LICENSE +0 -0
github_to_sqlite/cli.py
CHANGED
|
@@ -142,15 +142,16 @@ def pull_requests(db_path, repo, pull_request_ids, auth, load, orgs, state, sear
|
|
|
142
142
|
else:
|
|
143
143
|
if orgs:
|
|
144
144
|
repos = itertools.chain.from_iterable(
|
|
145
|
-
utils.fetch_all_repos(token=token, org=org)
|
|
146
|
-
for org in orgs
|
|
145
|
+
utils.fetch_all_repos(token=token, org=org) for org in orgs
|
|
147
146
|
)
|
|
148
147
|
else:
|
|
149
148
|
repos = [utils.fetch_repo(repo, token)]
|
|
150
149
|
for repo_full in repos:
|
|
151
150
|
utils.save_repo(db, repo_full)
|
|
152
151
|
repo = repo_full["full_name"]
|
|
153
|
-
pull_requests = utils.fetch_pull_requests(
|
|
152
|
+
pull_requests = utils.fetch_pull_requests(
|
|
153
|
+
repo, state, token, pull_request_ids
|
|
154
|
+
)
|
|
154
155
|
utils.save_pull_requests(db, pull_requests, repo_full)
|
|
155
156
|
utils.ensure_db_shape(db)
|
|
156
157
|
|
|
@@ -499,7 +500,9 @@ def scrape_dependents(db_path, repos, auth, verbose):
|
|
|
499
500
|
{
|
|
500
501
|
"repo": repo_full["id"],
|
|
501
502
|
"dependent": dependent_id,
|
|
502
|
-
"first_seen_utc": datetime.datetime.
|
|
503
|
+
"first_seen_utc": datetime.datetime.now(datetime.timezone.utc)
|
|
504
|
+
.replace(tzinfo=None)
|
|
505
|
+
.isoformat(),
|
|
503
506
|
},
|
|
504
507
|
pk=("repo", "dependent"),
|
|
505
508
|
foreign_keys=(
|
github_to_sqlite/utils.py
CHANGED
|
@@ -229,11 +229,11 @@ def save_pull_requests(db, pull_requests, repo):
|
|
|
229
229
|
|
|
230
230
|
|
|
231
231
|
def save_user(db, user):
|
|
232
|
-
# Under some conditions, GitHub caches removed repositories with
|
|
232
|
+
# Under some conditions, GitHub caches removed repositories with
|
|
233
233
|
# stars and ends up leaving dangling `None` user references.
|
|
234
234
|
if user is None:
|
|
235
235
|
return None
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
# Remove all url fields except avatar_url and html_url
|
|
238
238
|
to_save = {
|
|
239
239
|
key: value
|
|
@@ -461,7 +461,9 @@ def fetch_stargazers(repo, token=None):
|
|
|
461
461
|
|
|
462
462
|
|
|
463
463
|
def fetch_all_repos(username=None, token=None, org=None):
|
|
464
|
-
assert
|
|
464
|
+
assert (
|
|
465
|
+
username or token or org
|
|
466
|
+
), "Must provide username= or token= or org= or a combination"
|
|
465
467
|
headers = make_headers(token)
|
|
466
468
|
# Get topics for each repo:
|
|
467
469
|
headers["Accept"] = "application/vnd.github.mercy-preview+json"
|
|
@@ -695,7 +697,10 @@ def ensure_foreign_keys(db):
|
|
|
695
697
|
for expected_foreign_key in FOREIGN_KEYS:
|
|
696
698
|
table, column, table2, column2 = expected_foreign_key
|
|
697
699
|
if (
|
|
698
|
-
expected_foreign_key not in
|
|
700
|
+
expected_foreign_key not in {
|
|
701
|
+
(fk.table, fk.column, fk.other_table, fk.other_column)
|
|
702
|
+
for fk in db[table].foreign_keys
|
|
703
|
+
}
|
|
699
704
|
and
|
|
700
705
|
# Ensure all tables and columns exist
|
|
701
706
|
db[table].exists()
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: github-to-sqlite
|
|
3
|
-
Version: 2.9
|
|
3
|
+
Version: 2.9.1
|
|
4
4
|
Summary: Save data from GitHub to a SQLite database
|
|
5
|
-
Home-page: https://github.com/dogsheep/github-to-sqlite
|
|
6
5
|
Author: Simon Willison
|
|
7
|
-
License: Apache
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
6
|
+
License-Expression: Apache-2.0
|
|
9
7
|
License-File: LICENSE
|
|
10
|
-
Requires-Dist: sqlite-utils
|
|
8
|
+
Requires-Dist: sqlite-utils>4
|
|
11
9
|
Requires-Dist: requests
|
|
12
|
-
Requires-Dist:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
Requires-Dist: pyyaml
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Project-URL: Homepage, https://github.com/dogsheep/github-to-sqlite
|
|
13
|
+
Project-URL: Changelog, https://github.com/dogsheep/github-to-sqlite/releases
|
|
14
|
+
Project-URL: Issues, https://github.com/dogsheep/github-to-sqlite/issues
|
|
15
|
+
Project-URL: CI, https://github.com/dogsheep/github-to-sqlite/actions
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
# github-to-sqlite
|
|
19
19
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
github_to_sqlite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
github_to_sqlite/cli.py,sha256=Qk6AFMgW2hYuJOASZ5wP2_mQEwl04RmKS25C143AWVI,19505
|
|
3
|
+
github_to_sqlite/utils.py,sha256=nqixL6NNvK1kiOkkjGwvSwcQNw-3mormqp68lLXNmSo,29321
|
|
4
|
+
github_to_sqlite-2.9.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
github_to_sqlite-2.9.1.dist-info/WHEEL,sha256=-i9oRNYVXXZJUIYl5zclLIg6onEb0NLibTX34uln84w,81
|
|
6
|
+
github_to_sqlite-2.9.1.dist-info/entry_points.txt,sha256=zr29qE6GkeNBMRB4dBewDVokC920g7K_5r6q5mtcctM,63
|
|
7
|
+
github_to_sqlite-2.9.1.dist-info/METADATA,sha256=tlLiKD_UoTlqmLXg5Y7wcGvEVvNbgQYCkOBY72l2LHA,13443
|
|
8
|
+
github_to_sqlite-2.9.1.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
github_to_sqlite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
github_to_sqlite/cli.py,sha256=JxbYVmXAMYPPUDwtFtVdSuvlZE-1-cnRLaKxCBTYEic,19402
|
|
3
|
-
github_to_sqlite/utils.py,sha256=M4c2fKONp0AMLAVclz6osT6P4QLuarDuZuRtJyoH_2g,29198
|
|
4
|
-
github_to_sqlite-2.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
github_to_sqlite-2.9.dist-info/METADATA,sha256=kBjA4WI-pWaapWJle-aMcT6q-tiXHVMbR-PNLS5ypVs,13341
|
|
6
|
-
github_to_sqlite-2.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
7
|
-
github_to_sqlite-2.9.dist-info/entry_points.txt,sha256=uS48AK6__Anjdc2wyHRuKHN406CMSP-OYtxkdtqhuGM,62
|
|
8
|
-
github_to_sqlite-2.9.dist-info/top_level.txt,sha256=bur6DmbPzE5A4FKDQpi9AkSa-AIjAGKdRor_kyLlllA,17
|
|
9
|
-
github_to_sqlite-2.9.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
github_to_sqlite
|
|
File without changes
|