Skip to content

Commit

Permalink
Addressing additional PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mwootendev committed Nov 22, 2023
1 parent bb5aa02 commit 7b40173
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/dynamicprompts/parser/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,7 @@ def create_parser(
# stripped with variable access. This restores them so that the
# variable can be properly recognized at a later stage
variable_ref.set_parse_action(
lambda s, l, t: parser_config.variable_start
+ "".join(t)
+ parser_config.variable_end,
lambda string, location, token: f"{parser_config.variable_start}{''.join(token)}{parser_config.variable_end}",
)

variable_assignment = _configure_variable_assignment(
Expand Down
6 changes: 4 additions & 2 deletions src/dynamicprompts/samplers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def replace_wildcard_variables(
try:
wildcard_result = wildcard.parse_string(command.wildcard)
return command.with_content("".join(wildcard_result))
except Exception as ex:
logger.warning("Unable to parse wildcard path %s", command.wildcard)
except Exception:
logger.warning("Unable to parse wildcard %r", command.wildcard, exc_info=True)
return command


Expand All @@ -114,4 +114,6 @@ def _replace_variable(string, location, token, *, variables: dict):

if isinstance(variable, LiteralCommand):
variable = variable.literal
if not isinstance(variable, str):
raise NotImplementedError("evaluating complex commands within wildcards is not supported right now")
return variable or default or var_name

0 comments on commit 7b40173

Please sign in to comment.