Lucas Maystre added the comment:
Sorry for the little glitches you had to fix, I wonder why I didn't catch them.
Anyways, thanks Petri!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Roundup Robot added the comment:
New changeset d5a0698a8354 by Petri Lehtinen in branch 'default':
#11175: argparse.FileType now accepts encoding and errors arguments.
http://hg.python.org/cpython/rev/d5a0698a8354
--
nosy: +python-dev
___
Python
Petri Lehtinen added the comment:
Committed, thanks for the patch!
I made little tweaks before committing:
- changed l1 to UTF-8 in the example (guess you mis-uploaded the latest version)
- changed the argument to 'replace' in test_r_1_replace
- fixed 3-space indentation to 4-space indentation
Lucas Maystre added the comment:
As per Ezio's comment, changed l1 to utf-8 in the example of the doc.
--
Added file: http://bugs.python.org/file28195/filetype11175.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Lucas Maystre added the comment:
OK, I'll give it a try.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
Python-bugs-list mailing
Lucas Maystre added the comment:
Added some documentation for the patch. Let me know what you think.
--
Added file: http://bugs.python.org/file28139/filetype11175.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Lucas Maystre added the comment:
Is there something I can do something to move this forward?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
Petri Lehtinen added the comment:
Since Steven is not responding, I think I can commit it at some point. Thanks
for the remainder :)
--
assignee: - petri.lehtinen
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Chris Jerdonek added the comment:
The patch needs documentation, though, right?
http://docs.python.org/dev/library/argparse.html#filetype-objects
--
nosy: +chris.jerdonek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Petri Lehtinen added the comment:
Right, good point. Lucas, could you fix the documentation too?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
Lucas Maystre added the comment:
Alright, here's a version with more tests (unittest.mock is awesome!). I think
it tests exactly what it should (and no more), i.e. that the arguments are
correctly passed to `open`.
--
Added file: http://bugs.python.org/file27729/filetype11175.patch
Petri Lehtinen added the comment:
LGTM. Let's wait for Steven's comments as he's the maintainer of argparse.
--
keywords: +needs review
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: -berker.peksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
nosy: +ezio.melotti
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
Lucas Maystre added the comment:
Here's an attempt at implementing this (my first contribution). Some notes:
- I tried to keep `__repr__()` backwards compatible. It would have been easier
to inherit from `_AttributeHolder`, but maybe this might break some things...
- I added some test cases
Petri Lehtinen added the comment:
Lucas: You only added tests for the repr, you should probably test the actual
new functionality, too.
--
nosy: +petri.lehtinen
stage: needs patch - patch review
___
Python tracker rep...@bugs.python.org
Lucas Maystre added the comment:
OK, as discussed offline with Petri I'll put some tests to ensure that open()
is called the right way (using unittest.mock.patch).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
Changes by Petri Lehtinen pe...@digip.org:
--
versions: +Python 3.4 -Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berkerpeksag
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
Changes by Éric Araujo mer...@netwok.org:
--
keywords: +easy
nosy: +eric.araujo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11175
___
___
New submission from Steven Bethard steven.beth...@gmail.com:
Suggestion from a personal email:
Allow FileType to accept encoding and errors arguments
and pass these as keyword arguments to codecs.open() instead of open().
--
components: Library (Lib)
messages: 128301
nosy: bethard
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
The encoding and errors arguments are probably useful, but why would you use
the codecs module?
--
nosy: +amaury.forgeotdarc
___
Python tracker rep...@bugs.python.org
Steven Bethard steven.beth...@gmail.com added the comment:
Probably because the suggestion came from someone thinking about both Python 2
and 3. But given that this feature request can only target Python 3.3, you're
absolutely right that there's no need to go through the codecs module.
23 matches
Mail list logo