Skip to content

[skip ci] Don't block GUI thread on add-on updates#17055

Closed
seanbudd wants to merge 2 commits into
rcfrom
try-fixAddonUpdateBG
Closed

[skip ci] Don't block GUI thread on add-on updates#17055
seanbudd wants to merge 2 commits into
rcfrom
try-fixAddonUpdateBG

Conversation

@seanbudd

@seanbudd seanbudd commented Aug 27, 2024

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #17036

Summary of the issue:

NVDA runs the add-on update check on the GUI thread. If the telemetry to the add-on store is slow, the NVDA GUI is blocked.

Description of user facing changes

NVDA no longer gets stuck if there is a bad connection to the add-on store

Description of development approach

Use a daemonized thread rather than the GUI Thread for add-on store update checks

Testing strategy:

Simulate a poor network connection with poorconn.

python -m poorconn delay_before_sending_upon_acceptance --t=120 --length=1

From the NVDA python console, trigger the add-on update notification job and set the base URL to the poor connection

import addonStore.network
addonStore.network.BASE_URL = "http://127.0.0.1:8000"
import schedule
schedule.jobs[0].run()

Known issues with pull request:

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

Summary by CodeRabbit

  • Documentation
    • Improved code formatting and readability across various files, enhancing clarity for developers without altering functionality.
  • Style
    • Standardized spacing around operators and parameters, ensuring consistent coding style throughout the codebase.
    • Unified string quotation marks to double quotes for consistency in multiple files.
  • Refactor
    • Streamlined function signatures and parameter formatting for better readability, while maintaining existing logic and behavior.

@seanbudd seanbudd added this to the 2024.4 milestone Aug 27, 2024
@seanbudd seanbudd marked this pull request as ready for review August 27, 2024 06:33
@seanbudd seanbudd requested a review from a team as a code owner August 27, 2024 06:33
@seanbudd seanbudd requested a review from SaschaCowley August 27, 2024 06:33
@coderabbitai

coderabbitai Bot commented Aug 27, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The code changes primarily consist of formatting improvements across various files within the NVDA project. These adjustments focus on enhancing readability through consistent spacing, alignment, and comment formatting. The underlying functionality and control flow of the code remain unchanged, ensuring that no new features or significant alterations have been introduced.

Changes

Files Change Summary
appveyor/crowdinSync.py, appveyor/mozillaSyms.py, extras/controllerClient/examples/example_python.py, projectDocs/dev/developerGuide/conf.py, site_scons/site_tools/doxygen.py, site_scons/site_tools/gettextTool.py, site_scons/site_tools/listModules.py, site_scons/site_tools/md2html.py, site_scons/site_tools/msrpc.py, site_scons/site_tools/recursiveInstall.py, source/COMRegistrationFixes/__init__.py, source/IAccessibleHandler/__init__.py, source/IAccessibleHandler/internalWinEventHandler.py, source/IAccessibleHandler/orderedWinEventLimiter.py, source/IAccessibleHandler/types.py, source/IAccessibleHandler/utils.py, source/JABHandler.py, source/NVDAHelper.py, source/NVDAObjects/IAccessible/MSHTML.py, source/NVDAObjects/IAccessible/SysMonthCal32.py, source/NVDAObjects/IAccessible/adobeAcrobat.py, source/NVDAObjects/IAccessible/akelEdit.py, source/NVDAObjects/IAccessible/chromium.py, source/NVDAObjects/IAccessible/delphi.py, source/NVDAObjects/IAccessible/hh.py, source/NVDAObjects/IAccessible/ia2TextMozilla.py, source/NVDAObjects/IAccessible/ia2Web.py, source/NVDAObjects/IAccessible/mozilla.py, source/NVDAObjects/IAccessible/msOffice.py, source/NVDAObjects/IAccessible/mscandui.py, source/NVDAObjects/IAccessible/qt.py, source/NVDAObjects/IAccessible/scintilla.py, source/NVDAObjects/IAccessible/sysListView32.py, source/NVDAObjects/IAccessible/sysTreeView32.py, source/NVDAObjects/IAccessible/webKit.py, source/NVDAObjects/IAccessible/winConsole.py, source/NVDAObjects/IAccessible/winword.py Formatting adjustments, including consistent spacing, alignment, and comment formatting without altering functionality.

