ultralytics-actions 0.0.64__py3-none-any.whl → 0.0.66__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 CHANGED
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.64"
25
+ __version__ = "0.0.66"
@@ -56,45 +56,46 @@ URL_IGNORE_LIST = { # use a set (not frozenset) to update with possible private
56
56
  "storage.googleapis.com", # private GCS buckets
57
57
  "{", # possible Python fstring
58
58
  "(", # breaks pattern matches
59
- "api", # ignore api endpoints
60
- }
61
- REDIRECT_IGNORE_LIST = {
62
- "{", # possible f-string
63
- "}", # possible f-string
64
- "/es/",
65
- "/us/",
66
- "en-us",
67
- "es-es",
68
- "/latest/",
69
- "/2022/",
70
- "/2023/",
71
- "/2024/",
72
- "/2025/",
73
- "/2026/",
74
- "/2027/",
75
- "/2028/",
76
- "/2029/",
77
- "/2030/",
78
- "credential",
79
- "login",
80
- "consent",
81
- "verify",
82
- "badge",
83
- "shields.io",
84
- "bit.ly",
85
- "ow.ly",
86
- "https://youtu.be/",
87
- "latex.codecogs.com",
88
- "svg.image",
89
- "?view=azureml",
90
- "ultralytics.com/actions",
91
- "ultralytics.com/bilibili",
92
- "ultralytics.com/images",
93
- "app.gong.io/call?",
94
- "https://code.visualstudio.com/", # errors
95
- "?rdt=", # problems with reddit redirecting to https://www.reddit.com/r/ultralytics/?rdt=48616
96
- "objects.githubusercontent.com", # Prevent replacement with temporary signed GitHub asset URLs
59
+ "api.", # ignore api endpoints
97
60
  }
61
+ REDIRECT_IGNORE_LIST = frozenset(
62
+ {
63
+ "{", # possible f-string
64
+ "}", # possible f-string
65
+ "/es/",
66
+ "/us/",
67
+ "en-us",
68
+ "es-es",
69
+ "/latest/",
70
+ ":text", # ignore text-selection links due to parsing complications
71
+ ":443", # https://getcruise.com/ -> https://www.gm.com:443/innovation/path-to-autonomous
72
+ "404",
73
+ "notfound",
74
+ "unsupported", # https://labs.google/fx/tools/video-fx/unsupported-country
75
+ "authorize", # nature articles like https://idp.nature.com/authorize?response_type=cookie&client...
76
+ "credential",
77
+ "login",
78
+ "consent",
79
+ "verify",
80
+ "badge",
81
+ "shields.io",
82
+ "bit.ly",
83
+ "ow.ly",
84
+ "https://youtu.be/",
85
+ "latex.codecogs.com",
86
+ "svg.image",
87
+ "?view=azureml",
88
+ "?utm_",
89
+ "redirect",
90
+ "ultralytics.com/actions",
91
+ "ultralytics.com/bilibili",
92
+ "ultralytics.com/images",
93
+ "app.gong.io/call?",
94
+ "https://code.visualstudio.com/", # errors
95
+ "?rdt=", # problems with reddit redirecting to https://www.reddit.com/r/ultralytics/?rdt=48616
96
+ "objects.githubusercontent.com", # Prevent replacement with temporary signed GitHub asset URLs
97
+ }
98
+ )
98
99
  URL_PATTERN = re.compile(
99
100
  r"\[([^]]+)]\(([^)]+)\)" # Matches Markdown links [text](url)
100
101
  r"|"
@@ -189,7 +190,7 @@ def is_url(url, session=None, check=True, max_attempts=3, timeout=2, return_url=
189
190
  return (False, url) if return_url else False
190
191
 
191
192
 
192
- def check_links_in_string(text, verbose=True, return_bad=False, replace=False, redirect=True):
193
+ def check_links_in_string(text, verbose=True, return_bad=False, replace=False):
193
194
  """Process text, find URLs, check for 404s, and handle replacements with redirects or Brave search."""
194
195
  urls = []
195
196
  for md_text, md_url, plain_url in URL_PATTERN.findall(text):
@@ -199,7 +200,7 @@ def check_links_in_string(text, verbose=True, return_bad=False, replace=False, r
199
200
 
200
201
  with requests.Session() as session, ThreadPoolExecutor(max_workers=64) as executor:
201
202
  session.headers.update(REQUESTS_HEADERS)
202
- results = list(executor.map(lambda x: is_url(x[1], session, return_url=True, redirect=redirect), urls))
203
+ results = list(executor.map(lambda x: is_url(x[1], session, return_url=True, redirect=True), urls))
203
204
  bad_urls = [url for (title, url), (valid, redirect) in zip(urls, results) if not valid]
204
205
 
205
206
  if replace:
@@ -211,14 +212,14 @@ def check_links_in_string(text, verbose=True, return_bad=False, replace=False, r
211
212
  for (title, url), (valid, redirect) in zip(urls, results):
212
213
  # Handle invalid URLs with Brave search
213
214
  if not valid and brave_api_key:
214
- alternative_urls = brave_search(f"{title[:200]} {url[:200]}", brave_api_key, count=3)
215
- if alternative_urls:
216
- # Try each alternative URL until we find one that works
217
- for alt_url in alternative_urls:
215
+ if search_urls := brave_search(f"{title[:200]} {(redirect or url)[:200]}", brave_api_key, count=3):
216
+ best_url = search_urls[0]
217
+ for alt_url in search_urls:
218
218
  if is_url(alt_url, session):
219
- replacements[url] = alt_url
220
- modified_text = modified_text.replace(url, alt_url)
219
+ best_url = alt_url
221
220
  break
221
+ replacements[url] = best_url
222
+ modified_text = modified_text.replace(url, best_url)
222
223
  # Handle redirects for valid URLs
223
224
  elif valid and redirect and redirect != url:
224
225
  replacements[url] = redirect
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.64
3
+ Version: 0.0.66
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=_0iCAgCQC2PbO-T1qslfJ9W1VETJy0oGXGI1hGhHklQ,742
1
+ actions/__init__.py,sha256=L3cynhD5wwQCRCJTLoJ-mEplN7f0ktXTaRkiRe5G0Tk,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=XjFyREuhiA7pHfHHBQQqHYKokHhq_px1P9sezk_f1vA,545
7
- actions/utils/common_utils.py,sha256=KIwFev9mGdgD7Z5IT0UuHNgZi-phKcZ1A1pggBU8Xbo,10191
7
+ actions/utils/common_utils.py,sha256=L4F4lMkmHEjUp7ZilVEN1kXSPy9ksbbELZJ2vEWspBk,10587
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.64.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
- ultralytics_actions-0.0.64.dist-info/METADATA,sha256=GpiuJf5WlfPKaSl8hCZsXDH-JuKUJunJzweiokhJzAg,10923
12
- ultralytics_actions-0.0.64.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
13
- ultralytics_actions-0.0.64.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
- ultralytics_actions-0.0.64.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
- ultralytics_actions-0.0.64.dist-info/RECORD,,
10
+ ultralytics_actions-0.0.66.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ ultralytics_actions-0.0.66.dist-info/METADATA,sha256=KAzdN9xmYeEEOmDnbEXe1lMd4RZBxy9A6txeEUh02O8,10923
12
+ ultralytics_actions-0.0.66.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
13
+ ultralytics_actions-0.0.66.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
+ ultralytics_actions-0.0.66.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
+ ultralytics_actions-0.0.66.dist-info/RECORD,,