#1150 using ConfigParser.read_file for PY3
Merged by mikem. Opened by julian8628.
julian8628/koji issue/1075  into  master

Download 1150.patch

:thumbsup:

Want to add a docstring here to indicate what you expect "parser" to be? "six.moves.configparser.ConfigParser or "six.moves.configparser.SafeConfigParser")

rebased onto b365fa7e4367a733742811acff5b6e424ca41af4

Want to add a docstring here to indicate what you expect "parser" to be? "six.moves.configparser.ConfigParser or "six.moves.configparser.SafeConfigParser")

updated

Want to add a docstring here to indicate what you expect "parser" to be?

Taking this a step further, it seems that the option is never used. So, it's worth asking if we even should provide it.

I'm guessing the thinking is that we may in the future want to use one of the other parsers provided by the ConfigParser module (e.g. RawConfigParser, SafeConfigParser). We use RawConfigParser in the hub and web code, for example.

While we're here, it may be worth defaulting to SafeConfigParser.

And given that, I almost wonder if instead of a parser option, we might want a raw option that toggles between SafeConfigParser and RawConfigParser.

@mikem I wonder if we could drop all readfp and read_files invokings, and use read instead.

And given that, I almost wonder if instead of a parser option, we might want a raw option that toggles between SafeConfigParser and RawConfigParser.

+1

FYI SafeConfigParser will no longer exist in a future Python release,

$ python3
Python 3.7.2 (default, Jan  3 2019, 09:14:01) 
[GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from configparser import SafeConfigParser
>>> SafeConfigParser()
__main__:1: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in future versions. Use ConfigParser directly instead.

https://docs.python.org/3/whatsnew/3.2.html#configparser

@julian8628 You can also go through PR #866 and pick what is usable from there (as this one mostly obsoletes that PR)

Something like this I think:

https://github.com/mikem23/koji-playground/commits/pagure/pr/1150

That change looks good to me Mike

rebased onto a8d835269b0d3b4c58a2c1bf78b7e369127ff73d

@mikem thanks, that's good
I've updated this pr and made some minor fixes for invoking and testing

I'm going to check config.read() usage based on PR #866

Thanks for fixing the unit test.

I'm going to check config.read() usage based on PR #866

Do you mean to update this pr with more changes then? If so, please let me know. Otherwise I'll merge this tomorrow.

Thanks for fixing the unit test.

I'm going to check config.read() usage based on PR #866

Do you mean to update this pr with more changes then? If so, please let me know. Otherwise I'll merge this tomorrow.

I would file another PR for the rest of works, which should not a block for python3 stuff.
Feel free to merge this

Commit 8813d284 fixes this pull-request

Pull-Request has been merged by mikem

Metadata