ziya 0.1.43__py3-none-any.whl → 0.1.44__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 ziya might be problematic. Click here for more details.

app/utils/code_util.py CHANGED
@@ -130,7 +130,7 @@ def correct_git_diff(git_diff: str, original_file_path: str) -> str:
130
130
  corrected_diff = '\n'.join(corrected_lines)
131
131
  return corrected_diff
132
132
 
133
- def _find_correct_start_line(original_content: list, hunk_lines: list) -> int:
133
+ def _find_correct_old_start_line(original_content: list, hunk_lines: list) -> int:
134
134
  """
135
135
  Finds the correct starting line number in the original file by matching context and deleted lines.
136
136
 
@@ -149,15 +149,15 @@ def _find_correct_start_line(original_content: list, hunk_lines: list) -> int:
149
149
  """
150
150
  # Extract context and deleted lines from the hunk
151
151
  if not original_content:
152
- # Creating a new file.
153
- return 1
152
+ # Creating a new file, should start with @@ -0,0 +1,N @@
153
+ return 0
154
154
 
155
155
  if len(hunk_lines) < 3:
156
156
  error_msg = (
157
157
  f"Invalid git diff format: Expected at least 2 lines in the hunk, but got {len(hunk_lines)} lines.\n"
158
- "Hunk content:\n{}".format('\n'.join(hunk_lines)))
158
+ + "Hunk content:\n{}".format('\n'.join(hunk_lines)))
159
159
  logger.error(error_msg)
160
- raise RuntimeError("git diff file is not valid.")
160
+ raise RuntimeError("Invalid git diff format.")
161
161
 
162
162
  context_and_deleted = []
163
163
  for line in hunk_lines:
