auto-coder 0.1.197__py3-none-any.whl → 0.1.198__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.

Potentially problematic release.


This version of auto-coder might be problematic. Click here for more details.

@@ -98,6 +98,9 @@ class EnvInfo(pydantic.BaseModel):
98
98
  conda_env: Optional[str]
99
99
  virtualenv: Optional[str]
100
100
  has_bash: bool
101
+ default_shell: Optional[str]
102
+ home_dir: Optional[str]
103
+ cwd: Optional[str]
101
104
 
102
105
 
103
106
  def has_sufficient_content(file_content, min_line_count=10):
@@ -155,8 +158,19 @@ def detect_env() -> EnvInfo:
155
158
  )
156
159
 
157
160
  conda_env = os.environ.get("CONDA_DEFAULT_ENV")
158
-
159
161
  virtualenv = os.environ.get("VIRTUAL_ENV")
162
+
163
+ # Get default shell
164
+ if os_name == "win32":
165
+ default_shell = os.environ.get("COMSPEC", "cmd.exe")
166
+ else:
167
+ default_shell = os.environ.get("SHELL", "/bin/sh")
168
+
169
+ # Get home directory
170
+ home_dir = os.path.expanduser("~")
171
+
172
+ # Get current working directory
173
+ cwd = os.getcwd()
160
174
 
161
175
  has_bash = True
162
176
  try:
@@ -171,6 +185,9 @@ def detect_env() -> EnvInfo:
171
185
  conda_env=conda_env,
172
186
  virtualenv=virtualenv,
173
187
  has_bash=has_bash,
188
+ default_shell=default_shell,
189
+ home_dir=home_dir,
190
+ cwd=cwd,
174
191
  )
175
192
 
176
193
 
@@ -207,15 +207,17 @@ class CodeAutoMergeEditBlock:
207
207
  codes = self.get_edits(content)
208
208
  changes_to_make = []
209
209
  changes_made = False
210
- unmerged_blocks = []
210
+ unmerged_blocks = []
211
+ merged_blocks = []
211
212
 
212
213
  # First, check if there are any changes to be made
213
214
  file_content_mapping = {}
214
215
  for block in codes:
215
216
  file_path, head, update = block
216
217
  if not os.path.exists(file_path):
217
- changes_to_make.append((file_path, None, update))
218
+ changes_to_make.append((file_path, None, update))
218
219
  file_content_mapping[file_path] = update
220
+ merged_blocks.append((file_path, "", update, 1))
219
221
  changes_made = True
220
222
  else:
221
223
  if file_path not in file_content_mapping:
@@ -232,7 +234,8 @@ class CodeAutoMergeEditBlock:
232
234
  changes_to_make.append(
233
235
  (file_path, existing_content, new_content))
234
236
  file_content_mapping[file_path] = new_content
235
- changes_made = True
237
+ merged_blocks.append((file_path, head, update, 1))
238
+ changes_made = True
236
239
  else:
237
240
  # If the SEARCH BLOCK is not found exactly, then try to use
238
241
  # the similarity ratio to find the best matching block
@@ -247,7 +250,8 @@ class CodeAutoMergeEditBlock:
247
250
  (file_path, existing_content, new_content)
248
251
  )
249
252
  file_content_mapping[file_path] = new_content
250
- changes_made = True
253
+ merged_blocks.append((file_path, head, update, similarity))
254
+ changes_made = True
251
255
  else:
252
256
  unmerged_blocks.append(
253
257
  (file_path, head, update, similarity))
@@ -309,12 +313,14 @@ class CodeAutoMergeEditBlock:
309
313
  if self.args.request_id and not self.args.skip_events:
310
314
  # collect modified files
311
315
  event_data = []
312
- for file_path, old_block, new_block in changes_to_make:
316
+ for code in merged_blocks:
317
+ file_path, head, update, similarity = code
313
318
  event_data.append(
314
319
  {
315
- "file_path": file_path,
316
- "old_block": old_block,
317
- "new_block": new_block,
320
+ "file_path": file_path,
321
+ "head": head,
322
+ "update": update,
323
+ "similarity": similarity,
318
324
  }
319
325
  )
320
326
 
autocoder/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.197"
1
+ __version__ = "0.1.198"