resolve paths

in my case, i've started using symlinks a bit more often, and the current impl causes issues, we need to resolve the symlinked path too.
This commit is contained in:
Kevin Turcios 2025-09-26 14:49:29 -07:00
parent 05e5a94233
commit 4325416827
3 changed files with 5 additions and 5 deletions

View file

@ -173,7 +173,7 @@ def get_qualified_name(module_name: str, full_qualified_name: str) -> str:
def module_name_from_file_path(file_path: Path, project_root_path: Path, *, traverse_up: bool = False) -> str:
try:
relative_path = file_path.relative_to(project_root_path)
relative_path = file_path.resolve().relative_to(project_root_path.resolve())
return relative_path.with_suffix("").as_posix().replace("/", ".")
except ValueError:
if traverse_up:

View file

@ -334,7 +334,7 @@ def extract_code_markdown_context_from_files(
helpers_of_fto.get(file_path, set()) | helpers_of_helpers.get(file_path, set())
),
)
code_string_context = CodeString(code=code_context, file_path=file_path.relative_to(project_root_path))
code_string_context = CodeString(code=code_context, file_path=file_path.resolve().relative_to(project_root_path.resolve()))
code_context_markdown.code_strings.append(code_string_context)
# Extract code from file paths containing helpers of helpers
for file_path, helper_function_sources in helpers_of_helpers_no_overlap.items():
@ -365,7 +365,7 @@ def extract_code_markdown_context_from_files(
project_root=project_root_path,
helper_functions=list(helpers_of_helpers_no_overlap.get(file_path, set())),
)
code_string_context = CodeString(code=code_context, file_path=file_path.relative_to(project_root_path))
code_string_context = CodeString(code=code_context, file_path=file_path.resolve().relative_to(project_root_path.resolve()))
code_context_markdown.code_strings.append(code_string_context)
return code_context_markdown

View file

@ -1827,7 +1827,7 @@ def get_system_details():
hashing_context = code_ctx.hashing_code_context
# The expected contexts
expected_read_write_context = f"""
```python:{main_file_path.relative_to(opt.args.project_root)}
```python:{main_file_path.resolve().relative_to(opt.args.project_root.resolve())}
import utility_module
class Calculator:
@ -2096,7 +2096,7 @@ def select_precision(precision, fallback_precision):
else:
return DEFAULT_PRECISION
```
```python:{main_file_path.relative_to(opt.args.project_root)}
```python:{main_file_path.resolve().relative_to(opt.args.project_root.resolve())}
import utility_module
class Calculator: