ultralytics-actions 0.0.36__tar.gz → 0.0.37__tar.gz

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.
Files changed (22) hide show
  1. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/PKG-INFO +1 -1
  2. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/__init__.py +1 -1
  3. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/utils/common_utils.py +3 -2
  4. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/pyproject.toml +4 -0
  5. ultralytics_actions-0.0.37/tests/test_urls.py +98 -0
  6. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/PKG-INFO +1 -1
  7. ultralytics_actions-0.0.36/tests/test_urls.py +0 -15
  8. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/LICENSE +0 -0
  9. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/README.md +0 -0
  10. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/first_interaction.py +0 -0
  11. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/summarize_pr.py +0 -0
  12. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/summarize_release.py +0 -0
  13. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/update_markdown_code_blocks.py +0 -0
  14. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/utils/__init__.py +0 -0
  15. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/utils/github_utils.py +0 -0
  16. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/actions/utils/openai_utils.py +0 -0
  17. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/setup.cfg +0 -0
  18. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/SOURCES.txt +0 -0
  19. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  20. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/entry_points.txt +0 -0
  21. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/requires.txt +0 -0
  22. {ultralytics_actions-0.0.36 → ultralytics_actions-0.0.37}/ultralytics_actions.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.36
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>
@@ -22,4 +22,4 @@
22
22
  # ├── test_summarize_pr.py
23
23
  # └── ...
24
24
 
25
- __version__ = "0.0.36"
25
+ __version__ = "0.0.37"
@@ -50,7 +50,8 @@ def is_url(url, check=True, max_attempts=3, timeout=2):
50
50
 
51
51
  # Check structure
52
52
  result = parse.urlparse(url)
53
- if not all([result.scheme, result.netloc]):
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]:
54
55
  return False
55
56
 
56
57
  # Check response
@@ -82,7 +83,7 @@ def check_links_in_string(text, verbose=True, return_bad=False):
82
83
  r"(" # Start capturing group for plaintext URLs
83
84
  r"(?:https?://)?" # Optional http:// or https://
84
85
  r"(?:www\.)?" # Optional www.
85
- r"[\w.-]+" # Domain name and subdomains
86
+ r"(?:[\w.-]+)?" # Optional domain name and subdomains
86
87
  r"\.[a-zA-Z]{2,}" # TLD
87
88
  r"(?:/[^\s\"')\]]*)?" # Optional path
88
89
  r")"
@@ -95,6 +95,10 @@ packages = { find = { where = ["."], include = ["actions", "actions.*"] } }
95
95
  [tool.setuptools.dynamic]
96
96
  version = { attr = "actions.__version__" }
97
97
 
98
+ [tool.pytest.ini_options]
99
+ addopts = "--doctest-modules --durations=30 --color=yes"
100
+ norecursedirs = [".git", "dist", "build"]
101
+
98
102
  [tool.ruff]
99
103
  line-length = 120
100
104
 
