Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
1024 Report
提交
067be799
1
1024 Report
项目概览
CSDN 技术社区
/
1024 Report
通知
84
Star
6
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
1024 Report
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
067be799
编写于
10月 18, 2022
作者:
F
feilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix repo country
上级
cddcfc3d
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
4 deletion
+40
-4
ranks/个人向中国主要开源技术栈贡献榜单.csv
ranks/个人向中国主要开源技术栈贡献榜单.csv
+0
-0
ranks/个人向国际主要开源技术栈贡献榜单.csv
ranks/个人向国际主要开源技术栈贡献榜单.csv
+0
-0
ranks/公司向中国主要开源技术栈贡献榜单.csv
ranks/公司向中国主要开源技术栈贡献榜单.csv
+0
-0
src/tasks/ranks.py
src/tasks/ranks.py
+40
-4
未找到文件。
ranks/个人向中国主要开源技术栈贡献榜单.csv
浏览文件 @
067be799
此差异已折叠。
点击以展开。
ranks/个人向国际主要开源技术栈贡献榜单.csv
浏览文件 @
067be799
此差异已折叠。
点击以展开。
ranks/公司向中国主要开源技术栈贡献榜单.csv
浏览文件 @
067be799
此差异已折叠。
点击以展开。
src/tasks/ranks.py
浏览文件 @
067be799
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
import
numpy
as
np
import
numpy
as
np
import
pandas
as
pd
import
pandas
as
pd
def
quit
():
import
sys
sys
.
exit
(
0
)
def
load_repo_github_info
(
config
,
ctx
):
def
load_repo_github_info
(
config
,
ctx
):
schema
=
config
[
"schema"
]
schema
=
config
[
"schema"
]
...
@@ -225,6 +228,7 @@ def rank_personal_top_n(config, ctx):
...
@@ -225,6 +228,7 @@ def rank_personal_top_n(config, ctx):
# 合并 repo_github_user_info 仓库排行表记录
# 合并 repo_github_user_info 仓库排行表记录
df
=
ctx
[
"repo_github_user_commit_info"
]
df
=
ctx
[
"repo_github_user_commit_info"
]
exit_person_count
=
0
for
index
,
row
in
df
.
iterrows
():
for
index
,
row
in
df
.
iterrows
():
email
=
row
[
"actor_email"
]
email
=
row
[
"actor_email"
]
...
@@ -238,6 +242,12 @@ def rank_personal_top_n(config, ctx):
...
@@ -238,6 +242,12 @@ def rank_personal_top_n(config, ctx):
person_key
=
email
.
lower
()
person_key
=
email
.
lower
()
repo_key
=
repo_name
.
lower
()
repo_key
=
repo_name
.
lower
()
repo_item
=
repo_top_n_dict
.
get
(
repo_key
)
repo_item
=
repo_top_n_dict
.
get
(
repo_key
)
person
=
personal_dict
.
get
(
person_key
)
if
person
is
not
None
:
exit_person_count
+=
1
else
:
person
=
{}
if
repo_item
is
not
None
:
if
repo_item
is
not
None
:
repo_user_contribute_list
=
repo_item
.
get
(
'user_contribute_list'
)
repo_user_contribute_list
=
repo_item
.
get
(
'user_contribute_list'
)
if
repo_user_contribute_list
is
None
:
if
repo_user_contribute_list
is
None
:
...
@@ -247,9 +257,11 @@ def rank_personal_top_n(config, ctx):
...
@@ -247,9 +257,11 @@ def rank_personal_top_n(config, ctx):
# 项目的用户贡献者列表增加
# 项目的用户贡献者列表增加
repo_user_contribute_list
.
append
({
repo_user_contribute_list
.
append
({
"actor_email"
:
email
,
"actor_email"
:
email
,
"country"
:
person
.
get
(
"country"
,
"Null"
),
"total"
:
total
,
"total"
:
total
,
"repo_score"
:
repo_item
[
'score'
]
# 项目得分
"repo_score"
:
repo_item
[
'score'
]
# 项目得分
})
})
print
(
f
"exit_person_count:
{
exit_person_count
}
"
)
# 项目内的用户贡献排序
# 项目内的用户贡献排序
for
repo_key
in
repo_top_n_dict
:
for
repo_key
in
repo_top_n_dict
:
...
@@ -258,8 +270,30 @@ def rank_personal_top_n(config, ctx):
...
@@ -258,8 +270,30 @@ def rank_personal_top_n(config, ctx):
if
repo_user_contribute_list
is
not
None
:
if
repo_user_contribute_list
is
not
None
:
repo_user_contribute_list
.
sort
(
repo_user_contribute_list
.
sort
(
key
=
lambda
x
:
x
[
"total"
],
reverse
=
True
)
key
=
lambda
x
:
x
[
"total"
],
reverse
=
True
)
# 根据项目贡献者的国别信息统计,来决定项目的国别
s
=
{
"china"
:
0
,
"international"
:
0
,
"Null"
:
0
,
"all"
:
len
(
repo_user_contribute_list
)
}
for
u
in
repo_user_contribute_list
:
s
[
u
[
"country"
]]
+=
1
# 如果项目内的成员,在国别上占主导优势(超过50%)
# 就判定该项目为对应的国别
if
s
[
"Null"
]
/
s
[
"all"
]
>
0.5
:
repo_item
[
"country"
]
=
"Null"
else
:
if
(
s
[
"china"
]
+
s
[
"Null"
])
/
s
[
"all"
]
>
0.5
:
repo_item
[
"country"
]
=
"china"
else
:
repo_item
[
"country"
]
=
"international"
else
:
else
:
print
(
f
"[warn] missing contributors repo:
{
repo_key
}
"
)
# print(f"[warn] missing contributors repo:{repo_key}")
pass
# 现在,合并每个项目的用户贡献到一个总表
# 现在,合并每个项目的用户贡献到一个总表
personal_score_dict
=
{}
personal_score_dict
=
{}
...
@@ -285,7 +319,7 @@ def rank_personal_top_n(config, ctx):
...
@@ -285,7 +319,7 @@ def rank_personal_top_n(config, ctx):
if
repo_user_contribute_list
is
None
:
if
repo_user_contribute_list
is
None
:
continue
continue
repo_
region
=
repo_item
[
'region
'
]
repo_
country
=
repo_item
[
'country
'
]
for
repo_person
in
repo_user_contribute_list
:
for
repo_person
in
repo_user_contribute_list
:
email
=
repo_person
[
'actor_email'
]
email
=
repo_person
[
'actor_email'
]
...
@@ -311,7 +345,7 @@ def rank_personal_top_n(config, ctx):
...
@@ -311,7 +345,7 @@ def rank_personal_top_n(config, ctx):
repo_person
[
"repo_score"
]
repo_person
[
"repo_score"
]
# en
# en
if
repo_
region
!=
"国产
"
:
if
repo_
country
==
"international
"
:
person_item
=
personal_score_dict_en
.
get
(
person_key
)
person_item
=
personal_score_dict_en
.
get
(
person_key
)
if
person_item
is
None
:
if
person_item
is
None
:
person_item
=
{
person_item
=
{
...
@@ -329,7 +363,7 @@ def rank_personal_top_n(config, ctx):
...
@@ -329,7 +363,7 @@ def rank_personal_top_n(config, ctx):
else
:
else
:
person_item
[
'score'
]
+=
repo_person
[
"total"
]
*
\
person_item
[
'score'
]
+=
repo_person
[
"total"
]
*
\
repo_person
[
"repo_score"
]
repo_person
[
"repo_score"
]
el
se
:
el
if
repo_country
==
"china"
:
# zh_cn
# zh_cn
person_item
=
personal_score_dict_zh_cn
.
get
(
person_key
)
person_item
=
personal_score_dict_zh_cn
.
get
(
person_key
)
if
person_item
is
None
:
if
person_item
is
None
:
...
@@ -348,6 +382,8 @@ def rank_personal_top_n(config, ctx):
...
@@ -348,6 +382,8 @@ def rank_personal_top_n(config, ctx):
else
:
else
:
person_item
[
'score'
]
+=
repo_person
[
"total"
]
*
\
person_item
[
'score'
]
+=
repo_person
[
"total"
]
*
\
repo_person
[
"repo_score"
]
repo_person
[
"repo_score"
]
else
:
pass
# 个人向全部技术项目贡献排行榜
# 个人向全部技术项目贡献排行榜
df
=
pd
.
DataFrame
.
from_dict
(
personal_score_dict
,
orient
=
'index'
)
df
=
pd
.
DataFrame
.
from_dict
(
personal_score_dict
,
orient
=
'index'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录