pyrecli 0.3.5__tar.gz → 0.3.6__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrecli
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Command line utilities for DiamondFire templates
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Classifier: Programming Language :: Python :: 3.13
15
15
  Classifier: Programming Language :: Python :: 3.14
16
16
  Provides-Extra: dev
17
- Requires-Dist: dfpyre (>=0.10.6)
17
+ Requires-Dist: dfpyre (>=0.10.7)
18
18
  Requires-Dist: pytest (>=9.0.2) ; extra == "dev"
19
19
  Requires-Dist: rapidnbt (>=1.3.5)
20
20
  Requires-Dist: twine (>=6.2.0) ; extra == "dev"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyrecli"
3
- version = "0.3.5"
3
+ version = "0.3.6"
4
4
  description = "Command line utilities for DiamondFire templates"
5
5
  authors = [
6
6
  {name = "Amp"}
@@ -11,7 +11,7 @@ keywords = ["diamondfire", "minecraft", "template", "cli", "tools"]
11
11
 
12
12
  requires-python = ">=3.10"
13
13
  dependencies = [
14
- "dfpyre>=0.10.6",
14
+ "dfpyre>=0.10.7",
15
15
  "rapidnbt>=1.3.5"
16
16
  ]
17
17
 
@@ -5,9 +5,9 @@ from pyrecli.util import read_input_file, write_output_file, parse_templates_fro
5
5
 
6
6
 
7
7
  TEXT_CODE_PATTERNS = [
8
- re.compile(r"%var\(([a-zA-Z0-9!@#$%^&*~`\-_=+\\|;':\",.\/<>? ]+)\)"),
9
- re.compile(r"%index\(([a-zA-Z0-9!@#$%^&*~`\-_=+\\|;':\",.\/<>? ]+),\d+\)"),
10
- re.compile(r"%entry\(([a-zA-Z0-9!@#$%^&*~`\-_=+\\|;':\",.\/<>? ]+),[a-zA-Z0-9!@#$%^&*~`\-_=+\\|;':\",.\/<>? ]+\)")
8
+ re.compile(r"%var\(([^\t\r\n]+)\)"),
9
+ re.compile(r"%index\(([^\t\r\n]+),\d+\)"),
10
+ re.compile(r"%entry\(([^\t\r\n]+),[^\t\r\n]+\)")
11
11
  ]
12
12
 
13
13
 
@@ -33,16 +33,19 @@ def rename_command(input_path: str, output_path: str,
33
33
  if isinstance(argument, Variable):
34
34
  if argument.name == var_to_rename and (var_to_rename_scope is None or argument.scope == var_to_rename_scope):
35
35
  argument.name = new_var_name
36
+
37
+ # Check if this var's name contains a text code with the target variable
36
38
  argument.name = rename_var_in_text_code(argument.name, var_to_rename, new_var_name)
37
39
 
38
40
  # Try to rename parameter
39
- elif isinstance(argument, Parameter) and var_to_rename_scope == 'line':
40
- if argument.name == var_to_rename:
41
+ elif isinstance(argument, Parameter):
42
+ if argument.name == var_to_rename and var_to_rename_scope == 'line':
41
43
  argument.name = new_var_name
42
44
 
43
- # Check for occurrences of the variable in text codes
44
- elif isinstance(argument, (Number, String, Text)) and isinstance(argument.value, str):
45
- argument.value = rename_var_in_text_code(argument.value, var_to_rename, new_var_name)
45
+ # Rename occurrences of the variable in text codes
46
+ elif isinstance(argument, (Number, String, Text)):
47
+ if isinstance(argument.value, str):
48
+ argument.value = rename_var_in_text_code(argument.value, var_to_rename, new_var_name)
46
49
 
47
50
  # Check for text codes in function calls
48
51
  if codeblock.type in {'call_func', 'start_process'}:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes