ultralytics-actions 0.0.74__py3-none-any.whl → 0.0.75__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.74"
25
+ __version__ = "0.0.75"
@@ -83,72 +83,70 @@ def update_file(file_path, prefix, block_start, block_end, base_header):
83
83
  else:
84
84
  formatted_header = f"# {base_header}\n"
85
85
 
86
- # Keep shebang line if it exists
87
- start_idx = 0
88
- if lines and lines[0].startswith("#!"):
89
- start_idx = 1
90
-
91
- modified = False
92
- new_lines = lines[:start_idx]
93
- remaining_lines = lines[start_idx:]
94
-
95
- # If first line is already the exact header we want
96
- if remaining_lines and remaining_lines[0] == formatted_header:
97
- # Check if spacing is correct
98
- new_lines.append(remaining_lines[0])
99
- if len(remaining_lines) > 1:
100
- second_line = remaining_lines[1].strip()
101
- if second_line == "" or second_line in ["#", "//", "/*", "*", "<!--", "%"]:
102
- # Spacing is correct, append the rest
103
- new_lines.extend(remaining_lines[1:])
104
- else:
105
- # Add blank line
106
- new_lines.append("\n")
107
- new_lines.extend(remaining_lines[1:])
108
- modified = True
109
- else:
110
- # Only header exists, no need for blank line
111
- pass
112
- # Check if first line has "Ultralytics " but is not the exact header
113
- elif remaining_lines and "Ultralytics " in remaining_lines[0] and remaining_lines[0] != formatted_header:
114
- # Replace with proper header
115
- new_lines.append(formatted_header)
116
- modified = True
117
-
118
- # Check if second line is blank or commented
119
- if len(remaining_lines) > 1:
120
- second_line = remaining_lines[1].strip()
121
- if second_line == "" or second_line in ["#", "//", "/*", "*", "<!--", "%"]:
122
- # Keep existing blank/comment line
123
- new_lines.append(remaining_lines[1])
124
- new_lines.extend(remaining_lines[2:])
125
- else:
126
- # Add blank line
127
- new_lines.append("\n")
128
- new_lines.extend(remaining_lines[1:])
129
- else:
130
- # Only header line, no need for blank line after
131
- pass
132
- # No header found, add it
86
+ # Save original content for comparison
87
+ original_content = "".join(lines)
88
+
89
+ # Create two separate line collections:
90
+ # 1. prefix_lines: Special first line + header + blank line
91
+ # 2. content_lines: The actual file content (excluding header)
92
+ prefix_lines = []
93
+
94
+ # Check for special first line
95
+ special_line_index = -1
96
+ if lines and (lines[0].startswith("#!") or lines[0].startswith("<?xml") or lines[0].startswith("<!DOCTYPE")):
97
+ special_line_index = 0
98
+ prefix_lines.append(lines[0])
99
+
100
+ # Find existing header
101
+ header_index = -1
102
+ start_idx = special_line_index + 1 if special_line_index >= 0 else 0
103
+ end_idx = min(start_idx + 5, len(lines)) # Look in first few lines
104
+
105
+ for i in range(start_idx, end_idx):
106
+ if "Ultralytics " in lines[i]:
107
+ header_index = i
108
+ break
109
+
110
+ # Add the formatted header to prefix lines
111
+ prefix_lines.append(formatted_header)
112
+
113
+ # Determine where content starts
114
+ if header_index >= 0:
115
+ # Content starts after existing header
116
+ content_start = header_index + 1
117
+ # Skip blank line after header if present
118
+ if content_start < len(lines) and not lines[content_start].strip():
119
+ content_start += 1
120
+ content_lines = lines[content_start:]
133
121
  else:
