classification
Title: IDLE: change 'str' to 'code' in idlelib.pyparse.PyParse and users
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2018-02-23 00:56 by terry.reedy, last changed 2018-02-24 05:21 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5830 merged cheryl.sabella, 2018-02-23 12:36
PR 5844 merged miss-islington, 2018-02-24 02:35
PR 5845 merged miss-islington, 2018-02-24 02:36
Messages (6)
msg312606 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-23 00:56
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.
msg312623 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-02-23 09:44
Yes, I agree.  I'll start working on this one first.
msg312691 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-24 02:35
New changeset c29c03a34a9f3c82704b66f323ce5ea9dc89c8af by Terry Jan Reedy (Cheryl Sabella) in branch 'master':
bpo-32916: IDLE: Change `str` to `code` in pyparse (GH-5830)
https://github.com/python/cpython/commit/c29c03a34a9f3c82704b66f323ce5ea9dc89c8af
msg312694 - (view) Author: miss-islington (miss-islington) Date: 2018-02-24 02:59
New changeset f409c9988e72eff7c0378ab5578f5edecb8b1855 by Miss Islington (bot) in branch '3.7':
bpo-32916: IDLE: Change `str` to `code` in pyparse (GH-5830)
https://github.com/python/cpython/commit/f409c9988e72eff7c0378ab5578f5edecb8b1855
msg312695 - (view) Author: miss-islington (miss-islington) Date: 2018-02-24 03:16
New changeset cd2112f0b9ce3d1a8cff61c16a9208115fb1dbf4 by Miss Islington (bot) in branch '3.6':
bpo-32916: IDLE: Change `str` to `code` in pyparse (GH-5830)
https://github.com/python/cpython/commit/cd2112f0b9ce3d1a8cff61c16a9208115fb1dbf4
msg312699 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-02-24 05:21
Thanks.  It is nice splitting the work this way.
History
Date User Action Args
2018-02-24 05:21:23terry.reedysetstatus: open -> closed
type: enhancement
messages: + msg312699

resolution: fixed
stage: patch review -> resolved
2018-02-24 03:16:02miss-islingtonsetmessages: + msg312695
2018-02-24 02:59:56miss-islingtonsetnosy: + miss-islington
messages: + msg312694
2018-02-24 02:36:48miss-islingtonsetpull_requests: + pull_request5620
2018-02-24 02:35:49miss-islingtonsetpull_requests: + pull_request5619
2018-02-24 02:35:29terry.reedysetmessages: + msg312691
2018-02-23 12:36:55cheryl.sabellasetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request5608
2018-02-23 09:44:01cheryl.sabellasetmessages: + msg312623
2018-02-23 00:59:58terry.reedylinkissue32880 dependencies
2018-02-23 00:56:01terry.reedycreate