Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
31 lines (27 loc) · 1.32 KB

File metadata and controls

31 lines (27 loc) · 1.32 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
from urllib.parse import quote
def generate_vector_string(package) -> str:
vector_str = f"{package['name']}"
package_url = ""
type_map = {
"pypi": "Python package available on PyPI ecosystem",
"npm": "JavaScript package available on NPM ecosystem",
"go": "Go package ecosystem",
"crates": "Rust package available on Crates ecosystem",
"java": "Java package available on Maven ecosystem",
}
status_messages = {
"archived": "However, this package is found to be archived and no longer maintained.",
"deprecated": "However, this package is found to be deprecated and no longer "
"recommended for use.",
"malicious": "However, this package is found to be malicious and must not be used.",
}
vector_str += f" is a {type_map.get(package['type'], 'package of unknown type')}. "
package_name = quote(package["name"], safe="")
package_url = f"https://www.insight.stacklok.com/report/{package['type']}/{package_name}"
# Add extra status
status_suffix = status_messages.get(package["status"], "")
if status_suffix:
vector_str += f" {status_suffix} For additional information refer to {package_url}"
# add description
vector_str += f" - Package offers this functionality: {package['description']}"
return vector_str
Morty Proxy This is a proxified and sanitized view of the page, visit original site.