MCPcopy Create free account
hub / github.com/BrendanParmer/NodeToPython / str_to_py_str

Function str_to_py_str

NodeToPython/export/utils.py:48–61  ·  view source on GitHub ↗

Converts a regular string into one usuable in the add-on Parameters: string (str): string to be converted Returns: (str): converted string

(string: str)

Source from the content-addressed store, hash-verified

46 return f"\'{enum}\'"
47
48def str_to_py_str(string: str) -> str:
49 """
50 Converts a regular string into one usuable in the add-on
51
52 Parameters:
53 string (str): string to be converted
54
55 Returns:
56 (str): converted string
57 """
58 repr_str = repr(string)
59 if repr_str.startswith("'") and repr_str.endswith("'"):
60 repr_str = "\"" + repr_str[1:-1].replace('\"', '\\"') + "\""
61 return repr_str
62
63def vec1_to_py_str(vec1) -> str:
64 """

Callers 15

_create_manifestMethod · 0.85
_init_operatorMethod · 0.85
_create_socketMethod · 0.85
_create_panelMethod · 0.85
_create_nodeMethod · 0.85
_set_if_in_blend_fileMethod · 0.85
_node_tree_settingsMethod · 0.85
_load_imageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected