ultralytics-actions 0.0.34__py3-none-any.whl → 0.0.37__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.34"
25
+ __version__ = "0.0.37"
@@ -1,10 +1,11 @@
1
1
  # Ultralytics Actions 🚀, AGPL-3.0 license https://ultralytics.com/license
2
2
 
3
3
  import re
4
- import socket
5
4
  import time
6
- import urllib
7
5
  from concurrent.futures import ThreadPoolExecutor
6
+ from urllib import parse
7
+
8
+ import requests
8
9
 
9
10
 
10
11
  def remove_html_comments(body: str) -> str:
@@ -37,6 +38,10 @@ def is_url(url, check=True, max_attempts=3, timeout=2):
37
38
  "github.com", # ignore GitHub links that may be private repos
38
39
  "kaggle.com", # blocks automated header requests
39
40
  "reddit.com", # blocks automated header requests
41
+ "linkedin.com",
42
+ "twitter.com",
43
+ "x.com",
44
+ "storage.googleapis.com", # private GCS buckets
40
45
  )
41
46
  try:
42
47
  # Check allow list
@@ -44,24 +49,23 @@ def is_url(url, check=True, max_attempts=3, timeout=2):
44
49
  return True
45
50
 
46
51
  # Check structure
47
- result = urllib.parse.urlparse(url)
48
- if not all([result.scheme, result.netloc]):
52
+ result = parse.urlparse(url)
53
+ partition = result.netloc.partition(".") # i.e. netloc = "github.com" -> ("github", ".", "com")
54
+ if not result.scheme or not partition[0] or not partition[2]:
49
55
  return False
50
56
 
51
57
  # Check response
52
58
  if check:
53
59
  for attempt in range(max_attempts):
54
60
  try:
55
- req = urllib.request.Request(
56
- url,
57
- method="HEAD",
58
- headers={
59
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
60
- },
61
- )
62
- with urllib.request.urlopen(req, timeout=timeout) as response:
63
- return response.getcode() < 400
64
- except (urllib.error.URLError, socket.timeout):
61
+ headers = {
62
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0",
63
+ "Accept": "*",
64
+ "Accept-Language": "*",
65
+ "Accept-Encoding": "*",
66
+ }
67
+ return requests.head(url, headers=headers, timeout=timeout, allow_redirects=True).status_code < 400
68
+ except Exception:
65
69
  if attempt == max_attempts - 1: # last attempt
66
70
  return False
67
71
  time.sleep(2**attempt) # exponential backoff
@@ -79,18 +83,20 @@ def check_links_in_string(text, verbose=True, return_bad=False):
79
83
  r"(" # Start capturing group for plaintext URLs
80
84
  r"(?:https?://)?" # Optional http:// or https://
81
85
  r"(?:www\.)?" # Optional www.
82
- r"[\w.-]+" # Domain name and subdomains
86
+ r"(?:[\w.-]+)?" # Optional domain name and subdomains
83
87
  r"\.[a-zA-Z]{2,}" # TLD
84
88
  r"(?:/[^\s\"')\]]*)?" # Optional path
85
89
  r")"
86
90
  )
91
+ # all_urls.extend([url for url in match if url and parse.urlparse(url).scheme])
87
92
  all_urls = []
88
93
  for md_text, md_url, plain_url in re.findall(pattern, text):
89
94
  url = md_url or plain_url
90
- if url and urllib.parse.urlparse(url).scheme:
95
+ if url and parse.urlparse(url).scheme:
91
96
  all_urls.append(url)
92
97
 
93
98
  urls = set(map(clean_url, all_urls)) # remove extra characters and make unique
99
+ # bad_urls = [x for x in urls if not is_url(x, check=True)] # single-thread
94
100
  with ThreadPoolExecutor(max_workers=16) as executor: # multi-thread
95
101
  bad_urls = [url for url, valid in zip(urls, executor.map(lambda x: not is_url(x, check=True), urls)) if valid]
96
102
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.34
3
+ Version: 0.0.37
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>
@@ -28,12 +28,11 @@ Classifier: Operating System :: OS Independent
28
28
  Requires-Python: >=3.8
29
29
  Description-Content-Type: text/markdown
30
30
  License-File: LICENSE
31
- Requires-Dist: requests>=2.26.0
32
- Requires-Dist: ruff>=0.1.6
31
+ Requires-Dist: requests>=2.32.3
32
+ Requires-Dist: ruff>=0.8.4
33
33
  Requires-Dist: docformatter>=1.7.5
34
34
  Provides-Extra: dev
35
35
  Requires-Dist: pytest; extra == "dev"
36
- Requires-Dist: black; extra == "dev"
37
36
 
38
37
  <a href="https://www.ultralytics.com/" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>
39
38
 
@@ -1,15 +1,15 @@
1
- actions/__init__.py,sha256=GtlE-ku_TTk_fBoKBzCennk6SAk2-Cju6XccN_3qlVI,749
1
+ actions/__init__.py,sha256=Tvj_QXM4__IYEQm3Kgl5eRgbim3X2DZ8dM1bbULS-98,749
2
2
  actions/first_interaction.py,sha256=MCjDdpc4TgdeB1IWIdkFvXuvkolySBehdBRm1nPPAgo,17707
3
3
  actions/summarize_pr.py,sha256=Uq5TswlNZuxn7HenU8KhWr3z3m496_THWsW1zlYKQvU,11173
4
4
  actions/summarize_release.py,sha256=eEah_BkvdHaFsR1Nxx-WbiOC_xmoXfzQpfwQS0cGJqc,8462
5
5
  actions/update_markdown_code_blocks.py,sha256=WBNcMD_KKsZS-qSPBn6O1G0ggQ_VrT-jTQffbg7xH_M,6369
6
6
  actions/utils/__init__.py,sha256=W82wrlyOAlIPDOtJkgSKjJVXn6QMAoa43gEI0-aWkjs,441
7
- actions/utils/common_utils.py,sha256=XT8GG0SWBtlZLruA0nKrY4AJpkitvPbM8zndE8etuDo,3548
7
+ actions/utils/common_utils.py,sha256=__l3ZxElUlUJc9gAgekQQVowLPgK2VMIjSVQeoBqfFo,3853
8
8
  actions/utils/github_utils.py,sha256=42w9iHRayI275T7PqJaWpDSPCgDADhrbpnoVarT5ERs,6907
9
9
  actions/utils/openai_utils.py,sha256=CU0FdeUW6qeZsxYCC2NUcGjns7w6hDvT8PwaRlG7j9E,1829
10
- ultralytics_actions-0.0.34.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
- ultralytics_actions-0.0.34.dist-info/METADATA,sha256=IRDqEbAx1A8IaHxuGzP7SHRQOAiu3WAsptNL7QuPH8I,10591
12
- ultralytics_actions-0.0.34.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
- ultralytics_actions-0.0.34.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
- ultralytics_actions-0.0.34.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
- ultralytics_actions-0.0.34.dist-info/RECORD,,
10
+ ultralytics_actions-0.0.37.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ ultralytics_actions-0.0.37.dist-info/METADATA,sha256=QKYL5eSd0lVBXejHt21d8EFI-Nby0E7YXMTsCD1Etuk,10554
12
+ ultralytics_actions-0.0.37.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
13
+ ultralytics_actions-0.0.37.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
+ ultralytics_actions-0.0.37.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
+ ultralytics_actions-0.0.37.dist-info/RECORD,,