[issue9723] Add shlex.quote

2012-04-18 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: See #14616 for a doc edition related to this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___

[issue9723] Add shlex.quote

2011-08-16 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: FWIW there are still unnecessary escapes before '+' and '.', and possibly '-' This is IMO cosmetic and not as “important” as the duplicate characters already implied by the character class. Feel free to change it. Why can't pipes.quote

[issue9723] Add shlex.quote

2011-08-16 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: FWIW there are still unnecessary escapes before '+' and '.', and possibly '-' This is IMO cosmetic and not as “important” as the duplicate characters already implied by the character class. Feel free to change it. Why can't pipes.quote

[issue9723] Add shlex.quote

2011-08-16 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 5d4438001069 by Ezio Melotti in branch 'default': #9723: refactor regex. http://hg.python.org/cpython/rev/5d4438001069 -- ___ Python tracker rep...@bugs.python.org

[issue9723] Add shlex.quote

2011-08-12 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 8032ea4c3619 by Éric Araujo in branch '3.2': Test pipes.quote with a few non-ASCII characters (see #9723). http://hg.python.org/cpython/rev/8032ea4c3619 New changeset 6ae0345a7e29 by Éric Araujo in branch 'default':

[issue9723] Add shlex.quote

2011-08-12 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: I have restored compatibility (see commit messages). -- stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723

[issue9723] Add shlex.quote

2011-08-12 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: -_find_unsafe = re.compile(r'[^\w\d@%_\-\+=:,\./]').search +_find_unsafe = re.compile(r'[^\w@%\-\+=:,\./]', re.ASCII).search FWIW there are still unnecessary escapes before '+' and '.', and possibly '-' ('-' doesn't need escaping only when

[issue9723] Add shlex.quote

2011-08-12 Thread Matt Joiner
Matt Joiner anacro...@gmail.com added the comment: Why can't pipes.quote can't be moved to shlex.quote verbatim as I originally proposed? Is there justification to also change it as part of the relocation? I think any changes to its behaviour should be a separate issue. --

[issue9723] Add shlex.quote

2011-07-30 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: +_find_unsafe = re.compile(r'[^\w\d@%_\-\+=:,\./]').search \w already includes both \d and _, so (unless you really want to be explicit about it) they are redundant. Also keep in mind that they match non-ASCII letters/numbers on Python

[issue9723] Add shlex.quote

2011-07-30 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: \w already includes both \d and _, so (unless you really want to be explicit about it) they are redundant. [snip] I just started from the previous list and turned it into a regex. Eliminating redundancy sounds good, I’ll use your version.

[issue9723] Add shlex.quote

2011-07-29 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 5966eeb0457d by Éric Araujo in branch 'default': Add shlex.quote function, to escape filenames and command lines (#9723). http://hg.python.org/cpython/rev/5966eeb0457d -- nosy: +python-dev

[issue9723] Add shlex.quote

2011-07-29 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 43c41e19527a by Éric Araujo in branch 'default': Expand shlex.quote example (#9723) http://hg.python.org/cpython/rev/43c41e19527a -- ___ Python tracker

[issue9723] Add shlex.quote

2011-07-29 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: I suck at regexes, but the one I came up with lets quote pass the tests that existed for pipes.quote, so I figure it’s good. I did not change the string operations at the end of the function (+ and replace) as it was simple and working. In

[issue9723] Add shlex.quote

2011-07-29 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Sorry I didn't look at the patch earlier. I thought we were just *moving* pipes.quote. Why is a new regex involved? -- ___ Python tracker rep...@bugs.python.org

[issue9723] Add shlex.quote

2011-07-29 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Because I choose to follow Ian’s remark in msg127957: the implementation could use a couple regexes instead of iterating over strings though I have not touched the tests, so I felt confident with my regex. FWIW, I’ve also changed the argument

[issue9723] Add shlex.quote

2011-07-29 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Well, it's a micro-optimization (it would be interesting to benchmark, but not worth it). I find the original code much more readable than the regex, but it doesn't matter all that much. (And as far as optimization goes, using

[issue9723] Add shlex.quote

2011-07-29 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: str.translate is not an option, as the code does not replace but add characters (quotes). Out of sheer curiosity, I may actually benchmark this. -- ___ Python tracker rep...@bugs.python.org

[issue9723] Add shlex.quote

2011-07-29 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: You aren't using a regex to replace the quotes, either. len('abcd'.translate(str.maketrans('', '', string.ascii_letters ))) 0 False I don't know if this is faster than the corresponding search regex, but depending on how much overhead

[issue9723] Add shlex.quote

2011-07-18 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Here’s the patch, please review. -- assignee: - eric.araujo keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file22685/shlex.quote.diff ___ Python tracker

[issue9723] Add shlex.quote

2011-04-29 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: See also #11827 about subprocess.list2cmdline. -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___

[issue9723] Add shlex.quote

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li xua...@gmail.com: -- nosy: +xuanji ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___ ___ Python-bugs-list mailing list

[issue9723] Add shlex.quote

2011-04-27 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Someone on Stack Overflow suggested subprocess.list2cmdline. It’s one of those functions undocumented and absent from __all__ that somehow get found and used by some people. So when we make the patch, let’s include links to the new function

[issue9723] Add shlex.quote

2011-03-03 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___ ___

[issue9723] Add shlex.quote

2011-02-04 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: A note from Ian Bicking in http://mail.python.org/pipermail/stdlib-sig/2010-May/000948.html: I've had to do this sort of thing for similar reasons, like calling remote ssh commands, where a shell command is embedded in a positional argument.

[issue9723] Add shlex.quote

2011-01-24 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: you can just do 'from shlex import quote' in pipes We would have had to do that anyway, since pipes needs to use the function. Agreed that a deprecation is not necessary. -- ___ Python tracker

[issue9723] Add shlex.quote

2011-01-24 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Yes, I know you have to do it anyway, that's why I used the adverb 'just' (as in 'just that, and nothing more') (I note that 'just' as an adverb tends to get overused by English speakers, and so loses some of its semantic value... :)

[issue9723] Add shlex.quote

2011-01-24 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Putting quote() into shlex sounds good to me. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9723 ___

[issue9723] Add shlex.quote

2011-01-22 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Even if quote does not start with an underscore, its absence from the docs and from the module’s __all__ make it a private function. I propose to make it public as shlex.quote in 3.3 and deprecate pipes.quote for people that relied on it (i.e.

[issue9723] Add shlex.quote

2011-01-22 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Rather than doing a code deprecation you can just do 'from shlex import quote' in pipes (with a comment about backward compatibility). I don't think there is any real harm in leaving that kind of backward compatibility in place