@@ -0,0 +1,98 @@
1
+ # Ultralytics Actions 🚀, AGPL-3.0 license
2
+ # Continuous Integration (CI) GitHub Actions tests
3
+
4
+ import pytest
5
+
6
+ from actions.utils.common_utils import check_links_in_string, is_url
7
+
8
+ URLS = [
9
+ "https://docs.ultralytics.com/help/CLA/",
10
+ "https://docs.ultralytics.com/help/contributing",
11
+ "https://docs.ultralytics.com",
12
+ "https://ultralytics.com",
13
+ "https://github.com/ultralytics/ultralytics",
14
+ ]
15
+
16
+
17
+ @pytest.fixture
18
+ def verbose():
19
+ """Fixture that provides a verbose logging utility for detailed output during testing and debugging."""
20
+ return False # Set False to suppress print statements during tests
21
+
22
+
23
+ def test_is_url():
24
+ """Test each URL using is_url function."""
25
+ for url in URLS:
26
+ assert is_url(url), f"URL check failed: {url}"
27
+
28
+
29
+ def test_html_links(verbose):
30
+ """Tests the validity of URLs within HTML anchor tags and returns any invalid URLs found."""
31
+ text = "Visit <a href='https://err.com'>our site</a> or <a href=\"http://test.org\">test site</a>"
32
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
33
+ assert result is False
34
+ assert set(urls) == {"https://err.com", "http://test.org"}
35
+
36
+
37
+ def test_markdown_links(verbose):
38
+ """Validates URLs in markdown links within a given text using check_links_in_string."""
39
+ text = "Check [Example](https://err.com) or [Test](http://test.org)"
40
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
41
+ assert result is False
42
+ assert set(urls) == {"https://err.com", "http://test.org"}
43
+
44
+
45
+ def test_mixed_formats(verbose):
46
+ """Tests URL detection in mixed text formats (HTML, Markdown, plain text) using check_links_in_string."""
47
+ text = "A <a href='https://1.com'>link</a> and [markdown](https://2.org) and https://3.net"
48
+ result, urls = check_links_in_string(text, return_bad=True)
49
+ assert result is False
50
+ assert set(urls) == {"https://1.com", "https://2.org", "https://3.net"}
51
+
52
+
53
+ def test_duplicate_urls(verbose):
54
+ """Tests detection of duplicate URLs in various text formats using the check_links_in_string function."""
55
+ text = "Same URL: https://err.com and <a href='https://err.com'>link</a>"
56
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
57
+ assert result is False
58
+ assert set(urls) == {"https://err.com"}
59
+
60
+
61
+ def test_no_urls(verbose):
62
+ """Tests that a string with no URLs returns True when checked using the check_links_in_string function."""
63
+ text = "This text contains no URLs."
64
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
65
+ assert result is True
66
+ assert not set(urls)
67
+
68
+
69
+ def test_invalid_urls(verbose):
70
+ """Test invalid URLs."""
71
+ text = "Invalid URL: http://.com"
72
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
73
+ assert result is False
74
+ assert set(urls) == {"http://.com"}
75
+
76
+
77
+ def test_urls_with_paths_and_queries(verbose):
78
+ """Test URLs with paths and query parameters to ensure they are correctly identified and validated."""
79
+ text = "Complex URL: https://err.com/path?query=value#fragment"
80
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
81
+ assert result is False
82
+ assert set(urls) == {"https://err.com/path?query=value#fragment"}
83
+
84
+
85
+ def test_urls_with_different_tlds(verbose):
86
+ """Test URLs with various top-level domains (TLDs) to ensure correct identification and handling."""
87
+ text = "Different TLDs: https://err.ml https://err.org https://err.net https://err.io https://err.ai"
88
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
89
+ assert result is False
90
+ assert set(urls) == {"https://err.ml", "https://err.org", "https://err.net", "https://err.io", "https://err.ai"}
91
+
92
+
93
+ def test_case_sensitivity(verbose):
94
+ """Tests URL case sensitivity by verifying that URLs with different cases are correctly identified and handled."""
95
+ text = "Case test: HTTPS://err.com and https://err.com"
96
+ result, urls = check_links_in_string(text, verbose, return_bad=True)
97
+ assert result is False
98
+ assert set(urls) == {"https://err.com"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics-actions
3
- Version: 0.0.36
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>
@@ -1,15 +0,0 @@
1
- from actions.utils.common_utils import is_url
2
-
3
- URLS = [
4
- "https://docs.ultralytics.com/help/CLA/",
5
- "https://docs.ultralytics.com/help/contributing",
6
- "https://docs.ultralytics.com",
7
- "https://ultralytics.com",
8
- "https://github.com/ultralytics/ultralytics",
9
- ]
10
-
11
-
12
- def test_urls():
13
- """Test each URL using is_url function."""
14
- for url in URLS:
15
- assert is_url(url), f"URL check failed: {url}"