You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since brace expansion usually happens before other expansions (i.e. glob), the current behaviour of handling all the escaped characters breaks later stages. For instance:
>>> braceexpand(r'{foo,bar}-\?')
['foo-?', 'bar-?'] # lost the information about the escaped "?"
I think it'll be best if escape handling only removed the backslash if it refers to a brace character, otherwise they're left in the expansions to avoid the information loss.
Since this would be a breaking change I guess the escape keyword arg could accept also 'preserve' to enable this mode?
Right now I'm working around it by double-escaping the string before feeding it to braceexpand:
>>> value = re.sub(r'\\([^{}])', r'\\\\\1', value)
>>> braceexpand(value)
But the approach is finicky since it only handles braces and won't work with something like {1\..5\,x}.
thanks for this great module!
The text was updated successfully, but these errors were encountered:
Since brace expansion usually happens before other expansions (i.e. glob), the current behaviour of handling all the escaped characters breaks later stages. For instance:
I think it'll be best if escape handling only removed the backslash if it refers to a brace character, otherwise they're left in the expansions to avoid the information loss.
Since this would be a breaking change I guess the
escape
keyword arg could accept also'preserve'
to enable this mode?Right now I'm working around it by double-escaping the string before feeding it to braceexpand:
But the approach is finicky since it only handles braces and won't work with something like
{1\..5\,x}
.thanks for this great module!
The text was updated successfully, but these errors were encountered: