-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathrepository_detection.py
31 lines (26 loc) · 948 Bytes
/
repository_detection.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
slash_or_end = r'(?:/\b|/$|\s|\.$|\)|$)'
source_code_platforms = {
# code repository platforms
'github': r'(github\.com/\S+/\S+)',
'gitlab': r'(gitlab\.com/\S+/\S+)',
'sourceforge': r'(sourceforge\.net/\S+)',
'bitbucket': r'(bitbucket\.org/\S+)',
'.git': r'(\S+:\S+\.git\S*)',
'cran': rf'cran\.r-project\.org/(?:web/packages/|package=)(\S+){slash_or_end}',
'pypi': rf'pypi\.python\.org/pypi/(\S+){slash_or_end}',
}
mixed_publication_platforms = {
# publication platforms
'zenodo': rf'doi\.org/10.5281/(zenodo\.\d+?){slash_or_end}',
'bioconductor': rf'bioconductor.org/packages/(\S+){slash_or_end}',
'osf': r'osf.io/(\S+){slash_or_end}',
}
data_only_platforms = {
# unlikely that anyone stores code there, but just to be certain
'dryad': rf'datadryad.org/(\S+){slash_or_end}'
}
all_platforms = {
**source_code_platforms,
**mixed_publication_platforms,
**data_only_platforms
}