ultralytics-actions 0.0.43__py3-none-any.whl → 0.0.45__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.43"
25
+ __version__ = "0.0.45"
@@ -47,8 +47,8 @@ def update_issue_pr_content(event, number: int, node_id: str, issue_type: str):
47
47
  new_title = "Content Under Review"
48
48
  new_body = """This post has been flagged for review by [Ultralytics Actions](https://ultralytics.com/actions) due to possible spam, abuse, or off-topic content. For more information please see our:
49
49
 
50
- - [Code of Conduct](https://docs.ultralytics.com/help/code_of_conduct)
51
- - [Security Policy](https://docs.ultralytics.com/help/security)
50
+ - [Code of Conduct](https://docs.ultralytics.com/help/code-of-conduct/)
51
+ - [Security Policy](https://docs.ultralytics.com/help/security/)
52
52
 
53
53
  For questions or bug reports related to this action please visit https://github.com/ultralytics/actions.
54
54
 
@@ -285,7 +285,7 @@ def get_first_interaction_response(event, issue_type: str, title: str, body: str
285
285
 
286
286
  1. For bug reports:
287
287
  - A clear and concise description of the bug
288
- - A minimum reproducible example (MRE)[https://docs.ultralytics.com/help/minimum_reproducible_example/] that demonstrates the issue
288
+ - A minimum reproducible example [MRE](https://docs.ultralytics.com/help/minimum-reproducible-example/) that demonstrates the issue
289
289
  - Your environment details (OS, Python version, package versions)
290
290
  - Expected behavior vs. actual behavior
291
291
  - Any error messages or logs related to the issue
@@ -298,7 +298,7 @@ def get_first_interaction_response(event, issue_type: str, title: str, body: str
298
298
  3. For questions:
299
299
  - Provide as much context as possible about your question
300
300
  - Include any research you've already done on the topic
301
- - Specify which parts of the [documentation](https://docs.ultralytics.com), if any, you've already consulted
301
+ - Specify which parts of the [documentation](https://docs.ultralytics.com/), if any, you've already consulted
302
302
 
303
303
  Please make sure you've searched existing {issue_type}s to avoid duplicates. If you need to add any additional information, please comment on this {issue_type}.
304
304
 
@@ -311,12 +311,12 @@ Thank you for your contribution to improving our project!
311
311
  - ✅ **Define a Purpose**: Clearly explain the purpose of your fix or feature in your PR description, and link to any [relevant issues](https://github.com/{event.repository}/issues). Ensure your commit messages are clear, concise, and adhere to the project's conventions.
312
312
  - ✅ **Synchronize with Source**: Confirm your PR is synchronized with the `{event.repository}` `main` branch. If it's behind, update it by clicking the 'Update branch' button or by running `git pull` and `git merge main` locally.
313
313
  - ✅ **Ensure CI Checks Pass**: Verify all Ultralytics [Continuous Integration (CI)](https://docs.ultralytics.com/help/CI/) checks are passing. If any checks fail, please address the issues.
314
- - ✅ **Update Documentation**: Update the relevant [documentation](https://docs.ultralytics.com) for any new or modified features.
314
+ - ✅ **Update Documentation**: Update the relevant [documentation](https://docs.ultralytics.com/) for any new or modified features.
315
315
  - ✅ **Add Tests**: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
316
316
  - ✅ **Sign the CLA**: Please ensure you have signed our [Contributor License Agreement](https://docs.ultralytics.com/help/CLA/) if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
317
317
  - ✅ **Minimize Changes**: Limit your changes to the **minimum** necessary for your bug fix or feature addition. _"It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is."_ — Bruce Lee
318
318
 
319
- For more guidance, please refer to our [Contributing Guide](https://docs.ultralytics.com/help/contributing). Don’t hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀
319
+ For more guidance, please refer to our [Contributing Guide](https://docs.ultralytics.com/help/contributing/). Don’t hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀
320
320
  """
321
321
 
322
322
  if issue_type == "pull request":
