Re: [Python-Dev] ConfigParser argparse integration module
Wiadomość napisana przez S Joshua Swamidass w dniu 13 paź 2012, o godz. 05:24: > Hello, > > It seemed like there were several requests to enable ini file parsing with > argparse. I wrote module to do this. > I'd be curious to know if this is useful and anyone has a better approach. This mailing list focuses on the development *of* Python so your message if off-topic for this list. I suggest python-announce-l...@python.org or the generic python-l...@python.org. > http://pypi.python.org/pypi/ConfArgParse That being said, a couple of remarks: 1. See configglue which does what your module tries to do. 2. A "Production/Stable" trove classifier without any unit tests does not look very convincing. 3. Your code is 2.x only. 4. ConfArgParse.args2config uses RawConfigParser whereas ConfArgParse._parse_config uses SafeConfigParser which will lead to inconsistent content handling. 5. Your code is not PEP8 compliant. 6. Long option names traditionally don't use underscores but dashes. E.g. not --conf_file but --conf-file. 7. There doesn't seem to be a homepage. The one you listed in setup.py is your homepage, not the project's homepage. 8. There doesn't seem to be a code repository for the project. All in all: nice approach, promising project but definitely needs more work. Good luck :) -- Best regards, Łukasz Langa Senior Systems Architecture Engineer IT Infrastructure Department Grupa Allegro Sp. z o.o. http://lukasz.langa.pl/ +48 791 080 144 ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] [BUG] Trailing spaces in pretty-printed JSON
Use this script on a json file and observe all the trailing spaces generated. (screenshot attached.) #!/usr/bin/env python """ Pretty print json file. """ if __name__ == '__main__': import sys import json if '-h' in sys.argv or '--help' in sys.argv: print "Usage: ppjson " exit(0) assert sys.argv[1], "No file provided" with open(sys.argv[1]) as f: print json.dumps(json.load(f), indent=4) <>___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [BUG] Trailing spaces in pretty-printed JSON
On 2012-10-13, at 08:40 , Leo wrote: > Use this script on a json file and observe all the trailing spaces > generated. (screenshot attached.) 1. Why didn't you report that on the tracker? 2. Why are you rewriting json.tool? ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [BUG] Trailing spaces in pretty-printed JSON
On Sat, Oct 13, 2012 at 5:40 PM, Leo wrote: > Use this script on a json file and observe all the trailing spaces > generated. (screenshot attached.) Confirmed as still the case in Python 3 (specifically, with an early alpha of 3.3 and with 3.2 for Windows). It's because the item separator is '; ' and the newline and indent are appended to that. That can be overridden with: json.dumps({"asdf":"123","qwer":"234","zxcv":"345"},indent=4,separators=(',',': ')) but that compacts everything, not sure if that's what you want. The code in question is in Lib/json/encoder.py in the source tree; I'm sure you could post on the tracker (hint) with a patch (hint hint) if you want it to strip spaces followed by newlines. ChrisA ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com