/
package_github_details.py
102 lines (86 loc) · 2.63 KB
/
package_github_details.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
"""Package GitHub details schema in the S3 database."""
from pytest_voluptuous import S
from voluptuous import Url, Any
from .predicates import posint_zero_p
from .common import AUDIT, STATUS
# see [deployment]-bayesian-core-data/maven/io.vertx.vertx-core
# an example of GitHub details metadata stored in S3:
# {
# "_audit": {
# "ended_at": "2018-04-17T19:30:39.802408",
# "started_at": "2018-04-17T19:30:37.214113",
# "version": "v1"
# },
# "_release": "maven:io.vertx:vertx-core:None",
# "details": {
# "contributors_count": 30,
# "forks_count": 1343,
# "last_year_commits": {
# "sum": 602,
# "weekly": [
# 31,
# 14,
# ... shortede here ...
# 14,
# 18,
# 29,
# 8
# ]
# },
# "license": {
# "key": "other",
# "name": "Other",
# "spdx_id": null,
# "url": null
# },
# "open_issues_count": 153,
# "stargazers_count": 7719,
# "subscribers_count": 595,
# "topics": [
# "concurrency",
# "event-loop",
# "high-performance",
# "http2",
# "java",
# "jvm",
# "netty",
# "nio",
# "non-blocking",
# "reactive",
# "vertx"
# ]
# },
# "schema": {
# "name": "github_details",
# "version": "2-0-1"
# },
# "status": "success",
# "summary": []
# }
# schema(s) for GitHub details metadata
SCHEMA = S({"name": "github_details",
"version": "2-0-1"})
# TODO: weekly -> sum checks
LAST_YEAR_COMMITS = S({"sum": posint_zero_p,
"weekly": [posint_zero_p]})
# info about license(s)
LICENSE = S({"key": str,
"name": str,
"spdx_id": Any(None, str),
"url": Any(None, Url)})
# GitHub details
DETAILS = S({"contributors_count": posint_zero_p,
"forks_count": posint_zero_p,
"last_year_commits": LAST_YEAR_COMMITS,
"open_issues_count": posint_zero_p,
"stargazers_count": posint_zero_p,
"subscribers_count": posint_zero_p,
"topics": [str],
"license": LICENSE})
# GitHub details schema for package (not component)
PACKAGE_GITHUB_DETAILS_SCHEMA = S({"_audit": Any(None, AUDIT),
"_release": str,
"schema": SCHEMA,
"status": STATUS,
"summary": [str],
"details": DETAILS})