134
- # Add header at the beginning
135
- new_lines.append(formatted_header)
136
- # Add blank line if content follows
137
- if remaining_lines and remaining_lines[0].strip():
138
- new_lines.append("\n")
139
- new_lines.extend(remaining_lines)
140
- modified = True
141
-
142
- if modified:
143
- try:
144
- with open(file_path, "w", encoding="utf-8") as f:
145
- f.writelines(new_lines)
146
- return True
147
- except Exception as e:
148
- print(f"Error writing {file_path}: {e}")
149
- return False
150
-
151
- return False
122
+ # No header found
123
+ if special_line_index >= 0:
124
+ # Content starts after special line
125
+ content_lines = lines[special_line_index + 1 :]
126
+ else:
127
+ # No special line, content starts at beginning
128
+ content_lines = lines
129
+
130
+ # Add blank line before content if first content line isn't already blank
131
+ if content_lines and content_lines[0].strip():
132
+ prefix_lines.append("\n")
133
+
134
+ # Combine prefix lines and content lines
135
+ final_lines = prefix_lines + content_lines
136
+
137
+ # Check if content changed
138
+ new_content = "".join(final_lines)
139
+ if new_content == original_content:
140
+ return False
141
+
142
+ # Write updated content
143
+ try:
144
+ with open(file_path, "w", encoding="utf-8") as f:
145
+ f.writelines(final_lines)
146
+ return True
147
+ except Exception as e:
148
+ print(f"Error writing {file_path}: {e}")
149
+ return False
152
150
 
153
151
 
154
152
  def main(*args, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-actions
3
- Version: 0.0.74
3
+ Version: 0.0.75
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,17 +1,17 @@
1
- actions/__init__.py,sha256=nQOnE6gP5I5V0dZ7fjU0YZfiWQE1ZFN2wmcykmkBZjc,742
1
+ actions/__init__.py,sha256=ydPwQPnjTrOGpUcAFNDo38-7IPTfXGKKfexNWuU6JWk,742
2
2
  actions/dispatch_actions.py,sha256=vbA4w_B8vMXMen__ck2WoDsUFCELjXOQbpLzZCmqTXg,4240
3
3
  actions/first_interaction.py,sha256=whphdBrWkcWRt6RgOeK2dUoGq3aBTqttQdokxVjkye4,16309
4
4
  actions/summarize_pr.py,sha256=NCaDSbw4PVoRbPJzji_Ua2HadI2pn7QOE_dy3VK9_cc,10463
5
5
  actions/summarize_release.py,sha256=OncODHx7XsmB-nPf-B1tnxUTcaJx6hM4JAMa9frypzM,7922
6
- actions/update_file_headers.py,sha256=Il1k6mawv68Hxp5mQLzr2Unrx8jjZp0YxTmMokLS-NQ,6289
6
+ actions/update_file_headers.py,sha256=jXXV-mdxAoV_bF2Ot3YR-0Z7kDz5V6WB_L0OJME7Ykw,6013
7
7
  actions/update_markdown_code_blocks.py,sha256=9PL7YIQfApRNAa0que2hYHv7umGZTZoHlblesB0xFj4,8587
8
8
  actions/utils/__init__.py,sha256=TXYvhFgDeAnosePM4jfOrEd6PlC7tWC-WMOgCB_T6Tw,728
9
9
  actions/utils/common_utils.py,sha256=2eNwGJFigl9bBXcyWzdr8mr97Lrx7zFKWIFYugZcUJw,11736
10
10
  actions/utils/github_utils.py,sha256=gdObDzOGmoLl8LXJ-fza7Dr2qLKfDsX2HbpcyFBEMtE,10097
11
11
  actions/utils/openai_utils.py,sha256=09kW4K2LOc6KsWz5tijf2Piinhu3PIKPDVkRC3KyIxU,2943
12
- ultralytics_actions-0.0.74.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
13
- ultralytics_actions-0.0.74.dist-info/METADATA,sha256=NYGb5bD22MoR2FJRxB08c49pSahA5kwGhevZFQziX8M,11638
14
- ultralytics_actions-0.0.74.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
15
- ultralytics_actions-0.0.74.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
16
- ultralytics_actions-0.0.74.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
17
- ultralytics_actions-0.0.74.dist-info/RECORD,,
12
+ ultralytics_actions-0.0.75.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
13
+ ultralytics_actions-0.0.75.dist-info/METADATA,sha256=typ-_UzWp0Afv9bnPlYsstJcaOZQ8TzHfXSTVgG1HSM,11638
14
+ ultralytics_actions-0.0.75.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
15
+ ultralytics_actions-0.0.75.dist-info/entry_points.txt,sha256=rvqr6Juj7lCJL1DQLwMmOrA8R2Q8tyR_dvCe0mYuJ8s,441
16
+ ultralytics_actions-0.0.75.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
17
+ ultralytics_actions-0.0.75.dist-info/RECORD,,