ultralytics-actions 0.0.81__tar.gz → 0.0.83__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 (34) hide show
  1. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/PKG-INFO +1 -1
  2. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/__init__.py +1 -1
  3. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/update_file_headers.py +0 -2
  4. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/utils/github_utils.py +6 -1
  5. ultralytics_actions-0.0.83/tests/test_file_headers.py +114 -0
  6. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/PKG-INFO +1 -1
  7. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/SOURCES.txt +1 -0
  8. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/LICENSE +0 -0
  9. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/README.md +0 -0
  10. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/dispatch_actions.py +0 -0
  11. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/first_interaction.py +0 -0
  12. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/summarize_pr.py +0 -0
  13. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/summarize_release.py +0 -0
  14. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/update_markdown_code_blocks.py +0 -0
  15. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/utils/__init__.py +0 -0
  16. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/utils/common_utils.py +0 -0
  17. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/actions/utils/openai_utils.py +0 -0
  18. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/pyproject.toml +0 -0
  19. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/setup.cfg +0 -0
  20. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_cli_commands.py +0 -0
  21. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_common_utils.py +0 -0
  22. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_dispatch_actions.py +0 -0
  23. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_first_interaction.py +0 -0
  24. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_github_utils.py +0 -0
  25. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_init.py +0 -0
  26. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_openai_utils.py +0 -0
  27. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_summarize_pr.py +0 -0
  28. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_summarize_release.py +0 -0
  29. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_update_markdown_codeblocks.py +0 -0
  30. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/tests/test_urls.py +0 -0
  31. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/dependency_links.txt +0 -0
  32. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/entry_points.txt +0 -0
  33. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/requires.txt +0 -0
  34. {ultralytics_actions-0.0.81 → ultralytics_actions-0.0.83}/ultralytics_actions.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.81
3
+ Version: 0.0.83
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.81"
25
+ __version__ = "0.0.83"
@@ -39,8 +39,6 @@ COMMENT_MAP = {
39
39
  # HTML/XML style
40
40
  ".html": (None, "<!-- ", " -->"),
41
41
  ".xml": (None, "<!-- ", " -->"), # Android XML
42
- # MATLAB style
43
- ".m": ("% ", None, None),
44
42
  }
45
43
 
46
44
  # Ignore these Paths (do not update their headers)
@@ -115,7 +115,12 @@ class Action:
115
115
  """Retrieves the diff content for a specified pull request."""
116
116
  url = f"{GITHUB_API_URL}/repos/{self.repository}/pulls/{self.pr.get('number')}"
117
117
  response = self.get(url, headers=self.headers_diff)
118
- return response.text if response.status_code == 200 else ""
118
+ if response.status_code == 200:
119
+ return response.text
120
+ elif response.status_code == 406:
121
+ return "**ERROR: DIFF TOO LARGE - PR exceeds GitHub's 20,000 line limit, unable to retrieve diff."
122
+ else:
123
+ return "**ERROR: UNABLE TO RETRIEVE DIFF."
119
124
 
120
125
  def get_repo_data(self, endpoint: str) -> dict:
121
126
  """Fetches repository data from a specified endpoint."""