actions/utils/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- from .common_utils import remove_html_comments
3
+ from .common_utils import REQUESTS_HEADERS, remove_html_comments
4
4
  from .github_utils import (
5
5
  GITHUB_API_URL,
6
6
  Action,
@@ -11,6 +11,7 @@ from .openai_utils import get_completion
11
11
 
12
12
  __all__ = (
13
13
  "GITHUB_API_URL",
14
+ "REQUESTS_HEADERS",
14
15
  "Action",
15
16
  "check_pypi_version",
16
17
  "get_completion",
@@ -7,6 +7,22 @@ from urllib import parse
7
7
 
8
8
  import requests
9
9
 
10
+ REQUESTS_HEADERS = {
11
+ "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",
12
+ "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",
13
+ "Accept-Language": "en-US,en;q=0.9,es;q=0.8,zh-CN;q=0.7,zh;q=0.6",
14
+ "Accept-Encoding": "gzip, deflate, br, zstd",
15
+ "sec-ch-ua": '"Chromium";v="132", "Google Chrome";v="132", "Not_A Brand";v="99"',
16
+ "sec-ch-ua-mobile": "?0",
17
+ "sec-ch-ua-platform": '"macOS"',
18
+ "Sec-Fetch-Site": "none",
19
+ "Sec-Fetch-Mode": "navigate",
20
+ "Sec-Fetch-User": "?1",
21
+ "Sec-Fetch-Dest": "document",
22
+ "Referer": "https://www.google.com/",
23
+ "Origin": "https://www.google.com/",
24
+ }
25
+
10
26
 
11
27
  def remove_html_comments(body: str) -> str:
12
28
  """Removes HTML comments from a string using regex pattern matching."""
@@ -20,8 +36,8 @@ def clean_url(url):
20
36
  return url
21
37
 
22
38
 
23
- def is_url(url, check=True, max_attempts=3, timeout=2):
24
- """Check if string is URL and check if URL exists."""
39
+ def is_url(url, session=None, check=True, max_attempts=3, timeout=2):
40
+ """Check if string is URL and optionally verify it exists."""
25
41
  allow_list = (
26
42
  "localhost",
27
43
  "127.0.0",
@@ -36,8 +52,6 @@ def is_url(url, check=True, max_attempts=3, timeout=2):
36
52
  "example",
37
53
  "mailto:",
38
54
  "github.com", # ignore GitHub links that may be private repos
39
- "kaggle.com", # blocks automated header requests
40
- "reddit.com", # blocks automated header requests
41
55
  "linkedin.com",
42
56
  "twitter.com",
43
57
  "x.com",
@@ -54,17 +68,20 @@ def is_url(url, check=True, max_attempts=3, timeout=2):
54
68
  if not result.scheme or not partition[0] or not partition[2]:
55
69
  return False
56
70
 
57
- # Check response
58
71
  if check:
72
+ requester = session if session else requests
73
+ bad_codes = {404, 410, 500, 502, 503, 504}
74
+ kwargs = {"timeout": timeout, "allow_redirects": True}
75
+ if not session:
76
+ kwargs["headers"] = REQUESTS_HEADERS
77
+
59
78
  for attempt in range(max_attempts):
60
79
  try:
61
- headers = {
62
- "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",
63
- "Accept": "*/*", # Wildcard for maximum compatibility
64
- "Accept-Language": "*", # Wildcard for any language
65
- "Accept-Encoding": "*", # Wildcard for any encoding
66
- }
67
- return requests.head(url, headers=headers, timeout=timeout, allow_redirects=True).status_code < 400
80
+ # Try HEAD first, then GET if needed
81
+ for method in (requester.head, requester.get):
82
+ if method(url, stream=method == requester.get, **kwargs).status_code not in bad_codes:
83
+ return True
84
+ return False
68
85
  except Exception:
69
86
  if attempt == max_attempts - 1: # last attempt
70
87
  return False
@@ -97,8 +114,9 @@ def check_links_in_string(text, verbose=True, return_bad=False):
97
114
 
98
115
  urls = set(map(clean_url, all_urls)) # remove extra characters and make unique
99
116
  # bad_urls = [x for x in urls if not is_url(x, check=True)] # single-thread
100
- with ThreadPoolExecutor(max_workers=16) as executor: # multi-thread
101
- bad_urls = [url for url, valid in zip(urls, executor.map(lambda x: not is_url(x, check=True), urls)) if valid]
117
+ with requests.Session() as session, ThreadPoolExecutor(max_workers=16) as executor:
118
+ session.headers.update(REQUESTS_HEADERS)
119
+ bad_urls = [url for url, valid in zip(urls, executor.map(lambda x: not is_url(x, session), urls)) if valid]
102
120
 
103
121
  passing = not bad_urls
104
122
  if verbose and not passing:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ultralytics-actions
3
- Version: 0.0.43
3
+ Version: 0.0.45
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>
@@ -0,0 +1,15 @@
1
+ actions/__init__.py,sha256=t0J0QOMCfEFOvtGGcdegXhIj1oEh6uO71pH7Wmr1_XE,742
2
+ actions/first_interaction.py,sha256=Oosw3GlXObF4RxYJG8haIjKXSV4MAx_uPXfMdRKY5qA,17851
3
+ actions/summarize_pr.py,sha256=Pfcm6ArfZfcMme48FcCGNmMwrFFlsG0czifhXHDKAlY,11166
4
+ actions/summarize_release.py,sha256=2D1IIeS4xrQNEJER3HItm5u9XvTL8hwGX_jWD2S8q1Y,8455
5
+ actions/update_markdown_code_blocks.py,sha256=DN6rrDw2VHXUTetrrg1SHlYDco9iaGOfQBKFORqbCBI,6362
6
+ actions/utils/__init__.py,sha256=WStdEAYROVnF0nubEOmrFLrejkRiMXIefA5O1ckfcFs,476
7
+ actions/utils/common_utils.py,sha256=eqrRyN1zMY66vADwKsKE0RHY7v_d_Spq5FHKchDl0h4,4836
8
+ actions/utils/github_utils.py,sha256=0h0Hz2tgUta61Ymn9YggRXBZ7aZdF5krKnX7Tj9jqRU,7068
9
+ actions/utils/openai_utils.py,sha256=U7DjxTdFGdhmWSE4_KIg1yPQdtrfG4GkbNZCgMw4_1Q,1822
10
+ ultralytics_actions-0.0.45.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
+ ultralytics_actions-0.0.45.dist-info/METADATA,sha256=hNeerqNDFs7VnlPCK1kffEFz3MP0enS4uToxwRLIsqc,10561
12
+ ultralytics_actions-0.0.45.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
13
+ ultralytics_actions-0.0.45.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
+ ultralytics_actions-0.0.45.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
+ ultralytics_actions-0.0.45.dist-info/RECORD,,
@@ -1,15 +0,0 @@
1
- actions/__init__.py,sha256=aAmI7gQULg-Fo2bzOA3w9hsgUKEn5tY-anSOCO8tTwk,742
2
- actions/first_interaction.py,sha256=n88RWru6ZXttFgmBXVMUBJEXoC9UVIV_TOlOWAR2pO4,17846
3
- actions/summarize_pr.py,sha256=Pfcm6ArfZfcMme48FcCGNmMwrFFlsG0czifhXHDKAlY,11166
4
- actions/summarize_release.py,sha256=2D1IIeS4xrQNEJER3HItm5u9XvTL8hwGX_jWD2S8q1Y,8455
5
- actions/update_markdown_code_blocks.py,sha256=DN6rrDw2VHXUTetrrg1SHlYDco9iaGOfQBKFORqbCBI,6362
6
- actions/utils/__init__.py,sha256=Jc--odEZWBrQmgI9C9rPdKIJNj8YW-mCJV71VWQyMCA,434
7
- actions/utils/common_utils.py,sha256=-gYRI0KJqG7Ht4JPGUxCYpHRKFfuSGi1lPr__F-SGuw,4086
8
- actions/utils/github_utils.py,sha256=0h0Hz2tgUta61Ymn9YggRXBZ7aZdF5krKnX7Tj9jqRU,7068
9
- actions/utils/openai_utils.py,sha256=U7DjxTdFGdhmWSE4_KIg1yPQdtrfG4GkbNZCgMw4_1Q,1822
10
- ultralytics_actions-0.0.43.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
11
- ultralytics_actions-0.0.43.dist-info/METADATA,sha256=5SL4G92EJxHtNqdGkNNoy7spr6ze5HrCoOpNK1TqXvE,10561
12
- ultralytics_actions-0.0.43.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
13
- ultralytics_actions-0.0.43.dist-info/entry_points.txt,sha256=GowvOFplj0C7JmsjbKcbpgLpdf2r921pcaOQkAHWZRA,378
14
- ultralytics_actions-0.0.43.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
15
- ultralytics_actions-0.0.43.dist-info/RECORD,,