Skip to content

Commit

Permalink
Fix python demo
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltrt committed Nov 5, 2024
1 parent 6f2e9bc commit cf41ce0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
16 changes: 2 additions & 14 deletions demo/find_replace_custom_cleanup/python/configurations/rules.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,9 @@ replace = ""
holes = ["str_literal"]

# Deletes an assignment to an empty list. Example: `a = []`
#
# Note the multiple escapes (`\`) for the regex below
# `\[` (match the `[` character) -> `\\\\[`
# `\s*` (match zero or more empty spaces) -> `\\\\s*`
[[rules]]
name = "delete_empty_list_assignment"
query = """
(
(assignment
left: (_) @i
right: (list) @list
) @assignment
(#match? @list "\\\\[\\\\s*,?\\\\]")
)
"""
replace_node = "@assignment"
query = """cs :[variable] = []"""
replace_node = "*"
replace = ""
is_seed_rule = false
2 changes: 1 addition & 1 deletion demo/find_replace_custom_cleanup_demos.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def python_demo():
old_mtime = getmtime(file_path)

args = PiranhaArguments(
"py",
"python",
substitutions={
"str_literal": "dependency2",
"str_to_replace": "dependency1",
Expand Down

0 comments on commit cf41ce0

Please sign in to comment.