File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -186,10 +186,10 @@ def fileprefix_from_cmd(cmd, allowed_chars=False):
186186 Simplify the cmd to only the allowed_chars we want in a filename
187187
188188 :param cmd: the cmd (string)
189- :param allowed_chars: characters allowed in filename (defaults to string.ascii_letters + string.digits)
189+ :param allowed_chars: characters allowed in filename (defaults to string.ascii_letters + string.digits + "_-" )
190190 """
191191 if not allowed_chars :
192- allowed_chars = string .ascii_letters + string .digits
192+ allowed_chars = f" { string .ascii_letters } { string .digits } _-"
193193
194194 return '' .join ([c for c in cmd if c in allowed_chars ])
195195
Original file line number Diff line number Diff line change @@ -200,6 +200,8 @@ def test_fileprefix_from_cmd(self):
200200 'abd123' : 'abd123' ,
201201 'ab"a' : 'aba' ,
202202 'a{:$:S@"a' : 'aSa' ,
203+ 'cmd-with-dash' : 'cmd-with-dash' ,
204+ 'cmd_with_underscore' . 'cmd_with_underscore' ,
203205 }
204206 for cmd , expected_simplification in cmds .items ():
205207 self .assertEqual (fileprefix_from_cmd (cmd ), expected_simplification )
You can’t perform that action at this time.
0 commit comments