Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular interpolation in configparser #54708

Closed
ambv opened this issue Nov 22, 2010 · 4 comments
Closed

Modular interpolation in configparser #54708

ambv opened this issue Nov 22, 2010 · 4 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@ambv
Copy link
Contributor

ambv commented Nov 22, 2010

BPO 10499
Nosy @freddrake, @birkenfeld, @rhettinger, @merwok, @ambv
Files
  • configparser_interpolation.diff: Refactoring to enable modular interpolation
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ambv'
    closed_at = <Date 2010-12-03.16:29:45.449>
    created_at = <Date 2010-11-22.03:16:24.286>
    labels = ['type-feature', 'library']
    title = 'Modular interpolation in configparser'
    updated_at = <Date 2010-12-03.16:29:45.447>
    user = 'https://github.com/ambv'

    bugs.python.org fields:

    activity = <Date 2010-12-03.16:29:45.447>
    actor = 'lukasz.langa'
    assignee = 'lukasz.langa'
    closed = True
    closed_date = <Date 2010-12-03.16:29:45.449>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2010-11-22.03:16:24.286>
    creator = 'lukasz.langa'
    dependencies = []
    files = ['19767']
    hgrepos = []
    issue_num = 10499
    keywords = ['patch', 'needs review']
    message_count = 4.0
    messages = ['122078', '122537', '122744', '123258']
    nosy_count = 6.0
    nosy_names = ['fdrake', 'georg.brandl', 'rhettinger', 'eric.araujo', 'lukasz.langa', 'asolovyov']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue10499'
    versions = ['Python 3.2']

    @ambv
    Copy link
    Contributor Author

    ambv commented Nov 22, 2010

    SUMMARY
    =======

    This is a refactoring of configparser raised from discussions on bpo-6517 and bpo-9876. It solves both issues and makes the code quite elegant. Best part is, it's fully backwards compatible [1].

    In the patch I basically did:
    a) move the interpolation functionality out of the parsers
    b) deprecate RCP and CP in favor of SCP
    c) refactor the resulting code to get rid of duplicates

    This means that actually despite the generalization and introduction of deprecation warnings, configparser lost 22 lines in the process. The implementation is complete and unit tested.

    WHAT'S LEFT TO DO
    =================

    1. Obviously the new interpolation init argument needs docs. This includes the docstrings on *Interpolation classes that describe how the algorithms work.

    2. ExtendedInterpolation class implementing the buildout syntax, that would satisfy the request from bpo-9876.

    3. Once we have more interpolation implementations new test cases will be added to test_cfgparser.py.

    Will do all three when I have any opinions on the current direction.

    REVIEW HINTS
    ============

    I need some thumbs up or advice on the design decisions made.

    1. interpolation now takes a class, init instantiates an object on its own. Do tell if taking an object upfront would be a better approach.

    2. *Interpolation classes have methods which take the parser as an argument. Do tell if making it an object attribute would be a better approach.

    All other points of interest during a review naturally apply here too.

    [1] Assuming _names are private and can be moved around when needed.

    @ambv ambv self-assigned this Nov 22, 2010
    @ambv ambv added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Nov 22, 2010
    @ambv
    Copy link
    Contributor Author

    ambv commented Nov 27, 2010

    Patch reposted here for review: http://codereview.appspot.com/3309043/

    @freddrake
    Copy link
    Member

    Review posted.

    @ambv
    Copy link
    Contributor Author

    ambv commented Dec 3, 2010

    Committed in rev 86976.

    @ambv ambv closed this as completed Dec 3, 2010
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants