Skip to content

Commit

Permalink
Change file naming rules: replace with _
Browse files Browse the repository at this point in the history
- Update file naming rules
- Add `.gitignore` rules for tests output
  • Loading branch information
zincnode committed Nov 23, 2024
1 parent 6d421ac commit d3f6af6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions depyf/explain/patched_lazy_format_graph_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ def patched_lazy_format_graph_code(name, gm, maybe_id=None, **kwargs):
from depyf.explain.utils import get_current_compiled_fn_name, write_code_to_file_template
from depyf.utils import get_code_owner
func_name = get_current_compiled_fn_name()
file_name = name if name != func_name else "Captured Graph"
file_name = func_name + " " + file_name
file_name = str(name).replace(" ", "_") if name != func_name else "Captured_Graph"
file_name = func_name + "_" + file_name
import inspect
import os

Expand Down Expand Up @@ -35,7 +35,7 @@ def patched_lazy_format_graph_code(name, gm, maybe_id=None, **kwargs):
src = simple_code + commented_src
if filepath is not None:
new_filepath = write_code_to_file_template(
src, os.path.dirname(filepath) + "/" + file_name + " " + "%s" + ".py")
src, os.path.dirname(filepath) + "/" + file_name + "_" + "%s" + ".py")
scope = fn.__globals__
exec(compile(src, filename=new_filepath, mode="exec"), scope)
fn.__code__ = scope[fn.__name__].__code__
Expand Down
2 changes: 1 addition & 1 deletion depyf/explain/patched_load_by_key_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ def patched_load_by_key_path(

func_name = get_current_compiled_fn_name()
new_filepath = write_code_to_file_template(src, os.path.join(
dump_src_dir, func_name + " kernel " + "%s" + ".py"))
dump_src_dir, func_name + "_kernel_" + "%s" + ".py"))
path = new_filepath
return unpatched_load_by_key_path(key, path, linemap, attrs)

0 comments on commit d3f6af6

Please sign in to comment.