ultralytics-actions 0.0.59__py3-none-any.whl → 0.0.60__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.
- actions/__init__.py +1 -1
- actions/utils/common_utils.py +26 -24
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/METADATA +1 -1
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/RECORD +8 -8
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/WHEEL +0 -0
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/entry_points.txt +0 -0
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/licenses/LICENSE +0 -0
- {ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/top_level.txt +0 -0
actions/__init__.py
CHANGED
actions/utils/common_utils.py
CHANGED
@@ -8,7 +8,6 @@ from urllib import parse
|
|
8
8
|
|
9
9
|
import requests
|
10
10
|
|
11
|
-
BRAVE_API_KEY = os.getenv("BRAVE_API_KEY")
|
12
11
|
REQUESTS_HEADERS = {
|
13
12
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
|
14
13
|
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
@@ -87,7 +86,9 @@ def clean_url(url):
|
|
87
86
|
def brave_search(query, api_key, count=5):
|
88
87
|
"""Search for alternative URLs using Brave Search API."""
|
89
88
|
headers = {"X-Subscription-Token": api_key, "Accept": "application/json"}
|
90
|
-
|
89
|
+
if len(query) > 400:
|
90
|
+
print(f"WARNING ⚠️ Brave search query length {len(query)} exceed limit of 400 characters, truncating.")
|
91
|
+
url = f"https://api.search.brave.com/res/v1/web/search?q={parse.quote(query.strip()[:400])}&count={count}"
|
91
92
|
response = requests.get(url, headers=headers)
|
92
93
|
data = response.json() if response.status_code == 200 else {}
|
93
94
|
results = data.get("web", {}).get("results", []) if data else []
|
@@ -156,28 +157,29 @@ def check_links_in_string(text, verbose=True, return_bad=False, replace=False):
|
|
156
157
|
valid_results = list(executor.map(lambda x: is_url(x[1], session), urls))
|
157
158
|
bad_urls = [url for (_, url, _), valid in zip(urls, valid_results) if not valid]
|
158
159
|
|
159
|
-
if replace and bad_urls
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
160
|
+
if replace and bad_urls:
|
161
|
+
if brave_api_key := os.getenv("BRAVE_API_KEY"):
|
162
|
+
replacements = {}
|
163
|
+
modified_text = text
|
164
|
+
|
165
|
+
for (title, url, is_md), valid in zip(urls, valid_results):
|
166
|
+
if not valid:
|
167
|
+
alternative_urls = brave_search(f"{title[:200]} {url[:200]}", brave_api_key, count=3)
|
168
|
+
if alternative_urls:
|
169
|
+
# Try each alternative URL until we find one that works
|
170
|
+
for alt_url in alternative_urls:
|
171
|
+
if is_url(alt_url, session):
|
172
|
+
break
|
173
|
+
replacements[url] = alt_url
|
174
|
+
modified_text = modified_text.replace(url, alt_url)
|
175
|
+
|
176
|
+
if verbose and replacements:
|
177
|
+
print(
|
178
|
+
f"WARNING ⚠️ replaced {len(replacements)} broken links:\n"
|
179
|
+
+ "\n".join(f" {k}: {v}" for k, v in replacements.items())
|
180
|
+
)
|
181
|
+
if replacements:
|
182
|
+
return (True, [], modified_text) if return_bad else modified_text
|
181
183
|
|
182
184
|
passing = not bad_urls
|
183
185
|
if verbose and not passing:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ultralytics-actions
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.60
|
4
4
|
Summary: Ultralytics Actions for GitHub automation and PR management.
|
5
5
|
Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>
|
6
6
|
Maintainer-email: Ultralytics <hello@ultralytics.com>
|
@@ -1,15 +1,15 @@
|
|
1
|
-
actions/__init__.py,sha256=
|
1
|
+
actions/__init__.py,sha256=1qWxqoUoowCT0UciA9kqtR30URWMLMTc8lc7umzaHhc,742
|
2
2
|
actions/first_interaction.py,sha256=1_WvQHCi5RWaSfyi49ClF2Zk_3CKGjFnZqz6FlxPRAc,17868
|
3
3
|
actions/summarize_pr.py,sha256=BKttOq-MGaanVaChLU5B1ewKUA8K6S05Cy3FQtyRmxU,11681
|
4
4
|
actions/summarize_release.py,sha256=tov6qsYGC68lfobvkwVyoWZBGtJ598G0m097n4Ydzvo,8472
|
5
5
|
actions/update_markdown_code_blocks.py,sha256=9PL7YIQfApRNAa0que2hYHv7umGZTZoHlblesB0xFj4,8587
|
6
6
|
actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
|
7
|
-
actions/utils/common_utils.py,sha256=
|
7
|
+
actions/utils/common_utils.py,sha256=dKiww1Aup68JXCHTKC7Rk4rKU9KUWAsdsbGSzHhSB0g,8392
|
8
8
|
actions/utils/github_utils.py,sha256=-F--JgxtXE0fSPMFEzakz7iZilp-vonzLiyXfg0b17Y,7117
|
9
9
|
actions/utils/openai_utils.py,sha256=qQbmrJpOUANxSMf7inDSgPIwgf0JHD1fWZuab-y2W6g,2942
|
10
|
-
ultralytics_actions-0.0.
|
11
|
-
ultralytics_actions-0.0.
|
12
|
-
ultralytics_actions-0.0.
|
13
|
-
ultralytics_actions-0.0.
|
14
|
-
ultralytics_actions-0.0.
|
15
|
-
ultralytics_actions-0.0.
|
10
|
+
ultralytics_actions-0.0.60.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
11
|
+
ultralytics_actions-0.0.60.dist-info/METADATA,sha256=E0Mn7U9LJMFpttbavimk3RIoc6xuQ1IBgcqxWryV-bw,10923
|
12
|
+
ultralytics_actions-0.0.60.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
13
|
+
ultralytics_actions-0.0.60.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
|
14
|
+
ultralytics_actions-0.0.60.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
|
15
|
+
ultralytics_actions-0.0.60.dist-info/RECORD,,
|
File without changes
|
{ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/entry_points.txt
RENAMED
File without changes
|
{ultralytics_actions-0.0.59.dist-info → ultralytics_actions-0.0.60.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|