Skip to content

Commit 51ffbb5

Browse files
committed
remove dead code
1 parent 70b9879 commit 51ffbb5

12 files changed

Lines changed: 1 addition & 211 deletions

codeplain_REST_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _raise_for_error_code(self, response_json):
108108
if error_code == "InternalServerError":
109109
raise plain2code_exceptions.InternalServerError(
110110
"Internal server error.\n\n"
111-
f"Please report the error to support@codeplain.ai with the attached {self.log_file_name} file."
111+
"Please report the error to support@codeplain.ai with the attached .log file."
112112
)
113113
exception_class = ERROR_CODE_EXCEPTIONS[error_code]
114114
raise exception_class(message)

concept_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from copy import deepcopy
33
from typing import Optional
44

5-
import mistletoe
65
import mistletoe.block_token
76
import networkx as nx
87

file_utils.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ def is_system_folder_path(file_path: str) -> bool:
5454
return bool(parts) and parts[0] in SYSTEM_FOLDERS
5555

5656

57-
def get_file_type(file_name):
58-
59-
# Extract the file extension
60-
ext = Path(file_name).suffix.lower() # Convert to lowercase to handle case-insensitive matching
61-
62-
# Use the dictionary to get the file type, defaulting to 'unknown' if the extension is not found
63-
return FILE_EXTENSION_MAPPING.get(ext, "unknown")
64-
65-
6657
def list_all_text_files(directory):
6758
all_files = []
6859
for root, dirs, files in os.walk(directory, topdown=True):
@@ -124,24 +115,6 @@ def delete_files_and_subfolders(directory):
124115
os.remove(entry.path)
125116

126117

127-
def copy_file(source_path, destination_path):
128-
# Ensure the destination directory exists
129-
os.makedirs(os.path.dirname(destination_path), exist_ok=True)
130-
131-
# Open the source file in read-binary ('rb') mode
132-
with open(source_path, "rb") as source_file:
133-
# Open the destination file in write-binary ('wb') mode
134-
with open(destination_path, "wb") as destination_file:
135-
# Copy the content from source to destination
136-
while True:
137-
# Read a chunk of the source file
138-
chunk = source_file.read(4096) # Reading in chunks of 4KB
139-
if not chunk:
140-
break # End of file reached
141-
# Write the chunk to the destination file
142-
destination_file.write(chunk)
143-
144-
145118
def add_current_path_if_no_path(filename):
146119
# Extract the base name of the file (ignoring any path information)
147120
basename = os.path.basename(filename)

hash_key.py

Lines changed: 0 additions & 29 deletions
This file was deleted.

plain2code_state.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def __init__(self, spec_filename: str, replay_with: Optional[str] = None):
2020
self.spec_filename: str = spec_filename
2121
self.call_count: int = 0
2222
self.unittest_batch_id: int = 0
23-
self.frid_render_anaysis: dict[str, str] = {}
2423
self.render_time_accumulated: int = 0
2524
self.last_render_start_timestamp: float = time.monotonic()
2625

@@ -30,9 +29,6 @@ def increment_call_count(self):
3029
def increment_unittest_batch_id(self):
3130
self.unittest_batch_id += 1
3231

33-
def add_rendering_analysis_for_frid(self, frid, rendering_analysis) -> None:
34-
self.frid_render_anaysis[frid] = rendering_analysis
35-
3632
def set_render_succeeded(self, succeeded: bool):
3733
self.render_succeeded = succeeded
3834

@@ -55,6 +51,3 @@ def to_dict(self):
5551
"replay": self.replay,
5652
"spec_filename": self.spec_filename,
5753
}
58-
59-
def get_render_func_id(self, frid: str) -> str:
60-
return f"{self.render_id}-{frid}"

plain2code_utils.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
from typing import Optional
2-
3-
import plain_spec
4-
from plain2code_console import console
5-
6-
71
def format_duration_hms(total_seconds: int) -> str:
82
"""Format a duration in seconds as hours, minutes, and seconds (e.g. ``1h 2m 3.45s``, ``45.67s``)."""
93
if total_seconds < 0:
@@ -26,31 +20,3 @@ def format_duration_hms(total_seconds: int) -> str:
2620
"functional_requirement_ambiguity": "Ambiguity is in the functionality",
2721
"other": "Ambiguity in the other parts of the specification",
2822
}
29-
30-
31-
def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[str]]):
32-
frid = plain_spec.get_first_frid(plain_source_tree)
33-
34-
while frid is not None:
35-
is_inside_range = render_range is None or frid in render_range
36-
37-
if is_inside_range:
38-
specifications, _ = plain_spec.get_specifications_for_frid(plain_source_tree, frid)
39-
functional_requirement_text = specifications[plain_spec.FUNCTIONAL_REQUIREMENTS][-1]
40-
console.info(
41-
"-------------------------------------\n"
42-
f"Rendering functionality {frid}:\n"
43-
f"{functional_requirement_text}\n"
44-
"-------------------------------------\n"
45-
)
46-
if plain_spec.ACCEPTANCE_TESTS in specifications:
47-
for i, acceptance_test in enumerate(specifications[plain_spec.ACCEPTANCE_TESTS], 1):
48-
console.info(f"Generating acceptance test #{i}:\n\n{acceptance_test}\n")
49-
else:
50-
console.info(
51-
"-------------------------------------\n"
52-
f"Skipping rendering iteration: {frid}\n"
53-
"-------------------------------------"
54-
)
55-
56-
frid = plain_spec.get_next_frid(plain_source_tree, frid)

render_machine/conformance_test_helpers.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

render_machine/render_types.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,6 @@ def set_conformance_tests_summary(self, summary: list[dict]):
139139
"test_summary"
140140
] = summary
141141

142-
def get_context_summary(self) -> dict:
143-
return {
144-
"current_testing_module_name": self.current_testing_module_name,
145-
"current_testing_frid": self.current_testing_frid,
146-
"fix_attempts": self.fix_attempts,
147-
"execution_phase": self.execution_phase.name,
148-
"acceptance_test_phase": self.acceptance_test_phase.name,
149-
"acceptance_tests_completed": self.acceptance_tests_completed,
150-
}
151-
152142

153143
@dataclass
154144
class ScriptExecutionHistory:

system_config.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ def _load_config(self):
2929
console.error(f"Failed to load system configuration: {e}")
3030
sys.exit(69)
3131

32-
def get_error_message(self, message_key, **kwargs):
33-
"""Get a formatted error message by its key."""
34-
if message_key not in self.error_messages:
35-
raise KeyError(f"Unknown error message key: {message_key}")
36-
return self.error_messages[message_key]["message"].format(**kwargs)
37-
3832

3933
# Create a singleton instance
4034
system_config = SystemConfig()

tests/test_cli_output.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"""Unit tests for cli_output module."""
22

3-
from datetime import datetime, timezone
4-
from io import StringIO
53
from unittest.mock import Mock, patch
64

7-
import pytest
8-
95
from cli_output.status import (
106
_create_progress_bar,
117
_display_credit_line,

0 commit comments

Comments
 (0)