@@ -0,0 +1,114 @@
1
+ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
+
3
+ # tests/test_update_file_headers.py
4
+ """Tests for the file headers update functionality."""
5
+
6
+ from pathlib import Path
7
+ from tempfile import TemporaryDirectory
8
+
9
+ from actions.update_file_headers import COMMENT_MAP, IGNORE_PATHS, update_file
10
+
11
+
12
+ def test_update_file_python():
13
+ """Test updating Python file headers."""
14
+ with TemporaryDirectory() as tmp_dir:
15
+ # Create a test Python file
16
+ test_file = Path(tmp_dir) / "test.py"
17
+ test_file.write_text("print('Hello World')\n")
18
+
19
+ # Update file
20
+ result = update_file(test_file, "# ", None, None, "Ultralytics 🚀 Test Header")
21
+
22
+ # Check results
23
+ assert result is True
24
+ content = test_file.read_text()
25
+ assert content.startswith("# Ultralytics 🚀 Test Header\n\n")
26
+ assert "print('Hello World')" in content
27
+
28
+
29
+ def test_update_file_cpp():
30
+ """Test updating C++ file headers."""
31
+ with TemporaryDirectory() as tmp_dir:
32
+ # Create a test C++ file
33
+ test_file = Path(tmp_dir) / "test.cpp"
34
+ test_file.write_text("#include <iostream>\n\nint main() {\n return 0;\n}\n")
35
+
36
+ # Update file
37
+ result = update_file(test_file, "// ", "/* ", " */", "Ultralytics 🚀 Test Header")
38
+
39
+ # Check results
40
+ assert result is True
41
+ content = test_file.read_text()
42
+ assert content.startswith("// Ultralytics 🚀 Test Header\n\n")
43
+ assert "#include <iostream>" in content
44
+
45
+
46
+ def test_update_file_with_existing_header():
47
+ """Test updating file with existing header."""
48
+ with TemporaryDirectory() as tmp_dir:
49
+ # Create a test file with existing header
50
+ test_file = Path(tmp_dir) / "test.py"
51
+ test_file.write_text("# Ultralytics 🚀 AGPL-3.0 License\n\ndef main():\n pass\n")
52
+
53
+ # Update file
54
+ result = update_file(test_file, "# ", None, None, "Ultralytics 🚀 Test Header")
55
+
56
+ # Check results
57
+ assert result is True
58
+ content = test_file.read_text()
59
+ assert content.startswith("# Ultralytics 🚀 Test Header\n\n")
60
+ assert "def main():" in content
61
+
62
+
63
+ def test_update_file_with_shebang():
64
+ """Test updating file with shebang."""
65
+ with TemporaryDirectory() as tmp_dir:
66
+ # Create a test file with shebang
67
+ test_file = Path(tmp_dir) / "test.py"
68
+ test_file.write_text("#!/usr/bin/env python3\n\nprint('Hello World')\n")
69
+
70
+ # Update file
71
+ result = update_file(test_file, "# ", None, None, "Ultralytics 🚀 Test Header")
72
+
73
+ # Check results
74
+ assert result is True
75
+ content = test_file.read_text()
76
+ assert content.startswith("#!/usr/bin/env python3\n# Ultralytics 🚀 Test Header\n\n")
77
+ assert "print('Hello World')" in content
78
+
79
+
80
+ def test_update_file_no_changes():
81
+ """Test updating file with no changes needed."""
82
+ with TemporaryDirectory() as tmp_dir:
83
+ # Create a test file with correct header
84
+ test_file = Path(tmp_dir) / "test.py"
85
+ test_file.write_text("# Ultralytics 🚀 Test Header\n\nprint('Hello World')\n")
86
+
87
+ # Update file
88
+ result = update_file(test_file, "# ", None, None, "Ultralytics 🚀 Test Header")
89
+
90
+ # Check results
91
+ assert result is False # No changes made
92
+
93
+
94
+ def test_comment_map_coverage():
95
+ """Test that all supported file extensions have defined comment styles."""
96
+ # Check for a few key extensions
97
+ assert ".py" in COMMENT_MAP
98
+ assert ".cpp" in COMMENT_MAP
99
+ assert ".js" in COMMENT_MAP
100
+ assert ".html" in COMMENT_MAP
101
+
102
+ # Check comment style format
103
+ for ext, (prefix, block_start, block_end) in COMMENT_MAP.items():
104
+ assert isinstance(ext, str)
105
+ assert prefix is None or isinstance(prefix, str)
106
+ assert block_start is None or isinstance(block_start, str)
107
+ assert block_end is None or isinstance(block_end, str)
108
+
109
+
110
+ def test_ignore_paths():
111
+ """Test that the ignore paths list exists and contains expected entries."""
112
+ assert isinstance(IGNORE_PATHS, set)
113
+ assert ".git" in IGNORE_PATHS
114
+ assert "__pycache__" in IGNORE_PATHS
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.81
3
+ Version: 0.0.83
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>
@@ -15,6 +15,7 @@ actions/utils/openai_utils.py
15
15
  tests/test_cli_commands.py
16
16
  tests/test_common_utils.py
17
17
  tests/test_dispatch_actions.py
18
+ tests/test_file_headers.py
18
19
  tests/test_first_interaction.py
19
20
  tests/test_github_utils.py
20
21
  tests/test_init.py