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

IDLE: change 'str' to 'code' in idlelib.pyparse.PyParse and users #77097

Closed
terryjreedy opened this issue Feb 23, 2018 · 6 comments
Closed

IDLE: change 'str' to 'code' in idlelib.pyparse.PyParse and users #77097

terryjreedy opened this issue Feb 23, 2018 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life topic-IDLE type-feature A feature request or enhancement

Comments

@terryjreedy
Copy link
Member

BPO 32916
Nosy @terryjreedy, @csabella, @miss-islington
PRs
  • bpo-32916: IDLE: Change str to code in pyparse #5830
  • [3.7] bpo-32916: IDLE: Change str to code in pyparse (GH-5830) #5844
  • [3.6] bpo-32916: IDLE: Change str to code in pyparse (GH-5830) #5845
  • 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/terryjreedy'
    closed_at = <Date 2018-02-24.05:21:23.629>
    created_at = <Date 2018-02-23.00:56:01.409>
    labels = ['3.8', 'expert-IDLE', 'type-feature', '3.7']
    title = "IDLE: change 'str' to 'code' in idlelib.pyparse.PyParse and users"
    updated_at = <Date 2018-02-24.05:21:23.628>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-02-24.05:21:23.628>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-02-24.05:21:23.629>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2018-02-23.00:56:01.409>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32916
    keywords = ['patch']
    message_count = 6.0
    messages = ['312606', '312623', '312691', '312694', '312695', '312699']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'cheryl.sabella', 'miss-islington']
    pr_nums = ['5830', '5844', '5845']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32916'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    Change 'str' to 'code' in pyparse and code that uses it. 'str' conflicts with the built-in name and it too general for 'the block of python code being processed'. 'code' is what the string is. The change applies to local 'str', 'self.str' references, and the 'set_str' method. The latter requires renames in other modules. From grep:

    F:\dev\3x\lib\idlelib\editor.py: 1305: y.set_str(rawtext)
    F:\dev\3x\lib\idlelib\editor.py: 1319: y.set_str(rawtext)
    F:\dev\3x\lib\idlelib\hyperparser.py: 47:
    parser.set_str(text.get(startatindex, stopatindex)+' \n')
    F:\dev\3x\lib\idlelib\hyperparser.py: 63:
    parser.set_str(text.get(startatindex, stopatindex)+' \n')

    editor imports pyparse and calls Parser once in
    y = pyparse.Parser...
    and never references y.str

    hyperparser imports pyparse and calls Parser once in
    parser = pyparse.Parser...
    and does reference the modifies parser.str once in line 67
    self.rawtext = parser.str[:-2]

    set_str is not called within pyparse itself

    The existing pyparse tests are sufficient for pyparse since they execute every line containig 'str'. The hyperparser test covers the above lines in Hyperparser.__init__, but test_editor covers almost nothing and would miss the editor lines.

    The two files access various methods and the editor code, the C_ constants, so I am not inclined to change names that are not so actively obnoxious.

    Since this will impact other pyparse changes, I think it should be next. Cheryl, respond here if you want to do the PR.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 (EOL) end of life labels Feb 23, 2018
    @terryjreedy terryjreedy self-assigned this Feb 23, 2018
    @csabella
    Copy link
    Contributor

    Yes, I agree. I'll start working on this one first.

    @terryjreedy
    Copy link
    Member Author

    New changeset c29c03a by Terry Jan Reedy (Cheryl Sabella) in branch 'master':
    bpo-32916: IDLE: Change str to code in pyparse (GH-5830)
    c29c03a

    @miss-islington
    Copy link
    Contributor

    New changeset f409c99 by Miss Islington (bot) in branch '3.7':
    bpo-32916: IDLE: Change str to code in pyparse (GH-5830)
    f409c99

    @miss-islington
    Copy link
    Contributor

    New changeset cd2112f by Miss Islington (bot) in branch '3.6':
    bpo-32916: IDLE: Change str to code in pyparse (GH-5830)
    cd2112f

    @terryjreedy
    Copy link
    Member Author

    Thanks. It is nice splitting the work this way.

    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Feb 24, 2018
    @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
    3.7 (EOL) end of life 3.8 (EOL) end of life topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants