Skip to content

Python3: stop using unichr in brailleInput.py#9835

Merged
michaelDCurran merged 2 commits into
threshold_py3_stagingfrom
py3_brailleInput
Jun 28, 2019
Merged

Python3: stop using unichr in brailleInput.py#9835
michaelDCurran merged 2 commits into
threshold_py3_stagingfrom
py3_brailleInput

Conversation

@michaelDCurran

Copy link
Copy Markdown
Member

Link to issue number:

None.

Summary of the issue:

Previously work was done to remove all usage of unichr from Python3, however brailleInput.py was not touched as it was thought that this would be handled when updating braille drivers in #9736.
However, pr #9736 does not do this.
Therefore, currently when trying to type on a braille display such as an Orbit Reader, the following traceback is seen:

Traceback (most recent call last):
  File "scriptHandler.py", line 189, in executeScript
    script(gesture)
  File "globalCommands.py", line 2059, in script_braille_dots
    brailleInput.handler.input(gesture.dots)
  File "brailleInput.py", line 247, in input
    if self._translate(endWord):
  File "brailleInput.py", line 129, in _translate
    data = u"".join([unichr(cell | LOUIS_DOTS_IO_START) for cell in self.bufferBraille[:pos]])
  File "brailleInput.py", line 129, in <listcomp>
    data = u"".join([unichr(cell | LOUIS_DOTS_IO_START) for cell in self.bufferBraille[:pos]])
NameError: name 'unichr' is not defined

Description of how this pull request fixes the issue:

All references to unichr in brailleInput.py have been changed to chr. Also, any mention of the unicode type in docstrings has been changed to str.

Testing performed:

Typed the following sentence on an Orbit Reader, using English 6 dot computer braille, UEB grade1 and UEB grade2, using contractions where possible:
"Hello, this is a test to see if this works."
Confirmed that the correct output was written and no traceback was produced.

Known issues with pull request:

None.

Change log entry:

None.

Comment thread source/brailleInput.py Outdated

@classmethod
def _makeDisplayText(cls, dots, space):
out = ""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is a safety guard so that we won't get an UnboundLocalError?

@michaelDCurran

Copy link
Copy Markdown
Member Author

@LeonarddeR: the out = "" and the asert were actually introduced by pr #9736. Somehow I accidentally added them here when testing. I have removed them now. Best to ask about the out = "" on the other pr.

@michaelDCurran michaelDCurran merged commit 7241d4f into threshold_py3_staging Jun 28, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Jun 28, 2019

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked through this, and have added additional type hinting in #9736 commit
128bc1e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants