codeplain 0.1.8__py3-none-any.whl → 0.2.0__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.
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/METADATA +1 -1
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/RECORD +7 -6
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/top_level.txt +1 -0
- diff_utils.py +32 -0
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/WHEEL +0 -0
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/entry_points.txt +0 -0
- {codeplain-0.1.8.dist-info → codeplain-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
codeplain_REST_api.py,sha256=qfzUw9v0-NKII4ibw3vqSBrCeU2WP4RcrrEti43F3zs,18400
|
|
2
2
|
concept_utils.py,sha256=vwSY4-FmxyqaDBxhntYzqG8t9pXvAWwiULP0DYQI32o,7905
|
|
3
|
+
diff_utils.py,sha256=AjiQlqo5pRos_8hVXZo5yBurl5BzSrTMGrQv4dCtRCg,1198
|
|
3
4
|
event_bus.py,sha256=sduIR3bgIbxAbLhwKd8Gx9YN9gzaeqy9-mNupS04aKw,1759
|
|
4
5
|
file_utils.py,sha256=4BIxzsteZQOaK-efkvQcoaIfYydsQNFR6elpsxJgXLQ,11591
|
|
5
6
|
git_utils.py,sha256=gTRps6RIzJJkyy9amaDxP38FPoxYulZViBWr9V0IPQg,12414
|
|
@@ -21,7 +22,7 @@ plain_modules.py,sha256=iDqqamtix5KahMC_v-vfQ7yndugmqtBW1z6XxTB4x6w,4876
|
|
|
21
22
|
plain_spec.py,sha256=zC-VOb_UJOs8OxtEiwQJuonw7Lkmbi7YHyFvvCvUZNo,13529
|
|
22
23
|
spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
|
|
23
24
|
system_config.py,sha256=mgHLn-CRHLO9Y9vKyI_eFBreY_YhFad-ctZgBYp-rIg,1777
|
|
24
|
-
codeplain-0.
|
|
25
|
+
codeplain-0.2.0.dist-info/licenses/LICENSE,sha256=wsFi5dpbJurnRNfBj8q2RCcF3ryrmdRIfxc3lPcmc4c,1069
|
|
25
26
|
config/__init__.py,sha256=beYSsJWmBNHDP5rYmVDouqgEeP3t1lkkepbXJ-oq0F8,37
|
|
26
27
|
config/system_config.yaml,sha256=bB5Th5jxgXFyaIvceUPID1ReebMMXsyMibV4gtu9sWQ,1148
|
|
27
28
|
render_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -64,8 +65,8 @@ tui/plain2code_tui.py,sha256=7agVU0NnaCuF1LuOSEmjx-XfEOQ6HHr1HlWe_b1Tses,11695
|
|
|
64
65
|
tui/state_handlers.py,sha256=HbjgaV-9xGhp3E-3X114zOqPkeNcCjT-R1PbVRxVdso,12674
|
|
65
66
|
tui/styles.css,sha256=Umm2TLePmywizZGV4Nd8UezZRiK5pFyibYRbpRvGqbs,3056
|
|
66
67
|
tui/widget_helpers.py,sha256=VJorEM2PjRBzN-jIDmKJPolFgo2d8-2NmTumgC5xeNo,5229
|
|
67
|
-
codeplain-0.
|
|
68
|
-
codeplain-0.
|
|
69
|
-
codeplain-0.
|
|
70
|
-
codeplain-0.
|
|
71
|
-
codeplain-0.
|
|
68
|
+
codeplain-0.2.0.dist-info/METADATA,sha256=U3zqfTbWbKKPngFYvsjVSItzsvMhS3rM7imS2NfQcA0,4300
|
|
69
|
+
codeplain-0.2.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
70
|
+
codeplain-0.2.0.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
71
|
+
codeplain-0.2.0.dist-info/top_level.txt,sha256=gYRA2-upa9A7U9hk0tJBW2hsZeazOuU1Pi_AvJ3YD44,631
|
|
72
|
+
codeplain-0.2.0.dist-info/RECORD,,
|
diff_utils.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from difflib import unified_diff
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def get_unified_diff(filename: str, existing_file_content: str, response_file_content: str) -> str:
|
|
5
|
+
diff = unified_diff(
|
|
6
|
+
existing_file_content.splitlines(keepends=True),
|
|
7
|
+
response_file_content.splitlines(keepends=True),
|
|
8
|
+
fromfile=filename,
|
|
9
|
+
tofile=filename,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
return "".join(diff)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_code_diff(response_files: dict[str, str], existing_files_content: dict[str, str]) -> dict[str, str]:
|
|
16
|
+
code_diff: dict[str, str] = {}
|
|
17
|
+
for file_name in response_files:
|
|
18
|
+
if file_name in existing_files_content and existing_files_content[file_name]:
|
|
19
|
+
if response_files[file_name]:
|
|
20
|
+
unified_diff_result = get_unified_diff(
|
|
21
|
+
file_name,
|
|
22
|
+
existing_files_content[file_name],
|
|
23
|
+
response_files[file_name],
|
|
24
|
+
)
|
|
25
|
+
if unified_diff_result and unified_diff_result.strip():
|
|
26
|
+
code_diff[file_name] = unified_diff_result
|
|
27
|
+
else:
|
|
28
|
+
code_diff[file_name] = f"File {file_name} was deleted."
|
|
29
|
+
else:
|
|
30
|
+
code_diff[file_name] = response_files[file_name]
|
|
31
|
+
|
|
32
|
+
return code_diff
|
|
File without changes
|
|
File without changes
|
|
File without changes
|