Assessment against linked issues

Objective Addressed Explanation
Does not block NVDA during timeout when connecting to update server. (#17036) Changes do not address the blocking issue during timeouts.

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6742bb5 and 09eaf81.

Files selected for processing (54)
  • appveyor/crowdinSync.py (2 hunks)
  • appveyor/mozillaSyms.py (3 hunks)
  • extras/controllerClient/examples/example_python.py (1 hunks)
  • projectDocs/dev/developerGuide/conf.py (6 hunks)
  • site_scons/site_tools/doxygen.py (2 hunks)
  • site_scons/site_tools/gettextTool.py (1 hunks)
  • site_scons/site_tools/listModules.py (3 hunks)
  • site_scons/site_tools/md2html.py (6 hunks)
  • site_scons/site_tools/msrpc.py (1 hunks)
  • site_scons/site_tools/recursiveInstall.py (2 hunks)
  • source/COMRegistrationFixes/init.py (1 hunks)
  • source/IAccessibleHandler/init.py (31 hunks)
  • source/IAccessibleHandler/internalWinEventHandler.py (3 hunks)
  • source/IAccessibleHandler/orderedWinEventLimiter.py (4 hunks)
  • source/IAccessibleHandler/types.py (1 hunks)
  • source/IAccessibleHandler/utils.py (3 hunks)
  • source/JABHandler.py (12 hunks)
  • source/NVDAHelper.py (13 hunks)
  • source/NVDAObjects/IAccessible/MSHTML.py (18 hunks)
  • source/NVDAObjects/IAccessible/SysMonthCal32.py (1 hunks)
  • source/NVDAObjects/IAccessible/adobeAcrobat.py (9 hunks)
  • source/NVDAObjects/IAccessible/akelEdit.py (1 hunks)
  • source/NVDAObjects/IAccessible/chromium.py (7 hunks)
  • source/NVDAObjects/IAccessible/delphi.py (1 hunks)
  • source/NVDAObjects/IAccessible/hh.py (2 hunks)
  • source/NVDAObjects/IAccessible/ia2TextMozilla.py (21 hunks)
  • source/NVDAObjects/IAccessible/ia2Web.py (17 hunks)
  • source/NVDAObjects/IAccessible/mozilla.py (9 hunks)
  • source/NVDAObjects/IAccessible/msOffice.py (7 hunks)
  • source/NVDAObjects/IAccessible/mscandui.py (2 hunks)
  • source/NVDAObjects/IAccessible/qt.py (4 hunks)
  • source/NVDAObjects/IAccessible/scintilla.py (1 hunks)
  • source/NVDAObjects/IAccessible/sysListView32.py (17 hunks)
  • source/NVDAObjects/IAccessible/sysTreeView32.py (5 hunks)
  • source/NVDAObjects/IAccessible/webKit.py (2 hunks)
  • source/NVDAObjects/IAccessible/winConsole.py (1 hunks)
  • source/NVDAObjects/IAccessible/winword.py (9 hunks)
  • source/NVDAObjects/JAB/init.py (14 hunks)
  • source/NVDAObjects/UIA/VisualStudio.py (5 hunks)
  • source/NVDAObjects/UIA/chromium.py (3 hunks)
  • source/NVDAObjects/UIA/excel.py (14 hunks)
  • source/NVDAObjects/UIA/spartanEdge.py (17 hunks)
  • source/NVDAObjects/UIA/sysListView32.py (4 hunks)
  • source/NVDAObjects/UIA/web.py (16 hunks)
  • source/NVDAObjects/UIA/winConsoleUIA.py (14 hunks)
  • source/NVDAObjects/UIA/wordDocument.py (14 hunks)
  • source/NVDAObjects/init.py (47 hunks)
  • source/NVDAObjects/behaviors.py (23 hunks)
  • source/NVDAObjects/inputComposition.py (2 hunks)
  • source/NVDAObjects/lockscreen.py (1 hunks)
  • source/NVDAObjects/window/init.py (8 hunks)
  • source/NVDAObjects/window/_msOfficeChart.py (8 hunks)
  • source/NVDAObjects/window/akelEdit.py (2 hunks)
  • source/NVDAObjects/window/edit.py (13 hunks)
Files skipped from review due to trivial changes (47)
  • appveyor/crowdinSync.py
  • appveyor/mozillaSyms.py
  • extras/controllerClient/examples/example_python.py
  • projectDocs/dev/developerGuide/conf.py
  • site_scons/site_tools/doxygen.py
  • site_scons/site_tools/gettextTool.py
  • site_scons/site_tools/listModules.py
  • site_scons/site_tools/md2html.py
  • site_scons/site_tools/msrpc.py
  • site_scons/site_tools/recursiveInstall.py
  • source/COMRegistrationFixes/init.py
  • source/IAccessibleHandler/init.py
  • source/IAccessibleHandler/orderedWinEventLimiter.py
  • source/IAccessibleHandler/types.py
  • source/IAccessibleHandler/utils.py
  • source/JABHandler.py
  • source/NVDAObjects/IAccessible/MSHTML.py
  • source/NVDAObjects/IAccessible/SysMonthCal32.py
  • source/NVDAObjects/IAccessible/adobeAcrobat.py
  • source/NVDAObjects/IAccessible/akelEdit.py
  • source/NVDAObjects/IAccessible/chromium.py
  • source/NVDAObjects/IAccessible/delphi.py
  • source/NVDAObjects/IAccessible/hh.py
  • source/NVDAObjects/IAccessible/ia2TextMozilla.py
  • source/NVDAObjects/IAccessible/ia2Web.py
  • source/NVDAObjects/IAccessible/mozilla.py
  • source/NVDAObjects/IAccessible/msOffice.py
  • source/NVDAObjects/IAccessible/mscandui.py
  • source/NVDAObjects/IAccessible/qt.py
  • source/NVDAObjects/IAccessible/scintilla.py
  • source/NVDAObjects/IAccessible/sysTreeView32.py
  • source/NVDAObjects/IAccessible/webKit.py
  • source/NVDAObjects/IAccessible/winConsole.py
  • source/NVDAObjects/JAB/init.py
  • source/NVDAObjects/UIA/VisualStudio.py
  • source/NVDAObjects/UIA/chromium.py
  • source/NVDAObjects/UIA/excel.py
  • source/NVDAObjects/UIA/sysListView32.py
  • source/NVDAObjects/UIA/web.py
  • source/NVDAObjects/UIA/winConsoleUIA.py
  • source/NVDAObjects/UIA/wordDocument.py
  • source/NVDAObjects/init.py
  • source/NVDAObjects/behaviors.py
  • source/NVDAObjects/inputComposition.py
  • source/NVDAObjects/lockscreen.py
  • source/NVDAObjects/window/init.py
  • source/NVDAObjects/window/akelEdit.py
Additional context used
Path-based instructions (7)
source/IAccessibleHandler/internalWinEventHandler.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAObjects/UIA/spartanEdge.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAObjects/IAccessible/winword.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAObjects/IAccessible/sysListView32.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAHelper.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAObjects/window/edit.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/NVDAObjects/window/_msOfficeChart.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious.


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

Ruff
source/NVDAObjects/IAccessible/winword.py

414-418: Do not assign a lambda expression, use a def

Rewrite getCell as a def

(E731)

source/NVDAObjects/IAccessible/sysListView32.py

192-192: byref may be undefined, or defined from star imports

(F405)


193-193: byref may be undefined, or defined from star imports

(F405)


194-194: byref may be undefined, or defined from star imports

(F405)


279-279: sizeof may be undefined, or defined from star imports

(F405)


452-452: sizeof may be undefined, or defined from star imports

(F405)


456-456: byref may be undefined, or defined from star imports

(F405)


456-456: sizeof may be undefined, or defined from star imports

(F405)


531-531: sizeof may be undefined, or defined from star imports

(F405)


546-546: byref may be undefined, or defined from star imports

(F405)


546-546: sizeof may be undefined, or defined from star imports

(F405)


553-553: byref may be undefined, or defined from star imports

(F405)


553-553: sizeof may be undefined, or defined from star imports

(F405)


577-577: sizeof may be undefined, or defined from star imports

(F405)


608-608: sizeof may be undefined, or defined from star imports

(F405)


619-619: byref may be undefined, or defined from star imports

(F405)


619-619: sizeof may be undefined, or defined from star imports

(F405)


626-626: byref may be undefined, or defined from star imports

(F405)


626-626: sizeof may be undefined, or defined from star imports

(F405)

source/NVDAHelper.py

205-205: byref may be undefined, or defined from star imports

(F405)


211-211: byref may be undefined, or defined from star imports

(F405)

source/NVDAObjects/window/edit.py

380-380: Local variable res is assigned to but never used

Remove assignment to unused variable res

(F841)

source/NVDAObjects/window/_msOfficeChart.py

520-520: Comparison to None should be cond is None

Replace with cond is None

(E711)

Additional comments not posted (87)
source/IAccessibleHandler/internalWinEventHandler.py (3)

104-106: LGTM!

The reformatting of the condition checking for invalid window handles improves readability without altering functionality.

The code changes are approved.


194-201: LGTM!

The expanded type hint for processDestroyWinEventFunc improves clarity and understanding of the function's expected input and output.

The code changes are approved.


230-230: LGTM!

The simplification of the conditional statement streamlines the logic without changing its intent, contributing to a cleaner and more concise code structure.

The code changes are approved.

source/NVDAObjects/UIA/spartanEdge.py (4)

29-38: LGTM!

The reformatting of the conditional checks enhances readability without altering functionality.

The code changes are approved.


46-46: LGTM!

The formatting adjustments consolidate conditions into single lines for clarity, improving readability without altering functionality.

The code changes are approved.


Line range hint 103-283: LGTM!

The reformatting for consistency enhances readability while maintaining the existing functionality.

The code changes are approved.


306-313: LGTM!

The minor formatting adjustments improve readability without altering functionality.

The code changes are approved.

source/NVDAObjects/IAccessible/winword.py (8)

42-46: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


75-91: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


96-119: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


124-136: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


139-173: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


176-194: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


197-228: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.


240-279: LGTM!

The reformatting for consistency enhances readability without altering functionality.

The code changes are approved.

source/NVDAObjects/IAccessible/sysListView32.py (9)

91-107: LGTM!

The fields in the LVITEM structure are correctly defined with appropriate types.

The code changes are approved.


112-127: LGTM!

The fields in the LVITEM64 structure are correctly defined with appropriate types.

The code changes are approved.


132-143: LGTM!

The fields in the LVCOLUMN structure are correctly defined with appropriate types.

The code changes are approved.


148-159: LGTM!

The fields in the LVCOLUMN64 structure are correctly defined with appropriate types.

The code changes are approved.


181-199: LGTM!

The methods in the List class are correctly implemented.

The code changes are approved.

Also applies to: 202-222, 225-244, 262-298

Tools
Ruff

192-192: byref may be undefined, or defined from star imports

(F405)


193-193: byref may be undefined, or defined from star imports

(F405)


194-194: byref may be undefined, or defined from star imports

(F405)


334-373: LGTM!

The methods in the GroupingItem class are correctly implemented.

The code changes are approved.


Line range hint 380-407: LGTM!

The methods in the ListItemWithoutColumnSupport class are correctly implemented.

The code changes are approved.


Line range hint 380-407: Ensure byref and sizeof are defined.

The byref and sizeof functions are used in several places. Ensure they are defined or imported correctly.

Run the following script to verify the definitions:

Verification successful

Ensure byref and sizeof are imported correctly

The byref and sizeof functions are used in the code, and they are imported from the ctypes module. There is no issue with their definitions or imports.

  • byref is imported from ctypes in multiple files, including source/winKernel.py.
  • sizeof is also imported from ctypes in source/winKernel.py.

These functions are correctly imported and should work as expected in the code.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definitions of `byref` and `sizeof`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref` and `sizeof`.
rg --type python -A 5 $'byref'
rg --type python -A 5 $'sizeof'

Length of output: 122


Script:

#!/bin/bash
# Description: Verify the definitions of `byref` and `sizeof`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref` and `sizeof`.
rg --type py -A 5 $'byref'
rg --type py -A 5 $'sizeof'

Length of output: 149405


181-199: Ensure byref and sizeof are defined.

The byref and sizeof functions are used in several places. Ensure they are defined or imported correctly.

Run the following script to verify the definitions:

Also applies to: 202-222, 225-244, 262-298

Verification successful

Ensure byref and sizeof are correctly imported.

The byref and sizeof functions are used in the code, and they are correctly imported from the ctypes module in several files, including source/winUser.py and source/winKernel.py. This confirms that the functions are defined and available for use in the codebase.

  • byref is imported from ctypes in source/winUser.py.
  • sizeof is imported from ctypes in source/winKernel.py.

No further action is required regarding the definitions or imports of these functions.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definitions of `byref` and `sizeof`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref` and `sizeof`.
rg --type python -A 5 $'byref'
rg --type python -A 5 $'sizeof'

Length of output: 122


Script:

#!/bin/bash
# Description: Verify the definitions of `byref` and `sizeof`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref` and `sizeof`.
rg --type py -A 5 $'byref'
rg --type py -A 5 $'sizeof'

Length of output: 149405

Tools
Ruff

192-192: byref may be undefined, or defined from star imports

(F405)


193-193: byref may be undefined, or defined from star imports

(F405)


194-194: byref may be undefined, or defined from star imports

(F405)

source/NVDAHelper.py (20)

69-70: LGTM!

The function _setDllFuncPointer is correctly implemented.

The code changes are approved.


74-81: LGTM!

The function nvdaController_speakText is correctly implemented.

The code changes are approved.


Line range hint 90-172: LGTM!

The function nvdaController_speakSsml is correctly implemented.

The code changes are approved.


174-179: LGTM!

The function nvdaController_cancelSpeech is correctly implemented.

The code changes are approved.


183-190: LGTM!

The function nvdaController_brailleMessage is correctly implemented.

The code changes are approved.


196-216: LGTM!

The function _lookupKeyboardLayoutNameWithHexString is correctly implemented.

The code changes are approved.

Tools
Ruff

205-205: byref may be undefined, or defined from star imports

(F405)


211-211: byref may be undefined, or defined from star imports

(F405)


222-252: LGTM!

The function nvdaControllerInternal_requestRegistration is correctly implemented.

The code changes are approved.


Line range hint 255-285: LGTM!

The function nvdaControllerInternal_reportLiveRegion is correctly implemented.

The code changes are approved.


289-293: LGTM!

The function nvdaControllerInternal_displayModelTextChangeNotify is correctly implemented.

The code changes are approved.


297-304: LGTM!

The function nvdaControllerInternal_drawFocusRectNotify is correctly implemented.

The code changes are approved.


308-318: LGTM!

The function nvdaControllerInternal_logMessage is correctly implemented.

The code changes are approved.


321-354: LGTM!

The function handleInputCompositionEnd is correctly implemented.

The code changes are approved.


363-391: LGTM!

The function handleInputCompositionStart is correctly implemented.

The code changes are approved.


395-414: LGTM!

The function nvdaControllerInternal_inputCompositionUpdate is correctly implemented.

The code changes are approved.


418-459: LGTM!

The function handleInputCandidateListUpdate is correctly implemented.

The code changes are approved.


463-466: LGTM!

The function nvdaControllerInternal_inputCandidateListUpdate is correctly implemented.

The code changes are approved.


509-529: LGTM!

The function handleInputConversionModeUpdate is correctly implemented.

The code changes are approved.


532-535: LGTM!

The function nvdaControllerInternal_inputConversionModeUpdate is correctly implemented.

The code changes are approved.


222-252: Ensure byref is defined.

The byref function is used in several places. Ensure it is defined or imported correctly.

Run the following script to verify the definitions:

Verification successful

Verification Successful: byref is correctly defined and imported.

The byref function is imported from ctypes in multiple files, confirming its correct definition and import in the codebase. The usage in nvdaControllerInternal_requestRegistration is valid. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definitions of `byref`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref`.
rg --type python -A 5 $'byref'

Length of output: 60


Script:

#!/bin/bash
# Description: Verify the definitions of `byref`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref`.
rg --type py -A 5 $'byref'

Length of output: 101213


196-216: Ensure byref is defined.

The byref function is used in several places. Ensure it is defined or imported correctly.

Run the following script to verify the definitions:

Verification successful

byref is correctly defined and imported.

The byref function is imported from ctypes in several files, confirming that it is correctly defined and available for use in the codebase. The original concern about byref being undefined is not valid.

  • byref is imported in files such as source/ui.py, source/winUser.py, and source/winKernel.py.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the definitions of `byref`.

# Test: Search for the definitions. Expect: Definitions or imports of `byref`.
rg --type python -A 5 $'byref'

Length of output: 60


Script:

#!/bin/bash
# Description: Verify the definitions or imports of `byref`.

# Test: Search for the definitions or imports of `byref`.
rg 'byref' -A 5

Length of output: 101881

Tools
Ruff

205-205: byref may be undefined, or defined from star imports

(F405)


211-211: byref may be undefined, or defined from star imports

(F405)

source/NVDAObjects/window/edit.py (20)

38-38: LGTM!

The formatting change improves readability.

The code change is approved.


40-40: LGTM!

The formatting change improves readability.

The code change is approved.


42-54: LGTM!

The formatting changes improve readability.

The code changes are approved.


56-56: LGTM!

The formatting change improves readability.

The code change is approved.


62-64: LGTM!

The formatting changes improve readability.

The code changes are approved.


69-71: LGTM!

The formatting changes improve readability.

The code changes are approved.


76-78: LGTM!

The formatting changes improve readability.

The code changes are approved.


97-117: LGTM!

The formatting changes improve readability.

The code changes are approved.


122-123: LGTM!

The formatting changes improve readability.

The code changes are approved.


127-132: LGTM!

The formatting changes improve readability.

The code changes are approved.


141-144: LGTM!

The formatting changes improve readability.

The code changes are approved.


171-205: LGTM!

The formatting changes improve readability.

The code changes are approved.


208-234: LGTM!

The formatting changes improve readability.

The code changes are approved.


254-281: LGTM!

The formatting changes improve readability.

The code changes are approved.


363-384: LGTM!

The formatting changes improve readability.

The code changes are approved.

Tools
Ruff

380-380: Local variable res is assigned to but never used

Remove assignment to unused variable res

(F841)


385-404: LGTM!

The formatting changes improve readability.

The code changes are approved.


Line range hint 454-496: LGTM!

The formatting changes improve readability.

The code changes are approved.


518-536: LGTM!

The formatting changes improve readability.

The code changes are approved.


538-544: LGTM!

The formatting changes improve readability.

The code changes are approved.


545-567: LGTM!

The formatting changes improve readability.

The code changes are approved.

source/NVDAObjects/window/_msOfficeChart.py (23)

380-385: LGTM!

The method correctly initializes the class attributes and calls the superclass constructor. The change in the method signature is consistent with the initialization logic.

The code changes are approved.


387-416: LGTM!

The method correctly identifies the chart segment type based on the chart type. There are no issues in the logic.

The code changes are approved.


418-419: LGTM!

The method correctly returns the role of the chart element as UNKNOWN.

The code changes are approved.


421-423: LGTM!

The method correctly returns the name of the chart element by calling _getChartElementText.

The code changes are approved.


425-427: LGTM!

The method correctly raises a NotImplementedError indicating that it should be implemented by subclasses.

The code changes are approved.


429-431: LGTM!

The method correctly reports the current chart element with extra information by calling _getChartElementText.

The code changes are approved.


432-441: LGTM!

The method correctly reports the color of the current chart element by checking the elementID and calling the appropriate methods.

The code changes are approved.


488-489: LGTM!

The method correctly returns the text for the chart element based on the ElementID by looking up the ELEMENT_IDS dictionary.

The code changes are approved.


492-493: LGTM!

The method correctly defines the gestures for the chart element.

The code changes are approved.


Line range hint 445-487: LGTM!

The method correctly defines the element IDs for the chart element.

The code changes are approved.


498-502: LGTM!

The method correctly initializes the class attributes and calls the superclass constructor. The change in the method signature is consistent with the initialization logic.

The code changes are approved.


504-514: LGTM!

The method correctly adds an element to the element list and updates the previous and next pointers.

The code changes are approved.


530-532: LGTM!

The method correctly navigates to the previous element in the element list.

The code changes are approved.


535-537: LGTM!

The method correctly navigates to the next element in the element list.

The code changes are approved.


541-544: LGTM!

The method correctly defines the gestures for the chart element list.

The code changes are approved.


549-549: LGTM!

The method correctly defines the role of the chart element list as CHART.

The code changes are approved.


551-557: LGTM!

The method correctly initializes the class attributes and calls the superclass constructor. The change in the method signature is consistent with the initialization logic.

The code changes are approved.


661-668: LGTM!

The method correctly initializes the class attributes and calls the superclass constructor. The change in the method signature is consistent with the initialization logic.

The code changes are approved.


719-721: LGTM!

The method correctly returns the name of the chart element collection.

The code changes are approved.


723-725: LGTM!

The method correctly acts as a placeholder and does not perform any actions.

The code changes are approved.


670-679: LGTM!

The method correctly adds an element to the element list.

The code changes are approved.


730-740: LGTM!

The method correctly initializes the class attributes and calls the superclass constructor. The change in the method signature is consistent with the initialization logic.

The code changes are approved.


767-773: LGTM!

The method correctly returns the name of the chart element series.

The code changes are approved.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Comment on lines +517 to +527
if len(self.elementList) == 0:
ui.message(self.name)
else:
if self.activeElement == None: self.activeElement = self.elementList[0] # noqa: E701, E711
else:
if direction=="previous": self.activeElement = self.activeElement.previous # noqa: E701
elif direction=="next": self.activeElement = self.activeElement.next # noqa: E701
self.activeElement.select()
if self.activeElement == None:
self.activeElement = self.elementList[0] # noqa: E701, E711
else:
if direction == "previous":
self.activeElement = self.activeElement.previous # noqa: E701
elif direction == "next":
self.activeElement = self.activeElement.next # noqa: E701
self.activeElement.select()

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.

Replace == None with is None.

The method correctly navigates to the next or previous element in the element list. However, replace == None with is None for better readability and to follow best practices.

- if self.activeElement == None:
+ if self.activeElement is None:
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if len(self.elementList) == 0:
ui.message(self.name)
else:
if self.activeElement == None: self.activeElement = self.elementList[0] # noqa: E701, E711
else:
if direction=="previous": self.activeElement = self.activeElement.previous # noqa: E701
elif direction=="next": self.activeElement = self.activeElement.next # noqa: E701
self.activeElement.select()
if self.activeElement == None:
self.activeElement = self.elementList[0] # noqa: E701, E711
else:
if direction == "previous":
self.activeElement = self.activeElement.previous # noqa: E701
elif direction == "next":
self.activeElement = self.activeElement.next # noqa: E701
self.activeElement.select()
if len(self.elementList) == 0:
ui.message(self.name)
else:
if self.activeElement is None:
self.activeElement = self.elementList[0] # noqa: E701, E711
else:
if direction == "previous":
self.activeElement = self.activeElement.previous # noqa: E701
elif direction == "next":
self.activeElement = self.activeElement.next # noqa: E701
self.activeElement.select()
Tools
Ruff

520-520: Comparison to None should be cond is None

Replace with cond is None

(E711)

@SaschaCowley SaschaCowley marked this pull request as draft August 27, 2024 07:13
@SaschaCowley

Copy link
Copy Markdown
Member

It looks like pre-commit-ci is still running here and is messing up the diff. Looking at your initial commit things look good though

@cary-rowen

Copy link
Copy Markdown
Contributor

Thanks to @seanbudd for the quick fix.

@seanbudd

Copy link
Copy Markdown
Member Author

Closing as merged via 6ec1c74

@seanbudd seanbudd closed this Aug 28, 2024
@seanbudd seanbudd mentioned this pull request Aug 28, 2024
seanbudd added a commit that referenced this pull request Aug 29, 2024
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.

3 participants