@@ -240,9 +240,9 @@ def _process_hunk_with_original_content(lines: list, start_index: int, cumulativ
240
240
  line_index += 1
241
241
 
242
242
  # Find the correct start_line_old by matching context and deleted lines
243
- start_line_old = _find_correct_start_line(original_content, hunk_lines)
243
+ start_line_old = _find_correct_old_start_line(original_content, hunk_lines)
244
244
 
245
- # Now process hunk_lines to calculate counts
245
+ # Calculate counts for the hunk lines
246
246
  for hunk_line in hunk_lines:
247
247
  if hunk_line.startswith('+') and not hunk_line.startswith('+++'):
248
248
  actual_count_new += 1
@@ -253,8 +253,15 @@ def _process_hunk_with_original_content(lines: list, start_index: int, cumulativ
253
253
  actual_count_old += 1
254
254
  actual_count_new += 1
255
255
 
256
- # Adjust start_line_new considering previous line offsets
257
- corrected_start_line_new = start_line_old + cumulative_line_offset
256
+ # Special handling for new file creation
257
+ if start_line_old == 0:
258
+ # For new files:
259
+ # count_old should be 0
260
+ actual_count_old = 0
261
+ corrected_start_line_new = 1
262
+ else:
263
+ # For existing files, adjust start_line_new considering previous line offsets
264
+ corrected_start_line_new = start_line_old + cumulative_line_offset
258
265
 
259
266
  # Calculate line offset for subsequent hunks
260
267
  line_offset = actual_count_new - actual_count_old
@@ -292,24 +299,3 @@ def _format_hunk_header(start_old: int, count_old: int, start_new: int, count_ne
292
299
  if count_new != 1:
293
300
  new_part += f',{count_new}'
294
301
  return f'@@ {old_part} {new_part} @@'
295
-
296
-
297
-
298
- if __name__ == '__main__':
299
- # TODO: Create unit test and move these code to unit test
300
- diff = """\
301
- diff --git a/file.txt b/file.txt
302
- index e69de29..4b825dc 100644
303
- --- a/file.txt
304
- +++ b/file.txt
305
- @@ -1,5 +1,5 @@
306
- Line one
307
- +Line two
308
- Line three
309
- Line four
310
- Line five
311
- @@ -10,2 +10,2 @@
312
- Line ten
313
- -Line eleven
314
- +Line eleven modified"""
315
- print(correct_git_diff(diff,""))
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ziya"
3
- version = "0.1.43"
3
+ version = "0.1.44"
4
4
  description = ""
5
5
  authors = ["Vishnu Krishnaprasad <vishnukool@gmail.com>"]
6
6
  readme = "README.md"
@@ -25,6 +25,9 @@ langchain-cli = ">=0.0.15"
25
25
  pydevd-pycharm = "^243.18137.19"
26
26
  langchain-community = "^0.3.1"
27
27
 
28
+ [tool.poetry.group.dev.dependencies]
29
+ pytest = "^8.3.3"
30
+
28
31
  [build-system]
29
32
  requires = ["poetry-core"]
30
33
  build-backend = "poetry.core.masonry.api"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ziya
3
- Version: 0.1.43
3
+ Version: 0.1.44
4
4
  Summary:
5
5
  Author: Vishnu Krishnaprasad
6
6
  Author-email: vishnukool@gmail.com
@@ -5,14 +5,14 @@ app/agents/prompts.py,sha256=Hm0TJcABRgnpV2bbBobigPznxeLVhyRLEHm7maQ9CEE,3873
5
5
  app/main.py,sha256=5bZk9PUm00bdk_w2gJTWJVQFcJ13WU3eN16vFU1AMk0,4303
6
6
  app/server.py,sha256=Ii_JFygHdMmxYsEtVm2L0vRRMINWgim3_cWLmVha8mg,4704
7
7
  app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- app/utils/code_util.py,sha256=EpRmWs36A4eGoZhTRwFymfRcwvu4hQj6S-lAkVi7uto,12148
8
+ app/utils/code_util.py,sha256=xE-MI8Ayv31_dsLhDe2ncPZLa7beyHcXYfwgvm-xlP4,12042
9
9
  app/utils/directory_util.py,sha256=2zxsSxSOZKesjhgjF3KguY__fC9XkjxHHnDbcxtnhXk,2762
10
10
  app/utils/gitignore_parser.py,sha256=Li3hQd60eclIuN2qxn8-NQ5sxRyMcnS88DFUxVHdx-A,7487
11
11
  app/utils/langchain_validation_util.py,sha256=RgmKayKMApvUA7SPF_DrBAcYdIzzLUVJfnOwTSc1Eug,527
12
12
  app/utils/logging_utils.py,sha256=8JEcc1t7L-a0G4HLmM8zFydNNSOd5l2-gkTxviLQUns,280
13
13
  app/utils/print_tree_util.py,sha256=O4Rb-GS8UODxfH7Z6bZGsr-opG6QLmvdaU1im5kh4IA,1419
14
14
  app/utils/version_util.py,sha256=NcvMWIImJDcO9K5OMX6jJD4q6Zb8Y117Mu8sWIkhxEc,631
15
- pyproject.toml,sha256=ZAbpqTqEaeD5pSQ6CoGYy_67IxYTpORqEfNa78HWvVI,878
15
+ pyproject.toml,sha256=WBtOx4nV8fhMkpOspzzfWXbb1F-KUJGa6LI3OMZ06_w,934
16
16
  scripts.py,sha256=70BOvYoboMhl3Bxjy73m1ozmI8UV8JZVyi2RwUptkK8,809
17
17
  templates/asset-manifest.json,sha256=CWTbaK4qJuG_uzscwg8HZ9leGVx06vlQKAVEDcLvtqo,1157
18
18
  templates/favicon.ico,sha256=HgB8xAZdDHFK2lODUsp2H_Dds_i14pnpydx7NEJrNrU,15086
@@ -30,8 +30,8 @@ templates/static/media/fa-solid-900.4d986b00ff9ca3828fbd.woff2,sha256=rhfBavvqIW
30
30
  templates/static/media/fa-solid-900.bacd5de623fb563b961a.ttf,sha256=tJkNDQxfXTjWLpNu6hIGdOWEx-6o3O44qXXAz5o3U5s,420332
31
31
  templates/static/media/fa-v4compatibility.c8e090db312b0bea2aa2.ttf,sha256=_49SX7BQxdJFGczI9XI9hbLlHt0_m8ZUivVa663U8mk,10832
32
32
  templates/static/media/fa-v4compatibility.cf7f5903d06b79ad60f1.woff2,sha256=x6hp-sopnRW-EKAfGdB2WnxNRtiSLZuTFyNcHkpvCYI,4792
33
- ziya-0.1.43.dist-info/LICENSE,sha256=8CfErGEG13yY1Z-CDlIhAQawX2KOv-QI_2Ge2z6x8SU,1064
34
- ziya-0.1.43.dist-info/METADATA,sha256=CeyrpIVxVI2L3s48rtCx8gxKyUfEiN17Y5AHvMHz1Mo,2867
35
- ziya-0.1.43.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
- ziya-0.1.43.dist-info/entry_points.txt,sha256=6-KUolj5XXeOPVCJGTJgUL_3lDVGxG-YtK5BTvFPyBg,147
37
- ziya-0.1.43.dist-info/RECORD,,
33
+ ziya-0.1.44.dist-info/LICENSE,sha256=8CfErGEG13yY1Z-CDlIhAQawX2KOv-QI_2Ge2z6x8SU,1064
34
+ ziya-0.1.44.dist-info/METADATA,sha256=O6uEKTh4y79uiZDJTl6w3PmqtmfWkDTHIv4x7EzKcyY,2867
35
+ ziya-0.1.44.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
36
+ ziya-0.1.44.dist-info/entry_points.txt,sha256=6-KUolj5XXeOPVCJGTJgUL_3lDVGxG-YtK5BTvFPyBg,147
37
+ ziya-0.1.44.dist-info/RECORD,,
File without changes
File without changes