mpourmpoulis / PythonVoiceCodingPlugin

Sublime Text 3 plugin for voice coding Python 3
https://pythonvoicecodingplugin.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
13 stars 3 forks source link

Subindexing strings that contain " or ' fails If surrounded by ' or " respectively #18

Closed mpourmpoulis closed 4 years ago

mpourmpoulis commented 4 years ago

Description

General Information

Plug-In Version: v0.1.2,develop, probably the entire 0.1.x Is affected

Queries Affected

picking up parts of certain types of strings fails! this also causes commands of the for smart string 2 to fail if problematic strings are within the search space

Response To Command

Context In Which It Appears

Does the problem seem to appear or disappear only some of the time? Does there seem to be

it seems that it does not like at all, when " or ' are inside a string that is surrounded by '," respectively

'" "'
"'b'"
"Bob's"
"\"ab\'"

even if they are escaped. In contrast these actually works

"\"ab\""
"\"ab"
'a\'b'

the same applies for triple quoted strings as well!

'''a\"b'''

Error Message

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\application\application.py", line 76, in respond_to_query
    s(view_information,query_description,extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\abstract\selection_query.py", line 80, in __call__
    self.result ,self.alternatives = self.handle_single(view_information,query_description, extra)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\queries\select_part.py", line 41, in handle_single
    result = get_sub_index(second_origin,query_description["sub_index"]-1)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 764, in get_sub_index
    candidates = get_subparts_of_string(root)
  File "C:\Users\Admin\AppData\Roaming\Sublime Text 3\Packages\PythonVoiceCodingPlugin\library\info.py", line 674, in get_subparts_of_string
    z = mean(y1,y2)
NameError: global name 'mean' is not defined
mpourmpoulis commented 4 years ago

0fcbc51877481349f38878509cb96068217c9694 tried to take care off of problems with strings that had prefixes like r"something" or u"something" but introduced a typo meaninstead of min which was causing the exception. However it failed To take care off triple quoted strings causing wrong results. Both these problems should now be solved in the develop branch